Skip to content

Commit

Permalink
Update package names
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Dec 9, 2024
1 parent 1b1d27b commit e0faec9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/create-impala/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 9 additions & 2 deletions packages/create-impala/src/cli.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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`
);
}
5 changes: 5 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/preact-js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "impala-app",
"name": "@demo/impala-preact-js",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion templates/preact-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "impala-app",
"name": "@demo/impala-preact-ts",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion templates/react-js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "impala-app",
"name": "@demo/impala-react-js",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion templates/react-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "impala-app",
"name": "@demo/impala-react-ts",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down

0 comments on commit e0faec9

Please sign in to comment.