Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Provide --compiler flag for up, down, list #82

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
12 changes: 11 additions & 1 deletion bin/commands/down.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require('path')
const runMigrations = require('migrate/lib/migrate')
const log = require('migrate/lib/log')
const load = require('../../lib/load')
const registerCompiler = require('migrate/lib/register-compiler')

exports.command = 'down [file]'

Expand Down Expand Up @@ -40,6 +41,11 @@ exports.builder = (yargs) => {
describe: 'single content type name to process',
demandOption: true
})
.option('compiler', {
describe: 'compiler to add, e.g. "ts:./tsnode.js"',
type: 'string',
requiresArg: false
})
.option('dry-run', {
alias: 'd',
describe: 'only shows the planned actions, don\'t write anything to Contentful',
Expand All @@ -59,8 +65,12 @@ exports.handler = async (args) => {
dryRun,
environmentId,
file,
spaceId
spaceId,
compiler
} = args
if (compiler) {
registerCompiler(compiler)
}

const migrationsDirectory = path.join('.', 'migrations')

Expand Down
12 changes: 11 additions & 1 deletion bin/commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const chalk = require('chalk')
const dateFormat = require('dateformat')
const log = require('migrate/lib/log')
const load = require('../../lib/load')
const registerCompiler = require('migrate/lib/register-compiler')

exports.command = 'list'

Expand Down Expand Up @@ -42,6 +43,11 @@ exports.builder = (yargs) => {
array: true,
default: []
})
.option('compiler', {
describe: 'compiler to add, e.g. "ts:./tsnode.js"',
type: 'string',
requiresArg: false
})
.option('all', {
alias: 'a',
describe: 'lists migrations for all content types',
Expand All @@ -59,8 +65,12 @@ exports.builder = (yargs) => {
}

exports.handler = async ({
spaceId, environmentId, contentType, accessToken
spaceId, environmentId, contentType, accessToken, compiler
}) => {
if (compiler) {
registerCompiler(compiler)
}

const migrationsDirectory = path.join('.', 'migrations')

const listSet = (set) => {
Expand Down
12 changes: 11 additions & 1 deletion bin/commands/up.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const pMap = require('p-map')
const runMigrations = require('migrate/lib/migrate')
const log = require('migrate/lib/log')
const load = require('../../lib/load')
const registerCompiler = require('migrate/lib/register-compiler')

exports.command = 'up [file]'

Expand Down Expand Up @@ -45,6 +46,11 @@ exports.builder = (yargs) => {
array: true,
default: []
})
.option('compiler', {
describe: 'compiler to add, e.g. "ts:./tsnode.js"',
type: 'string',
requiresArg: false
})
.option('all', {
alias: 'a',
describe: 'processes migrations for all content types',
Expand Down Expand Up @@ -83,8 +89,12 @@ exports.handler = async (args) => {
dryRun,
environmentId,
file,
spaceId
spaceId,
compiler
} = args
if (compiler) {
registerCompiler(compiler)
}

const migrationsDirectory = path.join('.', 'migrations')

Expand Down