diff --git a/packages/create-impala/package.json b/packages/create-impala/package.json index 66ea9be..5d072fd 100644 --- a/packages/create-impala/package.json +++ b/packages/create-impala/package.json @@ -13,6 +13,7 @@ "license": "MIT", "devDependencies": { "@clack/prompts": "^0.6.3", + "@types/node": "^18.15.7", "degit": "^2.8.4", "picocolors": "^1.0.0", "tsup": "^6.7.0" diff --git a/packages/create-impala/src/cli.ts b/packages/create-impala/src/cli.ts index d2ce319..ec4f887 100644 --- a/packages/create-impala/src/cli.ts +++ b/packages/create-impala/src/cli.ts @@ -1,6 +1,7 @@ import { intro, outro, spinner, text, isCancel, select } from "@clack/prompts"; import degit from "degit"; -import { existsSync } from "node:fs"; +import { existsSync, promises as fs } from "node:fs"; +import { join } from "node:path"; import color from "picocolors"; export async function createImpala() { @@ -65,5 +66,11 @@ export async function createImpala() { await emitter.clone(target); s.stop("Set up your project"); - outro(`You're all set!`); + const packageJsonPath = join(target, "package.json"); + const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8")); + packageJson.name = target.replaceAll(/[^a-zA-Z0-9-]/g, "-"); + await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2)); + outro( + `You're all set!\n\nTo get started, run:\n\n cd ${target}\n npm install\n npm run dev` + ); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea39326..2382c61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,6 +78,9 @@ importers: '@clack/prompts': specifier: ^0.6.3 version: 0.6.3 + '@types/node': + specifier: ^18.15.7 + version: 18.15.7 degit: specifier: ^2.8.4 version: 2.8.4 @@ -1171,6 +1174,7 @@ packages: glob@7.1.6: resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} + deprecated: Glob versions prior to v9 are no longer supported globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} @@ -1210,6 +1214,7 @@ packages: inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} diff --git a/templates/preact-js/package.json b/templates/preact-js/package.json index 3ebb84e..3154efa 100644 --- a/templates/preact-js/package.json +++ b/templates/preact-js/package.json @@ -1,5 +1,5 @@ { - "name": "impala-app", + "name": "@demo/impala-preact-js", "private": true, "version": "0.0.0", "type": "module", diff --git a/templates/preact-ts/package.json b/templates/preact-ts/package.json index 6425192..5b20b26 100644 --- a/templates/preact-ts/package.json +++ b/templates/preact-ts/package.json @@ -1,5 +1,5 @@ { - "name": "impala-app", + "name": "@demo/impala-preact-ts", "private": true, "version": "0.0.0", "type": "module", diff --git a/templates/react-js/package.json b/templates/react-js/package.json index 6d3ef55..556cbfa 100644 --- a/templates/react-js/package.json +++ b/templates/react-js/package.json @@ -1,5 +1,5 @@ { - "name": "impala-app", + "name": "@demo/impala-react-js", "private": true, "version": "0.0.0", "type": "module", diff --git a/templates/react-ts/package.json b/templates/react-ts/package.json index 0514140..5ed0b1e 100644 --- a/templates/react-ts/package.json +++ b/templates/react-ts/package.json @@ -1,5 +1,5 @@ { - "name": "impala-app", + "name": "@demo/impala-react-ts", "private": true, "version": "0.0.0", "type": "module",