Skip to content

Commit

Permalink
fix!: Move to a single package.json at the top level (#255)
Browse files Browse the repository at this point in the history
* chore: Use strict JS type checking

* fix!: Move to a single package.json at the top level

All package.jsons in subdirs are removed, merging the contents down.
Cloud Build and dockerfiles now in root.

feat: Get version number from package.json for counters and user-agents
chore: Update workflows for single package.json
chore: Update dockerfile builds for single package.json
chore: Split src/index.js into separate files for unified scaler and cloud function invokers
chore: Add root directory files to gcloudignore and functions src builder
  • Loading branch information
nielm authored Mar 25, 2024
1 parent d0d6c81 commit e63dad4
Show file tree
Hide file tree
Showing 58 changed files with 7,722 additions and 39,130 deletions.
17 changes: 14 additions & 3 deletions .gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:

.git
.gitignore

.github
.nyc_output
.vscode
kubernetes
node_modules
resources
terraform
test/
.eslint*
.mdl*
.prettier*
*release-please*
*.md

#!include:.gitignore
93 changes: 1 addition & 92 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,99 +19,8 @@ updates:
commit-message:
prefix: "fix"

- directory: "/src"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

- directory: "/src/autoscaler-common"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

- directory: "/src/forwarder"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

- directory: "/src/poller"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

- directory: "/src/poller/poller-core"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

- directory: "/src/scaler"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

- directory: "/src/scaler/scaler-core"
package-ecosystem: "npm"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
commit-message:
prefix: "fix"

# Docker dependencies
- directory: "/src"
package-ecosystem: "docker"
schedule:
interval: "weekly"
commit-message:
prefix: "fix"

- directory: "/src/poller"
package-ecosystem: "docker"
schedule:
interval: "weekly"
commit-message:
prefix: "fix"

- directory: "/src/scaler"
package-ecosystem: "docker"
schedule:
interval: "weekly"
commit-message:
prefix: "fix"

- directory: "/src/forwarder"
- directory: "/"
package-ecosystem: "docker"
schedule:
interval: "weekly"
Expand Down
34 changes: 2 additions & 32 deletions .github/workflows/codehealth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,14 @@ jobs:
node-version: 20
check-latest: true

- name: Install eslint and typescript compiler
run: npm install

- name: Install node modules in src/
working-directory: src
- name: Install node modules
run: npm install

- name: Execute "npm run typecheck"
working-directory: .
run: npm run typecheck

- name: Execute "npm run eslint"
run: npm run eslint

- name: NPM Audit src/
working-directory: src
run: npm audit

- name: NPM Audit src/forwarder
working-directory: src/forwarder
run: npm audit

- name: NPM Audit src/poller
working-directory: src/poller
run: npm audit

- name: NPM Audit src/poller/poller-core
working-directory: src/poller/poller-core
run: npm audit

- name: NPM Audit src/scaler
working-directory: src/scaler
run: npm audit

- name: NPM Audit src/scaler/scaler-core
working-directory: src/scaler/scaler-core
run: npm audit

- name: NPM Audit root
working-directory: .
- name: NPM Audit
run: npm audit
20 changes: 2 additions & 18 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: npm install in autoscaler-common
working-directory: src/autoscaler-common
- name: npm install
run: npm install

- name: npm install in poller-core
working-directory: src/poller/poller-core
run: npm install

- name: poller-core unit tests
working-directory: src/poller/poller-core
run: npm test
env:
CI: true

- name: npm install in scaler-core
working-directory: src/scaler/scaler-core
run: npm install

- name: scaler-core unit tests
working-directory: src/scaler/scaler-core
- name: Unit tests
run: npm test
env:
CI: true
14 changes: 5 additions & 9 deletions src/Dockerfile-poller → Dockerfile-poller
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS build-env

WORKDIR /usr/src/app
COPY autoscaler-common/ autoscaler-common/
COPY poller/ poller/

WORKDIR /usr/src/app/autoscaler-common
COPY src/autoscaler-common/ src/autoscaler-common/
COPY src/poller/ src/poller/
COPY package*.json ./
RUN npm config set update-notifier false
RUN npm install --omit=dev

WORKDIR /usr/src/app/poller
RUN npm install --omit=dev

FROM gcr.io/distroless/nodejs${NODE_VERSION}:latest
COPY --from=build-env /usr/src/app /usr/src/app
WORKDIR /usr/src/app/poller/poller-core
WORKDIR /usr/src/app/

CMD ["-e", "require('../index').main()"]
CMD ["-e", "require('./src/poller/index').main()"]
11 changes: 6 additions & 5 deletions src/Dockerfile-unified → Dockerfile-scaler
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS build-env

WORKDIR /usr/src/app
COPY . .

COPY src/autoscaler-common/ src/autoscaler-common/
COPY src/scaler/ src/scaler/
COPY package*.json ./
RUN npm config set update-notifier false
RUN npm install --omit=dev
RUN npm install --omit=dev

FROM gcr.io/distroless/nodejs${NODE_VERSION}:latest
COPY --from=build-env /usr/src/app /usr/src/app
WORKDIR /usr/src/app/scaler/scaler-core
WORKDIR /usr/src/app/

CMD ["-e", "require('../../index').main()"]
CMD ["-e", "require('./src/scaler/index').main()"]
18 changes: 8 additions & 10 deletions src/Dockerfile-scaler → Dockerfile-unified
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS build-env

WORKDIR /usr/src/app
COPY autoscaler-common/ autoscaler-common/
COPY scaler/ scaler/

WORKDIR /usr/src/app/autoscaler-common
COPY src/autoscaler-common/ src/autoscaler-common/
COPY src/scaler/scaler-core/ src/scaler/scaler-core/
COPY src/poller/poller-core/ src/poller/poller-core/
COPY src/unifiedScaler.js src/
COPY package*.json ./
RUN npm config set update-notifier false
RUN npm install --omit=dev

WORKDIR /usr/src/app/scaler
RUN npm install --omit=dev
RUN npm install --omit=dev

FROM gcr.io/distroless/nodejs${NODE_VERSION}:latest
COPY --from=build-env /usr/src/app /usr/src/app
WORKDIR /usr/src/app/scaler/scaler-core
WORKDIR /usr/src/app/

CMD ["-e", "require('../index').main()"]
CMD ["-e", "require('./src/unifiedScaler').main()"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"target": "ES6",
"checkJs": true,
"allowJs": true,
"noEmit": true
"noEmit": true,
"strict": true,
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["src/**/node_modules"]
"include": ["src/**/*"]
}
Loading

0 comments on commit e63dad4

Please sign in to comment.