From 7e5dba27714cc8b03c144320d7cdb74c6968a40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= Date: Sun, 15 Sep 2024 22:05:25 +0800 Subject: [PATCH] fix: postinstall --- .github/workflows/release-please.yml | 2 +- package.json | 5 +++-- src/cli/init.ts | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 8e06804..08128a4 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -42,7 +42,7 @@ jobs: - run: npm install -g pnpm if: ${{ steps.release.outputs.release_created }} # 安装依赖 不安装对等依赖 - - run: pnpm install --config.auto-install-peers=false + - run: pnpm install --config.auto-install-peers=false --ignore-scripts env: NODE_AUTH_TOKEN: ${{ secrets.RELEASE }} if: ${{ steps.release.outputs.release_created }} diff --git a/package.json b/package.json index 51df007..d04883f 100644 --- a/package.json +++ b/package.json @@ -123,10 +123,11 @@ "dev": "node lib/cli/start.js dev", "fix": "eslint lib/**/*.js --fix", "fix:all": "eslint lib/**/*.js --fix && eslint lib/**/*.d.ts --fix", + "init": "node lib/cli/init.js", + "postinstall": "npm run init", "pub": "npm publish --access public", "sort": "npx sort-package-json && sort-json tsconfig.json", - "start": "node lib/cli/start.js start", - "postinstall": "node lib/cli/init.js" + "start": "node lib/cli/start.js start" }, "dependencies": { "@types/express": "^4.17.21", diff --git a/src/cli/init.ts b/src/cli/init.ts index afb57e6..edbc305 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -2,6 +2,7 @@ import { getRegistry } from './pkg' import { KarinCfgInit } from '../core/init/config' +import { isPkg } from 'karin/core/init/dir' /** * 休眠函数 @@ -12,6 +13,7 @@ function sleep (ms: number) { } async function main () { + if (!isPkg) return /** 捕获错误 打印日志 */ process.on('uncaughtException', err => console.error(err)) process.on('unhandledRejection', err => console.error(err))