Skip to content

Commit

Permalink
fix: slow npm
Browse files Browse the repository at this point in the history
  • Loading branch information
cha0s committed Feb 9, 2024
1 parent 34b6743 commit 8aca988
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
17 changes: 17 additions & 0 deletions build/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ const shrinkwrapsAndPublish = async (creator) => {
await processCode(spawnWith(args, {cwd: dist}));
};

// npm can be slow...
const waitForPkgToPublish = (pkg) => (
new Promise(async (resolve) => {
if (await run(`npm view ${pkg}@${localVersions[pkg]}`)) {
resolve();
}
const handle = setInterval(async () => {
if (await run(`npm view ${pkg}@${localVersions[pkg]}`)) {
clearInterval(handle);
resolve();
}
}, 5000);
})
);

(async () => {
await concurrent(
(await Promise.all(workspaces.map((path) => glob(join(FLECKS_CORE_ROOT, path))))).flat(),
Expand Down Expand Up @@ -138,13 +153,15 @@ const shrinkwrapsAndPublish = async (creator) => {
// Pack dependencies.
await mkdir(packCache, {recursive: true});
const dependencies = ['build', 'core', 'fleck', 'server'];
await Promise.all(dependencies.map((pkg) => waitForPkgToPublish(`@flecks/${pkg}`)));
await Promise.all(dependencies.map(packPkg));
if (bumpedVersions['@flecks/create-fleck']) {
await shrinkwrapsAndPublish('create-fleck');
}
if (bumpedVersions['@flecks/create-app']) {
// Needs packed create-fleck for package lock.
await packPkg('create-fleck');
await waitForPkgToPublish('@flecks/create-fleck');
await shrinkwrapsAndPublish('create-app');
}
})();
1 change: 0 additions & 1 deletion packages/core/QUIRKS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- I use the variable `r` a lot when referencing a reducer's accumulator value

2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"access": "public"
},
"bin": {
"create-app": "./build/cli.js"
"create-app": "build/cli.js"
},
"files": [
"npm-shrinkwrap.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-fleck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"access": "public"
},
"bin": {
"create-fleck": "./build/cli.js"
"create-fleck": "build/cli.js"
},
"files": [
"npm-shrinkwrap.json",
Expand Down

0 comments on commit 8aca988

Please sign in to comment.