Skip to content

Commit

Permalink
chore(update): use new versions of libs etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Jun 22, 2022
1 parent 5be3d1c commit 349d9e1
Show file tree
Hide file tree
Showing 15 changed files with 1,579 additions and 1,266 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Qlever LLC
# Copyright 2022 Qlever LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,21 +12,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build and push docker image
name: Build, test, and push service images

on:
push:
pull_request:

jobs:
call-build-and-push-service:
yarn:
name: yarn CI
uses: qlever-llc/workflows/.github/workflows/build-and-publish-package.yml@master
secrets:
npm_token: ${{ secrets.NPM_AUTH_TOKEN }}
with:
# Remove this line if your tests don't need an OADA instance
oada: true
publish: false
docker:
name: Docker CI
# Wait for yarn tests to pass?
#needs:
# - yarn
uses: qlever-llc/workflows/.github/workflows/build-and-push-service.yml@master
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_repo: ${{ secrets.DOCKER_REPO }}
snyk_org: ${{ secrets.SNYK_ORG }}
# Actual secrets
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
snyk_token: ${{ secrets.SNYK_TOKEN }}
cosign_key: ${{ secrets.COSIGN_KEY }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -50,7 +50,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -64,4 +64,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@
"program": "${workspaceFolder}/dist/index.js",
"preLaunchTask": "${defaultBuildTask}",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
},
{
"type": "node",
"request": "attach",
"name": "Docker: Attach to service container",
"smartStep": true,
"localRoot": "${workspaceFolder}",
"remoteRoot": "/usr/src/app",
"resolveSourceMapLocations": null,
"port": "${input:port}"
}
],
"inputs": [
{
"id": "port",
"type": "promptString",
"description": "Enter the port number of the inspector",
"default": "9229"
}
]
}
37 changes: 31 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"search.exclude": {
".git": true,
".dccache": true,
".history": true,
".nvimlog": true,
"node_modules": true,
"package.lock": true,
"*.log": true,
".nvimlog": true,
".DS_Store": true,
"dist": true,
".test": true,
"*.tsbuildinfo": true,
".actrc": true,
"act": true,
".yarn": true,
".pnp.*": true,
".vim": true,
"coverage": true,
"tags.*": true,
"**/.yarn": true,
"**/.pnp.*": true
},
Expand All @@ -22,23 +26,26 @@
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.nodePath": ".yarn/sdks",
"files.exclude": {
".git": true,
".dccache": true,
".history": true,
".nvimlog": true,
"node_modules": true,
"package.lock": true,
".nvimlog": true,
"*.log": true,
".DS_Store": true,
"dist": true,
".test": true,
"*.tsbuildinfo": true,
".actrc": true,
"act": true,
".yarn": true,
".pnp.*": true,
".vim": true
".vim": true,
"coverage": true,
"tags.*": true
},
"eslint.packageManager": "yarn",
"eslint.useESLintClass": true,
"licenser.author": "Qlever LLC",
"licenser.license": "AL2",
"cSpell.words": [
Expand All @@ -51,8 +58,26 @@
"trellisfw",
"unfisk",
"unflat",
"UNFLATTEN",
"unflatten",
"unflattened",
"unflattening"
"Unflattening"
],
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.useESLintClass": true,
"explorerExclude.backup": null,
"npm.packageManager": "yarn",
"debug.javascript.autoAttachFilter": "smart",
"debug.javascript.breakOnConditionalError": true,
"debug.javascript.defaultRuntimeExecutable": {
"node": "yarn",
"pwa-node": "yarn"
},
"debug.javascript.autoAttachSmartPattern": [
"${workspaceFolder}/**",
"!**/node_modules/**",
"**/$KNOWN_TOOLS$/**",
"!**/yarn-*",
"!**/ava-*/**/cli.mjs"
]
}
785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-3.2.1.cjs
38 changes: 26 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
# Copyright 2022 Qlever LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG NODE_VER=16-alpine
ARG SERVICE=Qlever-LLC/unfisk
ARG DIR=/usr/src/app/

FROM node:$NODE_VER AS install
ARG SERVICE
ARG DIR

WORKDIR /$SERVICE
WORKDIR ${DIR}

COPY ./.yarn /$SERVICE/.yarn
COPY ./package.json ./yarn.lock ./.yarnrc.yml /$SERVICE/
COPY ./.yarn ${DIR}.yarn
COPY ./package.json ./yarn.lock ./.yarnrc.yml ${DIR}

RUN yarn workspaces focus --all --production

FROM install AS build
ARG SERVICE
ARG DIR

# Install dev deps too
RUN yarn install --immutable

COPY . /$SERVICE/
COPY . ${DIR}

# Build code and remove dev deps
RUN yarn build --verbose && rm -rfv .yarn .pnp*

FROM node:$NODE_VER AS production
ARG SERVICE
ARG DIR

# Install needed packages
RUN apk add --no-cache \
dumb-init
dumb-init

# Do not run service as root
USER node

WORKDIR /$SERVICE
WORKDIR ${DIR}

COPY --from=install /$SERVICE/ /$SERVICE/
COPY --from=build /$SERVICE/ /$SERVICE/
COPY --from=install ${DIR} ${DIR}
COPY --from=build ${DIR} ${DIR}

# Launch entrypoint with dumb-init
# Remap SIGTERM to SIGINT https:/Yelp/dumb-init#signal-rewriting
Expand Down
44 changes: 23 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qlever-llc/unfisk",
"version": "1.2.4",
"version": "2.0.0",
"description": "OADA uservice to \"unflatten\" a list into a list of links",
"author": "Alex Layton <[email protected]>",
"license": "Apache-2.0",
Expand All @@ -11,10 +11,11 @@
"node": ">=16.0.0"
},
"scripts": {
"start": "node --enable-source-maps dist/index.js",
"build": "tsc -b",
"start": "node ${INSPECT:-} --enable-source-maps dist/index.js",
"test": "yarn build test && c8 ava",
"test:debug": "ava -T 60m -svc 1 --no-worker-threads"
"test:debug": "ava -T 60m -svc 1 --no-worker-threads",
"lint": "eslint ."
},
"ava": {
"failFast": false,
Expand Down Expand Up @@ -46,28 +47,29 @@
]
},
"dependencies": {
"@oada/client": "^4.0.0",
"convict": "^6.2.2",
"@oada/client": "^4.1.2",
"convict": "^6.2.3",
"debug": "^4.3.4",
"dotenv": "^16.0.0",
"dotenv": "^16.0.1",
"moment": "^2.29.3",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
"@tsconfig/node16": "^1.0.2",
"@tsconfig/node16": "^1.0.3",
"@types/convict": "^6.1.1",
"@types/debug": "^4.1.7",
"@types/node": "^16.11.27",
"@types/prettier": "^2.6.0",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@yarnpkg/sdks": "^3.0.0-rc.2",
"ava": "^4.2.0",
"eslint": "^8.13.0",
"@types/node": "^16.11.41",
"@types/prettier": "^2.6.3",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"@yarnpkg/sdks": "^3.0.0-rc.9",
"ava": "4.0.0-rc.1",
"c8": "^7.11.3",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-xo": "^0.40.0",
"eslint-config-xo-typescript": "^0.50.0",
"eslint-config-xo": "^0.41.0",
"eslint-config-xo-typescript": "^0.51.1",
"eslint-formatter-pretty": "^4.1.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-plugin-array-func": "^3.1.7",
Expand All @@ -85,12 +87,12 @@
"eslint-plugin-optimize-regex": "^1.2.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-regexp": "^1.6.0",
"eslint-plugin-regexp": "^1.7.0",
"eslint-plugin-security": "^1.5.0",
"eslint-plugin-sonarjs": "^0.13.0",
"eslint-plugin-unicorn": "^42.0.0",
"prettier": "^2.6.2",
"typescript": "^4.6.3"
"prettier": "^2.7.1",
"typescript": "^4.7.4"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].1"
}
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const config = convict({
env: 'TOKEN',
arg: 'token',
},
// TODO: why does it need to be so long??
// ???: why does it need to be so long??
throttle: {
doc: 'Rate limit of how long to between unflattening items (ms)',
format: Number,
Expand Down
Loading

0 comments on commit 349d9e1

Please sign in to comment.