@legendapp/spark 0.0.1-next.3 → 0.0.1-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/camera.ts +13 -0
- package/customize.ts +2 -0
- package/html.ts +1 -0
- package/markdown.ts +1 -0
- package/package.json +34 -15
- package/patches/camera/react-native-nitro-image.patch +320 -0
- package/patches/camera/react-native-nitro-modules.patch +50 -0
- package/patches/camera/react-native-vision-camera.patch +2662 -0
- package/patches/camera/upstream.json +22 -0
- package/patches/dependencies.json +14 -0
- package/patches/react-native-enriched-html@1.1.1.patch +854 -0
- package/patches/react-native-enriched-markdown@1.1.1.patch +9261 -0
- package/postinstall.cjs +1 -0
- package/schema.json +104 -0
- package/skills/spark/SKILL.md +56 -0
- package/skills/spark/UPGRADING.md +246 -0
- package/ui-swipe.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-ai/src/invocation-command.cjs +11 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/invocation-command.d.cts +2 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/invocations.ts +2 -19
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +65 -11
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +3 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +36 -13
- package/vendor/node_modules/@legendapp/spark-cli/dist/credentials.js +41 -26
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-ai.cjs +108 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-artifacts.js +315 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-cli.cjs +75 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-github.cjs +133 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-policy.cjs +102 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-provider.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/customize-worker.cjs +273 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +157 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +3 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +128 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +100 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +30 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-native.cjs +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/helpers.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +52 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/js-runtime.cjs +96 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/json.js +16 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +152 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +184 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.d.cts +16 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/package-manager-config.js +41 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/package-manager.js +13 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/process.js +7 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +66 -30
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.js +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +20 -20
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-bootstrap.ps1 +87 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-bootstrap.sh +107 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-downloads.tsv +13 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/sdk-install.js +8 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/universal.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +102 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -8
- package/vendor/node_modules/@legendapp/spark-cli/package.json +6 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/.claude/skills/spark/SKILL.md +9 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/AGENTS.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/CLAUDE.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/README.md +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +47 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/.claude/skills/spark/SKILL.md +9 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/AGENTS.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/CLAUDE.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/README.md +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +46 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/.claude/skills/spark/SKILL.md +9 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/AGENTS.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/CLAUDE.md +4 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/README.md +15 -0
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +47 -3
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-codex/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-commands/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/RNDesktopApp.mm +14 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/menu.ts +6 -4
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/customize-hooks.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/customize.ts +117 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +20 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +5 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +14 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/customize-provider.cjs +16 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/customize.cjs +16 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/expo.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +106 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-desktop-config/schema.json +104 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/SparkCustomize.mm +517 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/RNDesktopShortcuts.mm +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.h +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +44 -4
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +65 -26
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +8 -6
- package/vendor/node_modules/@legendapp/spark-documents/package.json +8 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.h +1 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.mm +11 -10
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-html/package.json +24 -0
- package/vendor/node_modules/@legendapp/spark-html/src/Html.tsx +22 -0
- package/vendor/node_modules/@legendapp/spark-html/src/HtmlInput.tsx +102 -0
- package/vendor/node_modules/@legendapp/spark-html/src/index.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-html/src/types.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +24 -0
- package/vendor/node_modules/@legendapp/spark-markdown/src/Markdown.tsx +24 -0
- package/vendor/node_modules/@legendapp/spark-markdown/src/MarkdownInput.tsx +111 -0
- package/vendor/node_modules/@legendapp/spark-markdown/src/index.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-notifications/windows/SparkNotifications/SparkNotifications.h +16 -11
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +18 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/components.tsx +52 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/index.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/types.ts +24 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/useInputShortcuts.macos.ts +55 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/useInputShortcuts.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/useInputValue.ts +14 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/src/value.ts +16 -0
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +360 -35
- package/vendor/node_modules/@legendapp/spark-ui/macos/swipe-actions/RNSwipeActions.h +10 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/swipe-actions/RNSwipeActions.mm +422 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +30 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/swipe-actions/SwipeActionsNativeComponent.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/swipe-actions/index.tsx +41 -0
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { createRequire } = require('node:module');
|
|
5
|
+
const { createMigrationContext } = require('./migration-helpers.cjs');
|
|
6
|
+
|
|
7
|
+
const skillPath = 'node_modules/@legendapp/spark/skills/spark/SKILL.md';
|
|
8
|
+
const start = '<!-- spark:skill:start -->';
|
|
9
|
+
const end = '<!-- spark:skill:end -->';
|
|
10
|
+
const pointer = `${start}\nFrom the app root, read [Spark's app development skill](${skillPath}) before working on this app.\nThe installed Spark version owns these instructions; do not copy them here.\n${end}`;
|
|
11
|
+
const claudePointer = `---\nname: spark\ndescription: Develop, build, diagnose, or upgrade a Legend Spark desktop app.\n---\n\n${pointer}\n`;
|
|
12
|
+
|
|
13
|
+
/** @param {string} source */
|
|
14
|
+
function mergePointer(source) {
|
|
15
|
+
const first = source.indexOf(start);
|
|
16
|
+
const last = source.indexOf(end);
|
|
17
|
+
if (first === -1 && last === -1) return source + (source ? (source.endsWith('\n') ? '\n' : '\n\n') : '') + pointer + '\n';
|
|
18
|
+
if (first === -1 || last < first || source.indexOf(start, first + start.length) !== -1 || source.indexOf(end, last + end.length) !== -1) {
|
|
19
|
+
throw new Error('Malformed Spark skill markers. Repair the spark:skill section, then run spark upgrade.');
|
|
20
|
+
}
|
|
21
|
+
return source.slice(0, first) + pointer + source.slice(last + end.length);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @param {import('./migration-helpers.cjs').MigrationContext} context */
|
|
25
|
+
function planPointers(context) {
|
|
26
|
+
const edits = ['AGENTS.md', 'CLAUDE.md'].map(name => {
|
|
27
|
+
const file = name;
|
|
28
|
+
const before = context.readFile(file) ?? '';
|
|
29
|
+
return { file, before, after: mergePointer(before) };
|
|
30
|
+
});
|
|
31
|
+
const file = '.claude/skills/spark/SKILL.md';
|
|
32
|
+
const before = context.readFile(file) ?? '';
|
|
33
|
+
// A pre-existing user skill keeps its frontmatter and instructions.
|
|
34
|
+
edits.push({ file, before, after: !before || before === claudePointer ? claudePointer : mergePointer(before) });
|
|
35
|
+
for (const { file, before, after } of edits) {
|
|
36
|
+
if (before === after) continue;
|
|
37
|
+
context.writeFile(file, after);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @param {string} root */
|
|
42
|
+
function refreshPointers(root) {
|
|
43
|
+
const changes = new Map();
|
|
44
|
+
planPointers(createMigrationContext(root, '', changes, []));
|
|
45
|
+
writeChanges(root, [...changes.values()]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** @param {import('./migration-helpers.cjs').MigrationContext} context */
|
|
49
|
+
function upgradeWindowConfig(context) {
|
|
50
|
+
for (const file of ['desktop.config.json', 'app.json']) {
|
|
51
|
+
context.editJson(file, /** @param {{ window?: import('./migration-helpers.cjs').JsonObject; expo?: { extra?: { spark?: { window?: import('./migration-helpers.cjs').JsonObject } } } }} config */ config => {
|
|
52
|
+
const options = file === 'desktop.config.json' ? config.window : config.expo?.extra?.spark?.window;
|
|
53
|
+
if (!options) return;
|
|
54
|
+
if (typeof options !== 'object' || Array.isArray(options)) { context.manualStep(`Repair window configuration in ${file}; expected an object.`); return; }
|
|
55
|
+
for (const [nested, width, height] of [['size', 'width', 'height'], ['minSize', 'minWidth', 'minHeight'], ['maxSize', 'maxWidth', 'maxHeight']]) {
|
|
56
|
+
if (!(width in options) && !(height in options)) continue;
|
|
57
|
+
if (typeof options[width] !== 'number' || typeof options[height] !== 'number' || options[nested] !== undefined) {
|
|
58
|
+
context.manualStep(`Merge legacy ${width}/${height} into window.${nested} in ${file}; incomplete or conflicting dimensions need review.`);
|
|
59
|
+
} else {
|
|
60
|
+
options[nested] = { width: options[width], height: options[height] };
|
|
61
|
+
delete options[width]; delete options[height];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if ('restoreFrame' in options) {
|
|
65
|
+
if ('restoreBounds' in options && options.restoreBounds !== options.restoreFrame) context.manualStep(`Resolve window.restoreFrame/restoreBounds in ${file}.`);
|
|
66
|
+
else { options.restoreBounds = options.restoreFrame; delete options.restoreFrame; }
|
|
67
|
+
}
|
|
68
|
+
for (const [legacy, nested] of [['material', 'backgroundMaterial'], ['trafficLights', 'titleBar']]) {
|
|
69
|
+
if (!(legacy in options)) continue;
|
|
70
|
+
const macos = /** @type {import('./migration-helpers.cjs').JsonObject} */ (options.macos ?? {});
|
|
71
|
+
if (typeof macos !== 'object' || Array.isArray(macos) || macos[nested] !== undefined) context.manualStep(`Merge window.${legacy} into window.macos.${nested} in ${file}.`);
|
|
72
|
+
else {
|
|
73
|
+
macos[nested] = legacy === 'trafficLights' ? { trafficLights: options[legacy] } : options[legacy];
|
|
74
|
+
options.macos = macos; delete options[legacy];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Keep released migration versions fixed. New steps must be idempotent; only
|
|
82
|
+
// steps that preserve user configuration and need no install may run at startup.
|
|
83
|
+
/** @type {import('./migrations.cjs').Migration[]} */
|
|
84
|
+
const migrations = [
|
|
85
|
+
{
|
|
86
|
+
version: '0.0.1-next.3', automatic: false, breaking: true,
|
|
87
|
+
apply(context) {
|
|
88
|
+
upgradeWindowConfig(context);
|
|
89
|
+
context.replaceImport('@legendapp/spark/message-dialog', '@legendapp/spark/dialogs');
|
|
90
|
+
context.replaceImport('@legendapp/spark/expo-metro', '@legendapp/spark/metro');
|
|
91
|
+
context.manualStep('Review next.3 API contracts: dialogs/files, windows, registrations, settings, menus, shortcuts, processes, links, audio, notifications, updates, UI, removed universal tooling, and native lifecycle. Adapt arguments, results and cleanup; rebuild custom native modules.');
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{ version: '0.0.1-next.4', automatic: true, apply(context) {
|
|
95
|
+
planPointers(context);
|
|
96
|
+
context.manualStep('If the app uses a custom runtime, rebuild it for next.4 native dependency patches; review production module selection and affected SidebarSplitView/Windows native flows.');
|
|
97
|
+
} },
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
/** @param {string} root */
|
|
101
|
+
function installedSparkVersion(root) {
|
|
102
|
+
const file = createRequire(path.join(root, 'package.json')).resolve('@legendapp/spark/package.json');
|
|
103
|
+
return JSON.parse(fs.readFileSync(file, 'utf8')).version;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** @type {typeof import('./migrations.cjs').planMigrations} */
|
|
107
|
+
function planMigrations(root, version, { automatic = false, fromVersion } = {}) {
|
|
108
|
+
const { compare, valid } = createRequire(require.resolve('npm/package.json'))('semver');
|
|
109
|
+
const file = path.join(root, '.spark/version');
|
|
110
|
+
const previous = fs.existsSync(file) ? fs.readFileSync(file, 'utf8').trim() : fromVersion;
|
|
111
|
+
if (!valid(version) || (previous !== undefined && (!valid(previous) || compare(previous, version) > 0))) {
|
|
112
|
+
throw new Error(`Spark project version ${previous ?? '(unrecorded)'} cannot migrate to ${version}. Run spark upgrade.`);
|
|
113
|
+
}
|
|
114
|
+
const pending = migrations.filter(step => (!previous || compare(step.version, previous) > 0) && compare(step.version, version) <= 0).sort((a, b) => compare(a.version, b.version));
|
|
115
|
+
if (automatic && pending.some(step => !step.automatic)) throw new Error('Spark has pending migrations that require an install or configuration changes. Run spark upgrade.');
|
|
116
|
+
const changes = new Map();
|
|
117
|
+
/** @type {import('./migration-helpers.cjs').ManualStep[]} */
|
|
118
|
+
const manualSteps = [];
|
|
119
|
+
for (const step of pending) step.apply(createMigrationContext(root, step.version, changes, manualSteps));
|
|
120
|
+
planPointers(createMigrationContext(root, version, changes, manualSteps));
|
|
121
|
+
if (manualSteps.length) {
|
|
122
|
+
const context = createMigrationContext(root, version, changes, manualSteps);
|
|
123
|
+
const notesFile = '.spark/upgrade-notes.md';
|
|
124
|
+
let notes = context.readFile(notesFile) ?? '# Spark upgrade manual steps\n\nComplete these steps using the installed version notes. Keep this file until reviewed.\n';
|
|
125
|
+
for (const step of manualSteps) {
|
|
126
|
+
const entry = `- [ ] [${step.version}](../${step.notes}): ${step.message}`;
|
|
127
|
+
if (!notes.replaceAll('- [x]', '- [ ]').includes(entry)) notes += '\n' + entry + '\n';
|
|
128
|
+
}
|
|
129
|
+
context.writeFile(notesFile, notes);
|
|
130
|
+
}
|
|
131
|
+
return { previous, version, versions: pending.map(step => step.version), changes: [...changes.values()].filter(change => change.before !== change.after), manualSteps };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** @param {string} root @param {import('./migration-helpers.cjs').FileChange[]} changes */
|
|
135
|
+
function writeChanges(root, changes) {
|
|
136
|
+
const context = createMigrationContext(root, '', new Map(), []);
|
|
137
|
+
for (const change of changes) {
|
|
138
|
+
if (context.readFile(change.file) !== change.before) throw new Error(`Migration input changed: ${change.file}. Run spark upgrade again.`);
|
|
139
|
+
}
|
|
140
|
+
for (const { file, after } of changes) {
|
|
141
|
+
const destination = path.join(root, file);
|
|
142
|
+
if (after === null) fs.unlinkSync(destination);
|
|
143
|
+
else {
|
|
144
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
145
|
+
const temporary = `${destination}.${process.pid}.tmp`;
|
|
146
|
+
fs.writeFileSync(temporary, after);
|
|
147
|
+
fs.renameSync(temporary, destination);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** @type {typeof import('./migrations.cjs').applyMigrationPlan} */
|
|
153
|
+
function applyMigrationPlan(root, plan, recordVersion = true) {
|
|
154
|
+
writeChanges(root, plan.changes);
|
|
155
|
+
if (recordVersion) recordProjectVersion(root, plan.version);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** @type {typeof import('./migrations.cjs').recordProjectVersion} */
|
|
159
|
+
function recordProjectVersion(root, version) {
|
|
160
|
+
const file = path.join(root, '.spark/version');
|
|
161
|
+
if (fs.existsSync(file) && fs.readFileSync(file, 'utf8') === version + '\n') return;
|
|
162
|
+
// Record only successful migrations. A failed/partial attempt is safe to retry.
|
|
163
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
164
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
165
|
+
fs.writeFileSync(temporary, version + '\n');
|
|
166
|
+
fs.renameSync(temporary, file);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** @type {typeof import('./migrations.cjs').migrateProject} */
|
|
170
|
+
function migrateProject(root, version, automatic = true, options = {}) {
|
|
171
|
+
const plan = planMigrations(root, version, { ...options, automatic });
|
|
172
|
+
applyMigrationPlan(root, plan);
|
|
173
|
+
return plan.versions;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @type {typeof import('./migrations.cjs').printMigrationPlan} */
|
|
177
|
+
function printMigrationPlan(plan) {
|
|
178
|
+
console.log(`Migrations: ${plan.versions.join(' → ') || '(none pending)'}`);
|
|
179
|
+
for (const change of plan.changes) console.log(` ${change.after === null ? 'Delete' : change.before === null ? 'Create' : 'Edit'} ${change.file}`);
|
|
180
|
+
for (const step of plan.manualSteps) console.log(`Manual step (${step.version}): ${step.message}\n See ${step.notes}`);
|
|
181
|
+
console.log('Review .spark/upgrade-notes.md for outstanding manual steps after upgrading.');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
module.exports = { pointer, claudePointer, mergePointer, refreshPointers, migrations, installedSparkVersion, migrateProject, planMigrations, applyMigrationPlan, recordProjectVersion, printMigrationPlan };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const pointer: string;
|
|
2
|
+
export const claudePointer: string;
|
|
3
|
+
export function mergePointer(source: string): string;
|
|
4
|
+
export function refreshPointers(root: string): void;
|
|
5
|
+
import type { FileChange, ManualStep, MigrationContext } from './migration-helpers.cjs';
|
|
6
|
+
export interface Migration { version: string; automatic: boolean; breaking?: boolean; apply(context: MigrationContext): void }
|
|
7
|
+
export interface MigrationPlan { previous?: string; version: string; versions: string[]; changes: FileChange[]; manualSteps: ManualStep[] }
|
|
8
|
+
export interface MigrationOptions { automatic?: boolean; fromVersion?: string }
|
|
9
|
+
export const migrations: Migration[];
|
|
10
|
+
export function installedSparkVersion(root: string): string;
|
|
11
|
+
export function planMigrations(root: string, version: string, options?: MigrationOptions): MigrationPlan;
|
|
12
|
+
export function applyMigrationPlan(root: string, plan: MigrationPlan, recordVersion?: boolean): void;
|
|
13
|
+
/** Upgrade calls this only after installation and initialization succeed. */
|
|
14
|
+
export function recordProjectVersion(root: string, version: string): void;
|
|
15
|
+
export function printMigrationPlan(plan: MigrationPlan): void;
|
|
16
|
+
export function migrateProject(root: string, version: string, automatic?: boolean, options?: Pick<MigrationOptions, 'fromVersion'>): string[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { assertEnrichedHtmlPins } from "./enriched-html-pins.js";
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
5
|
+
import { prepareNativePatches } from "@legendapp/spark-desktop-config/native-patches.cjs";
|
|
4
6
|
import { findFramework } from "./local.js";
|
|
5
7
|
import { installedPackages, readJson, VERSION } from "./project.js";
|
|
6
8
|
const required = ["@react-native-runtimes/core", "react-native-nitro-modules", "@op-engineering/op-sqlite", "react-native-webview"];
|
|
@@ -67,6 +69,8 @@ export function validateWorkspaceNativePatches(root, packages) {
|
|
|
67
69
|
return errors;
|
|
68
70
|
}
|
|
69
71
|
export function assertNativePatchPreflight(root) {
|
|
72
|
+
assertEnrichedHtmlPins(root);
|
|
73
|
+
prepareNativePatches(root);
|
|
70
74
|
const packages = installedPackages(root);
|
|
71
75
|
const framework = findFramework(root);
|
|
72
76
|
let errors;
|
|
@@ -80,5 +84,5 @@ export function assertNativePatchPreflight(root) {
|
|
|
80
84
|
errors = validatePackedNativePatches(packages, requirements);
|
|
81
85
|
}
|
|
82
86
|
if (errors.length)
|
|
83
|
-
throw new Error(`Native preparation stopped before changing project files:\n${errors.map(error => `- ${error}`).join("\n")}`);
|
|
87
|
+
throw new Error(`Native patch preparation stopped before changing project files:\n${errors.map(error => `- ${error}`).join("\n")}`);
|
|
84
88
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parseDocument } from "yaml";
|
|
4
|
+
import { writeJson } from "./json.js";
|
|
5
|
+
import { overridePackageName } from "./package-manager.js";
|
|
6
|
+
export function readPnpmConfig(root) {
|
|
7
|
+
const file = path.join(root, "pnpm-workspace.yaml");
|
|
8
|
+
const document = parseDocument(existsSync(file) ? readFileSync(file, "utf8") : "");
|
|
9
|
+
if (document.errors.length)
|
|
10
|
+
throw new Error(`Invalid pnpm configuration: ${document.errors[0].message}`);
|
|
11
|
+
return document;
|
|
12
|
+
}
|
|
13
|
+
/** pnpm 11 reads installer settings from YAML; retain package.json settings for pnpm 10. */
|
|
14
|
+
export function writePackageConfig(root, pkg, manager, installRoot = root, preservedOverrides = []) {
|
|
15
|
+
if (manager === "pnpm") {
|
|
16
|
+
const file = path.join(root, "pnpm-workspace.yaml");
|
|
17
|
+
const document = readPnpmConfig(root);
|
|
18
|
+
if (!document.has("nodeLinker"))
|
|
19
|
+
document.set("nodeLinker", "hoisted");
|
|
20
|
+
for (const [name, version] of Object.entries(pkg.pnpm?.overrides ?? {})) {
|
|
21
|
+
if (!overridePackageName(name, preservedOverrides) || !document.hasIn(["overrides", name]))
|
|
22
|
+
document.setIn(["overrides", name], version);
|
|
23
|
+
}
|
|
24
|
+
for (const name of [...(pkg.pnpm?.onlyBuiltDependencies ?? [])]) {
|
|
25
|
+
if (!document.hasIn(["allowBuilds", name]))
|
|
26
|
+
document.setIn(["allowBuilds", name], true);
|
|
27
|
+
const source = pkg.dependencies?.[name] ?? pkg.pnpm?.overrides?.[name];
|
|
28
|
+
if (typeof source === "string" && source.startsWith("file:")) {
|
|
29
|
+
const key = `${name}@file:${path.relative(installRoot, path.resolve(installRoot, source.slice(5))).replaceAll("\\", "/")}`;
|
|
30
|
+
if (!document.hasIn(["allowBuilds", key]))
|
|
31
|
+
document.setIn(["allowBuilds", key], document.getIn(["allowBuilds", name]));
|
|
32
|
+
if (document.getIn(["allowBuilds", key]) === true && !pkg.pnpm.onlyBuiltDependencies.includes(key))
|
|
33
|
+
pkg.pnpm.onlyBuiltDependencies.push(key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (pkg.pnpm?.onlyBuiltDependencies)
|
|
37
|
+
pkg.pnpm.onlyBuiltDependencies = pkg.pnpm.onlyBuiltDependencies.filter((name) => document.getIn(["allowBuilds", name]) !== false);
|
|
38
|
+
writeFileSync(file, document.toString());
|
|
39
|
+
}
|
|
40
|
+
writeJson(path.join(root, "package.json"), pkg);
|
|
41
|
+
}
|
|
@@ -30,6 +30,11 @@ export function managerCommand(manager, args, env = process.env) {
|
|
|
30
30
|
: [manager, ...args];
|
|
31
31
|
}
|
|
32
32
|
export function applyOverrides(pkg, overrides, manager) {
|
|
33
|
+
// pnpm 10 can auto-install a registry peer beside an overridden file archive.
|
|
34
|
+
// Provide Nitro at the installation root so camera/runtimes peers share the patched copy.
|
|
35
|
+
const nitro = overrides["react-native-nitro-modules"];
|
|
36
|
+
if (manager === "pnpm" && nitro?.startsWith("file:"))
|
|
37
|
+
pkg.dependencies = { ...pkg.dependencies, "react-native-nitro-modules": nitro };
|
|
33
38
|
const existing = { ...pkg.overrides, ...pkg.resolutions, ...pkg.pnpm?.overrides };
|
|
34
39
|
delete pkg.overrides;
|
|
35
40
|
delete pkg.resolutions;
|
|
@@ -43,3 +48,11 @@ export function applyOverrides(pkg, overrides, manager) {
|
|
|
43
48
|
pkg.overrides = { ...existing, ...overrides };
|
|
44
49
|
}
|
|
45
50
|
export function localArchive(file) { return `file:${path.resolve(file).replaceAll("\\", "/")}`; }
|
|
51
|
+
/** Match Yarn paths, version-qualified npm selectors and pnpm parent>child selectors. */
|
|
52
|
+
export function overridePackageName(selector, checked) {
|
|
53
|
+
// Comparators after @, whitespace or || belong to the version range.
|
|
54
|
+
const child = selector.split(/(?<![@\s|])>(?=[@a-zA-Z])/).at(-1);
|
|
55
|
+
const segments = child.split("/");
|
|
56
|
+
const childName = segments.at(-2)?.startsWith("@") ? segments.slice(-2).join("/") : segments.at(-1);
|
|
57
|
+
return checked.find(name => childName === name || childName.startsWith(name + "@"));
|
|
58
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readJson } from "./json.js";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
3
4
|
import { createRequire } from "node:module";
|
|
@@ -55,3 +56,9 @@ export function spawnProcess(argv, options = {}) {
|
|
|
55
56
|
return result;
|
|
56
57
|
}
|
|
57
58
|
export { which } from "./executable.js";
|
|
59
|
+
// Windows .cmd shims are shell programs; run the package's actual JS entry.
|
|
60
|
+
export function nodeCommand(root, name, bin, args = []) {
|
|
61
|
+
const req = createRequire(path.join(root, "package.json"));
|
|
62
|
+
const file = req.resolve(`${name}/package.json`), pkg = readJson(file);
|
|
63
|
+
return ["node", path.resolve(path.dirname(file), typeof pkg.bin === "string" ? pkg.bin : pkg.bin[bin]), ...args];
|
|
64
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { initializeTemplate } from "./init-template.cjs";
|
|
2
|
+
import { installedSparkVersion, migrateProject } from "./migrations.cjs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { readJson } from "./json.js";
|
|
5
|
+
const version = readJson(fileURLToPath(new URL("../package.json", import.meta.url))).version;
|
|
6
|
+
export function ensureProjectVersion(root) {
|
|
7
|
+
const installed = installedSparkVersion(root);
|
|
8
|
+
if (installed !== version)
|
|
9
|
+
throw new Error(`This CLI is Spark ${version}, but the app has ${installed}. Run spark upgrade using the app's installed CLI.`);
|
|
10
|
+
migrateProject(root, installed);
|
|
11
|
+
initializeTemplate(root);
|
|
12
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { assertEnrichedHtmlPins } from "./enriched-html-pins.js";
|
|
1
2
|
import { nativeWindowOptions } from "@legendapp/spark-window-options";
|
|
3
|
+
import { prepareNativePatches } from "@legendapp/spark-desktop-config/native-patches.cjs";
|
|
2
4
|
import { macOSReleaseSettings } from "./macos-release.js";
|
|
3
5
|
import { projectPlatform, architecture } from "./platform.js";
|
|
4
6
|
import { resolveHelpers } from "./helpers.js";
|
|
@@ -6,23 +8,11 @@ import { readConfig as readAppConfig, prepareConfig, writeUpdates, statePath, is
|
|
|
6
8
|
export { readAppConfig, prepareConfig, writeUpdates, statePath, isUniversal };
|
|
7
9
|
import { createHash } from "node:crypto";
|
|
8
10
|
import { createRequire } from "node:module";
|
|
9
|
-
import { existsSync,
|
|
11
|
+
import { existsSync, readFileSync, readdirSync, realpathSync, } from "node:fs";
|
|
10
12
|
import path from "node:path";
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
export function writeJson(file, value) {
|
|
16
|
-
const content = JSON.stringify(value, null, 2) + "\n";
|
|
17
|
-
// Metro watches JSON too: rewriting unchanged session state on every runtime
|
|
18
|
-
// check causes empty Fast Refresh updates even when app code has not changed.
|
|
19
|
-
if (existsSync(file) && readFileSync(file, "utf8") === content)
|
|
20
|
-
return;
|
|
21
|
-
mkdirSync(path.dirname(file), { recursive: true });
|
|
22
|
-
const temporary = `${file}.${process.pid}.tmp`;
|
|
23
|
-
writeFileSync(temporary, content);
|
|
24
|
-
renameSync(temporary, file);
|
|
25
|
-
}
|
|
13
|
+
import { readJson, writeJson } from "./json.js";
|
|
14
|
+
export { readJson, writeJson };
|
|
15
|
+
export const VERSION = "0.0.1-next.5";
|
|
26
16
|
export function digest(value) {
|
|
27
17
|
return createHash("sha256").update(value).digest("hex");
|
|
28
18
|
}
|
|
@@ -109,9 +99,11 @@ export function installedPackages(root) {
|
|
|
109
99
|
}
|
|
110
100
|
return [...found.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
111
101
|
}
|
|
112
|
-
export function hashFiles(root, entries, windows = false) {
|
|
102
|
+
export function hashFiles(root, entries, windows = false, excluded = [], nativeSignature = false) {
|
|
113
103
|
const hash = createHash("sha256");
|
|
114
104
|
function visit(relative) {
|
|
105
|
+
if (excluded.includes(relative.split(path.sep).join("/")))
|
|
106
|
+
return;
|
|
115
107
|
const file = path.join(root, relative);
|
|
116
108
|
if (!existsSync(file))
|
|
117
109
|
return;
|
|
@@ -127,24 +119,53 @@ export function hashFiles(root, entries, windows = false) {
|
|
|
127
119
|
catch (error) {
|
|
128
120
|
if (error.code !== "ENOTDIR")
|
|
129
121
|
throw error;
|
|
130
|
-
|
|
122
|
+
let content = readFileSync(file);
|
|
123
|
+
if (nativeSignature && relative === "package.json") {
|
|
124
|
+
// Installation receipts and lifecycle scripts differ between workspace and packed copies.
|
|
125
|
+
const manifest = JSON.parse(content.toString());
|
|
126
|
+
delete manifest.scripts;
|
|
127
|
+
if (manifest.spark) {
|
|
128
|
+
delete manifest.spark.workspacePatch;
|
|
129
|
+
delete manifest.spark.dependencyPatch;
|
|
130
|
+
delete manifest.spark.patchHash;
|
|
131
|
+
if (!Object.keys(manifest.spark).length)
|
|
132
|
+
delete manifest.spark;
|
|
133
|
+
}
|
|
134
|
+
content = JSON.stringify(manifest);
|
|
135
|
+
}
|
|
136
|
+
hash.update(relative.split(path.sep).join("/")).update(content);
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
for (const entry of entries.sort())
|
|
134
140
|
visit(entry);
|
|
135
141
|
return hash.digest("hex");
|
|
136
142
|
}
|
|
137
|
-
export function nativePackages(root) {
|
|
143
|
+
export function nativePackages(root, { applyExcludes = true } = {}) {
|
|
144
|
+
assertEnrichedHtmlPins(root);
|
|
145
|
+
prepareNativePatches(root);
|
|
138
146
|
const installed = installedPackages(root);
|
|
139
147
|
if (projectPlatform(root) === "windows")
|
|
140
148
|
return windowsNativePackages(root, installed);
|
|
149
|
+
const excluded = ["app.json", "desktop.config.json"].some(file => existsSync(path.join(root, file)))
|
|
150
|
+
? readAppConfig(root).expo?.autolinking?.exclude ?? [] : [];
|
|
151
|
+
if (!applyExcludes) {
|
|
152
|
+
const appRequire = createRequire(path.join(root, "package.json"));
|
|
153
|
+
for (const name of excluded) {
|
|
154
|
+
if (installed.some(pkg => pkg.name === name))
|
|
155
|
+
continue;
|
|
156
|
+
const file = appRequire.resolve.paths(name)?.map(base => path.join(base, name, "package.json")).find(file => existsSync(file));
|
|
157
|
+
if (!file)
|
|
158
|
+
continue;
|
|
159
|
+
const json = readJson(file);
|
|
160
|
+
installed.push({ name: json.name, root: realpathSync(path.dirname(file)), json });
|
|
161
|
+
}
|
|
162
|
+
installed.sort((a, b) => a.name.localeCompare(b.name));
|
|
163
|
+
}
|
|
141
164
|
// Host/CNG code can change the native ABI without adding a TurboModule.
|
|
142
165
|
// Fold it into the mandatory app module's compatibility signature for Go.
|
|
143
166
|
const adapters = installed.filter(pkg => ["@legendapp/spark-desktop-host", "@legendapp/spark-desktop-config"].includes(pkg.name))
|
|
144
|
-
.map(pkg => hashFiles(pkg.root, ["package.json", "AppDelegate.mm", ...readdirSync(pkg.root).filter(name => name.endsWith(".cjs"))])).join(":");
|
|
145
|
-
|
|
146
|
-
? readAppConfig(root).expo?.autolinking?.exclude ?? [] : [];
|
|
147
|
-
return installed.filter(pkg => !excluded.includes(pkg.name))
|
|
167
|
+
.map(pkg => hashFiles(pkg.root, ["package.json", "AppDelegate.mm", "SparkCustomize.mm", ...readdirSync(pkg.root).filter(name => name.endsWith(".cjs"))], false, [], true)).join(":");
|
|
168
|
+
return installed.filter(pkg => !applyExcludes || !excluded.includes(pkg.name))
|
|
148
169
|
.filter((pkg) => pkg.json.codegenConfig ||
|
|
149
170
|
pkg.json.spark?.nativeModules ||
|
|
150
171
|
readdirSync(pkg.root).some((name) => name.endsWith(".podspec") || name === "expo-module.config.json"))
|
|
@@ -162,8 +183,11 @@ export function nativePackages(root) {
|
|
|
162
183
|
"common", "nitrogen/generated", "nitro.json",
|
|
163
184
|
"expo-module.config.json",
|
|
164
185
|
"react-native.config.js",
|
|
186
|
+
...(pkg.name === "react-native-enriched-markdown" ? ["ratex-version.json"] : []),
|
|
165
187
|
...readdirSync(pkg.root).filter((name) => name.endsWith(".podspec")),
|
|
166
|
-
]
|
|
188
|
+
], false, pkg.name === "react-native-enriched-markdown"
|
|
189
|
+
// Postinstall restores these assets; their pinned manifests are hashed above.
|
|
190
|
+
? ["cpp/highlight/vendor/grammars", "cpp/highlight/vendor/tree-sitter", "ios/vendor"] : [], true)),
|
|
167
191
|
}));
|
|
168
192
|
}
|
|
169
193
|
export function dependencyStamp(root) {
|
|
@@ -181,12 +205,12 @@ export function dependencyStamp(root) {
|
|
|
181
205
|
"react-native.config.js",
|
|
182
206
|
]);
|
|
183
207
|
}
|
|
184
|
-
export function selection(packages, used, include = []) {
|
|
208
|
+
export function selection(packages, used, include = [], excluded = []) {
|
|
185
209
|
const selected = new Set([
|
|
186
210
|
...packages.filter((p) => !p.sdk).map((p) => p.name),
|
|
187
211
|
...used,
|
|
188
212
|
...include,
|
|
189
|
-
]);
|
|
213
|
+
].filter(name => !excluded.includes(name)));
|
|
190
214
|
const reasons = {};
|
|
191
215
|
for (const pkg of packages)
|
|
192
216
|
if (selected.has(pkg.name))
|
|
@@ -209,6 +233,8 @@ export function selection(packages, used, include = []) {
|
|
|
209
233
|
for (const name of nativeDeps) {
|
|
210
234
|
if (!packages.some((p) => p.name === name))
|
|
211
235
|
throw new Error(`${pkg.name} requires missing native package ${name}`);
|
|
236
|
+
if (excluded.includes(name))
|
|
237
|
+
continue;
|
|
212
238
|
if (!selected.has(name)) {
|
|
213
239
|
selected.add(name);
|
|
214
240
|
reasons[name] = `native dependency of ${pkg.name}`;
|
|
@@ -229,7 +255,7 @@ export function selection(packages, used, include = []) {
|
|
|
229
255
|
export function hostSourceSignature(root) {
|
|
230
256
|
return digest(JSON.stringify(installedPackages(root)
|
|
231
257
|
.filter(pkg => ["@legendapp/spark-desktop-host", "@legendapp/spark-desktop-config"].includes(pkg.name))
|
|
232
|
-
.map(pkg => [pkg.name, hashFiles(pkg.root, ["package.json", "AppDelegate.mm", "windows", ...readdirSync(pkg.root).filter(file => file.endsWith(".cjs"))])])));
|
|
258
|
+
.map(pkg => [pkg.name, hashFiles(pkg.root, ["package.json", "AppDelegate.mm", "SparkCustomize.mm", "windows", ...readdirSync(pkg.root).filter(file => file.endsWith(".cjs"))])])));
|
|
233
259
|
}
|
|
234
260
|
export function nativePreparationInputs(root, packages) {
|
|
235
261
|
return {
|
|
@@ -282,6 +308,8 @@ export function runtimeFor(root, packages, mode) {
|
|
|
282
308
|
"@legendapp/spark-desktop-config",
|
|
283
309
|
].includes(p.name))
|
|
284
310
|
.map((p) => [p.name, p.json.version]);
|
|
311
|
+
const config = readAppConfig(root);
|
|
312
|
+
const customize = config.expo?.extra?.spark?.customize;
|
|
285
313
|
return {
|
|
286
314
|
schema: 1,
|
|
287
315
|
framework: VERSION,
|
|
@@ -297,7 +325,13 @@ export function runtimeFor(root, packages, mode) {
|
|
|
297
325
|
...(platform === "macos" && mode === "release" ? { releaseSettings: macOSReleaseSettings } : {}),
|
|
298
326
|
modules,
|
|
299
327
|
pins,
|
|
300
|
-
config
|
|
328
|
+
config,
|
|
329
|
+
customize: platform === "macos" && mode === "release" && customize ? {
|
|
330
|
+
source: hashFiles(path.resolve(root, customize.sourceRoot ?? "."), customize.files),
|
|
331
|
+
project: hashFiles(root, ["package.json", entryFile(root), ...readdirSync(root).filter(file => /(?:config\.|^\.babelrc)/.test(file))]),
|
|
332
|
+
tooling: hashFiles(import.meta.dirname, [...readdirSync(import.meta.dirname).filter(file => file.startsWith("customize-")), "js-runtime.cjs", "runtime-bootstrap.sh", "runtime-downloads.tsv"]),
|
|
333
|
+
ai: digest(readFileSync(createRequire(createRequire(path.join(root, "package.json")).resolve("@legendapp/spark/ai")).resolve("@legendapp/spark-ai/src/invocation-command.cjs"), "utf8")),
|
|
334
|
+
} : undefined,
|
|
301
335
|
helpers: resolveHelpers(root, readAppConfig(root).expo?.extra?.spark?.helpers, platform).map(helper => ({ name: helper.name, contents: hashFiles(root, helper.files), modes: helper.modes, directories: helper.directories })),
|
|
302
336
|
adapter: hostSourceSignature(root),
|
|
303
337
|
})),
|
|
@@ -320,6 +354,8 @@ export function goConfigurationIssues(config) {
|
|
|
320
354
|
issues.push("URL schemes and document associations require a custom runtime");
|
|
321
355
|
if (expo.extra?.spark?.menuBarOnly)
|
|
322
356
|
issues.push("Menu-bar-only activation requires a custom runtime");
|
|
357
|
+
if (expo.extra?.spark?.customize)
|
|
358
|
+
issues.push("Customizable apps require a custom release runtime");
|
|
323
359
|
if (expo.extra?.spark?.updates)
|
|
324
360
|
issues.push("Update feed configuration requires a custom runtime");
|
|
325
361
|
if (Object.keys(expo.extra?.spark?.helpers ?? {}).length)
|
|
@@ -368,10 +404,10 @@ function windowsNativePackages(root, installed) {
|
|
|
368
404
|
}
|
|
369
405
|
}
|
|
370
406
|
const adapter = installed.filter(pkg => ["@legendapp/spark-desktop-host", "@legendapp/spark-desktop-config"].includes(pkg.name))
|
|
371
|
-
.map(pkg => hashFiles(pkg.root, ["package.json", "windows", ...readdirSync(pkg.root).filter(name => name.endsWith(".cjs"))], true)).join(":");
|
|
407
|
+
.map(pkg => hashFiles(pkg.root, ["package.json", "windows", ...readdirSync(pkg.root).filter(name => name.endsWith(".cjs"))], true, [], true)).join(":");
|
|
372
408
|
const versions = installed.filter(pkg => ["react", "expo", "react-native", "react-native-windows"].includes(pkg.name)).map(pkg => [pkg.name, pkg.json.version]);
|
|
373
409
|
return installed.filter(supported).map(pkg => ({ ...pkg,
|
|
374
410
|
sdk: pkg.json.spark?.sdk === true || pkg.name === "@react-native-async-storage/async-storage", requires: pkg.json.spark?.requires ?? [],
|
|
375
|
-
signature: digest(hashFiles(pkg.root, ["package.json", "windows", "src", "cpp", "common", "react-native.config.js"], true) + (pkg.name === "@legendapp/spark-desktop-host" ? adapter + JSON.stringify(versions) : "")),
|
|
411
|
+
signature: digest(hashFiles(pkg.root, ["package.json", "windows", "src", "cpp", "common", "react-native.config.js"], true, [], true) + (pkg.name === "@legendapp/spark-desktop-host" ? adapter + JSON.stringify(versions) : "")),
|
|
376
412
|
}));
|
|
377
413
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
2
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { readJson
|
|
4
|
+
import { readJson } from "./json.js";
|
|
5
5
|
import { localArchive } from "./package-manager.js";
|
|
6
|
+
const VERSION = readJson(path.resolve(import.meta.dirname, "../package.json")).version;
|
|
6
7
|
export const releaseBase = (version) => `https://github.com/LegendApp/legend-spark/releases/download/v${version}`;
|
|
7
8
|
export function validateRelease(value) {
|
|
8
9
|
if (value?.schema !== 1 || value.version !== VERSION || !/^[a-f0-9]{40}$/.test(value.revision) || !value.packages || !value.runners)
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"version": "0.0.1-next.
|
|
4
|
-
"revision": "
|
|
3
|
+
"version": "0.0.1-next.5",
|
|
4
|
+
"revision": "89556a2806d0c3e29ed49da8569983988a7dad10",
|
|
5
5
|
"packages": {
|
|
6
6
|
"@react-native-runtimes/core": {
|
|
7
|
-
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.
|
|
7
|
+
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.5/runtimes-985164a87eb0.tgz",
|
|
8
8
|
"size": 53886,
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "138644fcfaf60b172c9f206c66c6d160515dd8803c70264687d0f503294c9c0b"
|
|
10
10
|
},
|
|
11
11
|
"react-native-nitro-modules": {
|
|
12
|
-
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.
|
|
13
|
-
"size":
|
|
14
|
-
"sha256": "
|
|
12
|
+
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.5/react-native-nitro-modules-0.37.0-02b4dff54381.tgz",
|
|
13
|
+
"size": 145600,
|
|
14
|
+
"sha256": "02b4dff54381bbd4640eb4067e1dc82d7a79ff7e7f83b4357a4265177722d999"
|
|
15
15
|
},
|
|
16
16
|
"@op-engineering/op-sqlite": {
|
|
17
|
-
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.
|
|
18
|
-
"size":
|
|
19
|
-
"sha256": "
|
|
17
|
+
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.5/op-engineering-op-sqlite-18.2.1-dcc9490310bc.tgz",
|
|
18
|
+
"size": 112508535,
|
|
19
|
+
"sha256": "dcc9490310bc74c869ba7cf5e846a8966fab7c3871c4a536482c20be237894fd"
|
|
20
20
|
},
|
|
21
21
|
"react-native-webview": {
|
|
22
|
-
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.
|
|
23
|
-
"size":
|
|
24
|
-
"sha256": "
|
|
22
|
+
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.5/react-native-webview-16.0.0-b887e540eca8.tgz",
|
|
23
|
+
"size": 116289,
|
|
24
|
+
"sha256": "b887e540eca87c6817de6b38c4e8f4076e3a65e0f7fa63f0c5882e1155447a59"
|
|
25
25
|
},
|
|
26
26
|
"expo-audio": {
|
|
27
|
-
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.
|
|
28
|
-
"size":
|
|
29
|
-
"sha256": "
|
|
27
|
+
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.5/expo-audio-1.1.1-aff5604f2c4c.tgz",
|
|
28
|
+
"size": 381841,
|
|
29
|
+
"sha256": "aff5604f2c4cab23299a71e37e802a572b2e66e2e2250b20a261e664d5346693"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"runners": {
|
|
33
33
|
"macos-arm64": {
|
|
34
|
-
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.
|
|
35
|
-
"size":
|
|
36
|
-
"sha256": "
|
|
34
|
+
"url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.5/spark-runner-macos-arm64.zip",
|
|
35
|
+
"size": 20508994,
|
|
36
|
+
"sha256": "5eaa98d9a0dbd83c36456ded9ee58b5825ac93956aa3d7c0c0d4180e9ef55ec8",
|
|
37
37
|
"app": "SparkRunner.app",
|
|
38
38
|
"teamId": "56DD97VT22",
|
|
39
|
-
"fingerprint": "
|
|
39
|
+
"fingerprint": "5467e7fabf776760d87e93493237825d59d13bc6c3a39efbe97a0426b1aac0f0"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|