fix: slow npm

This commit is contained in:
cha0s 2024-02-09 07:09:05 -06:00
parent 34b6743390
commit 8aca988ae3
4 changed files with 19 additions and 3 deletions

View File

@ -110,6 +110,21 @@ const shrinkwrapsAndPublish = async (creator) => {
await processCode(spawnWith(args, {cwd: dist})); 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 () => { (async () => {
await concurrent( await concurrent(
(await Promise.all(workspaces.map((path) => glob(join(FLECKS_CORE_ROOT, path))))).flat(), (await Promise.all(workspaces.map((path) => glob(join(FLECKS_CORE_ROOT, path))))).flat(),
@ -138,6 +153,7 @@ const shrinkwrapsAndPublish = async (creator) => {
// Pack dependencies. // Pack dependencies.
await mkdir(packCache, {recursive: true}); await mkdir(packCache, {recursive: true});
const dependencies = ['build', 'core', 'fleck', 'server']; const dependencies = ['build', 'core', 'fleck', 'server'];
await Promise.all(dependencies.map((pkg) => waitForPkgToPublish(`@flecks/${pkg}`)));
await Promise.all(dependencies.map(packPkg)); await Promise.all(dependencies.map(packPkg));
if (bumpedVersions['@flecks/create-fleck']) { if (bumpedVersions['@flecks/create-fleck']) {
await shrinkwrapsAndPublish('create-fleck'); await shrinkwrapsAndPublish('create-fleck');
@ -145,6 +161,7 @@ const shrinkwrapsAndPublish = async (creator) => {
if (bumpedVersions['@flecks/create-app']) { if (bumpedVersions['@flecks/create-app']) {
// Needs packed create-fleck for package lock. // Needs packed create-fleck for package lock.
await packPkg('create-fleck'); await packPkg('create-fleck');
await waitForPkgToPublish('@flecks/create-fleck');
await shrinkwrapsAndPublish('create-app'); await shrinkwrapsAndPublish('create-app');
} }
})(); })();

View File

@ -1,2 +1 @@
- I use the variable `r` a lot when referencing a reducer's accumulator value - I use the variable `r` a lot when referencing a reducer's accumulator value

View File

@ -19,7 +19,7 @@
"access": "public" "access": "public"
}, },
"bin": { "bin": {
"create-app": "./build/cli.js" "create-app": "build/cli.js"
}, },
"files": [ "files": [
"npm-shrinkwrap.json", "npm-shrinkwrap.json",

View File

@ -19,7 +19,7 @@
"access": "public" "access": "public"
}, },
"bin": { "bin": {
"create-fleck": "./build/cli.js" "create-fleck": "build/cli.js"
}, },
"files": [ "files": [
"npm-shrinkwrap.json", "npm-shrinkwrap.json",