Skip to content
Open
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
2 changes: 1 addition & 1 deletion configs/e2e/mendix-versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"latest": "11.12.0"
"latest": "11.12.3"
}
4 changes: 2 additions & 2 deletions packages/jsActions/mobile-resources-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"marketplace": {
"name": "Native Mobile Resources",
"description": "Download this module to access a rich set of widgets and nanoflow actions created for native mobile, including authentication, network, platform, and more. A must-have for native mobile development!",
"minimumMXVersion": "11.12.0",
"minimumMXVersion": "11.12.3",
"marketplaceId": 109513
},
"testProject": {
Expand Down Expand Up @@ -51,4 +51,4 @@
"mendix": "11.8.0",
"rimraf": "^6.1.2"
}
}
}
4 changes: 2 additions & 2 deletions packages/jsActions/nanoflow-actions-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"marketplace": {
"name": "Nanoflow Commons",
"description": "The Nanoflow Commons module contains commonly used nanoflow actions that are usable across web, hybrid mobile, and native mobile apps, such as: client activities, geo location, local storage, & more.",
"minimumMXVersion": "11.12.0",
"minimumMXVersion": "11.12.3",
"marketplaceId": 109515
},
"testProject": {
Expand All @@ -37,4 +37,4 @@
"@mendix/pluggable-widgets-tools": "*",
"mendix": "11.8.0"
}
}
}
2 changes: 2 additions & 0 deletions scripts/release/build-mpk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ async function createNativeMobileResourcesModule(): Promise<ArtifactResult> {
log(`Native widget folders found: ${nativeWidgetFolders.length}`);
const moduleInfo = {
...(await getPackageInfo(moduleFolder)),
version: inputs.version,
moduleNameInModeler: "NativeMobileResources",
moduleFolderNameInModeler: "nativemobileresources"
};
Expand Down Expand Up @@ -157,6 +158,7 @@ async function createNanoflowCommonsModule(): Promise<ArtifactResult> {
log(`Temp folder: ${tmpFolder}`);
const moduleInfo = {
...(await getPackageInfo(moduleFolder)),
version: inputs.version,
moduleNameInModeler: "NanoflowCommons",
moduleFolderNameInModeler: "nanoflowcommons"
};
Expand Down
5 changes: 5 additions & 0 deletions scripts/release/module-automation/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ async function cloneRepo(githubUrl, localFolder, branchName) {

async function createMPK(tmpFolder, moduleInfo, excludeFilesRegExp) {
console.log("Creating module MPK..");
// Required lazily: createWidgetRelease.js loads this module under plain node, which
// cannot resolve a .ts file. Only the ts-node entry points reach createMPK.
const { setModuleVersion } = require("./moduleVersion");
await setModuleVersion(tmpFolder, moduleInfo.moduleNameInModeler, moduleInfo.version, moduleInfo.minimumMXVersion);

await createModuleMpkInDocker(
tmpFolder,
moduleInfo.moduleNameInModeler,
Expand Down
60 changes: 60 additions & 0 deletions scripts/release/module-automation/moduleVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { basename, dirname } from "path";
import { exec } from "child_process";
import { readdir } from "fs/promises";
import { join } from "path";

type CommandResult = {
code: number | null;
output: string;
};

function runCommand(command: string, workingDirectory: string): Promise<CommandResult> {
return new Promise(resolve => {
exec(command, { cwd: workingDirectory }, (error, stdout, stderr) => {
const output = `${stdout}${stderr}`.trim();
resolve({ code: error ? (error as unknown as { code?: number }).code ?? 1 : 0, output });
});
});
}

function dockerMxCommand(mendixVersion: string, projectFile: string, mxArguments: string): string {
return (
`docker run -t -v ${dirname(projectFile)}:/source --rm mxbuild:${mendixVersion} ` +
`bash -c "mx ${mxArguments.replace("{project}", `/source/${basename(projectFile)}`)}"`
);
}

async function findProjectFile(projectDir: string): Promise<string> {
const entries = await readdir(projectDir, { withFileTypes: true });
const projectFile = entries.find(entry => entry.isFile() && entry.name.endsWith(".mpr"));
if (!projectFile) {
throw new Error(`No .mpr file found in ${projectDir}`);
}
return join(projectDir, projectFile.name);
}

export async function setModuleVersion(
projectDir: string,
moduleName: string,
version: string,
mendixVersion: string
): Promise<void> {
if (!/^\d+\.\d+\.\d+$/.test(version ?? "")) {
throw new Error(`Cannot set module version: "${version}" is not a SemVer major.minor.patch version`);
}
const projectFile = await findProjectFile(projectDir);

const command = dockerMxCommand(
mendixVersion,
projectFile,
`set-module-version {project} ${moduleName} ${version}`
);
const { code, output } = await runCommand(command, dirname(projectFile));
if (code === 0) {
console.log(`Set module "${moduleName}" version to ${version} via mx set-module-version.`);
} else {
throw new Error(
`Failed to set version ${version} of module "${moduleName}" in ${projectFile}. Error: ${output || "<none>"}`
);
}
}
Loading