Skip to content

Commit

Permalink
Update build script to fix missing version
Browse files Browse the repository at this point in the history
  • Loading branch information
aturingmachine committed Sep 2, 2021
1 parent d94ec9f commit 22b6fdb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxtapose",
"version": "0.0.1-beta.0.1.4",
"version": "0.0.1-beta.0.1.5",
"description": "Generate Files For Nuxt Projects",
"keywords": [
"nuxt",
Expand All @@ -20,8 +20,9 @@
"main": "dist/index.js",
"bin": "dist/index.js",
"scripts": {
"build": "tsc",
"dev": "tsc && node dist/index.js",
"build": "sh ./scripts/build.sh",
"compile": "tsc",
"dev": "npm run compile && node dist/index.js",
"lint": "eslint --max-warnings 0 'src/**'",
"lint:fix": "eslint --fix --max-warnings 0 'src/**'",
"test": "jest",
Expand Down
19 changes: 19 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env sh

###
# nuxtapose build script
#
# compiles the typescript then injects the version
# number from the package.json
###

echo ">>> Compiling Typescript..."
npm run compile

echo ">>> Updating Version number..."

PACKAGE_VERSION_NUMBER=$(grep version package.json | awk '{print $2}' | sed 's/[\"|,]//g')

sed -i 's/NP_VERSION_NUMBER/'$PACKAGE_VERSION_NUMBER'/g' dist/index.js

echo ">>> Build complete."
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const program = new Command()

program
.name('nuxtapose')
.version(process.env.npm_package_version || '0.0.1-beta.0.x.x')
.version('NP_VERSION_NUMBER')
.addHelpText('beforeAll', banner)
.hook('preAction', () => console.log(banner))
.option('-d, --debug', 'Increase logging verbosity')
Expand Down

0 comments on commit 22b6fdb

Please sign in to comment.