forked from changesets/changesets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for snapshot versioning and publish under custom tag (changes…
…ets#359) * initial implementation of snapshot release * add logic to release changelog file too * use unique hash for versioning * lint fix - remove unused vars * add error message when user runs snapshot in pre state * revert unused code from pre command * use hash cache * revert adding logger to git * update changelog for snapshot release support * 1: [Version command] Move caching of snapshot version to the assemble-release-plan's main function 2: [Version command] Add condition to throw error if snapshot version is made while changeset is in pre-state 3: [Publish command] Update the condision to capture preState.mode and updated the error message when tag is passed in pre state * split changessets and updated the description * Update .changeset/violet-gorillas-march.md Co-authored-by: Mateusz Burzyński <[email protected]> * Update .changeset/dry-rivers-train.md Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Mitchell Hamilton <[email protected]> Co-authored-by: Mateusz Burzyński <[email protected]>
- Loading branch information
1 parent
9f9c61f
commit 6d0790a
Showing
14 changed files
with
257 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
"@changesets/apply-release-plan": minor | ||
"@changesets/assemble-release-plan": minor | ||
"@changesets/cli": minor | ||
--- | ||
|
||
Add support for snapshot flag to version command. Usage: `changeset version --snapshot [tag]`. The updated version of the packages looks like `0.0.0[-tag]-YYYYMMDDHHMMSS` where YYYY, MM, DD, HH, MM, and SS is the date and time of when the snapshot version is created. You can use this feature with the tag option in the publish command to publish packages under experimental tags from feature branches. To publish a snapshot version of a package under an experimental tag you can do: | ||
|
||
``` | ||
$ # Version packages to snapshot version | ||
$ changeset version --snapshot | ||
$ # Publish packages under exprimental tag, keeping next and latest tag clean | ||
$ changeset publish --tag exprimental | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@changesets/cli": minor | ||
--- | ||
|
||
Add support for tag flag to publish command. Usage: `changeset publish --tag <tag>`. This will publish the packages under passed npm tag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules/ | |
*error.log | ||
scratchings.js | ||
dist/ | ||
.env | ||
.env | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import fixtures from "fixturez"; | ||
import publishCommand from "../index"; | ||
import { defaultConfig } from "@changesets/config"; | ||
import * as path from "path"; | ||
import * as pre from "@changesets/pre"; | ||
import { Config } from "@changesets/types"; | ||
|
||
let changelogPath = path.resolve(__dirname, "../../changelog"); | ||
let modifiedDefaultConfig: Config = { | ||
...defaultConfig, | ||
changelog: [changelogPath, null] | ||
}; | ||
|
||
const f = fixtures(__dirname); | ||
|
||
jest.mock("../npm-utils.ts"); | ||
jest.mock("../publishPackages.ts"); | ||
jest.mock("@changesets/pre"); | ||
|
||
describe("Publish command", () => { | ||
let cwd: string; | ||
|
||
beforeEach(async () => { | ||
cwd = await f.copy("simple-project"); | ||
}); | ||
describe("in pre state", () => { | ||
beforeEach(() => { | ||
// @ts-ignore | ||
pre.readPreState.mockImplementation(() => ({ mode: "pre" })); | ||
}); | ||
it("should report error if the tag option is used in pre release", async () => { | ||
await expect( | ||
publishCommand(cwd, { tag: "exprimental" }, modifiedDefaultConfig) | ||
).rejects.toThrowError(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.