Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@edifice.io/cli

Package Overview
Dependencies
Maintainers
0
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edifice.io/cli - npm Package Compare versions

Comparing version 1.6.0-develop-docker.0 to 1.6.0-develop-docker.20241120162649

2

package.json
{
"name": "@edifice.io/cli",
"version": "1.6.0-develop-docker.0",
"version": "1.6.0-develop-docker.20241120162649",
"description": "Edifice Frontend CLI",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,3 +5,2 @@ // @ts-check

import { parse as parseCommit } from "@commitlint/parse";
import currentGitBranch from "current-git-branch";
import { execSync } from "node:child_process";

@@ -27,5 +26,5 @@ import path from "node:path";

console.log({ branchConfigs, packages, rootDir, branch, tag, ghToken });
console.log({ branch, ghToken });
const branchName = /** @type {string} */ (branch ?? currentGitBranch());
const branchName = /** @type {string} */ (branch);
const isMainBranch = branchName === "main";

@@ -45,23 +44,9 @@ const npmTag = isMainBranch ? "latest" : branchName;

const semverTags = allTags.filter((t) => semver.valid(t)).reverse();
const filteredTags = semverTags
// Filter tags based on whether the branch is a release or pre-release
const filteredTags = allTags
// Ensure tag is valid
.filter((t) => semver.valid(t))
// 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) {
// If no tags exist for this prerelease branch, use main branch tags
const branchTags = semverTags.filter((t) => {
const tagPrerelease = semver.prerelease(t)?.[0];
return tagPrerelease === branchName;
});
if (branchTags.length === 0) {
return !isPrereleaseTag; // Use main branch tags
}
return isPrereleaseTag && prereleaseBranch === branchName;
}
// For main branch, exclude all prereleases
return !isPrereleaseTag;
// Exclude any prerelease tags
return semver.prerelease(t) === null;
})

@@ -74,2 +59,3 @@ // sort by latest

let latestTag = filteredTags.at(-1);
let rangeFrom = latestTag;

@@ -129,6 +115,6 @@

// /**
// * Get the commits since the latest tag
// * @type {import('./index.js').Commit[]}
// */
/**
* Get the commits since the latest tag
* @type {import('./index.js').Commit[]}
*/
const commitsSinceLatestTag = await Promise.all(

@@ -185,9 +171,2 @@ rawCommitsLog.map(async (c) => {

// 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

@@ -206,14 +185,8 @@ if (recommendedReleaseLevel === -1 && !tag) {

// const releaseType = branchConfig.prerelease
// ? "prerelease"
// : /** @type {const} */ ({ 0: "patch", 1: "minor", 2: "major" })[
// recommendedReleaseLevel
// ];
const releaseType = branchConfig.prerelease
? "prerelease"
: /** @type {const} */ ({ 0: "patch", 1: "minor", 2: "major" })[
recommendedReleaseLevel
];
const releaseType = /** @type {const} */ ({
0: "patch",
1: "minor",
2: "major",
})[recommendedReleaseLevel];
if (!releaseType) {

@@ -225,7 +198,5 @@ throw new Error(`Invalid release level: ${recommendedReleaseLevel}`);

? semver.parse(tag)?.version
: semver.inc(
latestTag,
branchConfig.prerelease ? `pre${releaseType}` : releaseType,
npmTag,
);
: branchConfig.prerelease
? `${semver.inc(latestTag, releaseType, npmTag, false)}.${Date.now()}`
: semver.inc(latestTag, releaseType, npmTag);

@@ -301,2 +272,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 {

@@ -309,16 +284,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)),
)

@@ -367,3 +329,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");
})

@@ -416,7 +386,7 @@ .join("\n\n");

console.info();
console.info(`Publishing all packages to npm with tag "${npmTag}"`);
/* console.info();
console.info(`Publishing all packages to npm with tag "${npmTag}"`); */
// Publish each package
for (const pkg of changedPackages) {
/* for (const pkg of changedPackages) {
const packageDir = path.join(rootDir, pkg.packageDir);

@@ -430,49 +400,68 @@

});
}
} */
console.info();
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.");
// Split the git operations into smaller chunks and add maxBuffer option
try {
execSync(`git checkout --track origin/${branch}`);
execSync("git config user.name 'jenkinsEdificePublic'");
execSync("git config user.email 'sre@edifice.io'");
console.info();
console.info(`Creating new git tag v${version}`);
execSync(`git tag -a -m "v${version}" v${version}`);
// Add files in smaller batches if needed
execSync("git add -A", { maxBuffer: 1024 * 1024 * 10 }); // 10MB buffer
console.info();
console.info("Pushing tags...");
execSync("git push --tags");
console.info(" Tags pushed.");
// Separate commit command
execSync(`git commit -m "${releaseCommitMsg(version)}" -n`, {
maxBuffer: 1024 * 1024 * 10,
});
if (ghToken && isMainBranch) {
console.info(" Committed Changes.");
console.info();
console.info("Creating github release...");
console.info("Pushing changes...");
// Stringify the markdown to escape any quotes
execSync(
`gh release create v${version} ${
branchConfig.prerelease ? "--prerelease" : ""
} --notes '${changelogMd.replace(/'/g, '"')}'`,
{ env: { ...process.env, GH_TOKEN: ghToken } },
);
console.info(" Github release created.");
// Push with increased buffer
execSync(`git push`, {
maxBuffer: 1024 * 1024 * 10,
});
console.info(" Changes 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.");
if (ghToken && isMainBranch) {
console.info();
console.info("Creating github release...");
// Stringify the markdown to escape any quotes
execSync(
`gh release create v${version} ${
branchConfig.prerelease ? "--prerelease" : ""
} --notes '${changelogMd.replace(/'/g, '"')}'`,
{ env: { ...process.env, GH_TOKEN: ghToken } },
);
console.info(" Github release created.");
}
console.info();
console.info("All done!");
} catch (error) {
console.error("Error during git operations:", error);
throw error;
}
console.info();
console.info("All done!");
};
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