1.4.0 • Published 5 months ago

sparkee v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

sparkee

Sparkee is a publish tool for monorepo,just like lerna but support pnpm, also support singleRepo.

About

What can Sparkee do?

There are six commands in sparkee:

init will initialize sparkee workspace. init-cliff will initialize git-cliff config file. run will run the script of package. info will show package's info of workspace. log will only generate changelog.md. publish will publish any updated packages and generate changelog automatically.

What diffrences with lerna?

  • Sparkee can publish Single package or customize multiple packages.
  • Support workspace protocol in package.json.
  • Use pnpm <--filter> publish so you can keep the workspace keyword of dependencies.
  • More friendly output of CLI.
  • CLI commands are very very simple!

Getting Started

Project structure

Sparkee needs a file structure like this(the same as the lerna project):

your-repo/
  package.json
  packages/
    package-1/
      src/
      package.json
    package-2/
      src/
      package.json

It will track file changes inside the packages src folders and package.json files.

Installation

# simple install or install it globally with -g
npm install sparkee --save-dev

# if you install globally, use it `sparkee <command>`
sparkee init
sparkee version
sparkee publish

# OR use npx in root of project
npx sparkee init
npx sparkee publish
npx sparkee version

Usage

init

$ sparkee init

Initialize sparkee workspace. There will create a spark.json, you can make sparkee manage all of packages or customized packages.

Sparkee assumes the repo has already been initialized with git init.

Example output on a new git repo:

Example-1. All packages:

$ sparkee init
? Do you need sparkee to manage all projects of packages folder? yes
✔ Sparkee init successful.

Example-2. Custom packages:

$ sparkee init
? Do you need sparkee to manage all projects of packages folder? No
? What packages do you want to manage? @geocld/pkg1
✔ Sparkee init successful.

Example-3. single repo:

$ sparkee init
? Please select repo type: singleRepo
✔ Sparkee init as singleRepo successful.

In singleRepo mode, spark.json will be:

{
  "singleRepo": true,
  "moduleManager": "npm"
}

singleRepo : Must be true in single repo. moduleManager: Can be npm or yarn or pnpm.

run(supported in v1.1.0)

$ sparkee run

Run the scripts of packages.json:

Example:

$ sparkee run
? Please select script: (Use arrow keys)
❯ dev -> rimraf dist && tsc -w
  build -> rimraf dist && tsc

info

$ sparkee info <--tree>

Print local information of packages.

Example:

$ sparkee info
> Current monorepo packages:
  · @geocld/pkg1: v1.0.0
  · @geocld/pkg2: v1.0.0

Or Print detail dependencies tree of packages:

$ sparkee info --tree

@geocld/pkg1@1.0.0
╰── @geocld/pkg2@1.0.0

----------

@geocld/pkg2@1.0.0

log(supported in v1.3.0)

$ sparkee log

If you only want to generate a changelog, you can execute the above command.

publish

$ sparkee publish

publish is the core of sparkee. When runing, this command does the following things:

  • Find updated packages since the last release(must with git tag, otherwise compare with first commit).
  • Select what packages that you want to publish.
  • Update version of package.json automatically.
  • Generate CHANGELOG.md automatically in selected packages.
  • Run git Commit, git tag and git push automatically.
  • Run pnpm publish

sparkee will never publish packages which do not exits in spark.json.

The workflow of sparkee is as follows:

workflow

publish --force

Sparkee will not publish unmodified packages, if you want to publish unmodified packages, use --force:

sparkee publish --force

publish --noPublish

If yout want sparkee just genetate changelog and create tag, publish command run in other place(such as pipeline), use --noPublish or --np:

sparkee publish --noPublish

or

sparkee publish --np

publish --noCommitCheck

If you want to skip commit check before publish or generate changelog, you can use --noCommitCheck or --ncm:

sparkee publish --noCommitCheck

or

sparkee publish --ncm

publish --package --ver

If you dont want to use prompt when publish(such as in CI/CD autodeploy case), you can use --package and --ver to specify the name and version of package.For example:

sparkee publish --package @geocld/sparkee --ver 1.2.0

Custom changelLog

sparkee use git-cliff internally to generate CHANGELOG.md, If you want to use custom changelog, you can run sparkee init-cliff to generate a cliff config file, refer to the configuration items in detail.

JSON $schema

Since version 1.3.0, a JSON schema file for the spark.json is published.

You can specify a relative path to the schema of the Sparkee npm package if Sparkee is installed in the node_modules folder:

{
  "$schema": "./node_modules/sparkee/template/schema.json",
  "moduleManager": "pnpm",
  "packages": [
    "@example/docs",
    "@example/cli",
  ]
}

License

MIT © Geocld

1.4.0

5 months ago

1.3.4

9 months ago

1.3.3

11 months ago

1.3.2

12 months ago

1.2.0

1 year ago

1.3.1

12 months ago

1.3.0

1 year ago

1.2.1

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-beta

2 years ago