Skip to content

Commit e1a72b8

Browse files
authored
Various improvements (#1859)
2 parents 9bfe585 + e31ebd9 commit e1a72b8

File tree

248 files changed

+489
-410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+489
-410
lines changed

automation/scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"lint": "echo 'Lint disabled for now, please update package scripts'",
1515
"lint:enableme": "eslint . --ext .mjs",
1616
"root-script:commitlint": "commitlint",
17-
"root-script:format-staged": "pretty-quick --staged --config \"./.prettierrc.cjs\" --pattern \"**/{src,script,typings,test,**}/**/*.{cjs,mjs,js,jsx,ts,tsx,scss,html,xml,md,json}\""
17+
"root-script:format-staged": "pretty-quick --staged --config \"./.prettierrc.cjs\" --pattern \"**/{src,script,typings,test,**}/**/*.{cjs,mjs,js,jsx,ts,tsx,scss,xml,md,json}\""
1818
},
1919
"dependencies": {
2020
"@commitlint/cli": "^19.8.1",

automation/utils/src/changelog.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { gh } from "./github";
22
import { PublishedInfo } from "./package-info";
3-
import { exec, pushd, popd } from "./shell";
3+
import { exec, popd, pushd } from "./shell";
44

55
export async function updateChangelogsAndCreatePR(
66
info: PublishedInfo,
@@ -10,6 +10,30 @@ export async function updateChangelogsAndCreatePR(
1010
const releaseBranchName = `${releaseTag}-update-changelog`;
1111
const appName = info.marketplace.appName;
1212

13+
// Check if branch already exists on remote
14+
try {
15+
const { stdout: remoteOutput } = await exec(`git ls-remote --heads ${remoteName} ${releaseBranchName}`, {
16+
stdio: "pipe"
17+
});
18+
if (remoteOutput.trim()) {
19+
// Branch exists on remote, get its commit hash and rename it
20+
const remoteCommitHash = remoteOutput.split("\t")[0].substring(0, 7); // Get short hash from remote output
21+
const renamedBranchName = `${releaseBranchName}-${remoteCommitHash}`;
22+
23+
console.log(
24+
`Branch '${releaseBranchName}' already exists on remote. Renaming it to '${renamedBranchName}'...`
25+
);
26+
27+
// Create new branch on remote with the renamed name pointing to the same commit
28+
await exec(`git push ${remoteName} ${remoteName}/${releaseBranchName}:refs/heads/${renamedBranchName}`);
29+
// Delete the old branch on remote
30+
await exec(`git push ${remoteName} --delete ${releaseBranchName}`);
31+
}
32+
} catch (error) {
33+
// Branch doesn't exist on remote, continue with original name
34+
console.log(`Using branch name '${releaseBranchName}'`);
35+
}
36+
1337
console.log(`Creating branch '${releaseBranchName}'...`);
1438
await exec(`git checkout -b ${releaseBranchName}`);
1539

automation/utils/src/monorepo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { prompt } from "enquirer";
22
import { oraPromise } from "./cli-utils";
3-
import { exec, find, mkdir, cp } from "./shell";
3+
import { cp, exec, find, mkdir } from "./shell";
44

55
type DependencyName = string;
66

automation/utils/src/steps.ts

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { copyMpkFiles, getMpkPaths } from "./monorepo";
1212
import { createModuleMpkInDocker } from "./mpk";
1313
import { ModuleInfo, PackageInfo, WidgetInfo } from "./package-info";
1414
import { addFilesToPackageXml, PackageType } from "./package-xml";
15-
import { chmod, cp, ensureFileExists, exec, mkdir, popd, pushd, rm, unzip, zip } from "./shell";
15+
import { chmod, cp, ensureFileExists, exec, find, mkdir, popd, pushd, rm, unzip, zip } from "./shell";
1616
import chalk from "chalk";
1717

1818
type Step<Info, Config> = (params: { info: Info; config: Config }) => Promise<void>;
@@ -196,6 +196,57 @@ export async function addWidgetsToMpk({ config }: ModuleStepParams): Promise<voi
196196
rm("-rf", target);
197197
}
198198

199+
export async function addREADMEOSSToMpk({ config, info }: ModuleStepParams): Promise<void> {
200+
logStep("Add READMEOSS to mpk");
201+
202+
// Check that READMEOSS file exists in package root and find it by name pattern
203+
const packageRoot = config.paths.package;
204+
const widgetName = info.mxpackage.name;
205+
const version = info.version.format();
206+
207+
// We'll search for files matching the name and version, ignoring timestamp
208+
const readmeossPattern = `*${widgetName}__${version}__READMEOSS_*.html`;
209+
210+
console.info(`Looking for READMEOSS file matching pattern: ${readmeossPattern}`);
211+
212+
// Find files matching the pattern in package root
213+
const matchingFiles = find(packageRoot).filter(file => {
214+
const fileName = parse(file).base;
215+
// Check if filename contains the widget name, version, and READMEOSS
216+
return fileName.includes(`${widgetName}__${version}__READMEOSS_`) && fileName.endsWith(".html");
217+
});
218+
219+
if (matchingFiles.length === 0) {
220+
console.warn(
221+
`⚠️ READMEOSS file not found for ${widgetName} version ${version}. Expected pattern: ${readmeossPattern}`
222+
);
223+
console.warn(` Skipping READMEOSS addition to mpk.`);
224+
return;
225+
}
226+
227+
const readmeossFile = matchingFiles[0];
228+
console.info(`Found READMEOSS file: ${parse(readmeossFile).base}`);
229+
230+
const mpk = config.output.files.modulePackage;
231+
const widgets = await getMpkPaths(config.dependencies);
232+
const mpkEntry = parse(mpk);
233+
const target = join(mpkEntry.dir, "tmp");
234+
235+
rm("-rf", target);
236+
237+
console.info("Unzip module mpk");
238+
await unzip(mpk, target);
239+
chmod("-R", "a+rw", target);
240+
241+
console.info(`Add READMEOSS file to ${mpkEntry.base}`);
242+
// Copy the READMEOSS file to the target directory
243+
cp(readmeossFile, target);
244+
245+
console.info("Create module zip archive");
246+
await zip(target, mpk);
247+
rm("-rf", target);
248+
}
249+
199250
export async function moveModuleToDist({ info, config }: ModuleStepParams): Promise<void> {
200251
logStep("Move module to dist");
201252

automation/utils/src/verify-widget-manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ClientModulePackageFile, readPackageXml } from "./package-xml";
2-
import { WidgetPackageSchema, WidgetPackage } from "./package-info";
2+
import { WidgetPackage, WidgetPackageSchema } from "./package-info";
33

44
type ParsedManifests = [WidgetPackage, ClientModulePackageFile];
55

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
},
2828
"engines": {
2929
"node": ">=22",
30-
"pnpm": "10.12.4"
30+
"pnpm": "10.15.0"
3131
},
32-
"packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184",
32+
"packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b",
3333
"pnpm": {
3434
"peerDependencyRules": {
3535
"allowedVersions": {

packages/customWidgets/calendar-custom-web/src/components/Button.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReactNode, createElement, FunctionComponent } from "react";
1+
import { createElement, FunctionComponent, ReactNode } from "react";
22
import classNames from "classnames";
33

44
export interface ButtonProps {

packages/customWidgets/calendar-custom-web/src/components/Calendar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSProperties, Component, ReactChild, createElement, ReactNode } from "react";
1+
import { Component, createElement, CSSProperties, ReactChild, ReactNode } from "react";
22

33
import { Alert } from "./Alert";
44
import { Container, Style } from "../utils/namespaces";

packages/customWidgets/calendar-custom-web/src/components/CalendarLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReactElement, createElement, FunctionComponent } from "react";
1+
import { createElement, FunctionComponent, ReactElement } from "react";
22
import "../ui/CalendarLoader.scss";
33

44
export const CalendarLoader: FunctionComponent = () =>

packages/customWidgets/calendar-custom-web/src/components/SizeContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CSSProperties, createElement, FunctionComponent, PropsWithChildren } from "react";
1+
import { createElement, CSSProperties, FunctionComponent, PropsWithChildren } from "react";
22
import classNames from "classnames";
33

44
export type HeightUnitType = "percentageOfWidth" | "percentageOfParent" | "pixels";

0 commit comments

Comments
 (0)