Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleDiff (file, original, formatted) {
var diff
var color = require('colorette')
if (original === formatted) {
diff = 'There is no difference with the original file.'
}
if (color.enabled) {
file = color.blue(file)
if(diff) {
diff = color.gray(diff)
} else {
var JsDiff = require('diff')
diff = JsDiff.createPatch(file, original, formatted)
diff = diff.split('\n').splice(4).map(function (line) {
if (line[0] === '+') {
line = color.green(line)
} else if (line[0] === '-') {
line = color.red(line)
} else if (line.match(/^@@\s+.+?\s+@@/) || '\\ No newline at end of file' === line) {
line = ''
}
return color.gray(line)
})
diff = diff.join('\n').trim()
const outputConfigs = {
index: getOutputConfig('index.js'),
indexMin: getOutputConfig('index.min.js', { min: true }),
all: getOutputConfig('index.all.js'),
allMin: getOutputConfig('index.all.min.js', { min: true }),
}
bundles.index.write(outputConfigs.index)
bundles.indexMin.write(outputConfigs.indexMin)
bundles.all.write(outputConfigs.all)
bundles.allMin.write(outputConfigs.allMin)
}
console.log(green('Bundles complete'))
console.log(blue('\n⏳ Building CSS themes...'))
for (const theme of fs.readdirSync('./build/themes')) {
const preparedThemeConfig = createRollupConfigWithoutPlugins(
`./build/themes/${theme}`,
)
const outputFile = `./themes/${theme.replace('.js', '.css')}`
const bundle = await rollup(
preparedThemeConfig(createPluginSCSS(outputFile)),
)
await bundle.write(getOutputConfigs.theme(theme))
fs.unlinkSync(`./themes/${theme}`)
}
console.log(green('✓ Themes\n'))
}
const build = async () => {
console.log(blue('⏳ Building bundles...'))
const preCSSBundle = await rollup(
getRollupConfigs.css(createPluginSCSS('./index.css')),
)
await preCSSBundle.write(getOutputConfigs.css('./index.js'))
fs.unlinkSync('./index.js')
console.log('CSS done')
const bundles = {
index: await rollup(getRollupConfigs.index(pluginConfigs.index)),
indexMin: await rollup(getRollupConfigs.index(pluginConfigs.indexMinify)),
all: await rollup(getRollupConfigs.all(pluginConfigs.all)),
allMin: await rollup(getRollupConfigs.all(pluginConfigs.allMinify)),
}
.then((version) => {
success(color.green('Current Version: ') + color.blue(version));
})
.catch(exit);
return text.replace(/<([^>]+)>/gi, (match) => {
return c.blue(match);
}).replace(//gi, (match) => {
return c.magenta(match);
function invoke(env) {
env.modulePath = env.modulePath || env.knexpath || process.env.KNEX_PATH;
const filetypes = ['js', 'coffee', 'ts', 'eg', 'ls'];
let pending = null;
const cliVersion = [
color.blue('Knex CLI version:'),
color.green(cliPkg.version),
].join(' ');
const localVersion = [
color.blue('Knex Local version:'),
color.green(env.modulePackage.version || 'None'),
].join(' ');
commander
.version(`${cliVersion}\n${localVersion}`)
.option('--debug', 'Run with debugging.')
.option('--knexfile [path]', 'Specify the knexfile path.')
.option('--knexpath [path]', 'Specify the path to knex instance.')
.option('--cwd [path]', 'Specify the working directory.')
.option('--client [name]', 'Set DB client without a knexfile.')
.option('--connection [address]', 'Set DB connection without a knexfile.')
.option(
'--migrations-directory [path]',
'Set migrations directory without a knexfile.'
)
.option(
function invoke(env) {
env.modulePath = env.modulePath || env.knexpath || process.env.KNEX_PATH;
const filetypes = ['js', 'coffee', 'ts', 'eg', 'ls'];
let pending = null;
const cliVersion = [
color.blue('Knex CLI version:'),
color.green(cliPkg.version),
].join(' ');
const localVersion = [
color.blue('Knex Local version:'),
color.green(env.modulePackage.version || 'None'),
].join(' ');
commander
.version(`${cliVersion}\n${localVersion}`)
.option('--debug', 'Run with debugging.')
.option('--knexfile [path]', 'Specify the knexfile path.')
.option('--knexpath [path]', 'Specify the path to knex instance.')
.option('--cwd [path]', 'Specify the working directory.')
.option('--client [name]', 'Set DB client without a knexfile.')
.option('--connection [address]', 'Set DB connection without a knexfile.')
fileMoveAction(from, to) {
if (this.options.logLevel < 3) {
return
}
this.info(
`${colors.blue('Moved')} ${colors.green(
path.relative(process.cwd(), from)
)} ${colors.dim('->')} ${colors.green(path.relative(process.cwd(), to))}`
)
}
}