lecodes-cli 0.5.1 → 0.5.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/dist/index.js CHANGED
@@ -170,6 +170,8 @@ var uploadBlob = (apiUrl, token, uuid, name, bytes) => {
170
170
  };
171
171
  var sync = (apiUrl, token, uuid, payload) => apiRequest(apiUrl, `/projects/${uuid}/sync`, { token, body: payload });
172
172
  var publishProject = (apiUrl, token, uuid) => apiRequest(apiUrl, `/projects/${uuid}/publish`, { token, body: {} });
173
+ var enableDesignShare = (apiUrl, token, uuid) => apiRequest(apiUrl, `/projects/${uuid}/design/share`, { token, body: {} });
174
+ var disableDesignShare = (apiUrl, token, uuid) => apiRequest(apiUrl, `/projects/${uuid}/design/share`, { token, method: "DELETE" });
173
175
  var downloadBlob = async (apiUrl, src) => {
174
176
  const resp = await fetch(`${apiUrl}${src}`);
175
177
  if (!resp.ok)
@@ -1335,6 +1337,24 @@ var serve = async (ctx, args) => {
1335
1337
  if (!flagBool(args, "no-open"))
1336
1338
  openBrowser(server.url);
1337
1339
  };
1340
+ var share = async (ctx, args) => {
1341
+ if (!ctx.manifest) {
1342
+ throw new CliError("`lecodes design share` needs a cloned project. Run it inside one, and push the design first (lecodes push).");
1343
+ }
1344
+ const config = loadConfig();
1345
+ const apiUrl = requireApiUrl(config);
1346
+ const token = requireToken(config);
1347
+ const uuid = ctx.manifest.uuid;
1348
+ if (flagBool(args, "off")) {
1349
+ await disableDesignShare(apiUrl, token, uuid);
1350
+ log(`${c.green("✓")} Design sharing is off.`);
1351
+ return;
1352
+ }
1353
+ const res = await enableDesignShare(apiUrl, token, uuid);
1354
+ log(`${c.bold("Design shared")} — anyone with this link can view the mockups (your app code stays private):`);
1355
+ log(` ${c.bold(res.url ?? "")}`);
1356
+ note("Turn it off with: lecodes design share --off");
1357
+ };
1338
1358
  var design = async (args) => {
1339
1359
  const sub = args._[0] ?? "serve";
1340
1360
  const ctx = getContext(args);
@@ -1344,7 +1364,9 @@ var design = async (args) => {
1344
1364
  return init(ctx);
1345
1365
  if (sub === "snapshot")
1346
1366
  return snapshot(ctx, args);
1347
- throw new CliError(`Unknown design subcommand "${sub}" (serve | init | snapshot).`);
1367
+ if (sub === "share")
1368
+ return share(ctx, args);
1369
+ throw new CliError(`Unknown design subcommand "${sub}" (serve | init | snapshot | share).`);
1348
1370
  };
1349
1371
 
1350
1372
  // src/serverDiff.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecodes-cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Clone, edit and push LeCodes projects from your machine.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,17 +21,18 @@
21
21
  },
22
22
  "scripts": {
23
23
  "vendor-runtime": "bun scripts/vendor-runtime.ts",
24
+ "sync-peers": "bun scripts/sync-peer-versions.ts",
24
25
  "build": "bun scripts/vendor-runtime.ts && bun build src/index.ts --target=node --outfile dist/index.js --external @letary/chisel --external lecodes-renderer --external lecodes-design --banner=\"#!/usr/bin/env node\"",
25
26
  "typecheck": "tsc --noEmit",
26
27
  "dev": "bun run src/index.ts",
27
- "prepublishOnly": "bun run build"
28
+ "prepublishOnly": "bun run sync-peers && bun run build"
28
29
  },
29
30
  "dependencies": {
30
31
  "@letary/chisel": "^0.2.0"
31
32
  },
32
33
  "peerDependencies": {
33
- "lecodes-design": "^0.1.0",
34
- "lecodes-renderer": "^0.4.0"
34
+ "lecodes-design": "^0.1.1",
35
+ "lecodes-renderer": "^0.4.2"
35
36
  },
36
37
  "peerDependenciesMeta": {
37
38
  "lecodes-design": {
@@ -43,7 +44,7 @@
43
44
  },
44
45
  "devDependencies": {
45
46
  "lecodes-design": "workspace:*",
46
- "lecodes-renderer": "workspace:*",
47
+ "lecodes-renderer": "^0.4.1",
47
48
  "sdk": "workspace:*"
48
49
  }
49
50
  }
@@ -187,6 +187,14 @@ function applyBindings(el: any, fns: [string, () => any][]) {
187
187
 
188
188
  // Не надо переписывать эту функцию 10 раз, обрати внимание, что у тебя тут возвращается this
189
189
  function styleFunction(this: any, newStyle: any) {
190
+ // `name` is a JS-node selector (read by hosts off el.name), not a layout property — extract it
191
+ // exactly like the constructor so `.style({ name })` is equivalent to the first-arg style. Left
192
+ // in the style it would never become el.name (breaking name-based lookups) and would leak into
193
+ // the layout engine.
194
+ if (newStyle && typeof newStyle.name === "string" && newStyle.name.length > 0) {
195
+ this.name = newStyle.name
196
+ delete newStyle.name
197
+ }
190
198
  const fns = extractBindings(this, newStyle)
191
199
  Object.assign(this._style, newStyle)
192
200
  if (this._id !== 0) {