1
0
Fork 0

fix(build): interpolate bundle with version metadata

This commit is contained in:
Sean Sube 2022-02-03 08:54:50 -06:00
parent 41884525da
commit 2893437718
5 changed files with 14 additions and 18 deletions

View File

@ -14,7 +14,7 @@ COPY docs/config-docker.yml /root/.salty-dog.yml
# copy package first, to invalidate other layers when version changes
COPY package.json /salty-dog/package.json
COPY yarn.lock /salty-dog/yarn.lock
RUN yarn install --development
RUN yarn install --production
# copy chunks, largest to smallest (entrypoint)
COPY out/src/ /salty-dog/out/

View File

@ -15,8 +15,7 @@ COPY docs/config-docker.yml /root/.salty-dog.yml
# copy package first, to invalidate other layers when version changes
COPY package.json /salty-dog/package.json
COPY yarn.lock /salty-dog/yarn.lock
RUN yarn install --development
# --production
RUN yarn install --production
# copy build
COPY out/src/ /salty-dog/out/

View File

@ -16,12 +16,6 @@ build({
'.js': '.cjs',
},
platform: 'node',
plugins: [
IgnorePlugin([{
resourceRegExp: /(dtrace-provider|ink|mv|node-fetch)/,
contextRegExp: /node_modules/,
}]),
],
}).catch((err) => {
console.error(err);
process.exit(1);

View File

@ -1,9 +1,10 @@
# node options
NODE_BIN = $(ROOT_PATH)node_modules/.bin
NODE_CMD ?= $(shell env node)
NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy
export NODE_VERSION := $(shell node -v 2>/dev/null || echo "none")
export PACKAGE_NAME := $(shell jq -r '.name' package.json)
export PACKAGE_VERSION := $(shell jq -r '.version' package.json)
# directory targets
node_modules: deps
@ -14,6 +15,8 @@ out: build
build: ## build the app
build: node_modules
yarn tsc
cat $(TARGET_PATH)/src/version.js | envsubst > $(TARGET_PATH)/src/version-out.js
mv $(TARGET_PATH)/src/version-out.js $(TARGET_PATH)/src/version.js
bundle: build
node config/esbuild.mjs

View File

@ -1,15 +1,15 @@
export const VERSION_INFO = {
build: {
job: '{{ BUILD_JOB }}',
node: '{{ NODE_VERSION }}',
runner: '{{ BUILD_RUNNER }}',
job: '${BUILD_JOB}',
node: '${NODE_VERSION}',
runner: '${BUILD_RUNNER}',
},
git: {
branch: '{{ GIT_BRANCH }}',
commit: '{{ GIT_COMMIT }}',
branch: '${GIT_BRANCH}',
commit: '${GIT_COMMIT}',
},
package: {
name: '{{ PACKAGE_NAME }}',
version: '{{ PACKAGE_VERSION }}',
name: '${PACKAGE_NAME}',
version: '${PACKAGE_VERSION}',
},
};