Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-11-03 23:47:51 +0300
committerGitHub <noreply@github.com>2022-11-03 23:47:51 +0300
commit9931679a13d881d9f54c2bcf601cc4a87ca59b4d (patch)
tree717c80ab82783312e2302d70d5ff58a3a96f945f
parentc10abe09fe18a58820022ec5c6e6b8eeabd2963d (diff)
chore: check version to determine whether to publish (#5811)
Co-authored-by: Gar <gar+gh@danger.computer>
-rw-r--r--scripts/publish.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/publish.js b/scripts/publish.js
index 62f2217b7..656c78d02 100644
--- a/scripts/publish.js
+++ b/scripts/publish.js
@@ -7,10 +7,12 @@ const resetdeps = () => npm('run', 'resetdeps')
const op = () => spawn('op', 'item', 'get', 'npm', '--otp', { out: true, ok: true })
-const getVersion = async (s) => {
- const mani = await pacote.manifest(s, { preferOnline: true })
- return mani.version
+const missingVersion = ({ name, version }) => {
+ const mani = await pacote.manifest(`${name}@${version}`, { preferOnline: true })
+ .catch(() => null)
+ return !mani
}
+
const getLatest = async (s) => {
const pack = await pacote.packument(s, { preferOnline: true })
return pack['dist-tags'].latest
@@ -35,9 +37,8 @@ const needsPublish = async ({ private, name, version }, { force, getTag }) => {
return
}
- const tag = await getTag({ name, version })
- if (force || version !== await getVersion(`${name}@${tag}`)) {
- return tag
+ if (force || await missingVersion({ name, version })) {
+ return getTag({ name, version })
}
}