A cli tool to generate cra-template from current create-react-app project.
Inside your own create-react-app project:
npx create-cra-template
# or
yarn create cra-template
Or install globally
yarn global add create-cra-template
cct
# or create-cra-template
template.json
and template
will be generated. You can also edit template.json
manually.
Make sure your package.json name is cra-template-[YOUR_TEMPLATE_NAME]
Example:
{
"name": "cra-template-ui"
}
npm login
npm publish
npx create-react-app --template [YOUR_TEMPLATE_NAME]
# or
yarn create react-app --template [YOUR_TEMPLATE_NAME]
There two commands create-cra-template
and cct
.
Run cct --help
to see more details.
cct
🕹 📤 A cli tool to generate cra-template from current create-react-app
project.
Commands:
cct Generate template [default]
cct clear [--all] Clear previous exports
Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
-c, --clear Clear previous exports before generation [boolean]
Below is a simple example of using create-cra-template
in your project:
const {
generateTemplateJson,
generateTemplateFiles,
clearPackageFileField,
clearTemplateFiles
} = require('create-cra-template')
const rootDir = process.cwd()
;(async()=>{
await clearPackageFileField(rootDir)
await clearTemplateFiles(rootDir)
await generateTemplateJson(rootDir)
await generateTemplateFiles(rootDir)
})()
Work in progress...
Work in progress...
🎉 That's it! Enjoy your own template.