Change build output from /release to /lib

This commit is contained in:
Egor Gorbachev 2019-09-19 16:49:18 +02:00
parent 93c36d2bd4
commit 638ded2cd2
6 changed files with 25 additions and 19 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
/node_modules/ /node_modules/
/out/ /out/
/release/ /lib/

10
.vscode/settings.json vendored
View file

@ -1,10 +1,10 @@
// Place your settings in this file to overwrite default and user settings. // Place your settings in this file to overwrite default and user settings.
{ {
"files.trimTrailingWhitespace": true, "files.trimTrailingWhitespace": true,
"search.exclude": { "search.exclude": {
"**/node_modules": true, "**/node_modules": true,
"**/release": true, "**/lib": true,
"**/out": true "**/out": true
}, },
"javascript.preferences.quoteStyle": "single", "javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single" "typescript.preferences.quoteStyle": "single"

View file

@ -28,7 +28,7 @@
// Loading basic-languages to get the YAML language definition // Loading basic-languages to get the YAML language definition
var paths = { var paths = {
'vs/basic-languages': '../node_modules/monaco-languages/release/dev', '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', vs: '../node_modules/monaco-editor-core/dev/vs',
}; };
if (document.location.protocol === 'http:') { if (document.location.protocol === 'http:') {
@ -36,7 +36,7 @@
let testIndex = document.location.pathname.indexOf('/test/'); let testIndex = document.location.pathname.indexOf('/test/');
if (testIndex !== -1) { if (testIndex !== -1) {
let prefix = document.location.pathname.substr(0, testIndex); let prefix = document.location.pathname.substr(0, testIndex);
paths['vs/language/yaml'] = prefix + '/release/dev'; paths['vs/language/yaml'] = prefix + '/lib/dev';
} }
} }
var require = { var require = {

View file

@ -7,14 +7,20 @@
"compile": "rimraf ./out && yarn compile:umd && yarn compile:esm", "compile": "rimraf ./out && yarn compile:umd && yarn compile:esm",
"compile:umd": "tsc -p ./src/tsconfig.json", "compile:umd": "tsc -p ./src/tsconfig.json",
"compile:esm": "tsc -p ./src/tsconfig.esm.json", "compile:esm": "tsc -p ./src/tsconfig.esm.json",
"bundle": "rimraf ./release && yarn bundle:umd && yarn bundle:esm", "bundle": "rimraf ./lib && yarn bundle:umd && yarn bundle:esm && mcopy ./src/monaco.d.ts ./lib/monaco.d.ts",
"bundle:umd": "node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts", "bundle:umd": "node ./scripts/bundle-umd",
"bundle:esm": "node ./scripts/release", "bundle:esm": "node ./scripts/bundle-esm",
"build": "yarn compile && yarn bundle", "build": "yarn compile && yarn bundle",
"prepublish": "yarn build", "prepublish": "yarn build",
"lint": "prettier \"{src,test}/**/*.{json,scss,html,ts}\" --write", "lint": "prettier \"{src,test}/**/*.{json,scss,html,ts}\" --write",
"test": "jest --verbose" "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 <kpdecker@gmail.com> (http://incaseofstairs.com)", "author": "Kevin Decker <kpdecker@gmail.com> (http://incaseofstairs.com)",
"maintainers": [ "maintainers": [
"kpdecker", "kpdecker",

View file

@ -11,7 +11,7 @@ const REPO_ROOT = path.join(__dirname, "../");
helpers.packageESM({ helpers.packageESM({
repoRoot: REPO_ROOT, repoRoot: REPO_ROOT,
esmSource: "out/esm", esmSource: "out/esm",
esmDestination: "release/esm", esmDestination: "lib/esm",
entryPoints: ["monaco.contribution.js", "yamlMode.js", "yaml.worker.js"], entryPoints: ["monaco.contribution.js", "yamlMode.js", "yaml.worker.js"],
resolveAlias: { resolveAlias: {
"vscode-nls": path.join(REPO_ROOT, "out/esm/fillers/vscode-nls.js") "vscode-nls": path.join(REPO_ROOT, "out/esm/fillers/vscode-nls.js")

View file

@ -28,7 +28,7 @@ function bundleOne(moduleId, exclude) {
requirejs.optimize({ requirejs.optimize({
baseUrl: 'out/amd/', baseUrl: 'out/amd/',
name: 'vs/language/yaml/' + moduleId, name: 'vs/language/yaml/' + moduleId,
out: 'release/dev/' + moduleId + '.js', out: 'lib/dev/' + moduleId + '.js',
exclude: exclude, exclude: exclude,
paths: { paths: {
'vs/language/yaml': REPO_ROOT + '/out/amd' 'vs/language/yaml': REPO_ROOT + '/out/amd'
@ -62,8 +62,8 @@ function bundleOne(moduleId, exclude) {
main: 'vscode-nls' main: 'vscode-nls'
}] }]
}, function () { }, function () {
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js'); const devFilePath = path.join(REPO_ROOT, 'lib/dev/' + moduleId + '.js');
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js'); const minFilePath = path.join(REPO_ROOT, 'lib/min/' + moduleId + '.js');
const fileContents = fs.readFileSync(devFilePath).toString(); const fileContents = fs.readFileSync(devFilePath).toString();
console.log(); console.log();
console.log(`Minifying ${devFilePath}...`); console.log(`Minifying ${devFilePath}...`);
@ -73,7 +73,7 @@ function bundleOne(moduleId, exclude) {
} }
}); });
console.log(`Done.`); 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); fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
}) })
} }