MCPcopy
hub / github.com/GrapesJS/grapesjs / initPlugin

Function initPlugin

packages/cli/src/init.ts:111–143  ·  view source on GitHub ↗
(opts: InitOptions = {})

Source from the content-addressed store, hash-verified

109const checkBoolean = (value) => (value && value !== 'false' ? true : false);
110
111export 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
145export default async (opts: InitOptions = {}) => {
146 const rootDir = path.basename(process.cwd());

Callers 1

init.tsFile · 0.85

Calls 8

printRowFunction · 0.90
checkBooleanFunction · 0.85
createSourceFilesFunction · 0.85
createFileComponentsFunction · 0.85
createFileBlocksFunction · 0.85
createI18nFunction · 0.85
createPackageFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected