Skip to content

Commit

Permalink
Do not demand content name
Browse files Browse the repository at this point in the history
  • Loading branch information
devlato committed Jun 30, 2020
1 parent 0dd02f2 commit 84705a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions bin/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.builder = (yargs) => {
describe: 'content type name',
type: 'string',
requiresArg: true,
demandOption: true
demandOption: false
})
.option('template-file', {
alias: 't',
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 84705a1

Please sign in to comment.