Skip to content

Commit 8ea914a

Browse files
committed
update 04
1 parent c326061 commit 8ea914a

File tree

25 files changed

+4388
-117
lines changed

25 files changed

+4388
-117
lines changed

07-cloud/04-turborepo/04-auto-publish/.changeset/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

07-cloud/04-turborepo/04-auto-publish/.changeset/config.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
3-
"changelog": [
4-
"@changesets/changelog-github",
5-
{ "repo": "<user-name>/<repository-name>" }
6-
],
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
74
"commit": false,
85
"fixed": [],
96
"linked": [],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nasdan/motto-helpers": patch
3+
---
4+
5+
fix tyrell motto
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nasdan/house-helpers": minor
3+
---
4+
5+
add tyrell house

07-cloud/04-turborepo/04-auto-publish/.github/workflows/publish-packages.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ jobs:
2020
- name: Setup Node.js
2121
uses: actions/setup-node@v4
2222
with:
23-
node-version: "20.x"
23+
node-version: "22.x"
2424
registry-url: "https://npm.pkg.github.com"
25-
always-auth: true
2625
scope: "@${{ github.repository_owner }}"
2726

2827
- name: Install

07-cloud/04-turborepo/04-auto-publish/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,27 @@ git push -u origin main
3030
This time we will install a third party library to help us with the monorepo package management, [changesets](https://github.com/changesets/changesets) is a tool to manage versioning and changelogs with a focus on multi-package repositories but you can use it in single package repositories too:
3131

3232
```bash
33-
npm install @changesets/cli @changesets/changelog-github --save-dev
33+
npm install @changesets/cli --save-dev
3434

3535
```
3636

37-
> Also, we will install `@changesets/changelog-github` to be used in a Github workflow
38-
3937
Create `changesets` config:
4038

4139
```bash
4240
npx changeset init
4341

4442
```
4543

46-
> Another valid command `node_modules/.bin/changeset init`
44+
> We can delete the `.changeset/README.md` file.
4745
4846
The command above will create a `.changeset` folder with a `config.js` file:
4947

5048
_./.changeset/config.js_
5149

52-
```diff
50+
```json
5351
{
54-
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
55-
- "changelog": "@changesets/cli/changelog",
56-
+ "changelog": [
57-
+ "@changesets/changelog-github",
58-
+ { "repo": "<user-name>/<repository-name>" }
59-
+ ],
52+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
53+
"changelog": "@changesets/cli/changelog",
6054
"commit": false,
6155
"fixed": [],
6256
"linked": [],
@@ -68,7 +62,7 @@ _./.changeset/config.js_
6862

6963
```
7064

71-
> `changelog`: We will use `@changesets/changelog-github` to generate a changelog file in the Github workflow
65+
> Notice that we will publish the packages as private packages, so we need to set the `access` field to `restricted` (it will publish the packages as private packages in the npm registry).
7266
>
7367
> More info about [changeset config file](https://github.com/changesets/changesets/blob/main/docs/config-file-options.md#changelog-false-or-a-path)
7468
@@ -80,7 +74,7 @@ _./package.json_
8074
{
8175
...
8276
"scripts": {
83-
"start": "turbo start type-check:watch",
77+
"start": "turbo watch start",
8478
"build": "turbo build",
8579
+ "changeset": "changeset",
8680
+ "publish-packages": "changeset publish"
@@ -136,9 +130,8 @@ permissions:
136130
+ - name: Setup Node.js
137131
+ uses: actions/setup-node@v4
138132
+ with:
139-
+ node-version: "20.x"
133+
+ node-version: "22.x"
140134
+ registry-url: "https://npm.pkg.github.com"
141-
+ always-auth: true
142135
+ scope: "@${{ github.repository_owner }}"
143136

144137
+ - name: Install
@@ -168,14 +161,17 @@ permissions:
168161
> [More info about github context variables](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context)
169162
>
170163
> [changesets/action](https://github.com/changesets/action)
164+
>
165+
> [Random npm bug with optional deps](https://github.com/npm/cli/issues/4828). Temporal solution: `rm -rf node_modules package-lock.json && npm install`
171166

172167
Reset packages versions to `0.0.0`:
173168

174169
_./helpers/house-helpers/package.json_
175170

176171
```diff
177172
{
178-
"name": "@<user-name>/house-helpers",
173+
- "name": "@my-org/motto-helpers",
174+
+ "name": "@<user-name>/house-helpers",
179175
- "version": "1.0.0",
180176
+ "version": "0.0.0",
181177
...
@@ -339,6 +335,8 @@ git push
339335
340336
```
341337

338+
> Ensure that you don't have any package published in the Github npm registry with the same name, otherwise, it will fail with 403 error.
339+
342340
The first time, if there are no changesets and no version of any package is published, the workflow will publish the versions of all packages (which have `private` field set to false).
343341

344342
![02-published-tags-and-packages](./readme-resources/02-published-tags-and-packages.png)
@@ -380,6 +378,8 @@ npm run changeset
380378
381379
```
382380

381+
> Remove version in apps if you don't want to see them in the menu.
382+
>
383383
> `Package to include`: Select only the `house-helpers` package with `space` and press `enter` to continue.
384384
>
385385
> `major`: Press `enter` without select any package to continue.

07-cloud/04-turborepo/04-auto-publish/apps/baratheon/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
"start": "vite --open"
88
},
99
"dependencies": {
10-
"@<user-name>/house-helpers": "*",
11-
"@<user-name>/motto-helpers": "*",
12-
"react": "^18.2.0",
13-
"react-dom": "^18.2.0"
10+
"@nasdan/house-helpers": "*",
11+
"@nasdan/motto-helpers": "*",
12+
"react": "^19.0.0",
13+
"react-dom": "^19.0.0"
1414
},
1515
"devDependencies": {
16-
"@types/react": "^18.2.66",
17-
"@types/react-dom": "^18.2.22",
18-
"@vitejs/plugin-react": "^4.2.1",
19-
"typescript": "^5.4.2",
20-
"vite": "^5.1.6"
16+
"@types/react": "^19.0.10",
17+
"@types/react-dom": "^19.0.4",
18+
"@vitejs/plugin-react": "^4.3.4",
19+
"typescript": "^5.8.2",
20+
"vite": "^6.2.0"
2121
}
2222
}

07-cloud/04-turborepo/04-auto-publish/apps/baratheon/src/app.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './app.css';
22
import logo from '/logo.png';
3-
import { House, getHouseTitle } from '@<user-name>/house-helpers';
4-
import { getHouseMotto } from '@<user-name>/motto-helpers';
3+
import { House, getHouseTitle } from '@nasdan/house-helpers';
4+
import { getHouseMotto } from '@nasdan/motto-helpers';
55

66
function App() {
77
return (

07-cloud/04-turborepo/04-auto-publish/apps/lannister/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
"start": "vite --open"
88
},
99
"dependencies": {
10-
"@<user-name>/house-helpers": "*",
11-
"@<user-name>/motto-helpers": "*",
12-
"react": "^18.2.0",
13-
"react-dom": "^18.2.0"
10+
"@nasdan/house-helpers": "*",
11+
"@nasdan/motto-helpers": "*",
12+
"react": "^19.0.0",
13+
"react-dom": "^19.0.0"
1414
},
1515
"devDependencies": {
16-
"@types/react": "^18.2.66",
17-
"@types/react-dom": "^18.2.22",
18-
"@vitejs/plugin-react": "^4.2.1",
19-
"typescript": "^5.4.2",
20-
"vite": "^5.1.6"
16+
"@types/react": "^19.0.10",
17+
"@types/react-dom": "^19.0.4",
18+
"@vitejs/plugin-react": "^4.3.4",
19+
"typescript": "^5.8.2",
20+
"vite": "^6.2.0"
2121
}
2222
}

07-cloud/04-turborepo/04-auto-publish/apps/lannister/src/app.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './app.css';
22
import logo from '/logo.png';
3-
import { House, getHouseTitle } from '@<user-name>/house-helpers';
4-
import { getHouseMotto } from '@<user-name>/motto-helpers';
3+
import { House, getHouseTitle } from '@nasdan/house-helpers';
4+
import { getHouseMotto } from '@nasdan/motto-helpers';
55

66
function App() {
77
return (

0 commit comments

Comments
 (0)