@todesktop/cli 1.18.2 → 1.18.3
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 +8 -2
- package/dist/cli.js +86 -14
- package/dist/cli.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ Create a `todesktop.json` file in the root of your Electron project.
|
|
|
47
47
|
|
|
48
48
|
```json
|
|
49
49
|
{
|
|
50
|
-
"$schema": "https://unpkg.com/@todesktop/cli@1.18.
|
|
50
|
+
"$schema": "https://unpkg.com/@todesktop/cli@1.18.3/schemas/schema.json",
|
|
51
51
|
"schemaVersion": 1
|
|
52
52
|
"id": "your-todesktop-id",
|
|
53
53
|
"icon": "./desktop-icon.png",
|
|
@@ -319,7 +319,7 @@ To enable JSON validation and IntelliSense for your `todesktop.json` file in com
|
|
|
319
319
|
- For example, if using a hosted version of the schema:
|
|
320
320
|
```json
|
|
321
321
|
{
|
|
322
|
-
"$schema": "https://unpkg.com/@todesktop/cli@1.18.
|
|
322
|
+
"$schema": "https://unpkg.com/@todesktop/cli@1.18.3/schemas/schema.json",
|
|
323
323
|
"id": "your-todesktop-id"
|
|
324
324
|
}
|
|
325
325
|
```
|
|
@@ -1531,6 +1531,12 @@ Now, when we build your app on ToDesktop servers, it will also run your custom
|
|
|
1531
1531
|
|
|
1532
1532
|
## Changelog
|
|
1533
1533
|
|
|
1534
|
+
### 1.18.3
|
|
1535
|
+
|
|
1536
|
+
#### Patch Changes
|
|
1537
|
+
|
|
1538
|
+
- 51821cc: Add support for pnpm workspace catalogs in workspace bundling
|
|
1539
|
+
|
|
1534
1540
|
### 1.18.2
|
|
1535
1541
|
|
|
1536
1542
|
#### Patch Changes
|
package/dist/cli.js
CHANGED
|
@@ -3075,12 +3075,17 @@ async function prepareWorkspaceBundle(input) {
|
|
|
3075
3075
|
bundlePath,
|
|
3076
3076
|
workspacePackage: pkg,
|
|
3077
3077
|
bundledNames: bundledPackageNames,
|
|
3078
|
-
contexts: bundledPackageContexts
|
|
3078
|
+
contexts: bundledPackageContexts,
|
|
3079
|
+
workspace
|
|
3079
3080
|
});
|
|
3080
3081
|
bundleEntries.push(...packageEntries.files);
|
|
3081
3082
|
bundleEntries.push(packageEntries.packageJsonEntry);
|
|
3082
3083
|
}
|
|
3083
|
-
const rewrittenAppPkgJson = applyRewriteMap(
|
|
3084
|
+
const rewrittenAppPkgJson = applyRewriteMap(
|
|
3085
|
+
appPkgJson,
|
|
3086
|
+
appRewriteMap,
|
|
3087
|
+
workspace.catalog
|
|
3088
|
+
);
|
|
3084
3089
|
logger_default.info(
|
|
3085
3090
|
`Bundling ${sortedPackageNames.length} workspace package(s) from ${workspace.type} workspace at ${workspace.rootDir}`
|
|
3086
3091
|
);
|
|
@@ -3167,7 +3172,7 @@ function createPnpmDefinition({
|
|
|
3167
3172
|
pnpmFile,
|
|
3168
3173
|
rootDir
|
|
3169
3174
|
}) {
|
|
3170
|
-
const packages = parsePnpmWorkspaceFile(pnpmFile);
|
|
3175
|
+
const { packages, catalog } = parsePnpmWorkspaceFile(pnpmFile);
|
|
3171
3176
|
if (!packages.length) {
|
|
3172
3177
|
throw new Error(
|
|
3173
3178
|
`pnpm workspace file at ${pnpmFile} does not define any packages.`
|
|
@@ -3177,7 +3182,8 @@ function createPnpmDefinition({
|
|
|
3177
3182
|
globs: packages,
|
|
3178
3183
|
rootDir,
|
|
3179
3184
|
realRootDir: import_fs3.default.realpathSync(rootDir),
|
|
3180
|
-
type: "pnpm"
|
|
3185
|
+
type: "pnpm",
|
|
3186
|
+
catalog
|
|
3181
3187
|
};
|
|
3182
3188
|
}
|
|
3183
3189
|
function createNpmDefinition({
|
|
@@ -3209,8 +3215,13 @@ function parsePnpmWorkspaceFile(filePath) {
|
|
|
3209
3215
|
const content = import_fs3.default.readFileSync(filePath, "utf8");
|
|
3210
3216
|
const parsed = import_js_yaml.default.load(content);
|
|
3211
3217
|
let packagesField;
|
|
3218
|
+
let catalogField;
|
|
3219
|
+
let catalogsField;
|
|
3212
3220
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3213
|
-
|
|
3221
|
+
const parsedObj = parsed;
|
|
3222
|
+
packagesField = parsedObj.packages;
|
|
3223
|
+
catalogField = parsedObj.catalog;
|
|
3224
|
+
catalogsField = parsedObj.catalogs;
|
|
3214
3225
|
} else {
|
|
3215
3226
|
packagesField = parsed;
|
|
3216
3227
|
}
|
|
@@ -3225,7 +3236,26 @@ function parsePnpmWorkspaceFile(filePath) {
|
|
|
3225
3236
|
`pnpm workspace file at ${filePath} does not define any packages.`
|
|
3226
3237
|
);
|
|
3227
3238
|
}
|
|
3228
|
-
|
|
3239
|
+
const catalog = {};
|
|
3240
|
+
if (catalogField && typeof catalogField === "object" && !Array.isArray(catalogField)) {
|
|
3241
|
+
for (const [key, value] of Object.entries(catalogField)) {
|
|
3242
|
+
if (typeof value === "string") {
|
|
3243
|
+
catalog[key] = value;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
if (catalogsField && typeof catalogsField === "object" && !Array.isArray(catalogsField)) {
|
|
3248
|
+
for (const [catalogName, catalogContent] of Object.entries(catalogsField)) {
|
|
3249
|
+
if (catalogContent && typeof catalogContent === "object" && !Array.isArray(catalogContent)) {
|
|
3250
|
+
for (const [packageName, version] of Object.entries(catalogContent)) {
|
|
3251
|
+
if (typeof version === "string") {
|
|
3252
|
+
catalog[`${catalogName}:${packageName}`] = version;
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
return { packages, catalog };
|
|
3229
3259
|
}
|
|
3230
3260
|
function workspaceIncludesPath({
|
|
3231
3261
|
appDir,
|
|
@@ -3397,7 +3427,7 @@ function getBundlePath(packageName) {
|
|
|
3397
3427
|
}
|
|
3398
3428
|
return packageName;
|
|
3399
3429
|
}
|
|
3400
|
-
function applyRewriteMap(manifest, rewriteMap) {
|
|
3430
|
+
function applyRewriteMap(manifest, rewriteMap, catalog) {
|
|
3401
3431
|
const clone = JSON.parse(JSON.stringify(manifest));
|
|
3402
3432
|
const sections = [
|
|
3403
3433
|
"dependencies",
|
|
@@ -3412,6 +3442,34 @@ function applyRewriteMap(manifest, rewriteMap) {
|
|
|
3412
3442
|
sectionDeps[depName] = rewrite;
|
|
3413
3443
|
}
|
|
3414
3444
|
}
|
|
3445
|
+
if (catalog) {
|
|
3446
|
+
for (const [depName, spec] of Object.entries(sectionDeps)) {
|
|
3447
|
+
if (typeof spec === "string" && spec.startsWith("catalog:")) {
|
|
3448
|
+
let catalogKey;
|
|
3449
|
+
if (spec === "catalog:") {
|
|
3450
|
+
catalogKey = depName;
|
|
3451
|
+
} else {
|
|
3452
|
+
const catalogRef = spec.slice("catalog:".length);
|
|
3453
|
+
const namedCatalogKey = `${catalogRef}:${depName}`;
|
|
3454
|
+
if (catalog[namedCatalogKey]) {
|
|
3455
|
+
catalogKey = namedCatalogKey;
|
|
3456
|
+
} else {
|
|
3457
|
+
catalogKey = catalogRef;
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
const resolvedVersion = catalog[catalogKey];
|
|
3461
|
+
if (resolvedVersion) {
|
|
3462
|
+
sectionDeps[depName] = resolvedVersion;
|
|
3463
|
+
} else {
|
|
3464
|
+
throw new Error(
|
|
3465
|
+
`Catalog reference "${spec}" for dependency "${depName}" not found in pnpm catalog. Available catalog entries: ${Object.keys(
|
|
3466
|
+
catalog
|
|
3467
|
+
).join(", ")}`
|
|
3468
|
+
);
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3415
3473
|
}
|
|
3416
3474
|
return clone;
|
|
3417
3475
|
}
|
|
@@ -3419,7 +3477,8 @@ async function buildPackageEntries({
|
|
|
3419
3477
|
bundlePath,
|
|
3420
3478
|
workspacePackage,
|
|
3421
3479
|
bundledNames,
|
|
3422
|
-
contexts
|
|
3480
|
+
contexts,
|
|
3481
|
+
workspace
|
|
3423
3482
|
}) {
|
|
3424
3483
|
const packageDir = workspacePackage.dir;
|
|
3425
3484
|
const { manifest } = workspacePackage;
|
|
@@ -3440,7 +3499,11 @@ async function buildPackageEntries({
|
|
|
3440
3499
|
});
|
|
3441
3500
|
const packageJsonEntry = {
|
|
3442
3501
|
content: Buffer.from(
|
|
3443
|
-
`${JSON.stringify(
|
|
3502
|
+
`${JSON.stringify(
|
|
3503
|
+
applyRewriteMap(manifest, rewrites, workspace.catalog),
|
|
3504
|
+
null,
|
|
3505
|
+
2
|
|
3506
|
+
)}
|
|
3444
3507
|
`
|
|
3445
3508
|
),
|
|
3446
3509
|
to: import_path8.default.posix.join(BUNDLED_ROOT, bundlePath, "package.json")
|
|
@@ -3463,7 +3526,7 @@ async function gatherPackageFiles({
|
|
|
3463
3526
|
const posixPattern = pattern.replace(/\\/g, "/");
|
|
3464
3527
|
return [pattern, `${posixPattern}/**/*`];
|
|
3465
3528
|
}
|
|
3466
|
-
} catch {
|
|
3529
|
+
} catch (_error) {
|
|
3467
3530
|
}
|
|
3468
3531
|
return [pattern];
|
|
3469
3532
|
});
|
|
@@ -4149,7 +4212,10 @@ var Login = ({ setIsLoggedIn }) => {
|
|
|
4149
4212
|
failureMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Error2, { errorMessage: failureMessage, marginTop: true })
|
|
4150
4213
|
] });
|
|
4151
4214
|
};
|
|
4152
|
-
var Error2 = ({
|
|
4215
|
+
var Error2 = ({
|
|
4216
|
+
errorMessage,
|
|
4217
|
+
marginTop
|
|
4218
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink14.Box, { marginTop: marginTop ? 1 : 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink14.Text, { color: "red", children: errorMessage }) });
|
|
4153
4219
|
Error2.propTypes = {
|
|
4154
4220
|
errorMessage: import_prop_types8.default.string.isRequired,
|
|
4155
4221
|
marginTop: import_prop_types8.default.bool
|
|
@@ -5450,7 +5516,10 @@ function BuildPicker({
|
|
|
5450
5516
|
});
|
|
5451
5517
|
function updateState(changes) {
|
|
5452
5518
|
setState(
|
|
5453
|
-
(previousState) => ({
|
|
5519
|
+
(previousState) => ({
|
|
5520
|
+
...previousState,
|
|
5521
|
+
...changes
|
|
5522
|
+
})
|
|
5454
5523
|
);
|
|
5455
5524
|
if (changes.state && ["error", "no-builds"].includes(changes.state)) {
|
|
5456
5525
|
setTimeout(() => exit(), 10);
|
|
@@ -5993,7 +6062,10 @@ function ReleaseConfirmation({
|
|
|
5993
6062
|
}, []);
|
|
5994
6063
|
function updateState(changes) {
|
|
5995
6064
|
setState(
|
|
5996
|
-
(previousState) => ({
|
|
6065
|
+
(previousState) => ({
|
|
6066
|
+
...previousState,
|
|
6067
|
+
...changes
|
|
6068
|
+
})
|
|
5997
6069
|
);
|
|
5998
6070
|
}
|
|
5999
6071
|
switch (state.state) {
|
|
@@ -6655,7 +6727,7 @@ var package_default = {
|
|
|
6655
6727
|
access: "public"
|
|
6656
6728
|
},
|
|
6657
6729
|
name: "@todesktop/cli",
|
|
6658
|
-
version: "1.18.
|
|
6730
|
+
version: "1.18.3",
|
|
6659
6731
|
license: "MIT",
|
|
6660
6732
|
author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
|
|
6661
6733
|
homepage: "https://todesktop.com/cli",
|