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..11d8f1f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ ], "scripts": { "lint": "eslint src/**/*.ts", + "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/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 diff --git a/scripts/release.js b/scripts/release.js new file mode 100644 index 0000000..49c5083 --- /dev/null +++ b/scripts/release.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