From 797962757f6fa25326997cbad3d568fe8065165c Mon Sep 17 00:00:00 2001 From: Austin McGee <947888+amcgee@users.noreply.github.com> Date: Tue, 27 Aug 2019 20:54:44 +0200 Subject: [PATCH] fix: create a subdirectory on init, publish scripts package --- cli/package.json | 3 +++ cli/src/commands/init.js | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cli/package.json b/cli/package.json index 234621799..470c71496 100644 --- a/cli/package.json +++ b/cli/package.json @@ -5,6 +5,9 @@ "repository": "https://github.com/amcgee/dhis2-app-platform", "author": "Austin McGee ", "license": "BSD-3-Clause", + "publishConfig": { + "access": "public" + }, "files": [ "assets", "bin", diff --git a/cli/src/commands/init.js b/cli/src/commands/init.js index 6ac42988a..f28c8f225 100644 --- a/cli/src/commands/init.js +++ b/cli/src/commands/init.js @@ -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) { @@ -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 = { @@ -162,11 +170,6 @@ const command = { type: 'boolean', default: false, }, - title: { - description: - 'The human-readable title of the application or library', - type: 'string', - }, }, handler, }