Run prettier

This commit is contained in:
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) { function tsc(_projectPath) {
const projectPath = path.join(REPO_ROOT, _projectPath); const projectPath = path.join(REPO_ROOT, _projectPath);
console.log(`Launching compiler at ${_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}`); console.log(`Compiled ${_projectPath}`);
} }
exports.tsc = tsc; exports.tsc = tsc;
@ -94,7 +98,11 @@ exports.tsc = tsc;
*/ */
function prettier(_filePath) { function prettier(_filePath) {
const filePath = path.join(REPO_ROOT, _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}`); console.log(`Ran prettier over ${_filePath}`);
} }
@ -189,7 +197,7 @@ function getGitVersion() {
let refsMatch; let refsMatch;
const refs = {}; const refs = {};
while (refsMatch = refsRegex.exec(refsRaw)) { while ((refsMatch = refsRegex.exec(refsRaw))) {
refs[refsMatch[2]] = refsMatch[1]; refs[refsMatch[2]] = refsMatch[1];
} }

View file

@ -96,6 +96,9 @@ function buildAMD(entryPoint, banner) {
buildOneAMD('min', 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/cssMode.ts', 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{');
buildAMD('src/cssWorker.ts', 'define("vs/language/css/cssWorker",[],()=>{'); buildAMD('src/cssWorker.ts', 'define("vs/language/css/cssWorker",[],()=>{');

View file

@ -223,7 +223,9 @@ declare var require: any;
function getMode(): Promise<typeof mode> { function getMode(): Promise<typeof mode> {
if (AMD) { 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 { } else {
return import('./cssMode'); return import('./cssMode');
} }

View file

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

View file

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

View file

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

View file

@ -14,9 +14,14 @@ removeDir(`monaco-html/out`);
tsc(`monaco-html/src/tsconfig.json`); 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({ esbuild
.build({
entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'], entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'],
bundle: true, bundle: true,
target: 'esnext', target: 'esnext',
@ -25,16 +30,20 @@ esbuild.build({
outdir: 'release/esm/', outdir: 'release/esm/',
plugins: [ plugins: [
alias({ alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'), 'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts')
}), })
], ]
}).then((result) => { })
.then((result) => {
if (result.errors.length > 0) { if (result.errors.length > 0) {
console.error(result.errors); console.error(result.errors);
} }
if (result.warnings.length > 0) { if (result.warnings.length > 0) {
console.error(result.warnings); 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,9 +14,14 @@ removeDir(`monaco-json/out`);
tsc(`monaco-json/src/tsconfig.json`); 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({ esbuild
.build({
entryPoints: ['src/jsonMode.ts', 'src/json.worker.ts', 'src/monaco.contribution.ts'], entryPoints: ['src/jsonMode.ts', 'src/json.worker.ts', 'src/monaco.contribution.ts'],
bundle: true, bundle: true,
target: 'esnext', target: 'esnext',
@ -25,16 +30,20 @@ esbuild.build({
outdir: 'release/esm/', outdir: 'release/esm/',
plugins: [ plugins: [
alias({ alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'), 'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts')
}), })
], ]
}).then((result) => { })
.then((result) => {
if (result.errors.length > 0) { if (result.errors.length > 0) {
console.error(result.errors); console.error(result.errors);
} }
if (result.warnings.length > 0) { if (result.warnings.length > 0) {
console.error(result.warnings); 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 offset = offsetDelta + scanner.getPosition();
let type = ''; let type = '';
const kind = <SyntaxKind><any>scanner.scan(); const kind = <SyntaxKind>(<any>scanner.scan());
if (kind === SyntaxKind.EOF) { if (kind === SyntaxKind.EOF) {
break; break;
} }
@ -261,7 +261,7 @@ function tokenize(
ret.endState = new JSONState( ret.endState = new JSONState(
state.getStateData(), state.getStateData(),
<ScanError><any>scanner.getTokenError(), <ScanError>(<any>scanner.getTokenError()),
lastWasColon, lastWasColon,
parents parents
); );