Skip to content

Commit

Permalink
fix: create a subdirectory on init, publish scripts package
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgee committed Aug 27, 2019
1 parent c84c7cc commit 7979627
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"repository": "https://github.com/amcgee/dhis2-app-platform",
"author": "Austin McGee <[email protected]>",
"license": "BSD-3-Clause",
"publishConfig": {
"access": "public"
},
"files": [
"assets",
"bin",
Expand Down
17 changes: 10 additions & 7 deletions cli/src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const chalk = require('chalk')

const makePaths = require('../lib/paths')

const handler = async ({ force, name, title, cwd, lib }) => {
const handler = async ({ force, name, cwd, lib }) => {
cwd = cwd || process.cwd()
cwd = path.join(cwd, name)
fs.mkdirpSync(cwd)
const paths = makePaths(cwd)

if (fs.existsSync(paths.config) && !force) {
Expand Down Expand Up @@ -145,7 +148,12 @@ const handler = async ({ force, name, title, cwd, lib }) => {

reporter.print('')
reporter.info('SUCCESS!')
reporter.print('Run `yarn start` to launch your new DHIS2 application')
const cdCmd = name != '.' ? `cd ${name} && ` : ''
reporter.print(
`Run ${chalk.bold(
`${cdCmd}yarn start`
)} to launch your new DHIS2 application`
)
}

const command = {
Expand All @@ -162,11 +170,6 @@ const command = {
type: 'boolean',
default: false,
},
title: {
description:
'The human-readable title of the application or library',
type: 'string',
},
},
handler,
}
Expand Down

0 comments on commit 7979627

Please sign in to comment.