Skip to content

Commit 562ca2c

Browse files
committed
feat(packpage): add prettier to format code
1 parent f1deff9 commit 562ca2c

File tree

8 files changed

+311
-38
lines changed

8 files changed

+311
-38
lines changed

.huskyrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "pretty-quick --staged --pattern \"**/*.*(json|js|ts|yml|md)\"",
4+
}
5+
}

.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const config = require('@boringcodes/prettier-config');
2+
3+
module.exports = config;

CHANGELOG.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,41 @@ All notable changes to this project will be documented in this file. See [standa
44

55
## [1.1.0](https://github.com/boringcodes/create-package/compare/v1.0.4...v1.1.0) (2020-03-23)
66

7-
87
### Features
98

10-
* **close #12:** add github workflows to template ([#13](https://github.com/boringcodes/create-package/issues/13)) ([e6912ed](https://github.com/boringcodes/create-package/commit/e6912ed200f4758a9e4f70dd2c2385121433f152)), closes [#12](https://github.com/boringcodes/create-package/issues/12)
11-
9+
- **close #12:** add github workflows to template ([#13](https://github.com/boringcodes/create-package/issues/13)) ([e6912ed](https://github.com/boringcodes/create-package/commit/e6912ed200f4758a9e4f70dd2c2385121433f152)), closes [#12](https://github.com/boringcodes/create-package/issues/12)
1210

1311
### Bug Fixes
1412

15-
* **close #12:** .github dir does not get copied ([5a3123b](https://github.com/boringcodes/create-package/commit/5a3123b90ef461ee1dd94c410bbfd7af1bb40605)), closes [#12](https://github.com/boringcodes/create-package/issues/12)
13+
- **close #12:** .github dir does not get copied ([5a3123b](https://github.com/boringcodes/create-package/commit/5a3123b90ef461ee1dd94c410bbfd7af1bb40605)), closes [#12](https://github.com/boringcodes/create-package/issues/12)
1614

1715
### [1.0.4](https://github.com/boringcodes/create-package/compare/v1.0.3...v1.0.4) (2020-03-23)
1816

1917
### [1.0.3](https://github.com/boringcodes/create-package/compare/v1.0.2...v1.0.3) (2020-03-23)
2018

2119
### [1.0.2](https://github.com/boringcodes/create-package/compare/v1.0.1...v1.0.2) (2020-03-22)
2220

23-
2421
### Bug Fixes
2522

26-
* **close #10:** missing dotfiles in the output ([#11](https://github.com/boringcodes/create-package/issues/11)) ([0855a35](https://github.com/boringcodes/create-package/commit/0855a354f75087722e09e20d80612f9ac435e742)), closes [#10](https://github.com/boringcodes/create-package/issues/10)
23+
- **close #10:** missing dotfiles in the output ([#11](https://github.com/boringcodes/create-package/issues/11)) ([0855a35](https://github.com/boringcodes/create-package/commit/0855a354f75087722e09e20d80612f9ac435e742)), closes [#10](https://github.com/boringcodes/create-package/issues/10)
2724

2825
### [1.0.1](https://github.com/boringcodes/create-package/compare/v1.0.0...v1.0.1) (2020-03-22)
2926

3027
## [1.0.0](https://github.com/boringcodes/create-package/compare/v0.1.3...v1.0.0) (2020-03-22)
3128

3229
### [0.1.3](https://github.com/boringcodes/create-package/compare/v0.1.2...v0.1.3) (2020-03-22)
3330

34-
3531
### Bug Fixes
3632

37-
* **close #6:** rename to generator-create-package to solve yo does not support scoped package ([#7](https://github.com/boringcodes/create-package/issues/7)) ([8f42b5f](https://github.com/boringcodes/create-package/commit/8f42b5fe189025a1ab4137b3f58ce949cc26c32d)), closes [#6](https://github.com/boringcodes/create-package/issues/6)
33+
- **close #6:** rename to generator-create-package to solve yo does not support scoped package ([#7](https://github.com/boringcodes/create-package/issues/7)) ([8f42b5f](https://github.com/boringcodes/create-package/commit/8f42b5fe189025a1ab4137b3f58ce949cc26c32d)), closes [#6](https://github.com/boringcodes/create-package/issues/6)
3834

3935
### [0.1.2](https://github.com/boringcodes/create-package/compare/v0.1.1...v0.1.2) (2020-03-21)
4036

4137
### [0.1.1](https://github.com/boringcodes/create-package/compare/v0.1.0...v0.1.1) (2020-02-28)
4238

4339
## 0.1.0 (2020-02-28)
4440

45-
4641
### Features
4742

48-
* **#4:** integrate github actions ci ([#5](https://github.com/boringcodes/create-package/issues/5)) ([4a139ec](https://github.com/boringcodes/create-package/commit/4a139ec7d926033d3d093f0ffacd92b36e6a15cb)), closes [#4](https://github.com/boringcodes/create-package/issues/4)
49-
* **close #1:** Init source ([#2](https://github.com/boringcodes/create-package/issues/2)) ([42e2d73](https://github.com/boringcodes/create-package/commit/42e2d7300d72283b99f3131de96cef5c666e1250)), closes [#1](https://github.com/boringcodes/create-package/issues/1) [#1](https://github.com/boringcodes/create-package/issues/1) [#1](https://github.com/boringcodes/create-package/issues/1)
43+
- **#4:** integrate github actions ci ([#5](https://github.com/boringcodes/create-package/issues/5)) ([4a139ec](https://github.com/boringcodes/create-package/commit/4a139ec7d926033d3d093f0ffacd92b36e6a15cb)), closes [#4](https://github.com/boringcodes/create-package/issues/4)
44+
- **close #1:** Init source ([#2](https://github.com/boringcodes/create-package/issues/2)) ([42e2d73](https://github.com/boringcodes/create-package/commit/42e2d7300d72283b99f3131de96cef5c666e1250)), closes [#1](https://github.com/boringcodes/create-package/issues/1) [#1](https://github.com/boringcodes/create-package/issues/1) [#1](https://github.com/boringcodes/create-package/issues/1)

generators/app/templates/rollup.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ const common = {
1414
plugins: [
1515
resolve(),
1616
commonjs(),
17-
typescript({ useTsconfigDeclarationDir: true, rollupCommonJSResolveHack: true }),
17+
typescript({
18+
useTsconfigDeclarationDir: true,
19+
rollupCommonJSResolveHack: true,
20+
}),
1821
async(),
1922
sourceMaps(),
2023
],
2124
};
2225

2326
export default [
24-
// package-name
2527
{
2628
...common,
2729
input: 'src/index.ts',
@@ -32,5 +34,5 @@ export default [
3234
sourcemap: true,
3335
},
3436
],
35-
}
37+
},
3638
];

generators/app/templates/tsconfig.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"moduleResolution": "node",
44
"target": "es5",
5-
"module":"esNext",
5+
"module": "esNext",
66
"lib": ["es2015", "es2016", "es2017", "dom"],
77
"strict": true,
88
"sourceMap": true,
@@ -12,16 +12,8 @@
1212
"emitDecoratorMetadata": true,
1313
"outDir": "dist",
1414
"declarationDir": "dist",
15-
"typeRoots": [
16-
"node_modules/@types"
17-
]
15+
"typeRoots": ["node_modules/@types"]
1816
},
19-
"include": [
20-
"src"
21-
],
22-
"exclude": [
23-
"node_modules",
24-
"dist",
25-
"**/*.js"
26-
]
17+
"include": ["src"],
18+
"exclude": ["node_modules", "dist", "**/*.js"]
2719
}
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
{
22
"enable": true,
3-
"extends": [
4-
"tslint-config-airbnb",
5-
"tslint-immutable",
6-
"tslint-sonarts"
7-
],
3+
"extends": ["tslint-config-airbnb", "tslint-immutable", "tslint-sonarts"],
84
"linterOptions": {
9-
"exclude": [
10-
"node_modules",
11-
"dist",
12-
"**/*.js"
13-
]
5+
"exclude": ["node_modules", "dist", "**/*.js"]
146
}
157
}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
],
1414
"scripts": {
1515
"purge": "rm -rf node_modules",
16+
"format": "prettier --write \"**/*.*(json|js|ts|yml|md)\"",
17+
"format:check": "prettier --check \"**/*.*(json|js|ts|yml|md)\"",
1618
"release": "standard-version --no-verify",
1719
"release:major": "yarn release --release-as major",
1820
"release:minor": "yarn release --release-as minor",
@@ -28,6 +30,10 @@
2830
"yosay": "^2.0.2"
2931
},
3032
"devDependencies": {
33+
"@boringcodes/prettier-config": "^1.0.0",
34+
"husky": "^4.2.3",
35+
"prettier": "^2.0.2",
36+
"pretty-quick": "^2.0.1",
3137
"standard-version": "^7.1.0"
3238
}
3339
}

0 commit comments

Comments
 (0)