Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions src/package-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,30 @@ async function getComposerJson(instruction, package, ref) {
return fs.readFileSync(package.composerJsonFile, 'utf8');
}

/**
* Determine the stability level of a composer version string
* @param {string} version - The version string to check (e.g. "2.4.0-beta1", "1.0.0", "dev-master")
* @returns {string} - Returns 'dev', 'alpha', 'beta', 'RC', 'stable', or 'patch'
*/
function getVersionStability(version) {
version = version.toLowerCase();

if (version.startsWith('dev-') || version.includes('-dev')) {
return 'dev';
}
if (version.includes('-alpha')) {
return 'alpha';
}
if (version.includes('-beta')) {
return 'beta';
}
if (version.includes('-rc')) {
return 'RC';
}

return 'stable';
}

/**
* @param {repositoryBuildDefinition} instruction
* @param {packageDefinition} package
Expand Down Expand Up @@ -545,18 +569,18 @@ async function determineMagentoCommunityEditionProject(url, ref, release) {
*
* @param {repositoryBuildDefinition} instruction
* @param {buildState} release
* @param {{minimumStability:String|undefined, description:String|undefined}} options
* @param {{description:String|undefined, transform: Array<String, Function>}} options
* @returns {Promise<{}>}
*/
async function createMagentoCommunityEditionProject(instruction, release, options) {
const defaults = {
minimumStability: 'stable',
description: 'eCommerce Platform for Growth (Community Edition)',
transform: {},
};
const {minimumStability, description, transform} = Object.assign(defaults, (options || {}))
const {description, transform} = Object.assign(defaults, (options || {}))
const name = `${instruction.vendor}/project-community-edition`;
const version = release.version || release.dependencyVersions[name] || release.ref;
const minimumStability = getVersionStability(version);
const {packageFilepath, files} = await createComposerJsonOnlyPackage(
instruction,
release,
Expand Down
5 changes: 1 addition & 4 deletions src/release-branch-build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,7 @@ async function processBuildInstruction(instruction, release) {
console.log('Packaging Magento Community Edition Project');
built = await createMagentoCommunityEditionProject(
instruction,
release,
{
minimumStability: 'alpha'
}
release
);
Object.assign(packages, built);
}
Expand Down
3 changes: 1 addition & 2 deletions src/release-build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ async function buildMageOsProjectCommunityEditionMetapackage(instruction, releas
instruction,
release,
{
minimumStability: 'stable',
description: 'Community built eCommerce Platform for Growth',
description: 'Community-built eCommerce Platform for Growth',
transform: {
[`${instruction.vendor}/project-community-edition`]: [
(composerConfig) => {
Expand Down