From 707de8a92291f83e9ad1babd9430bc123a764d6c Mon Sep 17 00:00:00 2001 From: linbudu599 Date: Thu, 24 Mar 2022 16:31:26 +0800 Subject: [PATCH] feat: fail fast when no packages found --- packages/apollo-element-starter/package.json | 32 ++++++++++---------- packages/apollo-server-starter/package.json | 10 +++--- packages/astro-docs-starter/package.json | 4 +-- packages/cra-ts/package.json | 6 ++-- scripts/cache-package.ts | 5 +++ scripts/init-workspace.ts | 5 +++ 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/packages/apollo-element-starter/package.json b/packages/apollo-element-starter/package.json index d645a40..4f288b8 100644 --- a/packages/apollo-element-starter/package.json +++ b/packages/apollo-element-starter/package.json @@ -18,34 +18,34 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "@apollo-elements/components": "^2.0.0", - "@apollo-elements/core": "^1.0.0", - "@apollo/client": "^3.5.4", - "graphql": "^15.0.0", - "lit": "^2.1.1", - "lit-element": "^3.1.1", + "@apollo-elements/components": "^3.0.1", + "@apollo-elements/core": "^2.1.0", + "@apollo/client": "^3.5.10", + "graphql": "^16.3.0", + "lit": "^2.2.1", + "lit-element": "^3.2.0", "pwa-helpers": "^0.9.1", "tslib": "^2.3.1" }, "devDependencies": { - "@apollo-elements/create": "^3.0.3", - "@graphql-codegen/cli": "^2.3.0", + "@apollo-elements/create": "^4.0.2", + "@graphql-codegen/cli": "^2.6.2", "@graphql-codegen/introspection": "^2.1.1", - "@graphql-codegen/near-operation-file-preset": "^2.2.2", - "@graphql-codegen/typed-document-node": "^2.2.1", - "@graphql-codegen/typescript": "^2.4.1", - "@graphql-codegen/typescript-operations": "^2.2.1", + "@graphql-codegen/near-operation-file-preset": "^2.2.9", + "@graphql-codegen/typed-document-node": "^2.2.8", + "@graphql-codegen/typescript": "^2.4.8", + "@graphql-codegen/typescript-operations": "^2.3.5", "@open-wc/rollup-plugin-html": "^1.x", "@pwrs/eslint-config": "^0.x", - "@rollup/plugin-commonjs": "^17.x", - "@rollup/plugin-node-resolve": "^11.x", + "@rollup/plugin-commonjs": "^21.x", + "@rollup/plugin-node-resolve": "^13.x", "@web/dev-server": "^0.1.x", "@web/dev-server-esbuild": "^0.2.x", "@web/dev-server-rollup": "^0.3.x", "npm-run-all": "^4.x", "rollup": "^2.x", - "rollup-plugin-esbuild": "^2.x", - "rollup-plugin-lit-css": "^2.x", + "rollup-plugin-esbuild": "^4.x", + "rollup-plugin-lit-css": "^3.x", "typescript": "^4.x" }, "keywords": [] diff --git a/packages/apollo-server-starter/package.json b/packages/apollo-server-starter/package.json index c09baf7..21b6080 100644 --- a/packages/apollo-server-starter/package.json +++ b/packages/apollo-server-starter/package.json @@ -12,11 +12,11 @@ }, "dependencies": { "apollo-graphql": "^0.9.5", - "apollo-server": "^3.6.4", - "apollo-server-core": "^3.6.4", - "chalk": "4.0.0", + "apollo-server": "^3.6.5", + "apollo-server-core": "^3.6.5", + "chalk": "5.0.1", "class-validator": "^0.13.2", - "graphql": "^15.3.0", + "graphql": "^16.3.0", "graphql-subscriptions": "^2.0.0", "nexus": "^1.3.0", "nexus-plugin-prisma": "^0.35.0", @@ -24,6 +24,6 @@ "type-graphql": "^1.1.1" }, "resolutions": { - "graphql": "^15.3.0" + "graphql": "^16.3.0" } } diff --git a/packages/astro-docs-starter/package.json b/packages/astro-docs-starter/package.json index 3994e9c..a04aef4 100644 --- a/packages/astro-docs-starter/package.json +++ b/packages/astro-docs-starter/package.json @@ -12,13 +12,13 @@ "@algolia/client-search": "^4.13.0", "@docsearch/css": "^3.0.0", "@docsearch/react": "^3.0.0", - "@types/react": "^17.0.40", + "@types/react": "^17.0.42", "react": "^17.0.2", "react-dom": "^17.0.2" }, "devDependencies": { "@astrojs/renderer-preact": "^0.5.0", "@astrojs/renderer-react": "^0.5.0", - "astro": "^0.24.2" + "astro": "^0.24.3" } } diff --git a/packages/cra-ts/package.json b/packages/cra-ts/package.json index ed33365..b5e3a04 100644 --- a/packages/cra-ts/package.json +++ b/packages/cra-ts/package.json @@ -7,9 +7,9 @@ "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", "@types/jest": "^27.4.1", - "@types/node": "^16.11.26", - "@types/react": "^17.0.40", - "@types/react-dom": "^17.0.13", + "@types/node": "^17.0.23", + "@types/react": "^17.0.42", + "@types/react-dom": "^17.0.14", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "5.0.0", diff --git a/scripts/cache-package.ts b/scripts/cache-package.ts index 5946b25..d104743 100644 --- a/scripts/cache-package.ts +++ b/scripts/cache-package.ts @@ -14,6 +14,11 @@ export default function useCachePackage(cli: CAC) { fs.ensureDirSync(CLIUtils.resolvedPackageRootDir); const existPackages = CLIUtils.existPackages; + if (!existPackages.length) { + consola.warn('No package found in current workspace, exit.'); + process.exit(0); + } + for (const p of existPackages) { const projectSrcPath = CLIUtils.resolvePackageDir(p); const projectDestPath = CLIUtils.resolveCachePackageDir(p); diff --git a/scripts/init-workspace.ts b/scripts/init-workspace.ts index 2922550..ec14381 100644 --- a/scripts/init-workspace.ts +++ b/scripts/init-workspace.ts @@ -12,6 +12,11 @@ export default function useInitWorkspaceAfterInstall(cli: CAC) { .action(async () => { const existPackages = CLIUtils.existPackages; + if (!existPackages.length) { + consola.warn('No package found in current workspace, exit.'); + process.exit(0); + } + const chosedStarters = await CLIUtils.createPackageMultiSelector( 'chosedStarters', 'Pick starters to initialize workspace'