Rocket-Punch is a tool for creating and publishing directories in a project into NPM packages.
Usually, we use Monorepo to make and publish part of the project as a package, but the use of Monorepo is cumbersome. (Many Config files that occur per package, such as Watch with Transpilers such as TypeScript...)
Rocket-Punch packages and distributes some of the directories inside the project /src directory to NPM without cumbersome settings.
- If there are directories
@myorg/package-a,@myorg/package-b, andpackage-cwithin the directory/src - The
rocket-punch buildcommand creates packages in theout/packagesdirectory. - The
rocket-punch publishcommand then publish packages from theout/pckagesdirectory collectively to the NPM.
It's a simple setting.
cd your-project-root
npx rocket-punch-initA .package.json, .packages.json files are created in the project.
build-packgaes and publish-packages would have been created in scripts in the package.json file.
- The
.package.jsonfile is a common application to thepackage.jsonof all packages to be created. - The
.packages.jsonfile is a list of which files in the/srcdirectory to package build and publish.
Please modify the setting files above to match the packages you will publish.
yarn run build-packages
yarn run publish-packagesAlso, if you run the commands above, packages are built / published.
- Please create directories with the same name as your package name within
/src. If your package is@myorg/package1, you can create the directory/src/@myorg/package1. - Circular dependency will fail to build. If
package1andpackage2refer to each other, the build will fail, so be careful.
rocket-punch buildrocket-punch publishrocket-punch doctorrocket-punch view
Most Import Types available in Create-React-App are supported. Afterwards, Vite.js' basic import types will also be supported.
- Plain Text
import string from './file.txt'import string from './file.md'
- YAML
import object from './file.yaml'import object from './file.yml'
- Images
import base64String from './file.jpg'import base64String from './file.jpeg'import base64String from './file.gif'import base64String from './file.png'import base64String from './file.webp'
- SVG
import base64String, { ReactComponent } from './file.svg'