Skip to content

Commit 479bd98

Browse files
committed
ci: add preinstall.js
1 parent 33706b5 commit 479bd98

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
run: yarn config set supportedArchitectures.cpu "ia32"
135135
shell: bash
136136
- name: Install dependencies
137-
run: yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --ignore-optional --registry https://registry.npmjs.org/ --prod
137+
run: node scripts/preinstall.js && yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --registry https://registry.npmjs.org/ --prod
138138
- name: Setup node x86
139139
uses: actions/setup-node@v4
140140
if: matrix.settings.target == 'i686-pc-windows-msvc'
@@ -187,7 +187,7 @@ jobs:
187187
check-latest: true
188188

189189
- name: Install dependencies
190-
run: yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --ignore-optional --registry https://registry.npmjs.org/ --prod
190+
run: node scripts/preinstall.js && yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --registry https://registry.npmjs.org/ --prod
191191
- name: Download artifacts
192192
uses: actions/download-artifact@v4
193193
with:
@@ -238,7 +238,7 @@ jobs:
238238
shell: bash
239239

240240
- name: Install dependencies
241-
run: yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --ignore-optional --registry https://registry.npmjs.org/ --prod
241+
run: node scripts/preinstall.js && yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --registry https://registry.npmjs.org/ --prod
242242
- name: Download artifacts
243243
uses: actions/download-artifact@v4
244244
with:
@@ -268,7 +268,7 @@ jobs:
268268
check-latest: true
269269

270270
- name: Install dependencies
271-
run: yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --ignore-optional --registry https://registry.npmjs.org/ --prod
271+
run: node scripts/preinstall.js && yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --registry https://registry.npmjs.org/ --prod
272272
- name: Download artifacts
273273
uses: actions/download-artifact@v4
274274
with:
@@ -296,7 +296,7 @@ jobs:
296296
check-latest: true
297297

298298
- name: Install dependencies
299-
run: yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --ignore-optional --registry https://registry.npmjs.org/ --prod
299+
run: node scripts/preinstall.js && yarn add esno@^4.0.0 shelljs@^0.8.5 @napi-rs/cli@^2.15.2 --registry https://registry.npmjs.org/ --prod
300300
- name: Download all artifacts
301301
uses: actions/download-artifact@v4
302302
with:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"build:dev": "env=development node scripts/build.js",
5454
"build": "node scripts/build.js",
5555
"build:debug": "napi build --platform",
56-
"publish:npm": "node scripts/publish.js && napi prepublish -t npm",
56+
"publish:npm": "node scripts/publish.js && napi prepublish -t npm && npm publish --access public",
5757
"test": "esno ./test.ts",
5858
"universal": "napi universal",
5959
"version": "napi version"

scripts/preinstall.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { writeFileSync } = require('fs')
2+
const { resolve } = require('path')
3+
4+
const pkgJson = require(resolve(process.cwd(), './package.json'))
5+
6+
delete pkgJson['optionalDependencies']
7+
8+
9+
writeFileSync(resolve(process.cwd(), './package.json'), JSON.stringify(pkgJson, "", "\n"))

0 commit comments

Comments
 (0)