Skip to content

Commit 7ba9a5b

Browse files
authored
refactor: pin version & copy scripts (#377)
* refactor: pin version & deprecate prettier * refactor: copy changeset files copy changeset files prevent init pending process * feat: add yaml into lint-staged * 🐛 (neo) support config cz-emoji * 🍱 add husky post-merge script * ⬆️ eslint-config * ♻️ copy husky script instead of init it * 📌 pnpm version * 🐛 copy patterns
1 parent 1f2e59f commit 7ba9a5b

File tree

11 files changed

+105
-31
lines changed

11 files changed

+105
-31
lines changed

.changeset/brave-bananas-work.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@aiou/generator-pnpm-ci": minor
3+
---
4+
5+
not use latest version package & upgrade eslint

.changeset/khaki-months-nail.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@aiou/generator-pnpm-ci": patch
3+
---
4+
5+
copy changeset assets

.changeset/witty-insects-rush.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@aiou/generator-pnpm-ci": minor
3+
---
4+
5+
add yaml files into lint-staged

packages/generators/pnpm-ci/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ prepack follow parts into your project
1313
- `release.yml` - publish package with `changeset`
1414
- `snapshot-release.yml` - publish prerelease package with `changeset`
1515
- `.husky & lint-staged` - lint-staged precommit with eslint config [@aiou/eslint-config](https://github.com/JiangWeixian/eslint-config)
16+
- `cz-emoji` - support `git-cz` with [cz-emoji](https://github.com/ngryman/cz-emoji#readme).
1617
- `ISSUE_TEMPLATE & PR_REQUEST_TEMPLATE` - see [here](https://github.com/neo-hack/neo/tree/master/packages/core/assets/templates) for more details
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"linked": [],
6+
"access": "public",
7+
"baseBranch": "master",
8+
"updateInternalDependencies": "patch",
9+
"ignore": []
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"path": "node_modules/cz-emoji"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm lint-staged
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
check_run() {
5+
if [ $(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep -c "package.json") -gt 0 ]
6+
then
7+
pnpm install
8+
fi
9+
}
10+
11+
check_run
+51-24
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
jobs:
2-
Issue template:
2+
issue template:
33
name: Setup github issue templates
44
paths: .neo/**/assets/templates/ISSUE_TEMPLATE/*.md
55
steps:
66
- name: Issue templates
77
uses: copy
88
with:
99
output: .github/ISSUE_TEMPLATE
10-
PR template:
10+
pr template:
1111
name: Setup github pr templates
1212
paths: .neo/**/assets/templates/*.md
1313
steps:
1414
- name: PR templates
1515
uses: copy
1616
with:
1717
output: .github
18-
CI:
19-
name: Setup ci workflow
18+
workflows:
19+
name: Setup workflow
2020
paths: .neo/**/assets/workflows/*
2121
steps:
2222
- name: CI Workflows
2323
uses: copy
2424
with:
2525
output: .github/workflows
26-
Lint:
26+
lint:
2727
name: Setup eslint
2828
paths: .neo/**/assets/eslint/.*
2929
steps:
3030
- name: ESLint
3131
uses: copy
3232

33-
Setup Pkg:
33+
setup package:
3434
paths: package.json
3535
name: Setup lint config
3636
steps:
@@ -52,57 +52,84 @@ jobs:
5252
pairs:
5353
- path: "lint-staged"
5454
value:
55-
"**/**/*.{js,ts,tsx,vue,json}": ["eslint --fix"]
55+
"**/**/*.{js,ts,tsx,vue,json,yml,yaml}": ["eslint --fix"]
5656

5757
- name: Add lint pkgs
5858
uses: json-editor
5959
with:
6060
pairs:
6161
- path: "devDependencies.typescript"
62-
value: "^4"
62+
value: "^4.6.4"
6363
- path: "devDependencies.eslint"
64-
value: "^8"
65-
- path: "devDependencies.prettier"
66-
value: "latest"
64+
value: "^8.32.0"
6765
- path: "devDependencies.@aiou/eslint-config"
68-
value: "latest"
66+
value: "^0.10.0"
6967
- path: "devDependencies.lint-staged"
70-
value: "latest"
68+
value: "^13.1.0"
7169

7270
- name: Add changeset
7371
uses: json-editor
7472
with:
7573
pairs:
7674
- path: "devDependencies.@changesets/cli"
77-
value: "latest"
75+
value: "^2.26.0"
7876

7977
- name: Add husky
8078
uses: json-editor
8179
with:
8280
pairs:
8381
- path: "devDependencies.husky"
84-
value: "latest"
82+
value: "^8.0.3"
8583

8684
- name: Add lint:fix
8785
uses: json-editor
8886
with:
8987
pairs:
9088
- path: "scripts.lint:fix"
9189
value: "eslint . --fix"
92-
Changeset:
90+
changeset:
9391
name: Setup Changeset
92+
paths: .neo/**/assets/changeset/*
9493
steps:
9594
- name: Setup changeset
96-
run: pnpx @changesets/cli init
95+
uses: copy
9796
with:
98-
quiet: true
97+
output: .changeset
9998

100-
Precommit:
101-
paths: .git
102-
name: Setup precommit
99+
husky:
100+
paths: .neo/**/assets/husky/**
101+
name: Copy husky scripts
103102
steps:
104103
- name: Setup Husky
105-
run: pnpx husky-init --yes
106-
continue-on-error: true
104+
uses: copy
105+
with:
106+
output: .husky
107+
prepare husky:
108+
paths: package.json
109+
name: Prepare husky script
110+
steps:
111+
- name: Add husky prepare scripts
112+
uses: json-editor
113+
with:
114+
pairs:
115+
- path: "scripts.prepare"
116+
value: "husky install"
117+
commitizen:
118+
paths: .git
119+
name: Setup Commitizen
120+
steps:
121+
- name: Add cz-emoji
122+
uses: json-editor
123+
with:
124+
pairs:
125+
- path: "devDependencies.cz-emoji"
126+
value: "^1.3.1"
127+
config commitizen:
128+
paths: .neo/**/assets/cz-emoji/.czrc
129+
name: Setup Commitizen
130+
steps:
131+
- name: Config Commitizen
132+
uses: copy
107133
with:
108-
quiet: true
134+
output: .
135+

packages/generators/pnpm-ci/package.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
{
22
"name": "@aiou/generator-pnpm-ci",
33
"version": "2.0.2",
4-
"description": "demo generator design for basic pnpm project",
5-
"keywords": [
6-
"aiou",
7-
"mario",
8-
"pnpm",
9-
"basic"
10-
],
4+
"description": "best developer practice for pnpm project",
5+
"keywords": ["aiou", "mario", "pnpm", "dx"],
116
"license": "MIT",
127
"homepage": "https://github.com/neo-hack/neo#readme",
138
"repository": {

0 commit comments

Comments
 (0)