Skip to content

Commit efe0d89

Browse files
committed
feat: set release stability based on the release version
1 parent 47140ec commit efe0d89

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

src/package-modules.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,30 @@ async function getComposerJson(instruction, package, ref) {
100100
return fs.readFileSync(package.composerJsonFile, 'utf8');
101101
}
102102

103+
/**
104+
* Determine the stability level of a composer version string
105+
* @param {string} version - The version string to check (e.g. "2.4.0-beta1", "1.0.0", "dev-master")
106+
* @returns {string} - Returns 'dev', 'alpha', 'beta', 'RC', 'stable', or 'patch'
107+
*/
108+
function getVersionStability(version) {
109+
version = version.toLowerCase();
110+
111+
if (version.startsWith('dev-') || version.includes('-dev')) {
112+
return 'dev';
113+
}
114+
if (version.includes('-alpha')) {
115+
return 'alpha';
116+
}
117+
if (version.includes('-beta')) {
118+
return 'beta';
119+
}
120+
if (version.includes('-rc')) {
121+
return 'RC';
122+
}
123+
124+
return 'stable';
125+
}
126+
103127
/**
104128
* @param {repositoryBuildDefinition} instruction
105129
* @param {packageDefinition} package
@@ -545,18 +569,18 @@ async function determineMagentoCommunityEditionProject(url, ref, release) {
545569
*
546570
* @param {repositoryBuildDefinition} instruction
547571
* @param {buildState} release
548-
* @param {{minimumStability:String|undefined, description:String|undefined}} options
572+
* @param {{description:String|undefined, transform: Array<String, Function>}} options
549573
* @returns {Promise<{}>}
550574
*/
551575
async function createMagentoCommunityEditionProject(instruction, release, options) {
552576
const defaults = {
553-
minimumStability: 'stable',
554577
description: 'eCommerce Platform for Growth (Community Edition)',
555578
transform: {},
556579
};
557-
const {minimumStability, description, transform} = Object.assign(defaults, (options || {}))
580+
const {description, transform} = Object.assign(defaults, (options || {}))
558581
const name = `${instruction.vendor}/project-community-edition`;
559582
const version = release.version || release.dependencyVersions[name] || release.ref;
583+
const minimumStability = getVersionStability(version);
560584
const {packageFilepath, files} = await createComposerJsonOnlyPackage(
561585
instruction,
562586
release,

src/release-branch-build-tools.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ async function processBuildInstruction(instruction, release) {
156156
console.log('Packaging Magento Community Edition Project');
157157
built = await createMagentoCommunityEditionProject(
158158
instruction,
159-
release,
160-
{
161-
minimumStability: 'alpha'
162-
}
159+
release
163160
);
164161
Object.assign(packages, built);
165162
}

src/release-build-tools.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ async function buildMageOsProjectCommunityEditionMetapackage(instruction, releas
273273
instruction,
274274
release,
275275
{
276-
minimumStability: 'stable',
277-
description: 'Community built eCommerce Platform for Growth',
276+
description: 'Community-built eCommerce Platform for Growth',
278277
transform: {
279278
[`${instruction.vendor}/project-community-edition`]: [
280279
(composerConfig) => {

0 commit comments

Comments
 (0)