0.6.0 • Published 6 years ago
component_scaffold v0.6.0
Component Scaffold
Installation
Using npm:
$ npm i -g component_scaffoldRunning the CLI:
$ scaffoldConfiguration
scaffold.config.json
- dest: string = Target parent destination for the files being built.
- friendlyName: string = Name that appears in the command line when running the
scaffoldcommand. - structure: arraystructure = The files and folders object array
structure <arraystructure>
- type: string =
fileorfolder - name: string = By default, the name of the
file/folderis the string input into the command line while running thescaffoldCLI. However, this will override that name to one of your choosing. - prefix: string = This string will become part of the
filename at the beginning of the final string regardless if a name is specified or if it's left to the default name. - suffix: string = This string will become part of the
filename at the end of the final string regardless if a name is specified or if it's left to the default name. - extension: string = This is the desired extension of the
file. - content: string | { src: string }
- string: If the
contentis astringit will fill thefilewith that string. - { src: string }: If the
contentis an object with a node ofsrc, the CLI will read a template file at location and utilize it's content to fill thefilebeing created.
- string: If the
Template file string replacement
When the content of a file is being filled by a template file, it's utilizes a simple string replacement for some of the options decided throughout the CLI process. These strings will be inclosed in % to indicate the beginning and the end of the desired replacement command. These options consist of the options input into the structure for the file. The only instance when the option will not be replaced as input is the name. The name has a case selection. These cases are:
- snake
- hyphen
- camel
- pascal
- uppercase
- lowercase
As an example on how to do the above:
export default class %name.pascal% extends React.Component<%name.pascal%Props, %name.pascal%States>The above resolved into:
export default class YourNewComponent extends React.Component<YourNewComponentProps,YourNewComponentStates>