Skip to content

Commit

Permalink
housekeeping: Update dependency node to v18 and yarn to v4 (#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Apr 30, 2024
1 parent e01fbee commit 26a636f
Show file tree
Hide file tree
Showing 123 changed files with 36,283 additions and 33,513 deletions.
49 changes: 49 additions & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

ROOT_DIR=$(pwd)
FRONTEND_DIR="${ROOT_DIR}/frontend"
BASE_GIT_DIFF_CMD="git diff --name-only --staged --relative=frontend"

if [[ $(${BASE_GIT_DIFF_CMD} -- frontend) ]]; then
echo "Running frontend checks in ${FRONTEND_DIR}..."
cd "${FRONTEND_DIR}"

if [[ $(${BASE_GIT_DIFF_CMD} -- **/**/package.json) ]]; then
echo "\nLinting frontend packages...\n"
{
yarn lint:packages
} || {
echo "\n${FRONTEND_DIR} package lint checks failed, please run \"yarn lint:packages:fix\" and commit the changes."
exit 1
}

echo "\nTesting frontend package constraints...\n"
{
yarn constraints
} || {
echo "\n${FRONTEND_DIR} constraints check failed, please run \"yarn constraints --fix\" and commit the changes."
exit 1
}
fi

STAGED_FILES=$(${BASE_GIT_DIFF_CMD} -- **/**/src)
if [[ ${STAGED_FILES} ]]; then
echo "\nLinting frontend code..."
{
yarn lint:files ${STAGED_FILES}
} || {
echo "\n${FRONTEND_DIR} lint checks failed, please try running \"yarn lint:fix\" and committing the changes."
exit 1
}

echo "\nRunning frontend tests..."
{
yarn test:coverage
} || {
echo "\n${FRONTEND_DIR} tests failed, please fix the issues and commit the changes."
exit 1
}
fi
fi

exit 0
3 changes: 2 additions & 1 deletion .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '18.x'
check-latest: true
- name: build and verify
run: make api-verify
Expand All @@ -39,3 +39,4 @@ jobs:
go-version: 1.22.x
- name: lint
run: make api-lint

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '18.x'
check-latest: true
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ name: docs
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main
paths:
- 'docs/**'
- .github/workflows/docs.yml
- "docs/**"
- .github/workflows/docs.yml
defaults:
run:
working-directory: ./docs/_website
jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -17,10 +20,10 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: "18.x"
check-latest: true
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
run: ../../tools/install-yarn.sh CWD bin=bin
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v4
Expand All @@ -30,6 +33,6 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn --cwd docs/_website install
run: ./bin/yarn.sh install --immutable
- name: lint
run: yarn --cwd docs/_website lint
run: ./bin/yarn.sh run lint
106 changes: 61 additions & 45 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@ name: frontend
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main
paths:
- 'frontend/**'
- .github/workflows/frontend.yml
- Makefile
- tools/frontend-e2e.sh
- "frontend/**"
- .github/workflows/frontend.yml
- Makefile
- tools/frontend-e2e.sh
env:
FRONTEND_DIR: ./frontend
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: "18.x"
check-latest: true
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
run: make yarn-ensure
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v4
Expand All @@ -45,20 +48,21 @@ jobs:
key: ${{ runner.os }}-fe-build-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn --cwd frontend install
run: make yarn-install
- name: build
run: yarn --cwd frontend build
run: make frontend
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: "18.x"
check-latest: true
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
run: make yarn-ensure
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v4
Expand All @@ -68,27 +72,35 @@ jobs:
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn --cwd frontend install
run: make yarn-install
- name: Compile packages
run: yarn --cwd frontend compile:dev
- run: make frontend-lint
- run: make frontend-verify
- run: yarn --cwd frontend test:licenses
run: yarn run compile:dev
working-directory: ${{ env.FRONTEND_DIR }}
- name: Frontend Lint
run: make frontend-lint
- name: Frontend Verify
run: make frontend-verify
- name: Frontend Constraints
run: yarn constraints
working-directory: ${{ env.FRONTEND_DIR }}
- name: Frontend Test Licenses
run: yarn run test:licenses
working-directory: ${{ env.FRONTEND_DIR }}
test-e2e:
name: test e2e
name: Test [e2e]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
id: setup-go
with:
go-version: 1.22.x
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: "18.x"
check-latest: true
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
run: make yarn-ensure
- name: cypress cache
id: cypress-cache
uses: actions/cache@v4
Expand Down Expand Up @@ -123,30 +135,31 @@ jobs:
${{ runner.os }}-go-build-
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn --cwd frontend install
run: make yarn-install
- name: Compile packages
run: yarn --cwd frontend compile:dev
run: yarn run compile:dev
working-directory: ${{ env.FRONTEND_DIR }}
- name: Test [e2e]
id: e2e
run: ./tools/frontend-e2e.sh
- name: Upload end-to-end artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure() && steps.e2e.outcome == 'failure'
with:
name: screenshots
path: ./frontend/packages/app/cypress/screenshots
test-unit:
name: test unit
name: Test [unit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: "18.x"
check-latest: true
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
run: make yarn-ensure
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v4
Expand All @@ -156,25 +169,27 @@ jobs:
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn --cwd frontend install
run: make yarn-install
- name: Compile packages
run: yarn --cwd frontend compile:dev
run: yarn run compile:dev
working-directory: ${{ env.FRONTEND_DIR }}
- name: Test [unit]
run: yarn --cwd frontend test:coverage
run: yarn run test:coverage
working-directory: ${{ env.FRONTEND_DIR }}
publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [build, lint, test-unit, test-e2e]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: "18.x"
check-latest: true
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"
- name: Enforce consistent Yarn version
run: ./tools/install-yarn.sh
run: make yarn-ensure
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v4
Expand All @@ -184,8 +199,9 @@ jobs:
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn --cwd frontend install
run: make yarn-install
- name: publish
run: yarn --cwd frontend publishBeta
run: yarn run publishBeta
working-directory: ${{ env.FRONTEND_DIR }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/scaffolding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
go-version: 1.22.x
- uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '18.x'
check-latest: true
- name: scaffold new app
run: yes | go run scaffolder.go -m gateway -p ${{ github.sha }} -o ${{ github.repository_owner }}
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Frontend build.
FROM node:16.20.2-buster as nodebuild
FROM node:18.19.0-buster as nodebuild
COPY ./frontend ./frontend
COPY ./tools/install-yarn.sh ./tools/install-yarn.sh
COPY ./tools/preflight-checks.sh ./tools/preflight-checks.sh
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ api-lint-fix:
tools/compile-protos.sh -c "$(PROJECT_ROOT_DIR)/api" -lf

.PHONY: api-verify # Verify API proto changes include generate frontend and backend assets.
api-verify:
api-verify: yarn-ensure
find backend/api -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
find frontend/api/src -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
rm backend/internal/test/pb/*.go
Expand Down Expand Up @@ -78,7 +78,7 @@ backend-config-validation:

.PHONY: yarn-install # Install frontend dependencies.
yarn-install: yarn-ensure
$(YARN) --cwd frontend install --frozen-lockfile
$(YARN) --cwd frontend install --immutable

.PHONY: backend-integration-test
backend-integration-test:
Expand All @@ -93,7 +93,7 @@ frontend-dev-build: yarn-install
$(YARN) --cwd frontend build:dev

.PHONY: frontend-dev # Start the frontend in development mode.
frontend-dev: yarn-install
frontend-dev: setup-git-hooks yarn-install
$(YARN) --cwd frontend start

.PHONY: frontend-lint # Lint the frontend code.
Expand All @@ -118,11 +118,11 @@ frontend-verify: yarn-ensure

.PHONY: docs # Build all doc assets.
docs: docs-generate yarn-ensure
$(YARN) --cwd docs/_website install --frozen-lockfile && $(YARN) --cwd docs/_website build
$(YARN) --cwd docs/_website install --immutable && $(YARN) --cwd docs/_website build

.PHONY: docs-dev # Start the docs server in development mode.
docs-dev: docs-generate yarn-ensure
$(YARN) --cwd docs/_website install --frozen-lockfile && BROWSER=none $(YARN) --cwd docs/_website start
$(YARN) --cwd docs/_website install --immutable && BROWSER=none $(YARN) --cwd docs/_website start

.PHONY: docs-generate # Generate the documentation content.
docs-generate:
Expand Down Expand Up @@ -189,6 +189,10 @@ preflight-checks-frontend:
preflight-checks-backend:
@tools/preflight-checks.sh backend

.PHONY: setup-git-hooks
setup-git-hooks:
@tools/setup-git-hooks.sh

.PHONY: preflight-checks
preflight-checks:
@tools/preflight-checks.sh
Expand Down
1 change: 1 addition & 0 deletions clutch
Loading

0 comments on commit 26a636f

Please sign in to comment.