From 34879208a7fb8002e1349d0b6e56b1f64b2c9c8a Mon Sep 17 00:00:00 2001 From: ienaga Date: Sun, 23 Mar 2025 13:27:06 +0900 Subject: [PATCH 1/2] #128 update actions yml --- .github/workflows/publish.yml | 1 + package.json | 1 + scripts/changePackage.js | 21 +++++++++++++++++++++ scripts/publish.js | 15 ++++----------- 4 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 scripts/changePackage.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4ee841a..d742129 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,6 +19,7 @@ jobs: - uses: actions/setup-node@v4 with: registry-url: "https://registry.npmjs.org" + - run: npm run release - run: npm install - run: npm run publish - run: cd ~/work/framework/framework/dist && npm publish --access public diff --git a/package.json b/package.json index 16f7a78..65b666a 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ ], "scripts": { "lint": "eslint src/**/*.ts", + "release": "node ./scripts/changePackage.js", "publish": "node ./scripts/clean.js && node ./scripts/version.js && tsc && node ./scripts/publish.js", "test": "vitest" }, diff --git a/scripts/changePackage.js b/scripts/changePackage.js new file mode 100644 index 0000000..49c5083 --- /dev/null +++ b/scripts/changePackage.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node + +"use strict"; + +const execute = () => +{ + const packageJson = JSON.parse( + readFileSync(`${process.cwd()}/package.json`, { "encoding": "utf8" }) + ); + + delete packageJson.peerDependencies; + packageJson.dependencies = { "@next2d/player": "*" }; + + // write package.json + writeFileSync( + join(process.cwd(), "package.json"), + JSON.stringify(packageJson, null, 2) + ); +}; + +execute(); \ No newline at end of file diff --git a/scripts/publish.js b/scripts/publish.js index 63031fe..886cc16 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -13,17 +13,10 @@ import { join } from "path"; */ const execute = () => { - const packageJson = JSON.parse( - readFileSync(`${process.cwd()}/package.json`, { "encoding": "utf8" }) - ); - - delete packageJson.peerDependencies; - packageJson.dependencies = { "@next2d/player": "*" }; - - // write package.json - writeFileSync( - join(process.cwd(), "dist/package.json"), - JSON.stringify(packageJson, null, 2) + // package.json file + spawnSync( + `cp -r ${process.cwd()}/package.json ${process.cwd()}/dist/package.json`, + { "shell": true } ); // LICENSE From 2afbdf3a7336db605bfb5f4a9ed3efa1ac24b9e8 Mon Sep 17 00:00:00 2001 From: ienaga Date: Sun, 23 Mar 2025 13:29:13 +0900 Subject: [PATCH 2/2] #128 update actions yml --- package.json | 2 +- scripts/{changePackage.js => release.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{changePackage.js => release.js} (100%) diff --git a/package.json b/package.json index 65b666a..11d8f1f 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ ], "scripts": { "lint": "eslint src/**/*.ts", - "release": "node ./scripts/changePackage.js", + "release": "node ./scripts/release.js", "publish": "node ./scripts/clean.js && node ./scripts/version.js && tsc && node ./scripts/publish.js", "test": "vitest" }, diff --git a/scripts/changePackage.js b/scripts/release.js similarity index 100% rename from scripts/changePackage.js rename to scripts/release.js