@ericsanchezok/meta-protocol 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/script/publish.ts +12 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@ericsanchezok/meta-protocol",
4
- "version": "1.1.4",
4
+ "version": "1.1.6",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "types": "./src/index.ts",
package/script/publish.ts CHANGED
@@ -21,12 +21,18 @@ for (const [key, value] of Object.entries(pkg.exports)) {
21
21
  await Bun.write("package.json", JSON.stringify(pkg, null, 2))
22
22
 
23
23
  try {
24
- const NPM_REGISTRY = "https://registry.npmjs.org"
25
- await $`rm -f *.tgz`.nothrow()
26
- await $`bun pm pack`
27
- const tgz = (await $`ls *.tgz`.text()).trim()
28
- const authFlag = process.env.NPM_TOKEN ? `--//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}` : ""
29
- await $`npm publish ${tgz} --tag ${Script.channel} --registry ${NPM_REGISTRY} --access public ${authFlag}`
24
+ if (await Script.npmVersionExists(pkg.name, Script.version)) {
25
+ console.log(`${pkg.name}@${Script.version} already published, skipping`)
26
+ } else {
27
+ const NPM_REGISTRY = "https://registry.npmjs.org"
28
+ await $`rm -f *.tgz`.nothrow()
29
+ await $`bun pm pack`
30
+ const tgz = (await $`ls *.tgz`.text()).trim()
31
+ const authFlag = process.env.NPM_TOKEN ? `--//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}` : ""
32
+ await Script.retry(
33
+ () => $`npm publish ${tgz} --tag ${Script.channel} --registry ${NPM_REGISTRY} --access public ${authFlag}`,
34
+ )
35
+ }
30
36
  } finally {
31
37
  await Bun.write("package.json", JSON.stringify(original, null, 2))
32
38
  }