Skip to content

Commit 3707af7

Browse files
build: switch to npm (#2246)
1 parent eb6ac03 commit 3707af7

File tree

15 files changed

+66561
-22000
lines changed

15 files changed

+66561
-22000
lines changed

.circleci/config.yml

+23-30
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ jobs:
1414
- checkout
1515
- attach_workspace:
1616
at: ~/circleci-f36-build
17-
- node/install-packages:
18-
pkg-manager: yarn
17+
- node/install-packages
1918
- run:
2019
name: Build packages
21-
command: yarn build
20+
command: npm run-script build
2221
- persist_to_workspace:
2322
root: .
2423
paths:
@@ -37,17 +36,16 @@ jobs:
3736
- checkout
3837
- attach_workspace:
3938
at: ~/circleci-f36-build
40-
- node/install-packages:
41-
pkg-manager: yarn
39+
- node/install-packages
4240
- run:
4341
name: Prettier
44-
command: yarn prettier:check
42+
command: npm run-script prettier:check
4543
- run:
4644
name: Lint
47-
command: yarn lint
45+
command: npm run-script lint
4846
- run:
4947
name: Check types
50-
command: yarn tsc
48+
command: npm run-script tsc
5149

5250
test:
5351
docker:
@@ -58,11 +56,10 @@ jobs:
5856
- checkout
5957
- attach_workspace:
6058
at: ~/circleci-f36-build
61-
- node/install-packages:
62-
pkg-manager: yarn
59+
- node/install-packages
6360
- run:
6461
name: Test
65-
command: yarn test
62+
command: npm run-script test
6663

6764
check-links:
6865
docker:
@@ -73,21 +70,20 @@ jobs:
7370
- checkout
7471
- attach_workspace:
7572
at: ~/circleci-f36-build
76-
- node/install-packages:
77-
pkg-manager: yarn
73+
- node/install-packages
7874
- run:
7975
name: Build Next.js website
80-
command: yarn docs:next:build
76+
command: npm run-script docs:next:build
8177
- run:
8278
name: Run production version of the website locally
83-
command: yarn docs:next:start-prod
79+
command: npm run-script docs:next:start-prod
8480
background: true
8581
- run:
8682
name: Wait for localhost:3000 to be ready
87-
command: yarn wait-on http://localhost:3000
83+
command: npx wait-on http://localhost:3000
8884
- run:
8985
name: Run links checker
90-
command: yarn blc http://localhost:3000 -ro --exclude "https://medium.com/contentful-design" --exclude "https://github.com/contentful/forma-36" --exclude "https://www.figma.com/@contentful"
86+
command: npx blc http://localhost:3000 -ro --exclude "https://medium.com/contentful-design" --exclude "https://github.com/contentful/forma-36" --exclude "https://www.figma.com/@contentful"
9187

9288
deploy_chromatic:
9389
docker:
@@ -98,14 +94,13 @@ jobs:
9894
- checkout
9995
- attach_workspace:
10096
at: ~/circleci-f36-build
101-
- node/install-packages:
102-
pkg-manager: yarn
97+
- node/install-packages
10398
- run:
10499
name: Storybook
105-
command: yarn storybook:build
100+
command: npm run-script storybook:build
106101
- run:
107102
name: Chromatic
108-
command: yarn chromatic
103+
command: npm run-script chromatic
109104

110105
release:
111106
docker:
@@ -116,24 +111,23 @@ jobs:
116111
- checkout
117112
- attach_workspace:
118113
at: ~/circleci-f36-build
119-
- node/install-packages:
120-
pkg-manager: yarn
114+
- node/install-packages
121115
- add_ssh_keys:
122116
fingerprints:
123117
- '2b:9f:13:79:d8:7b:f5:38:43:8f:3d:a8:7d:53:22:b2'
124118
- run: git config --global user.email ${GITHUB_EMAIL}
125119
- run: git config --global user.name ${GITHUB_USER}
126120
- run:
127121
name: Generate changelogrc
128-
command: yarn changelog:gen
122+
command: npm run-script changelog:gen
129123
- run:
130124
name: Generate packages changelogs
131-
command: yarn changeset version
125+
command: npx changeset version
132126
- run:
133127
name: Publish packages and create releases
134128
command: |
135129
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
136-
yarn run changeset:publish
130+
npm run-script changeset:publish
137131
138132
changelog:
139133
docker:
@@ -144,20 +138,19 @@ jobs:
144138
- checkout
145139
- attach_workspace:
146140
at: ~/circleci-f36-build
147-
- node/install-packages:
148-
pkg-manager: yarn
141+
- node/install-packages
149142
- add_ssh_keys:
150143
fingerprints:
151144
- '2b:9f:13:79:d8:7b:f5:38:43:8f:3d:a8:7d:53:22:b2'
152145
- run: git config --global user.email ${GITHUB_EMAIL}
153146
- run: git config --global user.name ${GITHUB_USER}
154147
- run:
155148
name: Generate changelog files
156-
command: yarn changelog:write
149+
command: npm run-script changelog:write
157150
- run:
158151
name: Commit changelog files
159152
command: |
160-
git add . && yarn run pretty:quick
153+
git add . && npm run-script pretty:quick
161154
git diff --staged --quiet || git commit -am "docs: update changelog on repository and website" && git push origin ${CIRCLE_BRANCH}
162155
163156
workflows:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
**/npm-debug.log*
2121
**/yarn-debug.log*
2222
**/yarn-error.log*
23-
**/package-lock.json
23+
**/yarn.lock
2424
**/tsconfig.tsbuildinfo
2525

2626
**/.cache

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,32 @@
2626

2727
### Creating new packages
2828

29-
We use use [Plop](https://plopjs.com/) to create scripts that help you to scaffold new packages. In the root of the repo, you can run `yarn generate`. Then follow the steps in the CLI. Plop will generate the relevant files and add the relevant imports and exports to the main `src/index.ts` file required to make the component available when publishing the library. Read more about [contribution to Forma 36](https://f36.contentful.com/introduction/contributing).
29+
We use use [Plop](https://plopjs.com/) to create scripts that help you to scaffold new packages. In the root of the repo, you can run `npm run-script generate`. Then follow the steps in the CLI. Plop will generate the relevant files and add the relevant imports and exports to the main `src/index.ts` file required to make the component available when publishing the library. Read more about [contribution to Forma 36](https://f36.contentful.com/introduction/contributing).
3030

3131
## Development
3232

33-
For local development, in the root of the repo run `yarn` to install all dependencies and then `yarn build` to build all packages. Now follow the instructions of the specific package you’re working on.
33+
For local development, in the root of the repo run `npm i` to install all dependencies and then `npm run-script build` to build all packages. Now follow the instructions of the specific package you’re working on.
3434
You will find each package’s instructions in their README files, check the [Packages](#packages) section for a list of all packages.
3535

3636
> In case you are having problems to install the dependencies, try using NVM to get the same node version we use by running `nvm use` in the root of the repo
3737
3838
### Storybook for f36-components
3939

40-
We use storybook with our react component library to develop components. You can start it from the root of the repo, just run `yarn storybook`
40+
We use storybook with our react component library to develop components. You can start it from the root of the repo, just run `npm run-script storybook`
4141

4242
## Commits & releases
4343

44-
Use `yarn commit`. This uses the [Commitzen](https://github.com/commitizen/cz-cli) CLI to create a conventional commit message based on your changes. CI is setup to release all new commits on the main branch that contains a new [changeset](https://github.com/changesets/changesets).
44+
Use `npm run-script commit`. This uses the [Commitzen](https://github.com/commitizen/cz-cli) CLI to create a conventional commit message based on your changes. CI is setup to release all new commits on the main branch that contains a new [changeset](https://github.com/changesets/changesets).
4545

4646
Read more about changeset [here](RELEASES.md)
4747

4848
## Testing with your own project locally
4949

5050
You can test changes to a package of this monorepo in your own project locally by taking the following steps:
5151

52-
1. Run `yarn build` in the desired package's directory to ensure your latest changes have been built
53-
2. Run `yarn link` in the desired package's directory
54-
3. Change to your local project's directory and run `yarn link NAME_OF_PACKAGE` to link to the local version of the package (e.g. `yarn link @contentful/f36-components`)
52+
1. Run `npm run-script build` in the desired package's directory to ensure your latest changes have been built
53+
2. Run `npm link` in the desired package's directory
54+
3. Change to your local project's directory and run `npm link NAME_OF_PACKAGE` to link to the local version of the package (e.g. `npm link @contentful/f36-components`)
5555

5656
## Get involved
5757

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ But in case you want a new version to be published, you will need to add a chang
1313

1414
### Through CLI
1515

16-
- run `yarn changeset` on the root of the repository.
16+
- run `npm run-script changeset` on the root of the repository.
1717
- it starts a wizard showing packages that had changes from `main` branch, and which kind of bump should be applied (major, minor or patch), and also ask for a description of the change.
1818
- it creates a file in the `.changeset` folder that needs to be commited to the branch.
1919
- `changeset-bot` will show that information in its comment on the PR.

docs/folder-structure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The basic folder structure of a component looks like this:
5656
package.json
5757
```
5858

59-
If you run `yarn generate component`, this structure will be generated for you automatically.
59+
If you run `npm run-script generate component`, this structure will be generated for you automatically.
6060

6161
### Test files
6262

0 commit comments

Comments
 (0)