popify-framework
The POPIFY Framework is designed to boost developer productivity by automating source code generation. It allows you to create commonly used project files (controllers, models, components, etc.) via an intuitive and extensible CLI.
- Generate Common Files: Quickly generate files such as controllers, models, components, and more.
- Stub-Based System: Customize generated files by replacing placeholders in file contents and filenames.
- Modular Hierarchical Structure: Simplifies the management of CLI commands, file systems, and stubs.
- Extensible CLI: Easily add new commands to meet your project's specific needs.
- TypeScript and Bun Support: Ensures optimal performance with robust typing.
Generate a controller with a single command:
npx popify make:controller MyController
Create a React context using the following command:
npx popify make:context MyContext
src/
commands/
hook/
make-hook.ts
hook.stub
special-hook.stub
component/
make-component.ts
context/
make-context.ts
README.md
package.json
popify.config.ts (optional)
src/
index.ts
commands/
base-make-command.ts
filesystem/
touch.ts
mkdir.ts
stub/
stub-service.ts
Here is an example class to create a React context file:
class MakeContext extends BaseMakeCommand {
name = 'make:context {name}'
summary = 'Create a react context file'
writePath = './src/context/Use{name}.tsx'
args = [
{
name: 'name', // The argument name
required: true, // Whether the argument is required
description: 'The name of the person to greet', // Description for help
},
];
async handle() {
const name = this.getArg('name');
let content = this.readStub('./stub/context.stub');
let filePath = this.inject(this.writePath, {
name: ucfirst(name)
});
content = this.inject(content, {
name: name,
contextName: 'use' + ucfirst(name)
});
this.write(content, filePath);
return 0;
}
}
- Clone the repository:
git clone https://github.com/your-username/popify-framework.git
cd popify-framework
- Install dependencies:
bun install
- Run the CLI:
bun run src/index.ts
Contributions are welcome! If you want to improve the POPIFY Framework, feel free to submit a pull request or open an issue.
This project is licensed under the MIT License. See the LICENSE
file for more details.