Migrate to npm workspaces
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
||||||
* @license MIT
|
|
||||||
*
|
|
||||||
* Script to initialize addon packages under "addons/" with outer deps.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const cp = require('child_process');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
||||||
|
|
||||||
// install addon deps
|
|
||||||
const addonsPath = path.join(PACKAGE_ROOT, 'addons');
|
|
||||||
if (fs.existsSync(addonsPath)) {
|
|
||||||
console.log('pulling addon dependencies...');
|
|
||||||
|
|
||||||
// walk all addon folders
|
|
||||||
fs.readdir(addonsPath, (err, files) => {
|
|
||||||
for (const folder of files) {
|
|
||||||
const addonPath = path.join(addonsPath, folder);
|
|
||||||
|
|
||||||
// install only if there are dependencies listed
|
|
||||||
let packageJson;
|
|
||||||
try {
|
|
||||||
packageJson = require(path.join(addonPath, 'package.json'));
|
|
||||||
} catch (e) {
|
|
||||||
// swallow as changing branches can leave folders around
|
|
||||||
}
|
|
||||||
if (packageJson
|
|
||||||
&& (
|
|
||||||
(packageJson.devDependencies && Object.keys(packageJson.devDependencies).length)
|
|
||||||
|| (packageJson.dependencies && Object.keys(packageJson.dependencies).length)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
console.log('Preparing', folder);
|
|
||||||
cp.execSync('npm ci', {cwd: addonPath});
|
|
||||||
} else {
|
|
||||||
console.log('Skipped', folder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Generated
+963
-88
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -8,6 +8,9 @@
|
|||||||
"types": "typings/xterm.d.ts",
|
"types": "typings/xterm.d.ts",
|
||||||
"repository": "https://github.com/xtermjs/xterm.js",
|
"repository": "https://github.com/xtermjs/xterm.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"workspaces": [
|
||||||
|
"addons/*"
|
||||||
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"cli",
|
"cli",
|
||||||
"command-line",
|
"command-line",
|
||||||
@@ -25,8 +28,6 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm run build",
|
"setup": "npm run build",
|
||||||
"presetup": "npm run install-addons",
|
|
||||||
"install-addons": "node ./bin/install-addons.js",
|
|
||||||
"start": "node demo/start",
|
"start": "node demo/start",
|
||||||
"build": "npm run tsc",
|
"build": "npm run tsc",
|
||||||
"watch": "npm run tsc-watch",
|
"watch": "npm run tsc-watch",
|
||||||
|
|||||||
Reference in New Issue
Block a user