Adjust package.json scripts and move all dev deps to the root package.json

This commit is contained in:
Alex Dima 2021-11-05 16:53:05 +01:00
parent ebcdd4fe0d
commit 7c6062ccf7
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
45 changed files with 1252 additions and 5160 deletions

View file

@ -9,10 +9,10 @@ const fs = require('fs');
const terser = require('terser');
const helpers = require('monaco-plugin-helpers');
const REPO_ROOT = path.resolve(__dirname, '..');
const REPO_ROOT = path.resolve(__dirname, '..', '..');
const sha1 = helpers.getGitVersion(REPO_ROOT);
const semver = require('../package.json').version;
const semver = require('../../package.json').version;
const headerVersion = semver + '(' + sha1 + ')';
const BUNDLED_FILE_HEADER = [
@ -37,15 +37,15 @@ function bundleOne(moduleId, exclude) {
out: 'release/dev/' + moduleId + '.js',
exclude: exclude,
paths: {
'vs/language/typescript': REPO_ROOT + '/out/amd',
'vs/language/typescript': REPO_ROOT + '/monaco-typescript/out/amd',
'vs/language/typescript/fillers/monaco-editor-core':
REPO_ROOT + '/out/amd/fillers/monaco-editor-core-amd'
REPO_ROOT + '/monaco-typescript/out/amd/fillers/monaco-editor-core-amd'
},
optimize: 'none'
},
async function (buildResponse) {
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, 'monaco-typescript/release/dev/' + moduleId + '.js');
const minFilePath = path.join(REPO_ROOT, 'monaco-typescript/release/min/' + moduleId + '.js');
const fileContents = fs.readFileSync(devFilePath).toString();
console.log();
console.log(`Minifying ${devFilePath}...`);
@ -56,7 +56,7 @@ function bundleOne(moduleId, exclude) {
});
console.log(`Done minifying ${devFilePath}.`);
try {
fs.mkdirSync(path.join(REPO_ROOT, 'release/min'));
fs.mkdirSync(path.join(REPO_ROOT, 'monaco-typescript/release/min'));
} catch (err) {}
fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
}

View file

@ -12,8 +12,9 @@ const generatedNote = `//
//
`;
const TYPESCRIPT_LIB_SOURCE = path.join(__dirname, '../node_modules/typescript/lib');
const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
const REPO_ROOT = path.join(__dirname, '../../');
const TYPESCRIPT_LIB_SOURCE = path.join(REPO_ROOT, 'node_modules/typescript/lib');
const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'monaco-typescript/src/lib');
(function () {
try {
@ -24,7 +25,7 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
importLibs();
const npmLsOutput = JSON.parse(
child_process.execSync('npm ls typescript --depth=0 --json=true').toString()
child_process.execSync('npm ls typescript --depth=0 --json=true', { cwd: REPO_ROOT }).toString()
);
const typeScriptDependencyVersion = npmLsOutput.dependencies.typescript.version;

View file

@ -6,12 +6,12 @@
const path = require('path');
const helpers = require('monaco-plugin-helpers');
const REPO_ROOT = path.join(__dirname, '../');
const REPO_ROOT = path.join(__dirname, '../../');
helpers.packageESM({
repoRoot: REPO_ROOT,
esmSource: 'out/esm',
esmDestination: 'release/esm',
esmSource: 'monaco-typescript/out/esm',
esmDestination: 'monaco-typescript/release/esm',
entryPoints: ['monaco.contribution.js', 'tsMode.js', 'ts.worker.js'],
resolveSkip: ['monaco-editor-core']
});