Skip to content

Commit 6c5a72e

Browse files
authored
refactor(package.json): refactor scripts for convenience pnpm workflow (#501)
* refactor(package.json): add scripts for convenience pnpm workflow Tried to mimic Qwik package convention with the "." notation * fix(pnpm link.dist): fix cd * chore(package.json): remove not yet used dependencies
1 parent 76c442a commit 6c5a72e

File tree

4 files changed

+67
-90
lines changed

4 files changed

+67
-90
lines changed

.github/actions/test/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
- name: Run Cypress component tests
3434
uses: cypress-io/github-action@v5
3535
with:
36-
command: 'pnpm test:headless:ci'
36+
command: 'pnpm test.headless.ci'
3737

3838
# - name: Publish to Chromatic
3939
# uses: chromaui/action@v1

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
pnpm run format:fix
4+
pnpm run format.fix

CONTRIBUTING.md

Lines changed: 47 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
11
# Contribution Guidelines
22

33
We would love for you to contribute to this project.
4-
As a contributor, here are the guidelines we would like you to follow:
4+
As a contributor, here are the guidelines we would like you to follow 👇
55

6-
## Be Kind - Code of Conduct
6+
### Be Kind - Code of Conduct
77

8-
Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md) to help us keep this project open and inclusive.
8+
Please, read and follow our [Code of Conduct](CODE_OF_CONDUCT.md) to help us keep this project open and inclusive.
99

10-
<br/>
11-
12-
## Found a bug? Want a feature? - Submit an Issue
10+
### Found a bug? Want a feature? - Submit an Issue
1311

1412
[Choose an issue template](https://github.com/qwikifiers/qwik-ui/issues/new/choose) to file a bug report / feature request.
1513

16-
<br/>
17-
1814
## Ready to contribute a Pull Request (PR)?
1915

20-
<br/>
16+
### 1. Make sure you aren't duplicating someone else's efforts.
2117

22-
### ▶ 1. First - [Search this repo for existing PRs](https://github.com/qwikifiers/qwik-ui/pulls) !
18+
- [Look out for existing PRs](https://github.com/qwikifiers/qwik-ui/pulls)
2319

24-
Try to find an open or closed PR that relates to the change you want to introduce.
20+
### 2. Make sure your idea is the right way to solve the issue.
2521

26-
<br/>
22+
[Look out for existing issues](https://github.com/qwikifiers/qwik-ui/issues) that may describe the problem you're fixing, or document the design for the feature you'd like to add.
2723

28-
### ▶ 2. **Before you start coding - [find](https://github.com/qwikifiers/qwik-ui/issues) / [create an issue](https://github.com/qwikifiers/qwik-ui/issues/new/choose)**
24+
Please, consider [creating an issue](https://github.com/qwikifiers/qwik-ui/issues/new) if you can't find anything.
2925

30-
**Make sure there's an issue** describing the problem you're fixing, or documents the design for the feature you'd like to add.
3126
Discussing the design up front helps to ensure that we're ready to accept your work.
3227

33-
**Don't waste your time working on code before you got a 👍 in an issue comment.**
34-
35-
<br/>
28+
### 3. Fork this repo and create a branch.
3629

37-
### ▶ 3. Fork this repo and create a branch.
38-
39-
- Hit that "Fork" button above (in this repo's GitHub page).
30+
- Hit the "Fork" button (top-right of the github repository).
4031

4132
![image](https://user-images.githubusercontent.com/1430726/95460679-ec014400-097d-11eb-9a7a-93e0262d37d9.png)
4233

@@ -56,119 +47,109 @@ Get your URL by from here 👇
5647
git checkout -b my-fix-branch main
5748
```
5849

59-
<br/>
60-
61-
### ▶ 4. Run the library
50+
### 4. Run the library
6251

63-
- From the root of the project run the following command:
52+
- From the root of the project run the install script:
6453

6554
```shell
6655
pnpm install
6756
```
6857

69-
- Download [Nx](https://nx.dev/):
70-
71-
```shell
72-
pnpm install --global nx@latest
73-
```
74-
75-
- Then run this command to get the qwik-ui documentation site in dev mode:
58+
- Then run the dev script to get the qwik-ui documentation site in dev mode:
7659

7760
```shell
78-
pnpm website
61+
pnpm dev
7962
```
8063

8164
- Visit the URL printed in the console and you'll have a page opened with the suite of widgets.
8265

83-
- Once you made some changes in either package (`headless`, `tailwind` or `material`), you will see them immediately reflected on the page.
66+
- Once you made some changes in either package (`headless` or `fluffy`) or the documentation website (`apps/website`), you will see them immediately reflected on the page.
8467

8568
Below is a list of other commands that you might find useful:
8669

8770
- Build the qwik-ui documentation:
8871

8972
```shell
90-
nx build website
73+
pnpm build
9174
```
9275

9376
- Preview of the qwik-ui documentation (no HMR):
9477

9578
```shell
96-
nx preview website
79+
pnpm preview
9780
```
9881

9982
- Build the Cloudfare version of the qwik-ui documentation
10083

10184
```shell
102-
nx build-cloudfare website
85+
pnpm build.clouflare
10386
```
10487

10588
- Preview the Cloudfare build of the qwik-ui documentation (no HMR)
10689

10790
```shell
108-
nx preview-cloudflare website
91+
pnpm preview.clouflare
10992
```
11093

111-
### 5. Make sure you add / modify tests
94+
### 5. Make sure you add / modify tests
11295

11396
Run either command to make sure there aren't any errors.
11497

11598
```shell
116-
nx component-test headless --skip-nx-cache
99+
pnpm test.headless --skip-nx-cache
117100
```
118101

119-
Or
102+
This will set up the Cypress component testing GUI. Please refer to official Cypress [documentation](https://docs.cypress.io/guides/overview/why-cypress) for further assistance.
103+
104+
### 6. Commit your changes using commitizen:
105+
106+
Instead of `git commit` use the following command:
120107

121108
```shell
122-
pnpm run test:headless --skip-nx-cache
109+
pnpm commit
123110
```
124111

125-
Both commands will set up the Cypress component testing GUI, so you are free to chose which syntax you prefer. Please refer to official Cypress [documentation](https://docs.cypress.io/guides/overview/why-cypress) for further assistance.
126-
<br/>
112+
Or if you prefer to keep your git workflow, you can install commitizen globally:
127113

128-
### ▶ 6. Commit your changes using commitizen:
114+
```shell
115+
pnpm install -g commitizen
116+
```
129117

130-
Instead of `git commit` use the following command:
118+
And run it with:
131119

132120
```shell
133-
pnpm run commit
121+
git cz
134122
```
135123

136124
It will then ask you a bunch of questions.
137125

138126
This will create a descriptive commit message that follows the
139127
[Angular commit message convention](#commit-message-format).
140128

141-
This is necessary to generate meaningful release notes / CHANGELOG automatically.
129+
This allows us to keep meaningful release notes / CHANGELOG automatically.
142130

143-
<br/>
144-
### ▶ 7. Push your branch to GitHub:
131+
### 7. Push your branch to GitHub:
145132

146133
```shell
147134
git push origin my-fix-branch
148135
```
149136

150-
### 8. Create a PR
137+
### 8. Create a PR
151138

152139
In GitHub, create a pull request for `qwikifiers/qwik-ui:main`.
153140

154141
Make sure you check the following checkbox "Allow edits from maintainers" -
155142

156143
![image](https://user-images.githubusercontent.com/1430726/95461503-fbcd5800-097e-11eb-9b55-321d1ff0e6bb.png)
157144

158-
If you need to update your PR for some reason -
145+
#### If you need to update your PR for some reason
159146

160147
- Make the required updates.
161148

162149
- Re-run the tests to ensure tests are still passing:
163150

164151
```shell
165-
nx component-test headless --skip-nx-cache
166-
```
167-
168-
Or
169-
170-
```shell
171-
pnpm run test:headless --skip-nx-cache
152+
pnpm test.headless --skip-nx-cache
172153
```
173154

174155
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
@@ -178,9 +159,7 @@ pnpm run test:headless --skip-nx-cache
178159
git push -f
179160
```
180161

181-
<br/>
182-
183-
### ▶ 9. Sign the CLA
162+
### 9. Sign the CLA
184163

185164
You will be asked to sign a [CLA (Contributor License Agreement)](/CLA.md) as part of the PR process, if you haven't already signed it.
186165

@@ -192,9 +171,7 @@ I have read the CLA Document and I hereby sign the CLA
192171

193172
The CLA assistant will automatically add your signature [here](/cla-signs/v1/cla.json) and push a commit to the main branch.
194173

195-
<br/>
196-
197-
### ▶ 10. After your PR is merged - delete your branches
174+
### 10. After your PR is merged - delete your branches
198175

199176
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
200177

@@ -222,31 +199,27 @@ After your pull request is merged, you can safely delete your branch and pull th
222199
git pull --ff upstream main
223200
```
224201

225-
<br/>
226-
227-
### ▶ 11. That's it! Thank you for your contribution! 🙏💓
202+
### 11. That's it! Thank you for your contribution! 🙏💓
228203

229204
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
230205

231-
<br/>
232-
233206
## Running in your own app
234207

235208
Sometimes you may not face an issue after running the build process, but your consumer app still might.
236209

237-
When that is the case, you can use `pnpm link` to link your own app to your forked version of qwik-ui.
210+
When that is the case, you can use npm linking to link your own app to your forked version of qwik-ui.
238211

239-
### 1. Link your fork
212+
### 1. Link your fork
240213

241-
Inside the root of your `qwik-ui` branch run:
214+
Inside the root of **your qwik-ui branch** run:
242215

243216
```
244217
pnpm link.dist
245218
```
246219

247-
### 2. Link your app
220+
### 2. Link your app
248221

249-
Inside the root of your project run:
222+
Inside the root of **your project** run:
250223

251224
```
252225
pnpm install

package.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,22 @@
88
"private": false,
99
"type": "module",
1010
"scripts": {
11-
"build:headless": "nx build headless",
1211
"commit": "git-cz",
13-
"format:fix": "pretty-quick --staged",
14-
"link.dist": "cd packages/kit-headless/dist && pnpm link --global",
12+
"format.fix": "pretty-quick --staged",
13+
"link.dist": "cd dist/packages/kit-headless && pnpm link --global",
1514
"lint": "nx affected:lint",
16-
"local:npm": "nx local-registry",
15+
"local.npm": "nx local-registry",
1716
"prepare": "husky install",
18-
"story:build:headless": "nx build-storybook headless",
19-
"story:headless": "nx storybook headless",
20-
"test:headless": "nx component-test headless",
21-
"test:headless:ci": "nx component-test-ci headless",
22-
"website": "nx serve website"
17+
"story.build.headless": "nx build-storybook headless",
18+
"story.headless": "nx storybook headless",
19+
"test.headless": "nx component-test headless",
20+
"test.headless.ci": "nx component-test-ci headless",
21+
"build": "nx build website",
22+
"build.cloudflare": "nx build-cloudflare website",
23+
"build.headless": "nx build headless",
24+
"dev": "nx serve website",
25+
"preview": "nx preview website",
26+
"preview.cloudflare": "nx preview-cloudflare website"
2327
},
2428
"packageManager": "[email protected]",
2529
"devDependencies": {
@@ -118,6 +122,11 @@
118122
"vitest": "^0.34.3",
119123
"wrangler": "^3.11.0"
120124
},
125+
"dependencies": {
126+
"@fontsource-variable/inter": "5.0.8",
127+
"shiki": "0.14.5",
128+
"tslib": "^2.6.2"
129+
},
121130
"config": {
122131
"commitizen": {
123132
"path": "./node_modules/cz-conventional-changelog"
@@ -128,11 +137,6 @@
128137
"qwik ui components",
129138
"components library"
130139
],
131-
"dependencies": {
132-
"@fontsource-variable/inter": "5.0.8",
133-
"shiki": "0.14.5",
134-
"tslib": "^2.6.2"
135-
},
136140
"nx": {
137141
"includedScripts": []
138142
}

0 commit comments

Comments
 (0)