From f109fe96884874c50cb8291d4d5233aa54367594 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Mon, 21 Sep 2020 02:04:15 -0400 Subject: [PATCH] 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 --- templates/basic/.github/workflows/main.yml | 12 ++---------- .../react-with-storybook/.github/workflows/main.yml | 12 ++---------- templates/react/.github/workflows/main.yml | 12 ++---------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/templates/basic/.github/workflows/main.yml b/templates/basic/.github/workflows/main.yml index d40f0f8f6..182554c6a 100644 --- a/templates/basic/.github/workflows/main.yml +++ b/templates/basic/.github/workflows/main.yml @@ -13,16 +13,8 @@ jobs: with: node-version: 12.x - - name: Use cached node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: nodeModules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - nodeModules- - - - name: Install dependencies - run: yarn install --frozen-lockfile + - name: Install deps and build (with cache) + uses: bahmutov/npm-install@v1 - name: Lint run: yarn lint diff --git a/templates/react-with-storybook/.github/workflows/main.yml b/templates/react-with-storybook/.github/workflows/main.yml index d40f0f8f6..182554c6a 100644 --- a/templates/react-with-storybook/.github/workflows/main.yml +++ b/templates/react-with-storybook/.github/workflows/main.yml @@ -13,16 +13,8 @@ jobs: with: node-version: 12.x - - name: Use cached node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: nodeModules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - nodeModules- - - - name: Install dependencies - run: yarn install --frozen-lockfile + - name: Install deps and build (with cache) + uses: bahmutov/npm-install@v1 - name: Lint run: yarn lint diff --git a/templates/react/.github/workflows/main.yml b/templates/react/.github/workflows/main.yml index d40f0f8f6..182554c6a 100644 --- a/templates/react/.github/workflows/main.yml +++ b/templates/react/.github/workflows/main.yml @@ -13,16 +13,8 @@ jobs: with: node-version: 12.x - - name: Use cached node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: nodeModules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - nodeModules- - - - name: Install dependencies - run: yarn install --frozen-lockfile + - name: Install deps and build (with cache) + uses: bahmutov/npm-install@v1 - name: Lint run: yarn lint