4.7 KiB
Simple Scaffold
GitHub | Documentation | NPM | casraf.dev
Looking to streamline your workflow and get your projects up and running quickly? Look no further than Simple Scaffold - the easy-to-use NPM package that simplifies the process of organizing and copying your commonly-created files.
With its agnostic and un-opinionated approach, Simple Scaffold can handle anything from a few simple files to an entire app boilerplate setup. Plus, with the power of Handlebars.js syntax, you can easily replace custom data and personalize your files to fit your exact needs. But that's not all - you can also use it to loop through data, use conditions, and write custom functions using helpers.
Don't waste any more time manually copying and pasting files - let Simple Scaffold do the heavy lifting for you and start building your projects faster and more efficiently today!
Quick Start
The fastest way to get started is to use npx to immediately start a scaffold process.
Prepare any templates you want to use - for example, in the directory templates/component; and use
that in the CLI args. Here is a simple example file:
templates/component/{{ psacalName name }}.tsx
// Created: {{ now | 'yyyy-MM-dd' }}
import React from 'react'
export default {{pascalCase name}}: React.FC = (props) => {
return (
<div className="{{camelCase name}}">{{pascalCase name}} Component</div>
)
}
To generate the template output, run:
# generate single component
npx simple-scaffold@latest \
-t templates/component -o src/components PageWrapper
This will immediately create the following file: src/components/PageWrapper.tsx
// Created: 2077/01/01
import React from 'react'
export default PageWrapper: React.FC = (props) => {
return (
<div className="pageWrapper">PageWrapper Component</div>
)
}
Documentation
See full documentation here.
Contributing
I am developing this package on my free time, so any support, whether code, issues, or just stars is very helpful to sustaining its life. If you are feeling incredibly generous and would like to donate just a small amount to help sustain this project, I would be very very thankful!
I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature, don't hesitate to open an appropriate issue and I will do my best to reply promptly.
If you are a developer and want to contribute code, here are some starting tips:
- Fork this repository
- Run
yarn install - Run
yarn devto start file watch mode - Make any changes you would like
- Create tests for your changes
- Update the relevant documentation (readme, code comments, type comments)
- Create a PR on upstream
Some tips on getting around the code:
-
Use
yarn devfor development - it runs TypeScript compile in watch mode, allowing you to make changes and immediately be able to try them usingyarn cmd. -
Use
yarn buildto build the output once -
Use
yarn testto run tests -
Use
yarn cmdto use the CLI feature of Simple Scaffold from within the root directory, enabling you to test different behaviors. Seeyarn cmd -hfor more information.This requires an updated build, and does not trigger one itself. From here you have several options:
- Run
yarn devto watch for file changes and build automatically - Run
yarn buildbefore running this to trigger a one-time build - Run
yarn build-cmdwhich triggers a build right before runningyarn cmdautomatically with the rest of the given arguments.
- Run
-
Use
yarn build-docsto build the documentation once -
Use
yarn watch-docsto start docs in watch mode -
To see the documentation, currently you have to serve the directory yourself with a static web server (like node's built in serve, VS code's "Go Live" mode, etc)
