From f9e7d168b83f64a958088f2595aa05c9049d71e3 Mon Sep 17 00:00:00 2001 From: Bruce Date: Thu, 23 Sep 2021 10:58:02 +0200 Subject: [PATCH] remove typescript bits from package.json generated for js projects (#1402) (newapp) Co-authored-by: Aleksandra --- .../generator/src/generators/app-generator.ts | 8 +++- .../generator/templates/app/package.js.json | 44 +++++++++++++++++++ .../app/{package.json => package.ts.json} | 2 +- 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 packages/generator/templates/app/package.js.json rename packages/generator/templates/app/{package.json => package.ts.json} (99%) diff --git a/packages/generator/src/generators/app-generator.ts b/packages/generator/src/generators/app-generator.ts index 4f98334184..3127d2df49 100644 --- a/packages/generator/src/generators/app-generator.ts +++ b/packages/generator/src/generators/app-generator.ts @@ -31,9 +31,9 @@ export class AppGenerator extends Generator { filesToIgnore() { if (!this.options.useTs) { - return ["tsconfig.json", "blitz-env.d.ts", "jest.config.ts"] + return ["tsconfig.json", "blitz-env.d.ts", "jest.config.ts", "package.ts.json"] } - return ["jsconfig.json", "jest.config.js"] + return ["jsconfig.json", "jest.config.js", "package.js.json"] } async getTemplateValues() { @@ -52,6 +52,10 @@ export class AppGenerator extends Generator { async preCommit() { this.fs.move(this.destinationPath("gitignore"), this.destinationPath(".gitignore")) this.fs.move(this.destinationPath("npmrc"), this.destinationPath(".npmrc")) + this.fs.move( + this.destinationPath(this.options.useTs ? "package.ts.json" : "package.js.json"), + this.destinationPath("package.json"), + ) const pkg = this.fs.readJSON(this.destinationPath("package.json")) as | Record | undefined diff --git a/packages/generator/templates/app/package.js.json b/packages/generator/templates/app/package.js.json new file mode 100644 index 0000000000..bb11972467 --- /dev/null +++ b/packages/generator/templates/app/package.js.json @@ -0,0 +1,44 @@ +{ + "name": "__name__", + "version": "1.0.0", + "scripts": { + "dev": "blitz dev", + "build": "blitz build", + "start": "blitz start", + "studio": "blitz prisma studio", + "lint": "eslint --ignore-path .gitignore --ext .js .", + "test": "jest", + "test:watch": "jest --watch", + "prepare": "husky install" + }, + "prisma": { + "schema": "db/schema.prisma" + }, + "prettier": { + "semi": false, + "printWidth": 100 + }, + "lint-staged": { + "*.{js}": [ + "eslint --fix" + ] + }, + "dependencies": { + "@prisma/client": "2.x", + "blitz": "canary", + "react-dom": "alpha", + "react": "alpha", + "zod": "3.x" + }, + "devDependencies": { + "eslint": "7.x", + "husky": "6.x", + "lint-staged": "10.x", + "prettier-plugin-prisma": "0.x", + "prettier": "2.x", + "pretty-quick": "3.x", + "preview-email": "3.x", + "prisma": "2.x" + }, + "private": true +} \ No newline at end of file diff --git a/packages/generator/templates/app/package.json b/packages/generator/templates/app/package.ts.json similarity index 99% rename from packages/generator/templates/app/package.json rename to packages/generator/templates/app/package.ts.json index f9f44ecd35..826c70121f 100644 --- a/packages/generator/templates/app/package.json +++ b/packages/generator/templates/app/package.ts.json @@ -44,4 +44,4 @@ "typescript": "~4.3" }, "private": true -} +} \ No newline at end of file