ember-codemod-remove-global-styles
Version:
Codemod to localize global styles
37 lines (36 loc) • 1.06 kB
JavaScript
;
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { runCodemod } from '../src/index.js';
// Provide a title to the process in `ps`
process.title = 'ember-codemod-remove-global-styles';
// Set codemod options
const argv = yargs(hideBin(process.argv))
.option('convert', {
choices: ['components', 'routes'],
describe: 'Which type of files to consider',
type: 'array',
})
.option('folder', {
describe: 'Which folder to consider',
type: 'string',
})
.option('root', {
describe: 'Where to run the codemod',
type: 'string',
})
.option('src', {
demandOption: true,
describe: 'Location of the global stylesheet (e.g. app/assets/app.css)',
type: 'string',
})
.parseSync();
const DEFAULT_FOR_CONVERT = ['components', 'routes'];
const codemodOptions = {
convert: new Set(argv['convert'] ?? DEFAULT_FOR_CONVERT),
folder: argv['folder'] ?? '',
projectRoot: argv['root'] ?? process.cwd(),
src: argv['src'],
};
runCodemod(codemodOptions);