Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add helper action --version #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion modules/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { logTask, logError } from './LogUtils'
import init from './init'
import build from './build'
import start from './start'
import version from './version'

const action = process.argv[2]

Expand All @@ -11,7 +12,13 @@ const actions = {
init
}

if (actions[action]) {
const helperActions = {
'--version': version
}

if (helperActions[action]) {
helperActions[action]()
} else if (actions[action]) {
logTask(`[${action}]`, 'task')
actions[action](() => {
logTask(`[${action}]`, 'task complete')
Expand Down
7 changes: 7 additions & 0 deletions modules/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { log } from './LogUtils'
import { getPackageJSON } from './PackageUtils'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the app's package.json, not the libraries :\


export default function version() {
const pkg = getPackageJSON()
log(pkg.version)
}