From 386a2de1173615d8c7d9048c6baec231ac9ccd62 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 6 Jul 2022 23:38:04 +0200 Subject: [PATCH 1/4] contributors: Add `erikarvstedt` --- contributors/erikarvstedt.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 contributors/erikarvstedt.txt diff --git a/contributors/erikarvstedt.txt b/contributors/erikarvstedt.txt new file mode 100644 index 000000000..0f84df7c2 --- /dev/null +++ b/contributors/erikarvstedt.txt @@ -0,0 +1,3 @@ +I hereby accept the terms of the Contributor License Agreement in the CONTRIBUTING.md file of the mempool/mempool git repository as of July 6, 2022. + +Signed: erikarvstedt From 78ee671051a3dc2704f68a77997e331cd4f0ebbc Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 6 Jul 2022 23:38:05 +0200 Subject: [PATCH 2/4] CI/frontend: Add missing install flag for `prod` flavor Also restrict linting, which requires dev packages, to the `dev` flavor. This makes the frontend build setup indentical to the backend. --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a3b69571..3a2901aec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install (Prod dependencies only) - run: npm install + run: npm install --prod if: ${{ matrix.flavor == 'prod'}} working-directory: ${{ matrix.flavor }}/frontend @@ -76,7 +76,8 @@ jobs: run: npm install working-directory: ${{ matrix.flavor }}/frontend - - name: Lint + - name: Lint + if: ${{ matrix.flavor == 'dev'}} run: npm run lint working-directory: ${{ matrix.flavor }}/frontend From 80476a2b61e74ffbd99439c1a606d941c54f6fbd Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 6 Jul 2022 23:38:06 +0200 Subject: [PATCH 3/4] CI: Use `npm ci` instead of `npm install` `npm ci` is recommended instead of `npm install` for automated builds. Its main advantage is the `package-lock.json` consistency check: The command fails if the lock file doesn't match `package.json`. --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a2901aec..a8c609130 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,12 +27,12 @@ jobs: - name: Install if: ${{ matrix.flavor == 'dev'}} - run: npm install + run: npm ci working-directory: ${{ matrix.flavor }}/backend - name: Install (Prod dependencies only) if: ${{ matrix.flavor == 'prod'}} - run: npm install --prod + run: npm ci --prod working-directory: ${{ matrix.flavor }}/backend - name: Lint @@ -67,13 +67,13 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install (Prod dependencies only) - run: npm install --prod + run: npm ci --prod if: ${{ matrix.flavor == 'prod'}} working-directory: ${{ matrix.flavor }}/frontend - name: Install if: ${{ matrix.flavor == 'dev'}} - run: npm install + run: npm ci working-directory: ${{ matrix.flavor }}/frontend - name: Lint From 6288bcde51c24871aaf273487bb8569e5a1d0cd0 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 6 Jul 2022 23:38:07 +0200 Subject: [PATCH 4/4] CI: Add `--no-optional` flag to prod flavor This ensures that the packages build successfully even when optional deps are unavailable. `--no-optional` currently has no effect on the backend, because it has no optional packages. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8c609130..3c65b3821 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install (Prod dependencies only) if: ${{ matrix.flavor == 'prod'}} - run: npm ci --prod + run: npm ci --prod --no-optional working-directory: ${{ matrix.flavor }}/backend - name: Lint @@ -67,7 +67,7 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install (Prod dependencies only) - run: npm ci --prod + run: npm ci --prod --no-optional if: ${{ matrix.flavor == 'prod'}} working-directory: ${{ matrix.flavor }}/frontend