@papit/create
v0.0.7
Published
Project and package scaffolding tool for @papit — opinionated, consistent, and designed to kickstart Papit-based projects with the correct structure from day one.
Readme
@papit/create
Project and package scaffolding tool for @papit — opinionated, consistent, and designed to kickstart Papit-based projects with the correct structure from day one.
This package is intended to be used from within a workspace or an empty directory. Simply run:
npm create @papitto generate a fully initialized Papit package, component, or project with zero or minimal configuration.
CLI Flags
| Flag | Description |
| ------------- | ----------------------------------- |
| --package | Create a package |
| --component | Create a component |
| --project | Create a project |
| --agree | Skip confirmations |
| --install | Install dependencies after creation |
| --commit | Create an initial git commit |
| --verbose | Show detailed output |
If no creation flag is provided, an interactive selector is shown.
How it works
@papit/create presents a set of creation options. Some of these can be invoked directly via flags, but the tool is primarily interactive and focused on generating boilerplate code based on predefined templates.
There are currently three built-in runners:
packagecomponentproject
Note: You can provide your own custom runners by placing them in the bin folder. Each runner must have a runner.js file with a default export, for example:
<workspace-root>/bin/runners/<custom>/runner.jsA runner is a function that receives two arguments:
info: {
root: string; // Location of the workspace root
local: string; // Location of the current package (if any)
script: string | null; // Location of the @papit/create script
}args: {
flags: Record<string, string | string[] | true | undefined>,
values: string[]
}For more details on the structure and behavior of these arguments, see the
@papit/arguments@papit/informationpackage.
Package
The package runner creates a new package at a selected location (sometimes referred to as layers or folders).
A template is selected — either one of the built-in templates or a custom template located at:
<workspace-root>/bin/runners/package/*The selected template folder is copied, and all files are processed to replace supported variables.
The generated license file automatically references the same license as the workspace root.
Available variables
VARIABLE_NAMEVARIABLE_FULL_NAMEVARIABLE_DESCRIPTIONVARIABLE_LAYER_FOLDERVARIABLE_PROJECTLICENSEVARIABLE_GITHUB_REPOVARIABLE_LOCAL_DESTINATIONVARIABLE_CLASS_NAMEVARIABLE_HTML_PREFIXVARIABLE_USER
Component
The component runner creates a new component and is intended for adding sub-components to an existing package.
Like the package runner, it copies a selected template from either built-ins or:
<workspace-root>/bin/runners/component/*Folder handling
views If a
viewsfolder exists in both the current package and the template, a new subfolder named after the component is created inside the package’sviewsdirectory and populated with the template content.src If the current package already has a
srcfolder with files, the template’ssrccontent is typically placed under:src/components/<component-name>
Available variables
VARIABLE_NAMEVARIABLE_FULL_NAMEVARIABLE_HTML_NAMEVARIABLE_CLASS_NAME
Project
⚠️ This runner is currently under development.
The project runner creates a raw monorepo project at a selected destination.
As with packages and components, custom templates can be provided at:
<workspace-root>/bin/runners/project/*You will be prompted to select a template during creation.
Licensing is handled interactively. You may provide an existing license file or omit it, in which case a standard MIT license is used.
Available variables
VARIABLE_NAMEVARIABLE_DESCRIPTIONVARIABLE_PROJECTLICENSEVARIABLE_USER
Contributing
Contributions are welcome.
Please ensure that:
- Templates follow Papit conventions
- Runners remain deterministic
- Interactive prompts stay minimal
Open a pull request when ready 🚀
License
Licensed under the @Papit License 1.0 Copyright (c) 2024 Henry Pap (@onkelhoy)
Key points:
- ✅ Free to use in commercial projects
- ✅ Free to modify and distribute
- ✅ Attribution required
- ❌ Cannot resell the component itself as a standalone product
See the LICENSE file for full details.
Support
For issues, questions, or contributions, please visit the GitHub repository.
