Skip to content

Commit f109fe9

Browse files
committed
fix: use @bahmutov/npm-install in templates' CI
- have been using this internally for about 6 months and I've personally contributed bugfixes and optimizations to it, so should be good to use by general users too - it's a good bit less configuration, which is particularly better for beginners, but even for advanced users, it means that improvements are shared out to all users - I also recommended it in an actions/cache issue about needing too much config already too, which I wouldn't have done if I weren't confident in its usage now - this properly caches node_modules by using ~/.npm or Yarn's cache dir as recommended, instead of `node_modules` itself, which is not - c.f. https://github.com/actions/cache/blob/main/examples.md#node---npm - it's also not susceptible to the `**/yarn.lock` issue that was reported because it caches the _one_ lockfile directly instead of potentially multiple lockfiles
1 parent dac1fd7 commit f109fe9

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

templates/basic/.github/workflows/main.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ jobs:
1313
with:
1414
node-version: 12.x
1515

16-
- name: Use cached node_modules
17-
uses: actions/cache@v2
18-
with:
19-
path: node_modules
20-
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
21-
restore-keys: |
22-
nodeModules-
23-
24-
- name: Install dependencies
25-
run: yarn install --frozen-lockfile
16+
- name: Install deps and build (with cache)
17+
uses: bahmutov/npm-install@v1
2618

2719
- name: Lint
2820
run: yarn lint

templates/react-with-storybook/.github/workflows/main.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ jobs:
1313
with:
1414
node-version: 12.x
1515

16-
- name: Use cached node_modules
17-
uses: actions/cache@v2
18-
with:
19-
path: node_modules
20-
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
21-
restore-keys: |
22-
nodeModules-
23-
24-
- name: Install dependencies
25-
run: yarn install --frozen-lockfile
16+
- name: Install deps and build (with cache)
17+
uses: bahmutov/npm-install@v1
2618

2719
- name: Lint
2820
run: yarn lint

templates/react/.github/workflows/main.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ jobs:
1313
with:
1414
node-version: 12.x
1515

16-
- name: Use cached node_modules
17-
uses: actions/cache@v2
18-
with:
19-
path: node_modules
20-
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
21-
restore-keys: |
22-
nodeModules-
23-
24-
- name: Install dependencies
25-
run: yarn install --frozen-lockfile
16+
- name: Install deps and build (with cache)
17+
uses: bahmutov/npm-install@v1
2618

2719
- name: Lint
2820
run: yarn lint

0 commit comments

Comments
 (0)