From fba503ea429b84a5bed12de075878c612c1d3182 Mon Sep 17 00:00:00 2001 From: icodesign Date: Sun, 21 Jul 2024 13:04:34 +0800 Subject: [PATCH] Update release scripts --- .changeset/config.json | 2 +- .github/workflows/release-package.yml | 10 ------- .gitignore | 1 + apps/cli/CHANGELOG.md | 4 +-- apps/cli/bin/cli.cjs | 4 +++ apps/cli/package.json | 41 ++++++++++++++++++--------- apps/cli/src/index.ts | 3 +- package.json | 18 +++--------- pnpm-lock.yaml | 21 ++++++++++++++ 9 files changed, 62 insertions(+), 42 deletions(-) create mode 100755 apps/cli/bin/cli.cjs diff --git a/.changeset/config.json b/.changeset/config.json index ae82eba..d4dfac0 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -4,7 +4,7 @@ "commit": false, "fixed": [], "linked": [], - "access": "restricted", + "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [] diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml index 9bb6582..27f5a9f 100644 --- a/.github/workflows/release-package.yml +++ b/.github/workflows/release-package.yml @@ -32,16 +32,6 @@ jobs: - name: Install dependencies run: pnpm install - - name: Build package - run: pnpm run --filter @icodesign/dolphin build - - - name: Make sure build artifacts are created (apps/cli/dist/index.cjs) - run: | - if [ ! -f "apps/cli/dist/index.cjs" ]; then - echo "Build artifacts does not exist. Exiting." - exit 1 - fi - - name: Create and publish versions uses: changesets/action@v1 with: diff --git a/.gitignore b/.gitignore index 0ecbefe..c87b109 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .pnpm-store .npmrc +package # Created by https://www.toptal.com/developers/gitignore/api/node # Edit at https://www.toptal.com/developers/gitignore?templates=node diff --git a/apps/cli/CHANGELOG.md b/apps/cli/CHANGELOG.md index f4c4e41..bb91c0b 100644 --- a/apps/cli/CHANGELOG.md +++ b/apps/cli/CHANGELOG.md @@ -1,7 +1,7 @@ # @icodesign/dolphin -## 1.0.0 +## 0.3.0 ### Major Changes -- 4492aa4: Initial release +- Initial release diff --git a/apps/cli/bin/cli.cjs b/apps/cli/bin/cli.cjs new file mode 100755 index 0000000..6c4a70a --- /dev/null +++ b/apps/cli/bin/cli.cjs @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +var cli = require('../dist/index.cjs'); +cli(); diff --git a/apps/cli/package.json b/apps/cli/package.json index 2bdba81..a0acded 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -1,36 +1,49 @@ { "name": "@icodesign/dolphin", - "version": "1.0.0", - "exports": "./dist/index.js", - "bin": "./dist/index.cjs", + "version": "0.3.0", + "main": "./dist/index.cjs", + "bin": "./bin/cli.cjs", "type": "module", "description": "Dolphin is an innovative, automated internationalization (i18n) service designed to integrate seamlessly into your development pipeline.", - "keywords": [ - "i18n", - "internationalization", - "localization", - "l10n", - "ai", - "artificial intelligence", - "translation", - "nlp", - "dolphin" - ], "author": "Lance Wang (icodesign)", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/icodesign/dolphin" }, + "files": [ + "dist" + ], + "publishConfig": { + "directory": "package" + }, + "clean-publish": { + "withoutPublish": true, + "tempDir": "package" + }, "scripts": { "clean": "rimraf dist", "build": "tsup", "dev": "tsc -w --preserveWatchOutput", "start": "node dist/index.cjs", "start:debug": "node --inspect-brk dist/index.cjs", + "prepack": "pnpm build", + "prepublishOnly": "rm -rf ./package && clean-publish --fields 'dependencies,publishConfig' && cp ../../README.md ../../LICENSE ./package", + "postpublish": "rm -rf ./package", "pkg:mac": "NODE_ENV=production pkg . --no-bytecode --public-packages '*' --public --targets node18-macos-x64,node18-macos-arm64 -o dist/bin/dolphin-macos", "pkg:mac:compressed": "NODE_ENV=production pkg . --no-bytecode --public-packages '*' --public --targets node18-macos-x64,node18-macos-arm64 --compress Brotli -o dist/bin/dolphin-macos" }, + "keywords": [ + "i18n", + "internationalization", + "localization", + "l10n", + "ai", + "artificial intelligence", + "translation", + "nlp", + "dolphin" + ], "dependencies": { "@repo/base": "workspace:*", "@repo/ioloc": "workspace:*", diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.ts index ddf381d..6ea6106 100644 --- a/apps/cli/src/index.ts +++ b/apps/cli/src/index.ts @@ -1,6 +1,7 @@ import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; +import { version } from '../package.json'; import { commands } from './commands/index.js'; // process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '1' @@ -9,7 +10,7 @@ import { commands } from './commands/index.js'; const parser = yargs(hideBin(process.argv)) .command(commands) - .version('0.1.0') + .version(version) .help() .alias('help', 'h'); diff --git a/package.json b/package.json index 35ab6b8..b48b899 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,7 @@ { - "name": "@icodesign/dolphin", - "version": "0.1.0", + "name": "dolphin", "private": true, "description": "Dolphin is an innovative, automated internationalization (i18n) service designed to integrate seamlessly into your development pipeline.", - "keywords": [ - "i18n", - "internationalization", - "localization", - "l10n", - "ai", - "artificial intelligence", - "translation", - "nlp", - "dolphin" - ], "author": "Lance Wang (icodesign)", "license": "MIT", "repository": { @@ -21,7 +9,8 @@ "url": "https://github.com/icodesign/dolphin" }, "scripts": { - "ci:publish": "pnpm publish -r" + "ci:version": "pnpm changeset version", + "ci:publish": "pnpm publish -r --access public" }, "dependencies": { "typescript": "^5.5.0" @@ -29,6 +18,7 @@ "devDependencies": { "@changesets/cli": "^2.27.7", "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "clean-publish": "^5.0.0", "prettier": "^3.3.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7d77ea1..a8cfc6f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,6 +18,9 @@ importers: '@trivago/prettier-plugin-sort-imports': specifier: ^4.3.0 version: 4.3.0(@vue/compiler-sfc@3.3.11)(prettier@3.3.3) + clean-publish: + specifier: ^5.0.0 + version: 5.0.0 prettier: specifier: ^3.3.0 version: 3.3.3 @@ -1779,6 +1782,11 @@ packages: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + clean-publish@5.0.0: + resolution: {integrity: sha512-1qjtqP3piZL4t8SqGojOyA12bg8AtbFPIQstNvxmss1fhwfma3CqMJ/Y/kbRvAllLX2/c4ZKjcCCKDqEtpcymA==} + engines: {node: '>= 18.0.0'} + hasBin: true + clean-regexp@1.0.0: resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} engines: {node: '>=4'} @@ -3241,6 +3249,10 @@ packages: resolution: {integrity: sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==} engines: {node: '>=14'} + lilconfig@3.1.2: + resolution: {integrity: sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==} + engines: {node: '>=14'} + lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} @@ -6704,6 +6716,13 @@ snapshots: ci-info@3.9.0: {} + clean-publish@5.0.0: + dependencies: + cross-spawn: 7.0.3 + fast-glob: 3.3.2 + lilconfig: 3.1.2 + micromatch: 4.0.5 + clean-regexp@1.0.0: dependencies: escape-string-regexp: 1.0.5 @@ -8145,6 +8164,8 @@ snapshots: lilconfig@3.0.0: {} + lilconfig@3.1.2: {} + lines-and-columns@1.2.4: {} load-tsconfig@0.2.5: {}