Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 8362f79

Browse files
committed
Update CONTRIBUTING to reflec the latest changes to the deploy process
1 parent 59ae3d3 commit 8362f79

File tree

1 file changed

+82
-56
lines changed

1 file changed

+82
-56
lines changed

CONTRIBUTING.md

+82-56
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,40 @@ _Note: replace "your-username" with your GitHub handle_
1919
Install all package dependencies and link local packages:
2020

2121
```
22-
yarn bootstrap
22+
theme-scripts $ yarn bootstrap
2323
```
2424

2525
Write some features. Run the tests with:
2626

2727
```
28-
yarn test
28+
theme-scripts $ yarn test
2929
```
3030

31+
## Linking a new themes package with Lerna
32+
33+
Adding dependency to all packages
34+
35+
```
36+
theme-scripts $ yarn lerna add [package-name]
37+
```
38+
39+
Adding dependency to a specific package
40+
41+
```
42+
theme-scripts $ yarn lerna add [package-name] --scope=@shopify/theme-[name]
43+
```
44+
45+
_Note: See the [lerna documentation](https://github.com/lerna/lerna/tree/2.x#add) for more information_
46+
3147
## How to test locally
3248

3349
The following details how to setup your local environment when you wish to create a new branch of a theme script package. It uses work on a new release of `@shopify/themes-a11y` as an example.
3450

3551
### Create a link to your local package to another project
52+
3653
Navigate to the package and type [`yarn link`](https://yarnpkg.com/en/docs/cli/link).
3754

38-
``` bash
55+
```bash
3956
theme-scripts $ cd packages/themes-a11y
4057
theme-a11y $ yarn link
4158

@@ -45,27 +62,26 @@ theme-a11y $ yarn link
4562

4663
Go to a local project you want to test out the script in.
4764

48-
``` bash
65+
```bash
4966
cd ../some-path/my-theme
5067
my-theme $ yarn link "@shopify/theme-a11y"
5168

5269
# success Using linked package for "@shopify/theme-a11y".
5370
```
5471

55-
5672
### Removing a link to a package
5773

58-
To unlink your package so other local projects stop using it, use [`yarn unlink`](https://yarnpkg.com/en/docs/cli/unlink). This is also called “unregistering” the package.
74+
To unlink your package so other local projects stop using it, use [`yarn unlink`](https://yarnpkg.com/en/docs/cli/unlink). This is also called “unregistering” the package.
5975

60-
``` bash
76+
```bash
6177
theme-a11y $ yarn unlink
6278

6379
# success Unregistered "@shopify/theme-a11y".
6480
```
6581

6682
When you don’t want your project to be using your local package, go to your local project and type `yarn unlink <package>`
6783

68-
``` bash
84+
```bash
6985
cd ../projects/my-theme
7086
my-theme $ yarn unlink "@shopify/theme-a11y"
7187

@@ -80,55 +96,65 @@ functionality, changing the return value of a function, etc),
8096
please ensure the documentation is also updated to
8197
reflect this.
8298

83-
## Changelog
84-
85-
The changelog is updated by the repo's maintainers since a [personal access token](https://github.com/settings/tokens) with repository access is needed to handle GitHub's API call limits.
86-
87-
If this is your first time generating changelog entries, add your personal access token with `public_repo` privileges to the `GITHUB_AUTH` environment variable by adding the following to your `.bashrc` file:
88-
89-
```
90-
# Lerna Changelog Personal Access Token for shopify/theme-scripts repo
91-
export GITHUB_AUTH=your_personal_access_token
92-
```
93-
94-
_Note: replace "your_personal_access_token" with your GitHub personal access token_
95-
96-
Run the changelog generator:
97-
98-
```
99-
npm run changelog
100-
```
101-
102-
If nothing appears, you may not have any PRs tagged with appropriate labels in this release or you may have already published those changes. If you just released `v0.12.1` and the previous version was `v0.12.0`, run the following command to get the changes since `v0.12.0`:
103-
104-
```
105-
npm run changelog -- --tag-from=v0.12.0
106-
```
107-
108-
Copy the generated markdown from your terminal into [CHANGELOG.md](https://github.com/Shopify/theme-scripts/blob/master/CHANGELOG.md) and add any additional comments you wish to include. If the title of the autogenerated changelog is `Unreleased`, make sure you change it the new version name.
109-
110-
Commit the changes directly to `master` branch, with a commit title of:
111-
112-
```
113-
Changelog vX.X.X
114-
```
115-
116-
_Note: replace "X.X.X" with new repo version number_
117-
118-
Finally, paste the updates you made to the changelog in the release tag notes, see example: [v0.10.0 tag notes](https://github.com/Shopify/theme-scripts/releases/tag/v0.10.0).
119-
12099
## Publishing
121100

122-
1. Merge any changes you want to include in your next release into `master`.
123-
124-
_Note: If you are merging multiple PRs into `master` with a single PR (e.g. you are merging a working branch called v0.11.0 with multiple fixes made from multiple PRs into `master`), then **do not squash and merge this PR** because you will loose valuable details in the auto generated changelog_
101+
⚠️ Note: You must have a Shopify Okta account ir order to login to Shipit and publish.
125102

126-
2. Update the [CHANGELOG.md](https://github.com/Shopify/theme-scripts/blob/master/CHANGELOG.md) as described above
127-
128-
3. To select a new version number, and publish packages to NPM, run:
129-
130-
```
131-
npm run publish
132-
```
103+
1. Merge any changes you want to include in your next release into `master`.
133104

134-
_Note: Make sure you are logged into your Shopify NPM account before publishing_
105+
_Note: If you are merging multiple PRs into `master` with a single PR (e.g. you are merging a working branch called v0.11.0 with multiple fixes made from multiple PRs into `master`), then **do not squash and merge this PR** because you will loose valuable details in the commit history_
106+
107+
2. Checkout `master` and pull the latest from the origin
108+
109+
```
110+
theme-scripts $ git checkout master && git pull origin master
111+
```
112+
113+
3. You can verify that there are indeed packages to be published (optional)
114+
115+
```
116+
theme-scripts $ yarn lerna updated
117+
...
118+
lerna info version 2.11.0
119+
lerna info Checking for updated packages...
120+
lerna info Comparing with v2.0.4.
121+
lerna info Checking for prereleased packages...
122+
lerna info result
123+
- @shopify/theme-a11y // This package was updated and can be published
124+
✨Done in 0.63s.
125+
```
126+
127+
4. Run the release step to choose the version bump desired
128+
129+
```
130+
theme-scripts $ yarn release
131+
...
132+
lerna info version 2.11.0
133+
lerna info current version 2.0.4
134+
lerna info Checking for updated packages...
135+
lerna info Comparing with v2.0.4.
136+
lerna info Checking for prereleased packages...
137+
? Select a new version (currently 2.0.4) (Use arrow keys)
138+
❯ Patch (2.0.5)
139+
Minor (2.1.0)
140+
Major (3.0.0)
141+
Prepatch (2.0.5-0)
142+
Preminor (2.1.0-0)
143+
Premajor (3.0.0-0)
144+
Prerelease
145+
Custom
146+
```
147+
148+
This command will:
149+
150+
1. Run the equivalent of lerna updated to determine which packages need to be published.
151+
2. If necessary, increment the version key in lerna.json.
152+
3. Update the package.json of all updated packages to their new versions.
153+
4. Update all dependencies of the updated packages with the new versions, specified with a caret (^).
154+
5. Create a new git commit and tag for the new version.
155+
6. Git push to origin master with the newly created tag.
156+
157+
_Note: See the [lerna documentation](https://github.com/lerna/lerna/tree/2.x#publish) for more information_
158+
159+
5. Login to [Shipit](https://shipit.shopify.io/shopify/theme-scripts/production)
160+
6. In the Undeployed Commits list, identify the commit with the name of the version that was created in step #4, wait for CI to be 🍏, click the 'Deploy' button to publish to npm's public registry.

0 commit comments

Comments
 (0)