|
|
@ -7,9 +7,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
const esbuild = require('esbuild');
|
|
|
|
const esbuild = require('esbuild');
|
|
|
|
const path = require('path');
|
|
|
|
const path = require('path');
|
|
|
|
const { removeDir } = require('../../build/fs');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
|
|
|
|
removeDir('samples/browser-esm-esbuild/dist', (entry) => /index.html$/.test(entry));
|
|
|
|
removeDir('dist', (entry) => /index.html$/.test(entry));
|
|
|
|
|
|
|
|
|
|
|
|
const workerEntryPoints = [
|
|
|
|
const workerEntryPoints = [
|
|
|
|
'vs/language/json/json.worker.js',
|
|
|
|
'vs/language/json/json.worker.js',
|
|
|
@ -50,3 +50,47 @@ function build(opts) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Remove a directory and all its contents.
|
|
|
|
|
|
|
|
* @param {string} _dirPath
|
|
|
|
|
|
|
|
* @param {(filename: string) => boolean} [keep]
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function removeDir(_dirPath, keep) {
|
|
|
|
|
|
|
|
if (typeof keep === 'undefined') {
|
|
|
|
|
|
|
|
keep = () => false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const dirPath = path.join(__dirname, _dirPath);
|
|
|
|
|
|
|
|
if (!fs.existsSync(dirPath)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rmDir(dirPath, _dirPath);
|
|
|
|
|
|
|
|
console.log(`Deleted ${_dirPath}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @param {string} dirPath
|
|
|
|
|
|
|
|
* @param {string} relativeDirPath
|
|
|
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function rmDir(dirPath, relativeDirPath) {
|
|
|
|
|
|
|
|
let keepsFiles = false;
|
|
|
|
|
|
|
|
const entries = fs.readdirSync(dirPath);
|
|
|
|
|
|
|
|
for (const entry of entries) {
|
|
|
|
|
|
|
|
const filePath = path.join(dirPath, entry);
|
|
|
|
|
|
|
|
const relativeFilePath = path.join(relativeDirPath, entry);
|
|
|
|
|
|
|
|
if (keep(relativeFilePath)) {
|
|
|
|
|
|
|
|
keepsFiles = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fs.statSync(filePath).isFile()) {
|
|
|
|
|
|
|
|
fs.unlinkSync(filePath);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
keepsFiles = rmDir(filePath, relativeFilePath) || keepsFiles;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!keepsFiles) {
|
|
|
|
|
|
|
|
fs.rmdirSync(dirPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return keepsFiles;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|