
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
No more struggles setting up a new JavaScript repository. Kick-start single-purpose repos, monorepos, monorepo workspaces and common tooling:
# initialize a monorepo
yarn dlx moker create --monorepo my-monorepo
cd my-monorepo
# install common tools
yarn moker use prettier doctoc semantic-release
# create workspaces
yarn moker add --template express server
yarn moker add --template cra client
yarn moker add --template lib shared
yarn moker add --template bandersnatch cli
🤓 Default: The core plugins make some assumptions you may not agree with. If that's the case, this tool is probably not for you. The defaults used are documented below and marked with a nerd-face emoji so you should be able to get a clear picture of what to expect.
You will need Node v14+ and Yarn v2+ in order to use moker
.
corepack enable
corepack prepare yarn@stable --activate
moker
is distributed as a NPM package, and can be run with yarn dlx
:
yarn dlx moker <command>
Note: Note that when we use
yarn dlx moker
to create a new repo,moker
is added as a dependency to your new repo, so we can simply useyarn moker
to execute commands from within the repo directory.
Create a new repo:
yarn dlx moker create my-repo
This will initialize a new repo in the my-repo
directory.
Create a new monorepo:
yarn dlx moker create --monorepo my-monorepo
This will initialize a new monorepo in the my-monorepo
directory.
🤓 Default: The monorepo is initiated with Yarn without Zero-Installs and in legacy
nodeLinker: node-modules
mode because a lot of packages are not yet compatible with PnP or require a workaround.
To add a new workspace (a.k.a. monorepo package) to your monorepo, run this from within the monorepo directory:
yarn moker add my-workspace
Workspaces are added in a customizable subdirectory of the monorepo (the default
is packages
).
Of course you want additional tools installed. You can add plugins with:
yarn moker use prettier
You can install multiple plugins at once:
yarn moker use prettier lint-staged husky
Plugins may work together. For example, lint-staged
will install a pre-commit
hook which formats code if prettier
and husky
are installed. The order in
which plugins are added does not matter.
Note: Some plugins only work at the repo or workspace level,
moker
will warn you if you try to add a plugin at the wrong level.
See the section available plugins for a list of options.
You can templates when creating repos:
yarn dlx moker create --template common my-repo
You can also use templates when creating workspaces:
yarn moker add --template lib shared
You can install multiple templates at once:
yarn dlx moker create --template common github-action my-action
See the section available templates for a list of options.
Plugins and templates can be used together, for example:
yarn dlx moker create --template express --use prettier my-repo
dependabot
repoThis plugin adds a Dependabot configuration to your monorepo with an updater for NPM packages.
If you have the github-actions
plugin installed, it will add an updater for
GitHub Actions workflows.
devcontainer
repoThis plugin creates a Development Containers
configuration using the
typescript-node
image.
If you have the prettier
plugin installed, it will add the
Prettier VS Code extension.
doctoc
repoThis plugin adds a script to generate a table of contents for the README using doctoc.
If you have the husky
plugin installed, it will also add a pre-commit hook.
esbuild
repo or workspaceThis plugin sets up esbuild and adds a build
and
build:watch
script to the repo or both the workspace and the monorepo.
🤓 Default: If you have the
typescript
plugin installed as well, we'll assume that you want to build to a bundle instead of transpiled TypeScript. We will still usetsc
for type checking.
github-actions
repoThis plugin creates a simple ci.yml
GitHub Actions workflow.
If you have the prettier
plugin installed, this will also setup a lint.yml
workflow.
If you have the semantic-release
plugin installed, this will also setup a
release.yml
workflow. This workflow needs these secrets to be added to your
repository:
GH_TOKEN
: a GitHub token with read/write access to your repositoryNPM_TOKEN
: an NPM token with publish access to your packages🤓 Default: The workflows will use the
main
branch by default, but it is trivial to change this.
husky
repoThis plugin sets up Husky at the repo level.
Warning: The
postinstall
script to install Husky automatically is only installed on (private) monorepos. Otherwise,postinstall
will run when someone installs your package and result in an error.
jest
repo or workspaceThis plugin sets up Jest and adds a test
and test:watch
script to the repo or both the workspace and the monorepo.
lint-staged
repoThis plugin sets up lint-staged at the monorepo level.
If you have the prettier
plugin installed, this will setup a task to format
staged files using prettier --write --ignore-unknown
.
If you have the husky
plugin installed, this will setup a pre-commit hook to
run yarn lint-staged
.
prettier
repoThis plugin sets up Prettier.
🤓 Default: Prettier is installed with this configuration:
proseWrap: always
We only set this
proseWrap
override because we think markdown files should always be truncated to match whatever theprintWidth
setting is. This makes it so much easier to read and write markdown files!
semantic-release
repoThis plugin sets up semantic-release. It uses the semantic-release-yarn plugin which has support for releasing monorepos.
Please note that by default the root repository is not published. You can change
this by setting the private
property in package.json
to false
.
🤓 Default: The release configuration will use the
main
branch by default, but it is trivial to change this.
todos
repo or workspaceThis plugin adds a script to generate a TODO markdown file from all code annotations using leasot.
If you have the husky
plugin installed, it will also add a pre-commit hook.
typescript
repo or workspaceThis plugin sets up TypeScript and adds a
build
and build:watch
script to the repo or both the workspace and the
monorepo.
bandersnatch
repo or workspaceScaffolds a simple bandersnatch CLI app tool with the typescript and jest plugins.
common
repoThis is the only monorepo template at this point. It simply installs all available monorepo plugins.
cra
repo or workspaceUses create-react-app to scaffold a React.js app (web client).
express
repo or workspaceScaffolds a simple express HTTP app with the typescript and jest plugins.
github-actions
repoScaffolds a custom GitHub Action template.
lib
repo or workspaceA plain shared library template with the typescript and jest plugins.
See moker --help
for a list of available commands.
Contributions are very welcome!
swc
/esbuild
Also see TODO.md.
To run the moker
CLI from source, run:
yarn start
Note that you can create a new monorepo for testing purposes outside the current working directory with:
yarn start create /path/to/my-repo
A devcontainer configuration is included in this repo to get started quickly.
©️ Copyright 2022 Joram van den Boezem
♻️ Licensed under the MIT license
🤔 Moker? MOnorepo KickstartER
FAQs
The moker CLI
The npm package moker receives a total of 19 weekly downloads. As such, moker popularity was classified as not popular.
We found that moker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.