-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure the
component-class
blueprint generates a signature in a …
…TS project (cherry picked from commit a362683)
- Loading branch information
1 parent
2932978
commit 7c51fef
Showing
4 changed files
with
52 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
const { dasherize } = require('ember-cli-string-utils'); | ||
const { EOL } = require('os'); | ||
|
||
function generateComponentSignature(componentName) { | ||
let args = ` // The arguments accepted by the component${EOL} Args: {};`; | ||
|
||
let blocks = | ||
` // Any blocks yielded by the component${EOL}` + | ||
` Blocks: {${EOL}` + | ||
` default: []${EOL}` + | ||
` };`; | ||
|
||
let element = | ||
` // The element to which \`...attributes\` is applied in the component template${EOL}` + | ||
` Element: null;`; | ||
|
||
return ( | ||
`export interface ${componentName}Signature {${EOL}` + | ||
`${args}${EOL}` + | ||
`${blocks}${EOL}` + | ||
`${element}${EOL}` + | ||
`}${EOL}` | ||
); | ||
} | ||
|
||
function modulePrefixForProject(project) { | ||
return dasherize(project.config().modulePrefix); | ||
} | ||
|
||
module.exports = { | ||
generateComponentSignature, | ||
modulePrefixForProject, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<%= importComponent %> | ||
<%= importTemplate %> | ||
<%= componentSignature %> | ||
export default <%= defaultExport %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters