create-fynpo v1.0.3
create-fynpo
Supplement tool to create a new fynpo monorepo. The directory structure of a fynpo monorepo will look like:
fynpo-repo/
package.json
packages/
package-1/
package.json
package-2/
package.jsonWhen run, create-fynpo will:
- Add
fynpoas a dev dependency - Creat a
fynpo.json/fynpo.config.jsconfig file - Add
commitlintconfig if enabled - Create an empty
packagesdirectory
Getting Started
To create a new fynpo monorepo,
npx create-fynpo fynpo-repo
cd fynpo-repo
fyn # Install dependenciesNote: We're naming the repo "fynpo-repo". You can name your repo anything you'd like. The npx... command creates a directory with the same name as the repo.
Options:
commitlint : Used to initialize the repo with commitlint configuration. This is enabled by default.
To initialize the repo without commitlint configuration, run the command with no-commitlint options. In this case, a simple fynpo.json config file will be added instead of fynpo.config.js.
npx create-fynpo fynpo-repo --no-commitlintThe commitlint configuration can always be added later by running:
npx fynpo init --commitlintCommitlint
configuration:
If commitlint is enabled, the initialized repo will include fynpo.config.js with the default commitlint config. This can be customized as per the team's needs.
The default configuration supports commmit message in [<semver>][feat|bug|chore] <message> format, where:
<semver> can be:
majorminorpatchchore
The format of commit type can be modified by updating the below config:
parserPreset: {
parserOpts: {
headerPattern: /^\[([^\]]+)\] ?(\[[^\]]+\])? +(.+)$/,
headerCorrespondence: ["type", "scope", "subject"],
},
},Refer here for the details of commitlint configuration.
Commit hooks:
To add commit hook,
# Install Husky
npm install husky --save-dev
# Active hooks
npx husky install
# Add hook
npx husky add .husky/commit-msg 'npx --no-install fynpo commitlint --edit $1'Note: The initialized repo will alreday have husky added in devDependencies and also husky install added to the prepare script.
Test:
To test the simple usage,
echo '[test] msg' | npx fynpo commitlintTo test the hook,
git commit -m "[patch] message"