MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / scaffold

Method scaffold

packages/cli/lib/project-generator.js:251–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249 }
250
251 scaffold() {
252 if (this.shouldExit()) return false;
253
254 this.destinationRoot(this.projectInfo.outdir);
255
256 // Store information for cli operation in .yo.rc.json
257 this.config.set('packageManager', this.options.packageManager || 'npm');
258 this.config.set('version', cliVersion);
259
260 // First copy common files from ../../project/templates
261 this.copyTemplatedFiles(
262 this.templatePath('../../project/templates/**/*'),
263 this.destinationPath(''),
264 {
265 project: this.projectInfo,
266 packageManager: this.config.get('packageManager'),
267 author: this.user.git.email()
268 ? {
269 name: this.user.git.name(),
270 email: this.user.git.email(),
271 }
272 : null,
273 },
274 );
275
276 // Rename `_.gitignore` back to `.gitignore`.
277 // Please note `.gitignore` will be renamed to `.npmignore` during publish
278 // if it's there in the templates.
279 this.fs.move(
280 this.destinationPath('_.gitignore'),
281 this.destinationPath('.gitignore'),
282 );
283
284 // Copy project type specific files from ./templates
285 this.copyTemplatedFiles(
286 this.templatePath('**/*'),
287 this.destinationPath(''),
288 {
289 project: this.projectInfo,
290 packageManager: this.config.get('packageManager'),
291 },
292 );
293
294 if (!this.projectInfo.eslint) {
295 this.fs.delete(this.destinationPath('.eslintrc.*.ejs'));
296 this.fs.delete(this.destinationPath('.eslintignore'));
297 }
298
299 if (!this.projectInfo.prettier) {
300 this.fs.delete(this.destinationPath('.prettier*'));
301 }
302
303 if (!this.projectInfo.loopbackBuild) {
304 this.fs.move(
305 this.destinationPath('package.plain.json.ejs'),
306 this.destinationPath('package.json.ejs'),
307 );
308 } else {

Callers

nothing calls this directly

Calls 5

shouldExitMethod · 0.80
copyTemplatedFilesMethod · 0.80
setMethod · 0.65
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected