ci(js): publish natives under @codemp scope...

... but keep using just codemp for package. to do this, we sed
@codemp/native into just codemp before doing npm publish, because napi
doesnt seem to have a flag to configure that without resorting to
package.json while creating subdirs.
This commit is contained in:
əlemi 2024-09-09 22:30:22 +02:00
parent 003711c9c0
commit decbda1bc8
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 10 additions and 5 deletions

View file

@ -66,7 +66,7 @@ jobs:
with: with:
path: dist/js/publish/artifacts path: dist/js/publish/artifacts
pattern: codemp-js-* pattern: codemp-js-*
- run: tree; npx napi artifacts; tree - run: npx napi artifacts
working-directory: dist/js/publish working-directory: dist/js/publish
- run: npx napi prepublish -t . --skip-gh-release - run: npx napi prepublish -t . --skip-gh-release
working-directory: dist/js/publish working-directory: dist/js/publish
@ -74,6 +74,11 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: rm -rf *.node artifacts node_modules - run: rm -rf *.node artifacts node_modules
working-directory: dist/js/publish working-directory: dist/js/publish
# TODO this is a bit awful, but napi just appends the platform triplet to the resulting package name
# however we want '@codemp/native-...' and 'codemp' (because otherwise it gets flagged as spam)
# so we just sed out before releasing. this is really ugly but if it works right now i'll just
# take it and think again about it later
- run: sed -i 's/"@codemp\/native"/"codemp"/' package.json
- run: npm publish - run: npm publish
working-directory: dist/js/publish working-directory: dist/js/publish
env: env:

View file

@ -1,5 +1,5 @@
{ {
"name": "codemp", "name": "@codemp/native",
"version": "0.0.6", "version": "0.0.6",
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "^2.18.4" "@napi-rs/cli": "^2.18.4"
@ -8,8 +8,8 @@
"name": "codemp" "name": "codemp"
}, },
"optionalDependencies": { "optionalDependencies": {
"codemp-win32-x64-msvc": "0.0.4", "@codemp/native-win32-x64-msvc": "0.0.4",
"codemp-darwin-arm64": "0.0.4", "@codemp/native-darwin-arm64": "0.0.4",
"codemp-linux-x64-gnu": "0.0.4" "@codemp/native-linux-x64-gnu": "0.0.4"
} }
} }