Skip to content
Closed
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
5 changes: 4 additions & 1 deletion App/frontend/desktop/src/pages/tests/app-frame.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe("AppFrame", () => {

it("positions the task action menu as a top-level viewport overlay", () => {
const overlayStyle = resolveSidebarMenuOverlayStyle(
{ right: 188, bottom: 424 },
{ left: 196, right: 188, bottom: 424 },
{ width: 512, height: 768 },
{ width: 128, height: 128, margin: 8, gap: 4 }
);
Expand Down Expand Up @@ -720,6 +720,7 @@ describe("AppFrame", () => {
onPin={() => undefined}
onRequestArchive={() => undefined}
onConfirmArchive={() => undefined}
onCancelArchive={() => undefined}
/>
</I18nProvider>
);
Expand All @@ -731,6 +732,7 @@ describe("AppFrame", () => {
onPin={() => undefined}
onRequestArchive={() => undefined}
onConfirmArchive={() => undefined}
onCancelArchive={() => undefined}
/>
</I18nProvider>
);
Expand All @@ -742,6 +744,7 @@ describe("AppFrame", () => {
onPin={() => undefined}
onRequestArchive={() => undefined}
onConfirmArchive={() => undefined}
onCancelArchive={() => undefined}
/>
</I18nProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ function PickerHarness(props: {
projects={projects}
registryState={props.registryState ?? "ready"}
disabled={false}
canChooseOtherFolder
onToggle={() => setOpen((current) => !current)}
onClose={() => setOpen(false)}
onSelect={(nextTarget) => {
Expand Down
4 changes: 4 additions & 0 deletions App/shell/desktop/electron-builder.unsigned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ directories:
files:
- dist/**/*
- package.json
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}"
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}/**/*"
- "!**/node_modules/**/*.{test,spec}.*"
- "!**/node_modules/**/{README,README*.md,README*.mdown,README*.markdown,README*.rst,README*.txt,CHANGELOG,CHANGELOG*.md,CHANGELOG*.mdown,CHANGELOG*.markdown,CHANGELOG*.rst,CHANGELOG*.txt,CONTRIBUTING,CONTRIBUTING*.md,CONTRIBUTING*.mdown,CONTRIBUTING*.markdown,CONTRIBUTING*.rst,CONTRIBUTING*.txt,CODE_OF_CONDUCT,CODE_OF_CONDUCT*.md,CODE_OF_CONDUCT*.mdown,CODE_OF_CONDUCT*.markdown,CODE_OF_CONDUCT*.rst,CODE_OF_CONDUCT*.txt,SECURITY,SECURITY*.md,SECURITY*.mdown,SECURITY*.markdown,SECURITY*.rst,SECURITY*.txt}"

asar: true
asarUnpack:
Expand Down
4 changes: 4 additions & 0 deletions App/shell/desktop/electron-builder.win.unsigned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ directories:
files:
- dist/**/*
- package.json
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}"
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}/**/*"
- "!**/node_modules/**/*.{test,spec}.*"
- "!**/node_modules/**/{README,README*.md,README*.mdown,README*.markdown,README*.rst,README*.txt,CHANGELOG,CHANGELOG*.md,CHANGELOG*.mdown,CHANGELOG*.markdown,CHANGELOG*.rst,CHANGELOG*.txt,CONTRIBUTING,CONTRIBUTING*.md,CONTRIBUTING*.mdown,CONTRIBUTING*.markdown,CONTRIBUTING*.rst,CONTRIBUTING*.txt,CODE_OF_CONDUCT,CODE_OF_CONDUCT*.md,CODE_OF_CONDUCT*.mdown,CODE_OF_CONDUCT*.markdown,CODE_OF_CONDUCT*.rst,CODE_OF_CONDUCT*.txt,SECURITY,SECURITY*.md,SECURITY*.mdown,SECURITY*.markdown,SECURITY*.rst,SECURITY*.txt}"

asar: true
asarUnpack:
Expand Down
4 changes: 4 additions & 0 deletions App/shell/desktop/electron-builder.win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ directories:
files:
- dist/**/*
- package.json
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}"
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}/**/*"
- "!**/node_modules/**/*.{test,spec}.*"
- "!**/node_modules/**/{README,README*.md,README*.mdown,README*.markdown,README*.rst,README*.txt,CHANGELOG,CHANGELOG*.md,CHANGELOG*.mdown,CHANGELOG*.markdown,CHANGELOG*.rst,CHANGELOG*.txt,CONTRIBUTING,CONTRIBUTING*.md,CONTRIBUTING*.mdown,CONTRIBUTING*.markdown,CONTRIBUTING*.rst,CONTRIBUTING*.txt,CODE_OF_CONDUCT,CODE_OF_CONDUCT*.md,CODE_OF_CONDUCT*.mdown,CODE_OF_CONDUCT*.markdown,CODE_OF_CONDUCT*.rst,CODE_OF_CONDUCT*.txt,SECURITY,SECURITY*.md,SECURITY*.mdown,SECURITY*.markdown,SECURITY*.rst,SECURITY*.txt}"

asar: true
asarUnpack:
Expand Down
4 changes: 4 additions & 0 deletions App/shell/desktop/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ directories:
files:
- dist/**/*
- package.json
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}"
- "!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}/**/*"
- "!**/node_modules/**/*.{test,spec}.*"
- "!**/node_modules/**/{README,README*.md,README*.mdown,README*.markdown,README*.rst,README*.txt,CHANGELOG,CHANGELOG*.md,CHANGELOG*.mdown,CHANGELOG*.markdown,CHANGELOG*.rst,CHANGELOG*.txt,CONTRIBUTING,CONTRIBUTING*.md,CONTRIBUTING*.mdown,CONTRIBUTING*.markdown,CONTRIBUTING*.rst,CONTRIBUTING*.txt,CODE_OF_CONDUCT,CODE_OF_CONDUCT*.md,CODE_OF_CONDUCT*.mdown,CODE_OF_CONDUCT*.markdown,CODE_OF_CONDUCT*.rst,CODE_OF_CONDUCT*.txt,SECURITY,SECURITY*.md,SECURITY*.mdown,SECURITY*.markdown,SECURITY*.rst,SECURITY*.txt}"

asar: true
asarUnpack:
Expand Down
46 changes: 46 additions & 0 deletions App/shell/desktop/tests/packaged-runtime-boundary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,29 @@ describe("desktop packaged runtime boundaries", () => {
}
});

it("excludes dependency tests and docs from every desktop app archive", () => {
for (const configPath of [
electronBuilderPath,
unsignedElectronBuilderPath,
winElectronBuilderPath,
winUnsignedBuilderPath
]) {
const config = parseYaml(readFileSync(configPath, "utf8")) as {
files?: string[];
};
const files = config.files ?? [];

expect(files).toContain("dist/**/*");
expect(files).toContain("!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}");
expect(files).toContain("!**/node_modules/**/{test,tests,__tests__,doc,docs,example,examples,coverage,.github}/**/*");
expect(files).toContain("!**/node_modules/**/*.{test,spec}.*");
expect(files).toContain(
"!**/node_modules/**/{README,README*.md,README*.mdown,README*.markdown,README*.rst,README*.txt,CHANGELOG,CHANGELOG*.md,CHANGELOG*.mdown,CHANGELOG*.markdown,CHANGELOG*.rst,CHANGELOG*.txt,CONTRIBUTING,CONTRIBUTING*.md,CONTRIBUTING*.mdown,CONTRIBUTING*.markdown,CONTRIBUTING*.rst,CONTRIBUTING*.txt,CODE_OF_CONDUCT,CODE_OF_CONDUCT*.md,CODE_OF_CONDUCT*.mdown,CODE_OF_CONDUCT*.markdown,CODE_OF_CONDUCT*.rst,CODE_OF_CONDUCT*.txt,SECURITY,SECURITY*.md,SECURITY*.mdown,SECURITY*.markdown,SECURITY*.rst,SECURITY*.txt}"
);
expect(files).not.toContain("!**/node_modules/**/*.md");
}
});

it("unpacks the sqlite-vec native extension in every desktop package variant", () => {
for (const configPath of [
electronBuilderPath,
Expand Down Expand Up @@ -1019,6 +1042,29 @@ describe("desktop packaged runtime boundaries", () => {
expect(winSource).toContain("sqlite-vec-windows-x64/vec0.*");
});

it("prunes third-party package docs and tests from macOS runtime before packaging", () => {
const source = readFileSync(packageMacDmgPath, "utf8");

expect(source).toContain("prune_node_modules_non_runtime_files");
expect(source).toContain('prune_node_modules_non_runtime_files "$RUNTIME_DIR"');
expect(source).toContain("-name tests");
expect(source).toContain("-name docs");
expect(source).toContain('-iname "README*.md"');
expect(source).toContain('-iname "README*.mdown"');
expect(source).toContain('-iname "CHANGELOG*.md"');
expect(source).toContain('-iname "SECURITY*.md"');
expect(source).toContain('-iname "*.test.js"');
expect(source).toContain('-iname "*.test.ts"');
expect(source).toContain('! \\( \\');
expect(source).toContain('-iname "LICENSE*"');
expect(source).toContain('-iname "NOTICE*"');
expect(source).toContain('rm -f "$RUNTIME_DIR/memmy-agent/dist/skills/README.md"');

expect(source.indexOf('prune_node_modules_non_runtime_files "$RUNTIME_DIR"')).toBeLessThan(
source.indexOf("npx electron-builder"),
);
});

it("sets an explicit edition in macOS package wrappers", () => {
for (const [name, accountChannel, edition] of [
["cn-unsigned", "phone", "cn"],
Expand Down
93 changes: 93 additions & 0 deletions scripts/internal/package-mac-dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,97 @@ prune_onnxruntime_native_artifacts() {
esac
}

prune_node_modules_non_runtime_files() {
local runtime_root="$1"

if [ ! -d "$runtime_root" ]; then
return
fi

local modules_dir
while IFS= read -r modules_dir; do
if [ ! -d "$modules_dir" ]; then
continue
fi

local disposable_list
disposable_list="$(mktemp)"
find "$modules_dir" -depth -type d \( \
-name test -o \
-name tests -o \
-name __tests__ -o \
-name doc -o \
-name docs -o \
-name example -o \
-name examples -o \
-name coverage -o \
-name .github \
\) > "$disposable_list"

local disposable_dir
while IFS= read -r disposable_dir; do
rm -rf "$disposable_dir"
done < "$disposable_list"
rm -f "$disposable_list"

if [ ! -d "$modules_dir" ]; then
continue
fi

find "$modules_dir" -type f \( \
-iname "README" -o \
-iname "README*.md" -o \
-iname "README*.mdown" -o \
-iname "README*.markdown" -o \
-iname "README*.rst" -o \
-iname "README*.txt" -o \
-iname "CHANGELOG" -o \
-iname "CHANGELOG*.md" -o \
-iname "CHANGELOG*.mdown" -o \
-iname "CHANGELOG*.markdown" -o \
-iname "CHANGELOG*.rst" -o \
-iname "CHANGELOG*.txt" -o \
-iname "CONTRIBUTING" -o \
-iname "CONTRIBUTING*.md" -o \
-iname "CONTRIBUTING*.mdown" -o \
-iname "CONTRIBUTING*.markdown" -o \
-iname "CONTRIBUTING*.rst" -o \
-iname "CONTRIBUTING*.txt" -o \
-iname "CODE_OF_CONDUCT" -o \
-iname "CODE_OF_CONDUCT*.md" -o \
-iname "CODE_OF_CONDUCT*.mdown" -o \
-iname "CODE_OF_CONDUCT*.markdown" -o \
-iname "CODE_OF_CONDUCT*.rst" -o \
-iname "CODE_OF_CONDUCT*.txt" -o \
-iname "SECURITY" -o \
-iname "SECURITY*.md" -o \
-iname "SECURITY*.mdown" -o \
-iname "SECURITY*.markdown" -o \
-iname "SECURITY*.rst" -o \
-iname "SECURITY*.txt" \
\) ! \( \
-iname "LICENSE*" -o \
-iname "NOTICE*" -o \
-iname "COPYING*" \
\) -delete

find "$modules_dir" -type f \( \
-iname "*.test.js" -o \
-iname "*.test.cjs" -o \
-iname "*.test.mjs" -o \
-iname "*.test.ts" -o \
-iname "*.test.tsx" -o \
-iname "*.spec.js" -o \
-iname "*.spec.cjs" -o \
-iname "*.spec.mjs" -o \
-iname "*.spec.ts" -o \
-iname "*.spec.tsx" -o \
-iname "test.js" -o \
-iname "tests.json" \
\) -delete
done < <(find "$runtime_root" -type d -name node_modules)
}

require_packaged_runtime_file() {
local required_file="$1"

Expand Down Expand Up @@ -502,6 +593,8 @@ prune_mac_runtime_artifacts() {

echo "Pruning macOS runtime artifacts for darwin-$target_cpu."
find "$RUNTIME_DIR" -type f -name "*.map" -delete
prune_node_modules_non_runtime_files "$RUNTIME_DIR"
rm -f "$RUNTIME_DIR/memmy-agent/dist/skills/README.md"

while IFS= read -r module_dir; do
prune_better_sqlite3_build_artifacts "$module_dir"
Expand Down