Skip to content

Commit

Permalink
run prettier after project generation instead of generating transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandra-c committed Dec 9, 2024
1 parent 057cf41 commit d5c3af0
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 206 deletions.
10 changes: 1 addition & 9 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ import path from 'path'
import { concat, mergeLeft } from 'ramda'
import { projectNameQ, getQuestions, usePrevConfigsQ } from './questions.js'
import { checkForLatestVersion, getCurrentVersion } from '../utils.js'
import filter from 'gulp-filter'
import { prettierTransform, defaultPrettierOptions } from '../generator-transforms.js'
import { YO_RC_FILE } from './constants.js'

export default class extends Generator {
constructor(args, opts) {
super(args, { ...opts, skipRegenerate: true, ignoreWhitespace: true, force: true, skipLocalCache: false })
this.registerClientTransforms()
}

async prompting() {
Expand Down Expand Up @@ -129,6 +126,7 @@ export default class extends Generator {

this.log(chalk.greenBright(`All the dependencies will be installed shortly using "npm" package manager...`))
this.spawnCommandSync('npm install')
this.spawnCommandSync('npx prettier --write **/*.{js,jsx,ts,tsx,css,scss,md,json}')
}

end() {
Expand All @@ -140,10 +138,4 @@ export default class extends Generator {
(*^_^*)`)
)
}

registerClientTransforms() {
const fileFilter = filter(['**/*.{js, json}'], { restore: true })

this.queueTransformStream([fileFilter, prettierTransform(defaultPrettierOptions), fileFilter.restore])
}
}
2 changes: 1 addition & 1 deletion generators/app/templates/infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test:watch": "npm run test -- --watch",
"test:ci": "cross-env CI=true npm test -- --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura --coverageReporters=lcov --coverageReporters=html",
"lint": "eslint --fix --ext .js .",
"prettier": "prettier --write **/*.js",
"prettier": "prettier --write **/*.{js,jsx,ts,tsx,css,md,json}",
"prepack": "husky install",
"prisma": "npx prisma db pull && npm run prisma:format && npx prisma generate",
"prisma:format": "npx prisma-case-format --file ./prisma/schema.prisma --table-case pascal --field-case camel"
Expand Down
34 changes: 0 additions & 34 deletions generators/generator-transforms.js

This file was deleted.

160 changes: 0 additions & 160 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
"dependencies": {
"boxen": "^8.0.1",
"chalk": "^5.3.0",
"gulp-filter": "^9.0.1",
"lodash": "^4.17.21",
"path": "^0.12.7",
"ramda": "^0.30.1",
"through2": "^4.0.2",
"update-notifier": "^7.3.1",
"yeoman-generator": "^7.3.3",
"yo": "^5.0.0",
Expand Down

0 comments on commit d5c3af0

Please sign in to comment.