0.0.0-pre.c7ffeaa • Published 3 years ago

@onerepo/plugin-changesets v0.0.0-pre.c7ffeaa

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

title: '@onerepo/plugin-changesets' tool: Changesets description: |

Manage changelogs with changesets and publish workspaces to public packages.

Installation

npm install --save-dev @onerepo/plugin-changesets
const { changesets } = require('@onerepo/plugin-changesets');

setup({
	plugins: [
		changesets({
			// ...options
		}),
	],
}).then(({ run }) => run());

Publish config

In order to properly use source-level dependencies without requiring constant file watching and rebuilding across workspaces, all package.json files should reference a source file in its "main" field, eg, "main": "./src/index.ts".

This causes issues when publishing shared modules for use outside of the monorepo, because consumers will likely need to use a pre-compiled version of the module. In order to safely rewrite this, as well as some other related fields, we build upon NPM’s publishConfig to include other fields: bin, main, module, typings, and exports. The presence of any of these fields in your publishConfig will trigger this plugin’s commands to overwrite the initial values during the publish cycle:

{
	"name": "my-package",
	"main": "./src/index.ts",
	"publishConfig": {
		"access": "public",
		"main": "./dist/index.js",
		"typings": "./dist/src/index.d.ts"
	}
}
{
	"name": "my-package",
	"main": "./dist/index.js",
	"typings": "./dist/src/index.d.ts"
}

Workflow

  1. For every change that should be documented in a changelog, add a changeset using the add command. This command will walk you through itself, prompting for information for each modified workspace:

    one change add

    Commit any files that are added during this process. You can always go back and edit these files manually, as long as they exist.

  2. When you have enough changes and you’re ready to publish, run the version command.

    one change version

    This will also prompt you for the workspaces that you want to publish. You can restrict this to avoid publishing any workspaces that are not yet ready.

    However, any dependency in the graph of the chosen workspace(s) that has changes will also be versioned and published at this time. This is an important step to ensure consumers external to your oneRepo have all of the latest changes.

    This command will delete the consumed changesets, write changelogs, and update version numbers across all modified workspaces. Commit these changes and review them using a pull-request.

  3. Once the pull-request is merged, you can safely run the publish command:

     one change publish

This plugin will trigger the core tasks plugin build lifecycle for every workspace during pre-release and publish. There is no need to manually run a build before publishing.

one change

Aliases: changeset, changesets

Manage changesets, versioning, and publishing your public workspaces to packages.

one change <command> [options]

one change add

Aliases: $0

Add a changeset

one change add [options]
OptionTypeDescriptionRequired
--affectedbooleanSelect all affected workspaces. If no other inputs are chosen, this will default to true.
--all, -abooleanRun across all workspaces
--files, -farrayDetermine workspaces from specific files
--type"major", "minor", "patch"Provide a semantic version bump type. If not given, a prompt will guide you through selecting the appropriate type.
--workspaces, -warrayList of workspace names to run against
OptionTypeDescriptionRequired
--from-refstringGit ref to start looking for affected files or workspaces
--through-refstringGit ref to start looking for affected files or workspaces

one change init

Initialize changesets for this repository.

one change init

You should only ever have to do this once.

one change prerelease

Aliases: pre-release, pre

Pre-release available workspaces.

one change prerelease
OptionTypeDescriptionRequired
--buildboolean, default: trueBuild workspaces before publishing
--otpbooleanSet to true if your publishes require an OTP for NPM.

one change publish

Aliases: release

Publish all workspaces with versions not available in the registry.

one change publish [options]

This command is safe to run any time – only packages that have previously gone through the version process will end up being published.

OptionTypeDescriptionRequired
--buildboolean, default: trueBuild workspaces before publishing
--otpbooleanSet to true if your publishes require an OTP for NPM.
OptionTypeDescriptionRequired
--allow-dirtybooleanBypass checks to ensure no local changes before publishing.

one change version

Version workspaces for publishing. Allows you to select a minimal set of workspaces from the current changesets, version them, and write changelogs.

one change version
1.0.0-beta.2

2 years ago

1.0.0-beta.1

2 years ago

1.0.0-beta.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.2

2 years ago

0.8.4

3 years ago

0.8.3

3 years ago

0.9.0

2 years ago

0.9.1

2 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.8.2

3 years ago

0.1.0

3 years ago

0.3.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.5.0

3 years ago

0.7.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.0.0

3 years ago