Skip to content

Commit

Permalink
update tools to handle renamed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Feb 11, 2020
1 parent 4b4c0d6 commit 0f73b28
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
5 changes: 5 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"command.publish.config": {
"ignore": ["*.md"]
},
"commands": {
"bootstrap": {
"ignore": ["ignite-core", "electrode-ignite", "generator-electrode"]
}
},
"fynpo": {
"publishConfig": {
"tags": {
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -37,5 +37,8 @@
"npm": ">= 3"
},
"private": true,
"license": "Apache-2.0"
"license": "Apache-2.0",
"prettier": {
"printWidth": 100
}
}
9 changes: 6 additions & 3 deletions tools/update-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down Expand Up @@ -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];
}
}

Expand Down
33 changes: 24 additions & 9 deletions xclap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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");
Expand All @@ -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, "/")
);
}
});
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"]);
}
Expand Down

0 comments on commit 0f73b28

Please sign in to comment.