Run `prettier`

pull/2766/head
Alexandru Dima 2021-11-12 10:55:50 +01:00
parent 734e1cb987
commit 9a52545094
No known key found for this signature in database
GPG Key ID: 39563C1504FDD0C9
9 changed files with 97 additions and 62 deletions

View File

@ -82,7 +82,11 @@ exports.removeDir = removeDir;
function tsc(_projectPath) {
const projectPath = path.join(REPO_ROOT, _projectPath);
console.log(`Launching compiler at ${_projectPath}...`);
cp.spawnSync(process.execPath, [path.join(__dirname, '../node_modules/typescript/lib/tsc.js'), '-p', projectPath], { stdio: 'inherit', stderr: 'inherit' });
cp.spawnSync(
process.execPath,
[path.join(__dirname, '../node_modules/typescript/lib/tsc.js'), '-p', projectPath],
{ stdio: 'inherit', stderr: 'inherit' }
);
console.log(`Compiled ${_projectPath}`);
}
exports.tsc = tsc;
@ -94,7 +98,11 @@ exports.tsc = tsc;
*/
function prettier(_filePath) {
const filePath = path.join(REPO_ROOT, _filePath);
cp.spawnSync(process.execPath, [path.join(__dirname, '../node_modules/prettier/bin-prettier.js'), '--write', filePath], { stdio: 'inherit', stderr: 'inherit' });
cp.spawnSync(
process.execPath,
[path.join(__dirname, '../node_modules/prettier/bin-prettier.js'), '--write', filePath],
{ stdio: 'inherit', stderr: 'inherit' }
);
console.log(`Ran prettier over ${_filePath}`);
}
@ -189,7 +197,7 @@ function getGitVersion() {
let refsMatch;
const refs = {};
while (refsMatch = refsRegex.exec(refsRaw)) {
while ((refsMatch = refsRegex.exec(refsRaw))) {
refs[refsMatch[2]] = refsMatch[1];
}

View File

@ -96,6 +96,9 @@ function buildAMD(entryPoint, banner) {
buildOneAMD('min', entryPoint, banner);
}
buildAMD('src/monaco.contribution.ts', 'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{');
buildAMD(
'src/monaco.contribution.ts',
'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{'
);
buildAMD('src/cssMode.ts', 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{');
buildAMD('src/cssWorker.ts', 'define("vs/language/css/cssWorker",[],()=>{');

View File

@ -223,7 +223,9 @@ declare var require: any;
function getMode(): Promise<typeof mode> {
if (AMD) {
return new Promise((resolve, reject) => { require(['vs/language/css/cssMode'], resolve, reject); });
return new Promise((resolve, reject) => {
require(['vs/language/css/cssMode'], resolve, reject);
});
} else {
return import('./cssMode');
}

View File

@ -14,8 +14,8 @@ module.exports = {
},
resolve: {
alias: {
'monaco-editor': path.resolve(__dirname, '../../release'),
},
'monaco-editor': path.resolve(__dirname, '../../release')
}
},
module: {
rules: [
@ -29,7 +29,9 @@ module.exports = {
}
]
},
plugins: [new MonacoWebpackPlugin({
monacoEditorPath: path.resolve(__dirname, '../../release')
})]
plugins: [
new MonacoWebpackPlugin({
monacoEditorPath: path.resolve(__dirname, '../../release')
})
]
};

View File

@ -11,8 +11,8 @@ module.exports = {
},
resolve: {
alias: {
'monaco-editor': path.resolve(__dirname, '../../release'),
},
'monaco-editor': path.resolve(__dirname, '../../release')
}
},
module: {
rules: [
@ -26,7 +26,9 @@ module.exports = {
}
]
},
plugins: [new MonacoWebpackPlugin({
monacoEditorPath: path.resolve(__dirname, '../../release')
})]
plugins: [
new MonacoWebpackPlugin({
monacoEditorPath: path.resolve(__dirname, '../../release')
})
]
};

View File

@ -110,7 +110,7 @@ monaco.languages.registerDocumentSemanticTokensProvider('plaintext', {
monaco.editor.defineTheme('myCustomTheme', {
base: 'vs',
inherit: true,
colors : {},
colors: {},
rules: [
{ token: 'comment', foreground: 'aaaaaa', fontStyle: 'italic' },
{ token: 'keyword', foreground: 'ce63eb' },

View File

@ -14,27 +14,36 @@ removeDir(`monaco-html/out`);
tsc(`monaco-html/src/tsconfig.json`);
dts(`monaco-html/out/amd/monaco.contribution.d.ts`, `monaco-html/monaco.d.ts`, 'monaco.languages.html');
dts(
`monaco-html/out/amd/monaco.contribution.d.ts`,
`monaco-html/monaco.d.ts`,
'monaco.languages.html'
);
esbuild.build({
entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'],
bundle: true,
target: 'esnext',
format: 'esm',
external: ['monaco-editor-core', '*/htmlMode'],
outdir: 'release/esm/',
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'),
}),
],
}).then((result) => {
if (result.errors.length > 0) {
console.error(result.errors);
}
if (result.warnings.length > 0) {
console.error(result.warnings);
}
esbuild
.build({
entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'],
bundle: true,
target: 'esnext',
format: 'esm',
external: ['monaco-editor-core', '*/htmlMode'],
outdir: 'release/esm/',
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts')
})
]
})
.then((result) => {
if (result.errors.length > 0) {
console.error(result.errors);
}
if (result.warnings.length > 0) {
console.error(result.warnings);
}
});
cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], {
stdio: 'inherit',
stderr: 'inherit'
});
cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { stdio: 'inherit', stderr: 'inherit' });

View File

@ -14,27 +14,36 @@ removeDir(`monaco-json/out`);
tsc(`monaco-json/src/tsconfig.json`);
dts(`monaco-json/out/amd/monaco.contribution.d.ts`, `monaco-json/monaco.d.ts`, 'monaco.languages.json');
dts(
`monaco-json/out/amd/monaco.contribution.d.ts`,
`monaco-json/monaco.d.ts`,
'monaco.languages.json'
);
esbuild.build({
entryPoints: ['src/jsonMode.ts', 'src/json.worker.ts', 'src/monaco.contribution.ts'],
bundle: true,
target: 'esnext',
format: 'esm',
external: ['monaco-editor-core', '*/jsonMode'],
outdir: 'release/esm/',
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'),
}),
],
}).then((result) => {
if (result.errors.length > 0) {
console.error(result.errors);
}
if (result.warnings.length > 0) {
console.error(result.warnings);
}
esbuild
.build({
entryPoints: ['src/jsonMode.ts', 'src/json.worker.ts', 'src/monaco.contribution.ts'],
bundle: true,
target: 'esnext',
format: 'esm',
external: ['monaco-editor-core', '*/jsonMode'],
outdir: 'release/esm/',
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts')
})
]
})
.then((result) => {
if (result.errors.length > 0) {
console.error(result.errors);
}
if (result.warnings.length > 0) {
console.error(result.warnings);
}
});
cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], {
stdio: 'inherit',
stderr: 'inherit'
});
cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { stdio: 'inherit', stderr: 'inherit' });

View File

@ -177,7 +177,7 @@ function tokenize(
let offset = offsetDelta + scanner.getPosition();
let type = '';
const kind = <SyntaxKind><any>scanner.scan();
const kind = <SyntaxKind>(<any>scanner.scan());
if (kind === SyntaxKind.EOF) {
break;
}
@ -261,7 +261,7 @@ function tokenize(
ret.endState = new JSONState(
state.getStateData(),
<ScanError><any>scanner.getTokenError(),
<ScanError>(<any>scanner.getTokenError()),
lastWasColon,
parents
);