fix(build): interpolate bundle with version metadata
This commit is contained in:
parent
41884525da
commit
2893437718
|
@ -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 first, to invalidate other layers when version changes
|
||||||
COPY package.json /salty-dog/package.json
|
COPY package.json /salty-dog/package.json
|
||||||
COPY yarn.lock /salty-dog/yarn.lock
|
COPY yarn.lock /salty-dog/yarn.lock
|
||||||
RUN yarn install --development
|
RUN yarn install --production
|
||||||
|
|
||||||
# copy chunks, largest to smallest (entrypoint)
|
# copy chunks, largest to smallest (entrypoint)
|
||||||
COPY out/src/ /salty-dog/out/
|
COPY out/src/ /salty-dog/out/
|
||||||
|
|
|
@ -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 first, to invalidate other layers when version changes
|
||||||
COPY package.json /salty-dog/package.json
|
COPY package.json /salty-dog/package.json
|
||||||
COPY yarn.lock /salty-dog/yarn.lock
|
COPY yarn.lock /salty-dog/yarn.lock
|
||||||
RUN yarn install --development
|
RUN yarn install --production
|
||||||
# --production
|
|
||||||
|
|
||||||
# copy build
|
# copy build
|
||||||
COPY out/src/ /salty-dog/out/
|
COPY out/src/ /salty-dog/out/
|
||||||
|
|
|
@ -16,12 +16,6 @@ build({
|
||||||
'.js': '.cjs',
|
'.js': '.cjs',
|
||||||
},
|
},
|
||||||
platform: 'node',
|
platform: 'node',
|
||||||
plugins: [
|
|
||||||
IgnorePlugin([{
|
|
||||||
resourceRegExp: /(dtrace-provider|ink|mv|node-fetch)/,
|
|
||||||
contextRegExp: /node_modules/,
|
|
||||||
}]),
|
|
||||||
],
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# node options
|
# node options
|
||||||
NODE_BIN = $(ROOT_PATH)node_modules/.bin
|
|
||||||
NODE_CMD ?= $(shell env node)
|
NODE_CMD ?= $(shell env node)
|
||||||
NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy
|
NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy
|
||||||
|
|
||||||
export NODE_VERSION := $(shell node -v 2>/dev/null || echo "none")
|
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
|
# directory targets
|
||||||
node_modules: deps
|
node_modules: deps
|
||||||
|
@ -14,6 +15,8 @@ out: build
|
||||||
build: ## build the app
|
build: ## build the app
|
||||||
build: node_modules
|
build: node_modules
|
||||||
yarn tsc
|
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
|
bundle: build
|
||||||
node config/esbuild.mjs
|
node config/esbuild.mjs
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
export const VERSION_INFO = {
|
export const VERSION_INFO = {
|
||||||
build: {
|
build: {
|
||||||
job: '{{ BUILD_JOB }}',
|
job: '${BUILD_JOB}',
|
||||||
node: '{{ NODE_VERSION }}',
|
node: '${NODE_VERSION}',
|
||||||
runner: '{{ BUILD_RUNNER }}',
|
runner: '${BUILD_RUNNER}',
|
||||||
},
|
},
|
||||||
git: {
|
git: {
|
||||||
branch: '{{ GIT_BRANCH }}',
|
branch: '${GIT_BRANCH}',
|
||||||
commit: '{{ GIT_COMMIT }}',
|
commit: '${GIT_COMMIT}',
|
||||||
},
|
},
|
||||||
package: {
|
package: {
|
||||||
name: '{{ PACKAGE_NAME }}',
|
name: '${PACKAGE_NAME}',
|
||||||
version: '{{ PACKAGE_VERSION }}',
|
version: '${PACKAGE_VERSION}',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue