Skip to content

Commit

Permalink
Merge pull request #416 from TAMULib/bundle-version_txt
Browse files Browse the repository at this point in the history
Provide the version in the dist bundle when building.
  • Loading branch information
kaladay committed Nov 19, 2021
2 parents a7dc84c + 76fd323 commit d35fbd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"DOCKER_SERVER": ""
},
"scripts": {
"build": "ng build --configuration production --single-bundle --output-hashing none",
"build": "ng build --configuration production --single-bundle --output-hashing none && npm run build:version",
"build:clean": "npm run clean && npm run build",
"build:tl-elements": "ng build --configuration production tl-elements",
"build:tl-components": "node scripts/build-tl-components.js",
"build:tl-components": "node scripts/build-tl-components.js && npm run build:version",
"build:tl-components-static": "node scripts/build-tl-components-static.js",
"build:lighthouse": "node scripts/build-lighthouse.js",
"prebuild": "npm run build:tl-elements",
Expand All @@ -31,6 +31,7 @@
"build:static-docs": "npm run test:audit && npm run build:static-setup && npm run build:docs-setup && npm run build:docs-development && npm run build:docs-usage",
"build:static-reports": "npm run build:static-setup && npm run test:coverage",
"build:static-production": "npm run build:static && node ./scripts/build-tl-components-configuration.js defaults-ci-overrides.env",
"build:version": "node ./scripts/build-version.js",
"clean": "npm run clean:dist && npm run clean:static",
"clean:dist": "rimraf dist",
"clean:static": "rimraf static",
Expand Down
6 changes: 6 additions & 0 deletions scripts/build-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node
const fs = require('fs-extra');

if (fs.existsSync('./dist')) {
fs.writeFile('./dist/bundle/version.txt', process.env.npm_package_version);
}

0 comments on commit d35fbd4

Please sign in to comment.