-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): remove copyright header from generated app #991
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const application = (module.exports = require('./dist')); | ||
|
||
if (require.main === module) { | ||
// Run the application | ||
application.main(); | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Uncomment these imports to begin using these cool features! | ||
|
||
// import {inject} from @loopback/context; | ||
|
||
|
||
export class <%= name %>Controller { | ||
constructor() {} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dist'; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist'); |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {Component, ProviderMap} from '@loopback/core'; | ||
|
||
export class <%= project.componentName %> implements Component { | ||
constructor() {} | ||
|
||
providers?: ProviderMap = { | ||
}; | ||
|
||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './component'; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './src'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
// License text available at https://opensource.org/licenses/MIT | ||
|
||
'use strict'; | ||
const rename = require('gulp-rename'); | ||
const BaseGenerator = require('./base-generator'); | ||
const utils = require('./utils'); | ||
|
||
|
@@ -55,6 +56,26 @@ module.exports = class ProjectGenerator extends BaseGenerator { | |
const isValid = utils.validate(this.args[0]); | ||
if (typeof isValid === 'string') throw new Error(isValid); | ||
} | ||
|
||
this.setupRenameTransformer(); | ||
} | ||
|
||
/** | ||
* Registers a Transform Stream with Yeoman. Removes `.template` extension | ||
* from files that have it during project generation. | ||
*/ | ||
setupRenameTransformer() { | ||
this.registerTransformStream( | ||
rename(function(file) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a function that can do this for us without having to import another package? I guess it's not a huge deal regardless though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can write a function ourselves ... but I didn't want to re-invent the wheel. (And it requires dealing with streams ... ) |
||
// extname already contains a leading '.' | ||
const fileName = `${file.basename}${file.extname}`; | ||
const result = fileName.match(/(.+)(.ts|.js)\.template$/); | ||
if (result) { | ||
file.extname = result[2]; | ||
file.basename = result[1]; | ||
} | ||
}) | ||
); | ||
} | ||
|
||
setOptions() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line of code needed? I thought functions defined in Yeoman index files get called in sequential order they're defined in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. If I comment it out and run CLI, the transformer is not registered ...