diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0d87909 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "pnpm-vscode-helper.extraWorkspaceScripts": ["develop"] +} diff --git a/package.json b/package.json index ec35bc1..a8cc1d9 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "docs:build": "vitepress build docs", "docs:dev": "vitepress dev docs", "docs:serve": "vitepress serve docs", - "init:dep": "pnpm install cac fs-extra ora consola execa preferred-pm type-fest chalk enquirer --workspace-root --registry=https://registry.npmmirror.com", + "init:dep": "pnpx zx scripts/zx/install-workspace-root-deps-only.mjs", "init:workspace": "pnpm init:dep && pnpm cli cache && pnpm cli init", "postinstall": "pnpm cli cache && pnpm remind", "remind": "ts-node -P scripts/tsconfig.script.json scripts/postinstall-reminder.ts" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff35fe2..39430bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,7 +19,7 @@ importers: '@types/prettier': ^2.4.4 '@types/prompts': ^2.0.14 cac: ^6.7.12 - chalk: ^4.0.0 + chalk: ^4.1.2 consola: ^2.15.3 enquirer: ^2.3.6 execa: ^5.0.0 diff --git a/scripts/zx/install-workspace-root-deps-only.mjs b/scripts/zx/install-workspace-root-deps-only.mjs new file mode 100644 index 0000000..f49ee9f --- /dev/null +++ b/scripts/zx/install-workspace-root-deps-only.mjs @@ -0,0 +1,19 @@ +#!/usr/bin/env zx + +// https://github.com/google/zx#__filename--__dirname +const content = await fs.readFile( + path.resolve(__dirname, '../../package.json'), + 'utf-8' +); + +const { devDependencies } = JSON.parse(content); + +const composed = Object.entries(devDependencies) + .reduce((prev, curr) => { + const withVersion = curr[0] + '@' + curr[1]; + prev.push(withVersion); + return prev; + }, []) + .filter((p) => !p.startsWith('@types')); + +await $`pnpm install ${composed} --workspace-root --registry=https://registry.npmmirror.com`;