Skip to content

Migrate to monorepo with new @code-pushup/create-eslint-config package #46

@matejchalk

Description

@matejchalk

Motivation

To enable users to run npm init @code-pushup/eslint-config, we need to publish our setup wizard as a new @code-pushup/create-eslint-config package. Since we need to keep the setup logic in sync with @code-pushup/eslint-config, it would be best to maintain them together in the same repository.

Recommended Nx commands

Nx provides various commands to automate some of the initial migration. It is recommended to run these generators first and commit them separately, before making manual fixes and other changes.

  • npx nx@latest init
    • Sets up Nx in an existing repo.
    • Use Guided setup.
  • npx nx g @nx/workspace:convert-to-monorepo
    • Converts standalone repo to monorepo.
    • Moves @code-pushup/eslint-config from root to packages.
  • npx nx g @nx/js:library
    • Generates a new publishable library.
    • Use options --directory=packages/create-eslint-config --importPath=@code-pushup/create-eslint-config --linter=eslint --publishable=true --unitTestRunner=vitest --useProjectJson=true.

Acceptance criteria

  • The code-pushup/eslint-config repository is converted to a monorepo with 2 packages - @code-pushup/eslint-config (existing) and @code-pushup/create-eslint-config (new).
  • Nx is used to orchestrate tasks in the new monorepo.
  • Current scripts in package.json are converted into Nx targets for the eslint-config project.
    • Cache is configured for each target (except for test:watch and release), including cache outputs where applicable (test:coverage, docs).
  • Vitest is set up to run unit tests for both packages.
  • ESLint is set up for both packages; the config is "dogfooded".
  • TypeScript strict compilation is enforced for both packages. (Supports .js files with JSDocs as an alternative to .ts files.)
  • The CI/CD pipeline checks affected projects on each PR.
  • Documentation is updated for the monorepo structure.
    • The @code-pushup/eslint-config Markdown docs are generated as before.
    • The monorepo's root README links to the @code-pushup/eslint-config README.
    • The @code-pushup/create-eslint-config package is only mentioned as "coming soon" for now.
    • A CONTRIBUTING.md is added to the monorepo.
  • Nx releases are configured in place of release-it.
    • Both packages are to be published together under the same version - i.e., fixed releases, not independent.
    • Conventional commits are used to determine the next version and changelog.
      • Commit messages are linted with Commitlint, with the scope matching Nx projects. Commitizen is also set up to use the same configuration. (This setup can be copied from the code-pushup/cli repo.)
    • GitHub releases are created as an artifact.
    • Releases will be triggered manually for now. They will later be automated in CI/CD releases for eslint-config packages #48.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions