Skip to content

Commit

Permalink
remove typescript bits from package.json generated for js projects (#…
Browse files Browse the repository at this point in the history
…1402)

(newapp)

Co-authored-by: Aleksandra <[email protected]>
  • Loading branch information
Bruce and beerose authored Sep 23, 2021
1 parent 554a91a commit f9e7d16
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/generator/src/generators/app-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {

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() {
Expand All @@ -52,6 +52,10 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
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<string, any>
| undefined
Expand Down
44 changes: 44 additions & 0 deletions packages/generator/templates/app/package.js.json
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
"typescript": "~4.3"
},
"private": true
}
}

0 comments on commit f9e7d16

Please sign in to comment.