Skip to content

Commit

Permalink
chore: use npm workspaces instead of lerna bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Jun 21, 2023
1 parent 5773ed4 commit 8739a4e
Show file tree
Hide file tree
Showing 26 changed files with 11,155 additions and 8,932 deletions.
13 changes: 7 additions & 6 deletions cloudbuild-e2e-cloud-functions-gen2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ steps:
- name: node:16-alpine
id: build
script: |
set -x
# install dev deps and tools for the monorepo
apk add zip jq
npm install --ignore-scripts
# bootstrap only the packages needed for e2e-test-server
npx lerna bootstrap --scope=@google-cloud/e2e-test-server --include-dependencies
# bootstrap and compile only the packages needed for e2e test server
npm install --workspace=./e2e-test-server
npx lerna@^6 run compile --scope=@google-cloud/e2e-test-server --include-dependencies
# builds a small self contained bundle with @vercel/ncc under dist/
cd e2e-test-server
Expand All @@ -33,9 +35,8 @@ steps:
# create a new fake package.json in dist/ and zip it up into a source zip for Cloud
# Functions
cd dist
npm init -y
npm install --save @google-cloud/functions-framework
zip -r function-source.zip . -x "node_modules*"
cp ../fake.package.json package.json
zip -qr function-source.zip .
# Run the test
- name: $_TEST_RUNNER_IMAGE
Expand Down
2 changes: 1 addition & 1 deletion e2e-test-server/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "./node_modules/gts/"
"extends": "../node_modules/gts/"
}
9 changes: 3 additions & 6 deletions e2e-test-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ ENV SRC="/src"
WORKDIR $SRC

FROM node-base as build-base
# copy local dependencies
COPY lerna.json package.json package-lock.json ./
# Install dev tools in the root of the repo
RUN npm install --ignore-scripts
COPY . ./
# bootstrap only the packages needed for e2e test server
RUN npx lerna@latest bootstrap --scope=@google-cloud/e2e-test-server --include-dependencies
# bootstrap and compile only the packages needed for e2e test server
RUN npm install --workspace=./e2e-test-server
RUN npx lerna@^6 run compile --scope=@google-cloud/e2e-test-server --include-dependencies
# builds a small self contained bundle with @vercel/ncc under dist/
RUN cd e2e-test-server && npm run bundle

Expand Down
10 changes: 10 additions & 0 deletions e2e-test-server/fake.package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "cloud-functions-dist",
"version": "1.0.0",
"description": "A fake package.json used for the zip bundle sent to Cloud Functions",
"main": "index.js",
"dependencies": {
"@google-cloud/functions-framework": "3.2.0"
}
}
6 changes: 3 additions & 3 deletions e2e-test-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"node": ">=14"
},
"scripts": {
"lint": "gts lint",
"lint": "gts-lint.mjs",
"clean": "gts clean",
"compile": "tsc",
"fix": "gts fix",
"prepare": "npm run compile",
"fix": "gts-fix.mjs",
"prepack": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run lint",
"server": "node build/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion e2e-test-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./node_modules/gts/tsconfig-google.json",
"extends": "../node_modules/gts/tsconfig-google.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
Expand Down
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"packages": ["packages/*", "samples/*", "e2e-test-server"],
"ignoreChanges": ["**/test/**", "**/*.md", "**/package-lock.json"],
"version": "independent",
"useWorkspaces": true,
"command": {
"publish": {
"registry": "https://wombat-dressing-room.appspot.com"
Expand Down
Loading

0 comments on commit 8739a4e

Please sign in to comment.