From 0f73b282f53d3d23bed0bb57305f63ce8a4a50f5 Mon Sep 17 00:00:00 2001 From: Joel Chen Date: Tue, 11 Feb 2020 01:32:25 -0800 Subject: [PATCH] update tools to handle renamed packages --- lerna.json | 5 +++++ package.json | 7 +++++-- tools/update-changelog.js | 9 ++++++--- xclap.js | 33 ++++++++++++++++++++++++--------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/lerna.json b/lerna.json index 968ee66ea..845173685 100644 --- a/lerna.json +++ b/lerna.json @@ -4,6 +4,11 @@ "command.publish.config": { "ignore": ["*.md"] }, + "commands": { + "bootstrap": { + "ignore": ["ignite-core", "electrode-ignite", "generator-electrode"] + } + }, "fynpo": { "publishConfig": { "tags": { diff --git a/package.json b/package.json index 50ccdca9f..e5607eb3d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "clap test", "test-generator": "clap test-generator", "test-boilerplate": "clap test-boilerplate", - "bootstrap": "fynpo", + "bootstrap": "clap bootstrap", "clean": "npm run nuke && npm run nuke-packages && npm run nuke-samples", "nuke": "rm -rf node_modules tmp lerna-debug.log npm-debug.log", "nuke-packages": "rm -rf packages/*/node_modules packages/*/coverage", @@ -37,5 +37,8 @@ "npm": ">= 3" }, "private": true, - "license": "Apache-2.0" + "license": "Apache-2.0", + "prettier": { + "printWidth": 100 + } } diff --git a/tools/update-changelog.js b/tools/update-changelog.js index dd1d5ba28..320714353 100644 --- a/tools/update-changelog.js +++ b/tools/update-changelog.js @@ -24,8 +24,8 @@ const changeLogFile = Path.resolve("CHANGELOG.md"); const changeLog = Fs.readFileSync(changeLogFile).toString(); let gitClean = false; const packageMapping = { - "electrode-archetype-react-app": "electrode-archetype-react-app[-dev]", - "electrode-archetype-react-app-dev": "electrode-archetype-react-app[-dev]", + "@xarc/app": "@xarc/app[-dev]", + "@xarc/app-dev": "@xarc/app[-dev]", "electrode-archetype-react-component": "electrode-archetype-react-component[-dev]", "electrode-archetype-react-component-dev": "electrode-archetype-react-component[-dev]", "electrode-archetype-webpack-dll": "electrode-archetype-webpack-dll[-dev]", @@ -58,7 +58,10 @@ const removeNpmScope = name => { if (name.startsWith("@")) { const parts = name.split("/"); if (parts.length === 2) { - return parts[1]; + if (parts[1] === "create-app") { + return parts[1]; + } + return parts[0].substr(1) + "-" + parts[1]; } } diff --git a/xclap.js b/xclap.js index 5ce396b84..d3a1f1e61 100644 --- a/xclap.js +++ b/xclap.js @@ -13,10 +13,24 @@ const _ = require("lodash"); const isWin32 = process.platform.startsWith("win32"); const packagesDir = Path.join(__dirname, "packages"); +const removeNpmScope = name => { + if (name.startsWith("@")) { + const parts = name.split("/"); + if (parts.length === 2) { + if (parts[1] === "create-app") { + return parts[1]; + } + return parts[0].substr(1) + "-" + parts[1]; + } + } + + return name; +}; + const pullLocalPackages = dir => { dir = Path.isAbsolute(dir) ? dir : Path.join(__dirname, dir); const localPkgs = [ - "electrode-archetype-react-app", + "@xarc/app", "electrode-react-webapp", "electrode-redux-router-engine", "electrode-auto-ssr", @@ -26,7 +40,7 @@ const pullLocalPackages = dir => { "subapp-server", "subapp-web" ]; - const localDevPkgs = ["electrode-archetype-react-app-dev"]; + const localDevPkgs = ["@xarc/app-dev"]; const localPackagesDir = Path.relative(dir, packagesDir); const appPkgFile = Path.join(dir, "package.json"); @@ -40,7 +54,7 @@ const pullLocalPackages = dir => { _.set( appPkg, ["fyn", section, pkg], - Path.join(localPackagesDir, pkg).replace(/\\/g, "/") + Path.join(localPackagesDir, removeNpmScope(pkg)).replace(/\\/g, "/") ); } }); @@ -122,8 +136,9 @@ const testGenerator = (testDir, name, clean, runTest, prompts) => { }; xclap.load({ - ".lerna.coverage": "~$lerna run --stream coverage", - bootstrap: "~$fynpo", + ".lerna.coverage": + "~$lerna run --ignore ignite-core --ignore electrode-ignite --ignore generator-electrode --stream coverage", + bootstrap: "~$fynpo --ignore ignite-core electrode-ignite generator-electrode", test: ["bootstrap", ".lerna.coverage", "build-test"], "test-generator": [".test-generator --all"], "test-create-app": [".test-create-app"], @@ -153,13 +168,13 @@ xclap.load({ const updatedStr = updated.join(" "); - if (updatedStr.indexOf("generator-electrode") >= 0) { - tasks.push("test-generator"); - } + // if (updatedStr.indexOf("generator-electrode") >= 0) { + // tasks.push("test-generator"); + // } if ( updatedStr.indexOf("electrode-archetype-react-component") >= 0 || - updatedStr.indexOf("electrode-archetype-react-app") >= 0 + updatedStr.indexOf("@xarc/app") >= 0 ) { tasks.push([".", "test-demo-component", ".test-tree-shaking"]); }