diff --git a/build/publish.js b/build/publish.js index 8320bf1..159daf1 100644 --- a/build/publish.js +++ b/build/publish.js @@ -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(), @@ -138,6 +153,7 @@ 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'); @@ -145,6 +161,7 @@ const shrinkwrapsAndPublish = async (creator) => { 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'); } })(); diff --git a/packages/core/QUIRKS.md b/packages/core/QUIRKS.md index 6e1ae27..12a2a8f 100644 --- a/packages/core/QUIRKS.md +++ b/packages/core/QUIRKS.md @@ -1,2 +1 @@ - I use the variable `r` a lot when referencing a reducer's accumulator value - diff --git a/packages/create-app/package.json b/packages/create-app/package.json index e39ffe4..c58c325 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -19,7 +19,7 @@ "access": "public" }, "bin": { - "create-app": "./build/cli.js" + "create-app": "build/cli.js" }, "files": [ "npm-shrinkwrap.json", diff --git a/packages/create-fleck/package.json b/packages/create-fleck/package.json index a5072f0..a58c273 100644 --- a/packages/create-fleck/package.json +++ b/packages/create-fleck/package.json @@ -19,7 +19,7 @@ "access": "public" }, "bin": { - "create-fleck": "./build/cli.js" + "create-fleck": "build/cli.js" }, "files": [ "npm-shrinkwrap.json",