From 638ded2cd242da854e3d73563490b80f0286d3ad Mon Sep 17 00:00:00 2001 From: Egor Gorbachev Date: Thu, 19 Sep 2019 16:49:18 +0200 Subject: [PATCH] Change build output from /release to /lib --- .gitignore | 6 +++--- .vscode/settings.json | 12 ++++++------ demo/index.html | 4 ++-- package.json | 12 +++++++++--- scripts/{release.js => bundle-esm.js} | 2 +- scripts/{bundle.js => bundle-umd.js} | 8 ++++---- 6 files changed, 25 insertions(+), 19 deletions(-) rename scripts/{release.js => bundle-esm.js} (96%) rename scripts/{bundle.js => bundle-umd.js} (88%) diff --git a/.gitignore b/.gitignore index d9ef910..47750fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/node_modules/ -/out/ -/release/ +/node_modules/ +/out/ +/lib/ diff --git a/.vscode/settings.json b/.vscode/settings.json index a311c44..b377e5f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,11 @@ // Place your settings in this file to overwrite default and user settings. { - "files.trimTrailingWhitespace": true, - "search.exclude": { - "**/node_modules": true, - "**/release": true, - "**/out": true + "files.trimTrailingWhitespace": true, + "search.exclude": { + "**/node_modules": true, + "**/lib": true, + "**/out": true }, "javascript.preferences.quoteStyle": "single", "typescript.preferences.quoteStyle": "single" -} \ No newline at end of file +} diff --git a/demo/index.html b/demo/index.html index 43671af..1025528 100644 --- a/demo/index.html +++ b/demo/index.html @@ -28,7 +28,7 @@ // Loading basic-languages to get the YAML language definition var paths = { 'vs/basic-languages': '../node_modules/monaco-languages/release/dev', - 'vs/language/yaml': '../release/dev', + 'vs/language/yaml': '../lib/dev', vs: '../node_modules/monaco-editor-core/dev/vs', }; if (document.location.protocol === 'http:') { @@ -36,7 +36,7 @@ let testIndex = document.location.pathname.indexOf('/test/'); if (testIndex !== -1) { let prefix = document.location.pathname.substr(0, testIndex); - paths['vs/language/yaml'] = prefix + '/release/dev'; + paths['vs/language/yaml'] = prefix + '/lib/dev'; } } var require = { diff --git a/package.json b/package.json index c2aa0a5..1560d0d 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,20 @@ "compile": "rimraf ./out && yarn compile:umd && yarn compile:esm", "compile:umd": "tsc -p ./src/tsconfig.json", "compile:esm": "tsc -p ./src/tsconfig.esm.json", - "bundle": "rimraf ./release && yarn bundle:umd && yarn bundle:esm", - "bundle:umd": "node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts", - "bundle:esm": "node ./scripts/release", + "bundle": "rimraf ./lib && yarn bundle:umd && yarn bundle:esm && mcopy ./src/monaco.d.ts ./lib/monaco.d.ts", + "bundle:umd": "node ./scripts/bundle-umd", + "bundle:esm": "node ./scripts/bundle-esm", "build": "yarn compile && yarn bundle", "prepublish": "yarn build", "lint": "prettier \"{src,test}/**/*.{json,scss,html,ts}\" --write", "test": "jest --verbose" }, + "main": "./lib/esm/monaco.contribution.js", + "module": "./lib/esm/monaco.contribution.js", + "typings": "./lib/monaco.d.ts", + "directories": { + "lib": "./lib" + }, "author": "Kevin Decker (http://incaseofstairs.com)", "maintainers": [ "kpdecker", diff --git a/scripts/release.js b/scripts/bundle-esm.js similarity index 96% rename from scripts/release.js rename to scripts/bundle-esm.js index 773ea31..19e42f1 100644 --- a/scripts/release.js +++ b/scripts/bundle-esm.js @@ -11,7 +11,7 @@ const REPO_ROOT = path.join(__dirname, "../"); helpers.packageESM({ repoRoot: REPO_ROOT, esmSource: "out/esm", - esmDestination: "release/esm", + esmDestination: "lib/esm", entryPoints: ["monaco.contribution.js", "yamlMode.js", "yaml.worker.js"], resolveAlias: { "vscode-nls": path.join(REPO_ROOT, "out/esm/fillers/vscode-nls.js") diff --git a/scripts/bundle.js b/scripts/bundle-umd.js similarity index 88% rename from scripts/bundle.js rename to scripts/bundle-umd.js index a639b60..e762d4d 100644 --- a/scripts/bundle.js +++ b/scripts/bundle-umd.js @@ -28,7 +28,7 @@ function bundleOne(moduleId, exclude) { requirejs.optimize({ baseUrl: 'out/amd/', name: 'vs/language/yaml/' + moduleId, - out: 'release/dev/' + moduleId + '.js', + out: 'lib/dev/' + moduleId + '.js', exclude: exclude, paths: { 'vs/language/yaml': REPO_ROOT + '/out/amd' @@ -62,8 +62,8 @@ function bundleOne(moduleId, exclude) { main: 'vscode-nls' }] }, function () { - const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js'); - const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js'); + const devFilePath = path.join(REPO_ROOT, 'lib/dev/' + moduleId + '.js'); + const minFilePath = path.join(REPO_ROOT, 'lib/min/' + moduleId + '.js'); const fileContents = fs.readFileSync(devFilePath).toString(); console.log(); console.log(`Minifying ${devFilePath}...`); @@ -73,7 +73,7 @@ function bundleOne(moduleId, exclude) { } }); console.log(`Done.`); - try { fs.mkdirSync(path.join(REPO_ROOT, 'release/min')) } catch (err) { } + try { fs.mkdirSync(path.join(REPO_ROOT, 'lib/min')) } catch (err) { } fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code); }) }