Ver código fonte

small tweaks

Alex Dima 3 anos atrás
pai
commit
1b00da60ec
2 arquivos alterados com 16 adições e 3 exclusões
  1. 16 1
      build/utils.js
  2. 0 2
      monaco-css/scripts/build.js

+ 16 - 1
build/utils.js

@@ -77,7 +77,7 @@ exports.removeDir = removeDir;
 /**
  * Launch the typescript compiler synchronously over a project.
  *
- * @param {string} projectPath
+ * @param {string} _projectPath
  */
 function tsc(_projectPath) {
 	const projectPath = path.join(REPO_ROOT, _projectPath);
@@ -87,6 +87,19 @@ function tsc(_projectPath) {
 }
 exports.tsc = tsc;
 
+/**
+ * Launch prettier on a specific file.
+ *
+ * @param {string} _filePath
+ */
+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' });
+
+	console.log(`Ran prettier over ${_filePath}`);
+}
+exports.prettier = prettier;
+
 /**
  * Transform an external .d.ts file to an internal .d.ts file
  *
@@ -128,5 +141,7 @@ function dts(_source, _destination, namespace) {
 	result.push(``);
 
 	fs.writeFileSync(destination, result.join('\n'));
+
+	prettier(_destination);
 }
 exports.dts = dts;

+ 0 - 2
monaco-css/scripts/build.js

@@ -16,8 +16,6 @@ tsc(`monaco-css/src/tsconfig.json`);
 
 dts(`monaco-css/out/amd/monaco.contribution.d.ts`, `monaco-css/monaco.d.ts`, 'monaco.languages.css');
 
-cp.spawnSync(process.execPath, [path.join(__dirname, '../../node_modules/prettier/bin-prettier.js'), '--write', path.join(__dirname, '../monaco.d.ts')], { stdio: 'inherit', stderr: 'inherit' });
-
 esbuild.build({
 	entryPoints: ['src/cssMode.ts', 'src/css.worker.ts', 'src/monaco.contribution.ts'],
 	bundle: true,