@changesets/cli
Advanced tools
Comparing version 2.0.1 to 2.0.2
# @changesets/cli | ||
## 2.0.2 | ||
### Patch Changes | ||
- [1ff73b7](https://github.com/atlassian/changesets/commit/1ff73b74f414031e49c6fd5a0f68e9974900d381) [#156](https://github.com/atlassian/changesets/pull/156) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Fix commits not being obtained for old changesets | ||
* [0320391](https://github.com/atlassian/changesets/commit/0320391699a73621d0e51ce031062a06cbdefadc) [#163](https://github.com/atlassian/changesets/pull/163) Thanks [@Noviny](https://github.com/Noviny)! - Reordered dependencies in the package json (this should have no impact) | ||
* Updated dependencies [3dd003c, 1ff73b7, 8c43fa0, 0320391, 1ff73b7]: | ||
- @changesets/get-release-plan@0.1.1 | ||
- @changesets/apply-release-plan@0.2.1 | ||
- @changesets/assemble-release-plan@0.2.1 | ||
- get-dependents-graph@0.1.1 | ||
- @changesets/git@0.2.1 | ||
- @changesets/parse@0.2.1 | ||
- @changesets/read@0.2.1 | ||
- @changesets/types@0.3.0 | ||
- @changesets/config@0.2.1 | ||
## 2.0.1 | ||
@@ -4,0 +23,0 @@ |
@@ -440,15 +440,2 @@ 'use strict'; | ||
const removeFolders = folderPath => { | ||
if (!fs.existsSync(folderPath)) return; | ||
const dirContents = fs.readdirSync(folderPath); | ||
dirContents.forEach(contentPath => { | ||
const singleChangesetPath = path.resolve(folderPath, contentPath); | ||
if (fs.statSync(singleChangesetPath).isDirectory()) { | ||
fs.emptyDirSync(singleChangesetPath); | ||
fs.rmdirSync(singleChangesetPath); | ||
} | ||
}); | ||
}; | ||
// TODO take in cwd, and fetch changesetBase ourselves | ||
@@ -476,8 +463,7 @@ async function getChangesets(changesetBase, sinceMasterOnly) { | ||
const commit = await git.getCommitThatAddsFile(jsonPath, changesetBase); | ||
return _objectSpread({}, json, { | ||
return { | ||
releases: json.releases, | ||
summary, | ||
commit, | ||
id: changesetDir | ||
}); | ||
}; | ||
}); | ||
@@ -503,3 +489,3 @@ return Promise.all(changesetContents); | ||
logger.warn("Make sure you validate all your dependencies"); | ||
logger.warn("In a future version, we will no longer apply these old changesets, and will instead throw here"); | ||
logger.warn("In a future major version, we will no longer apply these old changesets, and will instead throw here"); | ||
logger.warn("----------------------------------------------------------------------"); | ||
@@ -516,15 +502,2 @@ let thing = unreleasedChangesets.map(({ | ||
return thing; | ||
} // this function only exists while we wait for v1 changesets to be obsoleted | ||
// and should be deleted before v3 | ||
async function cleanupOldChangesets(cwd, config) { | ||
let changesetBase = await getChangesetBase(cwd); | ||
removeFolders(changesetBase); | ||
if (config.commit) { | ||
await git.add(changesetBase, cwd); | ||
logger.log("Committing removing old changesets..."); | ||
await git.commit(`removing legacy changesets`, cwd); | ||
} | ||
} | ||
@@ -546,3 +519,3 @@ | ||
}); | ||
if (!workspaces) throw new Error("Could not resolve workspaes for current working directory"); | ||
if (!workspaces) throw new Error("Could not resolve workspaces for current working directory"); | ||
let dependentsGraph = await getDependentsgraph({ | ||
@@ -555,6 +528,2 @@ cwd | ||
if (oldChangesets.length > 0) { | ||
await cleanupOldChangesets(cwd, config); | ||
} | ||
if (config.commit) { | ||
@@ -565,4 +534,2 @@ logger.log("All files have been updated and committed. You're ready to publish!"); | ||
} | ||
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"); | ||
} | ||
@@ -569,0 +536,0 @@ |
@@ -260,9 +260,2 @@ "use strict"; | ||
}); | ||
}, removeFolders = folderPath => { | ||
if (!fs.existsSync(folderPath)) return; | ||
fs.readdirSync(folderPath).forEach(contentPath => { | ||
const singleChangesetPath = path.resolve(folderPath, contentPath); | ||
fs.statSync(singleChangesetPath).isDirectory() && (fs.emptyDirSync(singleChangesetPath), | ||
fs.rmdirSync(singleChangesetPath)); | ||
}); | ||
}; | ||
@@ -278,8 +271,8 @@ | ||
const changesetContents = changesets.map(async changesetDir => { | ||
const summary = fs.readFileSync(path.join(changesetBase, changesetDir, "changes.md"), "utf-8"), jsonPath = path.join(changesetBase, changesetDir, "changes.json"), json = require(jsonPath), commit = await git.getCommitThatAddsFile(jsonPath, changesetBase); | ||
return _objectSpread({}, json, { | ||
const summary = fs.readFileSync(path.join(changesetBase, changesetDir, "changes.md"), "utf-8"), jsonPath = path.join(changesetBase, changesetDir, "changes.json"); | ||
return { | ||
releases: require(jsonPath).releases, | ||
summary: summary, | ||
commit: commit, | ||
id: changesetDir | ||
}); | ||
}; | ||
}); | ||
@@ -297,3 +290,3 @@ return Promise.all(changesetContents); | ||
logger.warn("There were old changesets from version 1 found"), logger.warn("Theses are being applied now but the dependents graph may have changed"), | ||
logger.warn("Make sure you validate all your dependencies"), logger.warn("In a future version, we will no longer apply these old changesets, and will instead throw here"), | ||
logger.warn("Make sure you validate all your dependencies"), logger.warn("In a future major version, we will no longer apply these old changesets, and will instead throw here"), | ||
logger.warn("----------------------------------------------------------------------"), | ||
@@ -307,10 +300,4 @@ unreleasedChangesets.map(({releases: releases, id: id, summary: summary}) => ({ | ||
async function cleanupOldChangesets(cwd, config) { | ||
let changesetBase = await getChangesetBase(cwd); | ||
removeFolders(changesetBase), config.commit && (await git.add(changesetBase, cwd), | ||
logger.log("Committing removing old changesets..."), await git.commit("removing legacy changesets", cwd)); | ||
} | ||
async function version(cwd, config) { | ||
let oldChangesets = await getOldChangesetsAndWarn(cwd), newChangesets = await readChangesets(cwd, !1), changesets = [ ...oldChangesets, ...newChangesets ]; | ||
let changesets = [ ...await getOldChangesetsAndWarn(cwd), ...await readChangesets(cwd, !1) ]; | ||
if (0 === changesets.length) return void logger.warn("No unreleased changesets found, exiting."); | ||
@@ -321,9 +308,7 @@ let workspaces = await getWorkspaces$1({ | ||
}); | ||
if (!workspaces) throw new Error("Could not resolve workspaes for current working directory"); | ||
if (!workspaces) throw new Error("Could not resolve workspaces for current working directory"); | ||
let dependentsGraph = await getDependentsgraph({ | ||
cwd: cwd | ||
}), releasePlan = await assembleReleasePlan(changesets, workspaces, dependentsGraph, config); | ||
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"), | ||
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"); | ||
await applyReleasePlan(releasePlan, 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"); | ||
} | ||
@@ -330,0 +315,0 @@ |
@@ -12,3 +12,3 @@ import meow from 'meow'; | ||
import { prompt } from 'enquirer'; | ||
import { getChangedPackagesSinceMaster, add as add$1, commit, getChangedChangesetFilesSinceMaster, getCommitThatAddsFile, tag } from '@changesets/git'; | ||
import { getChangedPackagesSinceMaster, add as add$1, commit, getChangedChangesetFilesSinceMaster, tag } from '@changesets/git'; | ||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread'; | ||
@@ -437,15 +437,2 @@ import prettier from 'prettier'; | ||
const removeFolders = folderPath => { | ||
if (!fs.existsSync(folderPath)) return; | ||
const dirContents = fs.readdirSync(folderPath); | ||
dirContents.forEach(contentPath => { | ||
const singleChangesetPath = path.resolve(folderPath, contentPath); | ||
if (fs.statSync(singleChangesetPath).isDirectory()) { | ||
fs.emptyDirSync(singleChangesetPath); | ||
fs.rmdirSync(singleChangesetPath); | ||
} | ||
}); | ||
}; | ||
// TODO take in cwd, and fetch changesetBase ourselves | ||
@@ -473,8 +460,7 @@ async function getChangesets(changesetBase, sinceMasterOnly) { | ||
const commit = await getCommitThatAddsFile(jsonPath, changesetBase); | ||
return _objectSpread({}, json, { | ||
return { | ||
releases: json.releases, | ||
summary, | ||
commit, | ||
id: changesetDir | ||
}); | ||
}; | ||
}); | ||
@@ -500,3 +486,3 @@ return Promise.all(changesetContents); | ||
logger.warn("Make sure you validate all your dependencies"); | ||
logger.warn("In a future version, we will no longer apply these old changesets, and will instead throw here"); | ||
logger.warn("In a future major version, we will no longer apply these old changesets, and will instead throw here"); | ||
logger.warn("----------------------------------------------------------------------"); | ||
@@ -513,15 +499,2 @@ let thing = unreleasedChangesets.map(({ | ||
return thing; | ||
} // this function only exists while we wait for v1 changesets to be obsoleted | ||
// and should be deleted before v3 | ||
async function cleanupOldChangesets(cwd, config) { | ||
let changesetBase = await getChangesetBase(cwd); | ||
removeFolders(changesetBase); | ||
if (config.commit) { | ||
await add$1(changesetBase, cwd); | ||
logger.log("Committing removing old changesets..."); | ||
await commit(`removing legacy changesets`, cwd); | ||
} | ||
} | ||
@@ -543,3 +516,3 @@ | ||
}); | ||
if (!workspaces) throw new Error("Could not resolve workspaes for current working directory"); | ||
if (!workspaces) throw new Error("Could not resolve workspaces for current working directory"); | ||
let dependentsGraph = await getDependentsgraph({ | ||
@@ -552,6 +525,2 @@ cwd | ||
if (oldChangesets.length > 0) { | ||
await cleanupOldChangesets(cwd, config); | ||
} | ||
if (config.commit) { | ||
@@ -562,4 +531,2 @@ logger.log("All files have been updated and committed. You're ready to publish!"); | ||
} | ||
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"); | ||
} | ||
@@ -566,0 +533,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Changeset } from "@changesets/types"; | ||
export default function getChangesets(changesetBase: string, sinceMasterOnly: boolean): Promise<Array<Changeset>>; | ||
import { NewChangeset } from "@changesets/types"; | ||
export default function getChangesets(changesetBase: string, sinceMasterOnly: boolean): Promise<Array<NewChangeset>>; |
{ | ||
"name": "@changesets/cli", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Organise your package versioning and publishing to make both contributors and maintainers happy", | ||
@@ -27,12 +27,11 @@ "bin": { | ||
"@babel/runtime": "^7.4.4", | ||
"@changesets/apply-release-plan": "^0.2.1", | ||
"@changesets/assemble-release-plan": "^0.2.1", | ||
"@changesets/config": "^0.2.1", | ||
"@changesets/get-release-plan": "^0.1.1", | ||
"@changesets/git": "^0.2.1", | ||
"@changesets/read": "^0.2.1", | ||
"@changesets/types": "^0.3.0", | ||
"@types/semver": "^6.0.0", | ||
"@types/uuid": "^3.4.4", | ||
"@changesets/git": "^0.2.0", | ||
"@changesets/types": "^0.2.0", | ||
"@changesets/config": "^0.2.0", | ||
"@changesets/get-release-plan": "^0.1.0", | ||
"@changesets/apply-release-plan": "^0.2.0", | ||
"@changesets/assemble-release-plan": "^0.2.0", | ||
"@changesets/read": "^0.2.0", | ||
"get-dependents-graph": "^0.1.0", | ||
"boxen": "^1.3.0", | ||
@@ -45,2 +44,3 @@ "chalk": "^2.1.0", | ||
"fuzzy": "^0.1.3", | ||
"get-dependents-graph": "^0.1.1", | ||
"get-workspaces": "^0.5.0", | ||
@@ -63,3 +63,3 @@ "globby": "^9.2.0", | ||
"devDependencies": { | ||
"@changesets/parse": "^0.2.0", | ||
"@changesets/parse": "^0.2.1", | ||
"jest-fixtures": "^0.5.0", | ||
@@ -66,0 +66,0 @@ "strip-ansi": "^5.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131903
2479
25
- Removed@changesets/types@0.2.0(transitive)
Updated@changesets/config@^0.2.1
Updated@changesets/git@^0.2.1
Updated@changesets/read@^0.2.1
Updated@changesets/types@^0.3.0
Updatedget-dependents-graph@^0.1.1