From 84705a1701e8296c2be7bc07374c355bef75c7ad Mon Sep 17 00:00:00 2001 From: Denis Tokarev Date: Tue, 30 Jun 2020 22:51:28 +1000 Subject: [PATCH] Do not demand content name --- bin/commands/create.js | 10 ++++++---- package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/commands/create.js b/bin/commands/create.js index bbba5ec..c4b78b9 100755 --- a/bin/commands/create.js +++ b/bin/commands/create.js @@ -18,7 +18,7 @@ exports.builder = (yargs) => { describe: 'content type name', type: 'string', requiresArg: true, - demandOption: true + demandOption: false }) .option('template-file', { alias: 't', @@ -41,13 +41,15 @@ exports.builder = (yargs) => { } exports.handler = ({ name, contentType, templateFile, extension }) => { - const migrationsDirectory = path.join('.', 'migrations', contentType) + const migrationsDirectory = !!contentType + ? path.join(process.cwd(), 'migrations', contentType) + : path.join(process.cwd(), 'migrations') templateFile = !!templateFile - ? path.isAbsolute(templateFile) + ? path.isAbsolute(templateFile) ? templateFile : path.join(process.cwd(), templateFile) : !!process.env.TEMPLATE_FILE && typeof process.env.TEMPLATE_FILE === 'string' - ? path.isAbsolute(process.env.TEMPLATE_FILE) + ? path.isAbsolute(process.env.TEMPLATE_FILE) ? process.env.TEMPLATE_FILE : path.join(process.cwd(), process.env.TEMPLATE_FILE) : path.join(__dirname, '..', '..', 'lib', 'template.js') diff --git a/package.json b/package.json index fc4bb53..adfdd8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "contentful-migrate-fork", - "version": "0.13.0", + "version": "0.13.1", "description": "Migration tooling for Contentful, with state management and custom templates support", "keywords": [ "migrate",