Skip to content

Commit

Permalink
Restructures out and release folders.
Browse files Browse the repository at this point in the history
out/amd -> out/languages/amd-tsc
out/release -> out/languages/bundled
release -> out/monaco-editor
  • Loading branch information
hediet committed Feb 22, 2023
1 parent fb0d6ba commit 5ccfdf7
Show file tree
Hide file tree
Showing 33 changed files with 132 additions and 200 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/publish-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extends:
publishRequiresApproval: false

- name: monaco-editor
workingDirectory: $(Build.SourcesDirectory)/release
workingDirectory: $(Build.SourcesDirectory)/out/monaco-editor
testPlatforms: []
buildSteps:
- script: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extends:
publishRequiresApproval: false

- name: monaco-editor
workingDirectory: $(Build.SourcesDirectory)/release
workingDirectory: $(Build.SourcesDirectory)/out/monaco-editor
testPlatforms: []
buildSteps:
- script: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: npm run prettier-check

- name: Build
run: npm run release
run: npm run build-monaco-editor

- name: Run unit tests
run: npm test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: npm ci

- name: Build
run: npm run release
run: npm run build-monaco-editor

- name: Install website node modules
working-directory: website
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
**/node_modules/
**/out/
**/release/
**/dependencies/
/test/manual/generated/**
/test/smoke/vite/dist/**
/test/smoke/parcel/dist/**
/test/smoke/parcel/.cache/**
**/dist/
**/out/
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/node_modules/
**/dist/
**/out/
**/release/
/samples/browser-esm-parcel/.parcel-cache/
/samples/browser-esm-parcel/dist/
/samples/browser-esm-vite-react/dist/**/*.js
Expand Down
22 changes: 2 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "Monaco Editor Playground",
"type": "chrome",
"request": "launch",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fout%2Famd",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fdist%2Flanguages%2Famd-tsc",
"preLaunchTask": "Launch Http Server",
"presentation": {
"group": "monaco",
Expand All @@ -22,7 +22,7 @@
"name": "Monaco Editor Playground (Load From VS Code Http Server)",
"type": "chrome",
"request": "launch",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fout%2Famd&source=http%3A%2F%2Flocalhost%3A5001%2Fout%2Fvs",
"url": "https://microsoft.github.io/monaco-editor/playground.html?sourceLanguages=http%3A%2F%2Flocalhost%3A5002%2Fdist%2Flanguages%2Famd-tsc&source=http%3A%2F%2Flocalhost%3A5001%2Fout%2Fvs",
"preLaunchTask": "Launch Http Server",
"presentation": {
"group": "monaco",
Expand All @@ -38,24 +38,6 @@
"args": ["-r", "test/unit/all.js"],
"outFiles": ["${workspaceFolder}/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "release",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/build/release.js",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "website",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/build/website.js",
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"files.trimTrailingWhitespace": true,
"search.exclude": {
"**/node_modules": true,
"**/release": true,
"**/dist": true,
"**/out": true
},
"typescript.tsdk": "./node_modules/typescript/lib",
Expand Down
75 changes: 14 additions & 61 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,77 +27,30 @@ import './{myLang}/{myLang}.contribution';

## Debugging / Developing The Core Editor

## Debugging / Developing Language Support

## Running the editor from source

You need to have all the build setup of VS Code to be able to build the Monaco Editor.

- Install all the [prerequisites](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)

```bash
# clone vscode-loc repository for localized string resources
/src> git clone https://github.com/microsoft/vscode-loc
# clone VS Code repository
/src> git clone https://github.com/microsoft/vscode
/src> cd vscode
# install npm deps for vscode
/src/vscode> yarn
# start the compiler in the background
/src/vscode> yarn watch
```

- For the monaco editor test pages:
TODO

```bash
# clone monaco-editor (note the folders must be siblings!)
/src> git clone https://github.com/microsoft/monaco-editor

# install npm deps for monaco-editor
/src/monaco-editor> npm install .
## Debugging / Developing Language Support

# compile and bundle all plugins
/src/monaco-editor> npm run release
TODO

# start a local http server in the background
/src/monaco-editor> npm run simpleserver
```
## Running the editor from source

Open [http://localhost:8080/monaco-editor/test/manual/?editor=src](http://localhost:8080/monaco-editor/test/manual/?editor=src) to run.
TODO

## Running the editor tests

```bash
# create a local release
/src/monaco-editor> npm run release

# run unit tests
/src/monaco-editor> npm run test

# compile the webpack plugin
/src/monaco-editor> npm run compile --prefix webpack-plugin

# package using the webpack plugin
/src/monaco-editor> npm run package-for-smoketest-webpack

# package using esbuild
/src/monaco-editor> npm run package-for-smoketest-esbuild

# package using vite
/src/monaco-editor> npm run package-for-smoketest-vite

# package using parcel
/src/monaco-editor> npm run package-for-smoketest-parcel --prefix test/smoke/parcel

# run the smoketest
/src/monaco-editor> npm run smoketest-debug
> npm run build-monaco-editor
> npm run test
> npm run compile --prefix webpack-plugin

> npm run package-for-smoketest-webpack
> npm run package-for-smoketest-esbuild
> npm run package-for-smoketest-vite
> npm run package-for-smoketest-parcel --prefix test/smoke/parcel
> npm run smoketest-debug
```

> Tip: All folders must be cloned as siblings.
> Tip: When running the test pages, use the control panel in the top right corner to switch between running from source, running from npm or running from the local release:
> ![image](https://cloud.githubusercontent.com/assets/5047891/19599080/eb0d7622-979e-11e6-96ce-dde98cd95dc1.png)
## Running the website locally

TOD
32 changes: 16 additions & 16 deletions build/build.ts → build/build-languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@
*--------------------------------------------------------------------------------------------*/

import glob from 'glob';
import { tsc, dts, buildESM, buildAMD } from './utils';
import { runTsc, massageAndCopyDts, buildESM, buildAMD } from './utils';
import { copyFile, removeDir } from './fs';

removeDir(`out`);
removeDir(`out/languages`);

tsc(`src/tsconfig.json`);
runTsc(`src/tsconfig.json`);

//#region Type Defintion

dts(
`out/amd/language/css/monaco.contribution.d.ts`,
`out/release/css.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/css/monaco.contribution.d.ts`,
`out/languages/bundled/css.d.ts`,
'monaco.languages.css'
);
dts(
`out/amd/language/html/monaco.contribution.d.ts`,
`out/release/html.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/html/monaco.contribution.d.ts`,
`out/languages/bundled/html.d.ts`,
'monaco.languages.html'
);
dts(
`out/amd/language/json/monaco.contribution.d.ts`,
`out/release/json.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/json/monaco.contribution.d.ts`,
`out/languages/bundled/json.d.ts`,
'monaco.languages.json'
);
dts(
`out/amd/language/typescript/monaco.contribution.d.ts`,
`out/release/typescript.d.ts`,
massageAndCopyDts(
`out/languages/amd-tsc/language/typescript/monaco.contribution.d.ts`,
`out/languages/bundled/typescript.d.ts`,
'monaco.languages.typescript'
);

Expand Down Expand Up @@ -133,7 +133,7 @@ buildAMD({

copyFile(
`src/language/typescript/lib/typescriptServices-amd.js`,
`out/amd/language/typescript/lib/typescriptServices.js`
`out/languages/amd-tsc/language/typescript/lib/typescriptServices.js`
);

buildESM({
Expand Down
36 changes: 18 additions & 18 deletions build/release.ts → build/build-monaco-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { removeDir } from '../build/fs';
import ts = require('typescript');
import { generateMetadata } from './releaseMetadata';

removeDir(`release`);
removeDir(`out/monaco-editor`);

// dev folder
AMD_releaseOne('dev');
Expand Down Expand Up @@ -39,7 +39,7 @@ generateMetadata();
delete json.scripts['postinstall'];

packageJSON.contents = Buffer.from(JSON.stringify(json, null, ' '));
writeFiles([packageJSON], `release`);
writeFiles([packageJSON], `out/monaco-editor`);
})();

(() => {
Expand All @@ -59,7 +59,7 @@ generateMetadata();
})
);

writeFiles(otherFiles, `release`);
writeFiles(otherFiles, `out/monaco-editor`);
})();

/**
Expand All @@ -70,13 +70,13 @@ function AMD_releaseOne(type: 'dev' | 'min') {
base: `node_modules/monaco-editor-core/${type}`
});
AMD_addPluginContribs(type, coreFiles);
writeFiles(coreFiles, `release/${type}`);
writeFiles(coreFiles, `out/monaco-editor/${type}`);

const pluginFiles = readFiles(`out/release/${type}/**/*`, {
base: `out/release/${type}`,
const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/*`, {
base: `out/languages/bundled/amd-${type}`,
ignore: ['**/monaco.contribution.js']
});
writeFiles(pluginFiles, `release/${type}`);
writeFiles(pluginFiles, `out/monaco-editor/${type}`);
}

/**
Expand All @@ -96,8 +96,8 @@ function AMD_addPluginContribs(type: 'dev' | 'min', files: IFile[]) {
// Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"');

const pluginFiles = readFiles(`out/release/${type}/**/monaco.contribution.js`, {
base: `out/release/${type}`
const pluginFiles = readFiles(`out/languages/bundled/amd-${type}/**/monaco.contribution.js`, {
base: `out/languages/bundled/amd-${type}`
});

const extraContent = pluginFiles.map((file) => {
Expand Down Expand Up @@ -141,7 +141,7 @@ function ESM_release() {
});
ESM_addImportSuffix(coreFiles);
ESM_addPluginContribs(coreFiles);
writeFiles(coreFiles, `release/esm`);
writeFiles(coreFiles, `out/monaco-editor/esm`);

ESM_releasePlugins();
}
Expand All @@ -152,7 +152,7 @@ function ESM_release() {
* Rewrites imports for 'monaco-editor-core/**'
*/
function ESM_releasePlugins() {
const files = readFiles(`out/release/esm/**/*`, { base: 'out/release/esm/' });
const files = readFiles(`out/languages/bundled/esm/**/*`, { base: 'out/languages/bundled/esm/' });

for (const file of files) {
if (!/(\.js$)|(\.ts$)/.test(file.path)) {
Expand Down Expand Up @@ -210,7 +210,7 @@ function ESM_releasePlugins() {
}

ESM_addImportSuffix(files);
writeFiles(files, `release/esm`);
writeFiles(files, `out/monaco-editor/esm`);
}

/**
Expand Down Expand Up @@ -256,8 +256,8 @@ function ESM_addPluginContribs(files: IFile[]) {

const mainFileDestPath = 'vs/editor/editor.main.js';

const mainFileImports = readFiles(`out/release/esm/**/monaco.contribution.js`, {
base: `out/release/esm`
const mainFileImports = readFiles(`out/languages/bundled/esm/**/monaco.contribution.js`, {
base: `out/languages/bundled/esm`
}).map((file) => {
let relativePath = path
.relative(path.dirname(mainFileDestPath), file.path)
Expand Down Expand Up @@ -292,8 +292,8 @@ function releaseDTS() {

let contents = monacodts.contents.toString();

const extraContent = readFiles('out/release/*.d.ts', {
base: 'out/release/'
const extraContent = readFiles('out/languages/bundled/*.d.ts', {
base: 'out/languages/bundled/'
}).map((file) => {
return file.contents.toString().replace(/\/\/\/ <reference.*\n/m, '');
});
Expand Down Expand Up @@ -321,7 +321,7 @@ function releaseDTS() {
contents: Buffer.from(toExternalDTS(contents))
};

writeFiles([monacodts, editorapidts], `release`);
writeFiles([monacodts, editorapidts], `out/monaco-editor`);

// fs.writeFileSync('website/typedoc/monaco.d.ts', contents);
}
Expand Down Expand Up @@ -422,5 +422,5 @@ function releaseThirdPartyNotices() {
contents += '\n' + thirdPartyNoticeContent;
tpn.contents = Buffer.from(contents);

writeFiles([tpn], `release`);
writeFiles([tpn], `out/monaco-editor`);
}
Loading

0 comments on commit 5ccfdf7

Please sign in to comment.