(opts: InitOptions = {})
| 109 | const checkBoolean = (value) => (value && value !== 'false' ? true : false); |
| 110 | |
| 111 | export const initPlugin = async (opts: InitOptions = {}) => { |
| 112 | printRow('Start project creation...'); |
| 113 | opts.components = checkBoolean(opts.components); |
| 114 | opts.blocks = checkBoolean(opts.blocks); |
| 115 | opts.i18n = checkBoolean(opts.i18n); |
| 116 | |
| 117 | const tasks = new Listr([ |
| 118 | { |
| 119 | title: 'Creating initial source files', |
| 120 | task: () => createSourceFiles(opts), |
| 121 | }, |
| 122 | { |
| 123 | title: 'Creating custom Component Type file', |
| 124 | task: () => createFileComponents(opts), |
| 125 | enabled: () => opts.components, |
| 126 | }, |
| 127 | { |
| 128 | title: 'Creating Blocks file', |
| 129 | task: () => createFileBlocks(opts), |
| 130 | enabled: () => opts.blocks, |
| 131 | }, |
| 132 | { |
| 133 | title: 'Creating i18n structure', |
| 134 | task: () => createI18n(opts), |
| 135 | enabled: () => opts.i18n, |
| 136 | }, |
| 137 | { |
| 138 | title: 'Update package.json', |
| 139 | task: () => createPackage(opts), |
| 140 | }, |
| 141 | ]); |
| 142 | await tasks.run(); |
| 143 | }; |
| 144 | |
| 145 | export default async (opts: InitOptions = {}) => { |
| 146 | const rootDir = path.basename(process.cwd()); |
no test coverage detected