Socket
Socket
Sign inDemoInstall

@changesets/cli

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@changesets/cli - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

changelog/dist/cli.cjs.d.ts

12

CHANGELOG.md
# @changesets/cli
## 2.0.1
### Patch Changes
- [62873042](https://github.com/atlassian/changesets/commit/62873042) [#153](https://github.com/atlassian/changesets/pull/153) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Make init write the default config file if it doesn't exist with a special message if an old config file exists
- [85f837a7](https://github.com/atlassian/changesets/commit/85f837a7) [#150](https://github.com/atlassian/changesets/pull/150) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Fix init command from crashing because it was trying to access a config that doesn't exist
* [709493b4](https://github.com/atlassian/changesets/commit/709493b4) - Fix version always removing legacy changesets even when the commit option is false
- [16cb2ff3](https://github.com/atlassian/changesets/commit/16cb2ff3) [#151](https://github.com/atlassian/changesets/pull/151) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Include changelog directory in published files
## 2.0.0

@@ -4,0 +16,0 @@

153

dist/cli.cjs.dev.js

@@ -89,3 +89,17 @@ 'use strict';

if (fs.existsSync(changesetBase)) {
logger.warn("It looks like you already have changesets initialized. You should be able to run changeset commands no problems.");
if (!fs.existsSync(path.join(changesetBase, "config.json"))) {
if (fs.existsSync(path.join(changesetBase, "config.js"))) {
logger.error("It looks like you're using the version 1 `.changeset/config.js` file");
logger.error("The format of the config object has significantly changed in v2 as well");
logger.error(" - we thoroughly recommend looking at the changelog for this package for what has changed");
logger.error("Changesets will write the defaults for the new config, remember to transfer your options into the new config at `.changeset/config.json`");
} else {
logger.error("It looks like you don't have a config file");
logger.error("The default config file will be written at `.changeset/config.json`");
}
await fs.writeFile(path.resolve(changesetBase, "config.json"), JSON.stringify(config.defaultWrittenConfig, null, 2));
} else {
logger.warn("It looks like you already have changesets initialized. You should be able to run changeset commands no problems.");
}
} else {

@@ -504,8 +518,11 @@ await fs.copy(path.resolve(pkgPath, "./default-files"), changesetBase);

async function cleanupOldChangesets(cwd) {
async function cleanupOldChangesets(cwd, config) {
let changesetBase = await getChangesetBase(cwd);
removeFolders(changesetBase);
await git.add(changesetBase, cwd);
logger.log("Committing removing old changesets...");
await git.commit(`removing legacy changesets`, cwd);
if (config.commit) {
await git.add(changesetBase, cwd);
logger.log("Committing removing old changesets...");
await git.commit(`removing legacy changesets`, cwd);
}
}

@@ -536,3 +553,3 @@

if (oldChangesets.length > 0) {
await cleanupOldChangesets(cwd);
await cleanupOldChangesets(cwd, config);
}

@@ -924,3 +941,2 @@

const cwd = process.cwd();
(async () => {

@@ -936,2 +952,7 @@ const workspaces = await getWorkspaces$1({

if (input[0] === "init") {
await init(cwd);
return;
}
let config$1;

@@ -980,71 +1001,65 @@

try {
switch (input[0]) {
case "init":
{
await init(cwd);
return;
}
switch (input[0]) {
case "add":
{
// @ts-ignore if this is undefined, we have already exited
await add(cwd, config$1);
return;
}
case "add":
{
// @ts-ignore if this is undefined, we have already exited
await add(cwd, config$1);
return;
}
case "version":
{
// @ts-ignore if this is undefined, we have already exited
await version(cwd, config$1);
return;
}
case "version":
{
// @ts-ignore if this is undefined, we have already exited
await version(cwd, config$1);
return;
}
case "publish":
{
// @ts-ignore if this is undefined, we have already exited
await run(cwd, {
otp
}, config$1);
return;
}
case "publish":
{
// @ts-ignore if this is undefined, we have already exited
await run(cwd, {
otp
}, config$1);
return;
}
case "status":
{
// @ts-ignore if this is undefined, we have already exited
await getStatus(cwd, {
sinceMaster,
verbose,
output
}, config$1);
return;
}
case "status":
{
// @ts-ignore if this is undefined, we have already exited
await getStatus(cwd, {
sinceMaster,
verbose,
output
}, config$1);
return;
}
case "bump":
{
logger.error('In version 2 of changesets, "bump" has been renamed to "version" - see our changelog for an explanation');
logger.error("To fix this, use `changeset version` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
case "bump":
{
logger.error('In version 2 of changesets, "bump" has been renamed to "version" - see our changelog for an explanation');
logger.error("To fix this, use `changeset version` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
case "release":
{
logger.error('In version 2 of changesets, "release" has been renamed to "publish" - see our changelog for an explanation');
logger.error("To fix this, use `changeset publish` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
case "release":
{
logger.error('In version 2 of changesets, "release" has been renamed to "publish" - see our changelog for an explanation');
logger.error("To fix this, use `changeset publish` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
default:
{
logger.error(`Invalid command ${input[0]} was provided`);
}
}
} catch (err) {
if (err instanceof ExitError) {
return process.exit(err.code);
}
throw err;
default:
{
logger.error(`Invalid command ${input[0]} was provided`);
throw new ExitError(1);
}
}
}
})();
})().catch(err => {
if (err instanceof ExitError) {
return process.exit(err.code);
}
logger.error(err);
process.exit(1);
});

@@ -60,3 +60,8 @@ "use strict";

const changesetBase = await getChangesetBase(cwd);
fs.existsSync(changesetBase) ? logger.warn("It looks like you already have changesets initialized. You should be able to run changeset commands no problems.") : (await fs.copy(path.resolve(pkgPath, "./default-files"), changesetBase),
fs.existsSync(changesetBase) ? fs.existsSync(path.join(changesetBase, "config.json")) ? logger.warn("It looks like you already have changesets initialized. You should be able to run changeset commands no problems.") : (fs.existsSync(path.join(changesetBase, "config.js")) ? (logger.error("It looks like you're using the version 1 `.changeset/config.js` file"),
logger.error("The format of the config object has significantly changed in v2 as well"),
logger.error(" - we thoroughly recommend looking at the changelog for this package for what has changed"),
logger.error("Changesets will write the defaults for the new config, remember to transfer your options into the new config at `.changeset/config.json`")) : (logger.error("It looks like you don't have a config file"),
logger.error("The default config file will be written at `.changeset/config.json`")),
await fs.writeFile(path.resolve(changesetBase, "config.json"), JSON.stringify(config.defaultWrittenConfig, null, 2))) : (await fs.copy(path.resolve(pkgPath, "./default-files"), changesetBase),
await fs.writeFile(path.resolve(changesetBase, "config.json"), JSON.stringify(config.defaultWrittenConfig, null, 2)),

@@ -300,6 +305,6 @@ logger.log(chalk`Thanks for choosing {green changesets} to help manage your versioning and publishing\n`),

async function cleanupOldChangesets(cwd) {
async function cleanupOldChangesets(cwd, config) {
let changesetBase = await getChangesetBase(cwd);
removeFolders(changesetBase), await git.add(changesetBase, cwd), logger.log("Committing removing old changesets..."),
await git.commit("removing legacy changesets", cwd);
removeFolders(changesetBase), config.commit && (await git.add(changesetBase, cwd),
logger.log("Committing removing old changesets..."), await git.commit("removing legacy changesets", cwd));
}

@@ -318,3 +323,3 @@

}), releasePlan = await assembleReleasePlan(changesets, workspaces, dependentsGraph, config);
await applyReleasePlan(releasePlan, cwd, config), oldChangesets.length > 0 && await cleanupOldChangesets(cwd),
await applyReleasePlan(releasePlan, cwd, config), oldChangesets.length > 0 && await cleanupOldChangesets(cwd, config),
config.commit ? logger.log("All files have been updated and committed. You're ready to publish!") : logger.log("All files have been updated. Review them and commit at your leisure"),

@@ -548,2 +553,3 @@ logger.warn("If you alter version changes in package.jsons, make sure to run bolt before publishing to ensure the repo is in a valid state");

if (!workspaces) throw new Error("We could not resolve workspaces - check you are running this command from the correct directory");
if ("init" === input[0]) return void await init(cwd);
let config$1;

@@ -561,48 +567,42 @@ try {

const {sinceMaster: sinceMaster, verbose: verbose, output: output, otp: otp} = flags;
[ "updateChangelog", "isPublic", "skipCI", "commit" ].forEach(flag => {
switch ([ "updateChangelog", "isPublic", "skipCI", "commit" ].forEach(flag => {
if (flags[flag]) throw logger.error(`the flag ${flag} has been removed from changesets for version 2`),
logger.error("Please encode the desired value into your config"), logger.error("See our changelog for more details"),
new ExitError(1);
});
try {
switch (input[0]) {
case "init":
return void await init(cwd);
}), input[0]) {
case "add":
return void await add(cwd, config$1);
case "add":
return void await add(cwd, config$1);
case "version":
return void await version(cwd, config$1);
case "version":
return void await version(cwd, config$1);
case "publish":
return void await run(cwd, {
otp: otp
}, config$1);
case "publish":
return void await run(cwd, {
otp: otp
}, config$1);
case "status":
return void await getStatus(cwd, {
sinceMaster: sinceMaster,
verbose: verbose,
output: output
}, config$1);
case "status":
return void await getStatus(cwd, {
sinceMaster: sinceMaster,
verbose: verbose,
output: output
}, config$1);
case "bump":
throw logger.error('In version 2 of changesets, "bump" has been renamed to "version" - see our changelog for an explanation'),
logger.error("To fix this, use `changeset version` instead, and update any scripts that use changesets"),
new ExitError(1);
case "bump":
throw logger.error('In version 2 of changesets, "bump" has been renamed to "version" - see our changelog for an explanation'),
logger.error("To fix this, use `changeset version` instead, and update any scripts that use changesets"),
new ExitError(1);
case "release":
throw logger.error('In version 2 of changesets, "release" has been renamed to "publish" - see our changelog for an explanation'),
logger.error("To fix this, use `changeset publish` instead, and update any scripts that use changesets"),
new ExitError(1);
case "release":
throw logger.error('In version 2 of changesets, "release" has been renamed to "publish" - see our changelog for an explanation'),
logger.error("To fix this, use `changeset publish` instead, and update any scripts that use changesets"),
new ExitError(1);
default:
logger.error(`Invalid command ${input[0]} was provided`);
}
} catch (err) {
if (err instanceof ExitError) return process.exit(err.code);
throw err;
default:
throw logger.error(`Invalid command ${input[0]} was provided`), new ExitError(1);
}
}
})();
})().catch(err => {
if (err instanceof ExitError) return process.exit(err.code);
logger.error(err), process.exit(1);
});

@@ -85,3 +85,17 @@ import meow from 'meow';

if (fs.existsSync(changesetBase)) {
logger.warn("It looks like you already have changesets initialized. You should be able to run changeset commands no problems.");
if (!fs.existsSync(path.join(changesetBase, "config.json"))) {
if (fs.existsSync(path.join(changesetBase, "config.js"))) {
logger.error("It looks like you're using the version 1 `.changeset/config.js` file");
logger.error("The format of the config object has significantly changed in v2 as well");
logger.error(" - we thoroughly recommend looking at the changelog for this package for what has changed");
logger.error("Changesets will write the defaults for the new config, remember to transfer your options into the new config at `.changeset/config.json`");
} else {
logger.error("It looks like you don't have a config file");
logger.error("The default config file will be written at `.changeset/config.json`");
}
await fs.writeFile(path.resolve(changesetBase, "config.json"), JSON.stringify(defaultWrittenConfig, null, 2));
} else {
logger.warn("It looks like you already have changesets initialized. You should be able to run changeset commands no problems.");
}
} else {

@@ -500,8 +514,11 @@ await fs.copy(path.resolve(pkgPath, "./default-files"), changesetBase);

async function cleanupOldChangesets(cwd) {
async function cleanupOldChangesets(cwd, config) {
let changesetBase = await getChangesetBase(cwd);
removeFolders(changesetBase);
await add$1(changesetBase, cwd);
logger.log("Committing removing old changesets...");
await commit(`removing legacy changesets`, cwd);
if (config.commit) {
await add$1(changesetBase, cwd);
logger.log("Committing removing old changesets...");
await commit(`removing legacy changesets`, cwd);
}
}

@@ -532,3 +549,3 @@

if (oldChangesets.length > 0) {
await cleanupOldChangesets(cwd);
await cleanupOldChangesets(cwd, config);
}

@@ -920,3 +937,2 @@

const cwd = process.cwd();
(async () => {

@@ -932,2 +948,7 @@ const workspaces = await getWorkspaces$1({

if (input[0] === "init") {
await init(cwd);
return;
}
let config;

@@ -976,71 +997,65 @@

try {
switch (input[0]) {
case "init":
{
await init(cwd);
return;
}
switch (input[0]) {
case "add":
{
// @ts-ignore if this is undefined, we have already exited
await add(cwd, config);
return;
}
case "add":
{
// @ts-ignore if this is undefined, we have already exited
await add(cwd, config);
return;
}
case "version":
{
// @ts-ignore if this is undefined, we have already exited
await version(cwd, config);
return;
}
case "version":
{
// @ts-ignore if this is undefined, we have already exited
await version(cwd, config);
return;
}
case "publish":
{
// @ts-ignore if this is undefined, we have already exited
await run(cwd, {
otp
}, config);
return;
}
case "publish":
{
// @ts-ignore if this is undefined, we have already exited
await run(cwd, {
otp
}, config);
return;
}
case "status":
{
// @ts-ignore if this is undefined, we have already exited
await getStatus(cwd, {
sinceMaster,
verbose,
output
}, config);
return;
}
case "status":
{
// @ts-ignore if this is undefined, we have already exited
await getStatus(cwd, {
sinceMaster,
verbose,
output
}, config);
return;
}
case "bump":
{
logger.error('In version 2 of changesets, "bump" has been renamed to "version" - see our changelog for an explanation');
logger.error("To fix this, use `changeset version` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
case "bump":
{
logger.error('In version 2 of changesets, "bump" has been renamed to "version" - see our changelog for an explanation');
logger.error("To fix this, use `changeset version` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
case "release":
{
logger.error('In version 2 of changesets, "release" has been renamed to "publish" - see our changelog for an explanation');
logger.error("To fix this, use `changeset publish` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
case "release":
{
logger.error('In version 2 of changesets, "release" has been renamed to "publish" - see our changelog for an explanation');
logger.error("To fix this, use `changeset publish` instead, and update any scripts that use changesets");
throw new ExitError(1);
}
default:
{
logger.error(`Invalid command ${input[0]} was provided`);
}
}
} catch (err) {
if (err instanceof ExitError) {
return process.exit(err.code);
}
throw err;
default:
{
logger.error(`Invalid command ${input[0]} was provided`);
throw new ExitError(1);
}
}
}
})();
})().catch(err => {
if (err instanceof ExitError) {
return process.exit(err.code);
}
logger.error(err);
process.exit(1);
});
{
"name": "@changesets/cli",
"version": "2.0.0",
"version": "2.0.1",
"description": "Organise your package versioning and publishing to make both contributors and maintainers happy",

@@ -12,3 +12,4 @@ "bin": {

"dist",
"bin.js"
"bin.js",
"changelog"
],

@@ -15,0 +16,0 @@ "main": "dist/cli.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc