From decbda1bc8b045f822be51268e1a0dd8917a6826 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 9 Sep 2024 22:30:22 +0200 Subject: [PATCH] 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. --- .github/workflows/javascript.yml | 7 ++++++- dist/js/publish/package.json | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/javascript.yml b/.github/workflows/javascript.yml index e93b5e1..22c1eb2 100644 --- a/.github/workflows/javascript.yml +++ b/.github/workflows/javascript.yml @@ -66,7 +66,7 @@ jobs: with: path: dist/js/publish/artifacts pattern: codemp-js-* - - run: tree; npx napi artifacts; tree + - run: npx napi artifacts working-directory: dist/js/publish - run: npx napi prepublish -t . --skip-gh-release working-directory: dist/js/publish @@ -74,6 +74,11 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: rm -rf *.node artifacts node_modules 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 working-directory: dist/js/publish env: diff --git a/dist/js/publish/package.json b/dist/js/publish/package.json index 85488f5..ca8940e 100644 --- a/dist/js/publish/package.json +++ b/dist/js/publish/package.json @@ -1,5 +1,5 @@ { - "name": "codemp", + "name": "@codemp/native", "version": "0.0.6", "devDependencies": { "@napi-rs/cli": "^2.18.4" @@ -8,8 +8,8 @@ "name": "codemp" }, "optionalDependencies": { - "codemp-win32-x64-msvc": "0.0.4", - "codemp-darwin-arm64": "0.0.4", - "codemp-linux-x64-gnu": "0.0.4" + "@codemp/native-win32-x64-msvc": "0.0.4", + "@codemp/native-darwin-arm64": "0.0.4", + "@codemp/native-linux-x64-gnu": "0.0.4" } }