@edifice.io/cli
Advanced tools
Comparing version 1.6.0 to 1.6.1-develop-b2school.1731944013005
{ | ||
"name": "@edifice.io/cli", | ||
"version": "1.6.0", | ||
"version": "1.6.1-develop-b2school.1731944013005", | ||
"description": "Edifice Frontend CLI", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -44,12 +44,6 @@ // @ts-check | ||
.filter((t) => semver.valid(t)) | ||
// Filter tags based on whether the branch is a release or pre-release | ||
// Only include non-prerelease tags from main branch | ||
.filter((t) => { | ||
const isPrereleaseTag = semver.prerelease(t) !== null; | ||
const prereleaseBranch = semver.prerelease(t)?.[0]; | ||
// For prerelease branches, only include tags for that branch | ||
if (branchConfig.prerelease) { | ||
return isPrereleaseTag && prereleaseBranch === branchName; | ||
} | ||
// For main branch, exclude all prereleases | ||
return !isPrereleaseTag; | ||
// Exclude any prerelease tags | ||
return semver.prerelease(t) === null; | ||
}) | ||
@@ -62,2 +56,3 @@ // sort by latest | ||
let latestTag = filteredTags.at(-1); | ||
let rangeFrom = latestTag; | ||
@@ -172,9 +167,2 @@ | ||
// If there is a breaking change and no manual tag is set, do not release | ||
/* if (recommendedReleaseLevel === 2 && !tag) { | ||
throw new Error( | ||
'Major versions releases must be tagged and released manually.' | ||
); | ||
} */ | ||
// If no release is semantically necessary and no manual tag is set, do not release | ||
@@ -205,3 +193,5 @@ if (recommendedReleaseLevel === -1 && !tag) { | ||
? semver.parse(tag)?.version | ||
: semver.inc(latestTag, releaseType, npmTag); | ||
: branchConfig.prerelease | ||
? `${semver.inc(latestTag, releaseType, npmTag, false)}.${Date.now()}` | ||
: semver.inc(latestTag, releaseType, npmTag); | ||
@@ -277,2 +267,6 @@ if (!version) { | ||
commitsSinceLatestTag.reduce((prev, curr) => { | ||
// Only include fix, feat, and chore commits | ||
if (!["docs", "fix", "feat", "chore"].includes(curr.type)) { | ||
return prev; | ||
} | ||
return { | ||
@@ -285,16 +279,3 @@ ...prev, | ||
.sort( | ||
getSorterFn(([type]) => | ||
[ | ||
"other", | ||
"examples", | ||
"docs", | ||
"ci", | ||
"test", | ||
"chore", | ||
"refactor", | ||
"perf", | ||
"fix", | ||
"feat", | ||
].indexOf(type), | ||
), | ||
getSorterFn(([type]) => ["docs", "chore", "fix", "feat"].indexOf(type)), | ||
) | ||
@@ -343,3 +324,11 @@ .reverse() | ||
.map(([type, commits]) => { | ||
return [`### ${capitalize(type)}`, commits.join("\n")].join("\n\n"); | ||
const typeTitle = | ||
{ | ||
fix: "Bug fixes", | ||
feat: "Features", | ||
chore: "Chores", | ||
docs: "Documentation", | ||
}[type] || capitalize(type); | ||
return [`### ${typeTitle}`, commits.join("\n")].join("\n\n"); | ||
}) | ||
@@ -409,29 +398,57 @@ .join("\n\n"); | ||
console.info("Committing changes..."); | ||
execSync( | ||
`git add -A && git reset -- ${changedPackages | ||
.map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json")) | ||
.join(" ")}`, | ||
); | ||
execSync( | ||
`git checkout -- ${changedPackages | ||
.map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json")) | ||
.join(" ")}`, | ||
); | ||
execSync(`git commit -m "${releaseCommitMsg(version)}" --allow-empty -n`); | ||
console.info(" Committed Changes."); | ||
console.info(); | ||
console.info("Pushing changes..."); | ||
execSync(`git push origin ${currentGitBranch()}`); | ||
console.info(" Changes pushed."); | ||
/** | ||
* We only commit changes on the main branch to avoid creating a new release | ||
* for every commit on a prerelease branch. | ||
*/ | ||
if (isMainBranch) { | ||
/** | ||
* Add all changed files and commit the changes with a release commit message. | ||
*/ | ||
execSync(`git add -A && git commit -m "${releaseCommitMsg(version)}"`); | ||
console.info(" Committed Changes."); | ||
console.info(); | ||
console.info(`Creating new git tag v${version}`); | ||
execSync(`git tag -a -m "v${version}" v${version}`); | ||
console.info(); | ||
console.info("Pushing changes..."); | ||
/** | ||
* Push the changes to the main branch. | ||
*/ | ||
execSync(`git push origin ${currentGitBranch()}`); | ||
console.info(" Changes pushed."); | ||
console.info(); | ||
console.info("Pushing tags..."); | ||
execSync("git push --tags"); | ||
console.info(" Tags pushed."); | ||
console.info(); | ||
console.info(`Creating new git tag v${version}`); | ||
/** | ||
* Create a new git tag for the release. | ||
*/ | ||
execSync(`git tag -a -m "v${version}" v${version}`); | ||
console.info(); | ||
console.info("Pushing tags..."); | ||
/** | ||
* Push the tags to the main branch. | ||
*/ | ||
execSync("git push --tags"); | ||
console.info(" Tags pushed."); | ||
} else { | ||
/** | ||
* Reset the changes to the package.json files so that we don't commit them | ||
* in the prerelease branch. | ||
*/ | ||
execSync( | ||
`git reset -- ${changedPackages | ||
.map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json")) | ||
.join(" ")}`, | ||
); | ||
/** | ||
* Checkout the package.json files so that we don't commit them in the | ||
* prerelease branch. | ||
*/ | ||
execSync( | ||
`git checkout -- ${changedPackages | ||
.map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json")) | ||
.join(" ")}`, | ||
); | ||
} | ||
if (ghToken && isMainBranch) { | ||
@@ -438,0 +455,0 @@ console.info(); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
55573
599
2