@naseej/blox 0.1.26 → 0.1.28

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.
Files changed (2) hide show
  1. package/dist/run.js +18 -16
  2. package/package.json +1 -1
package/dist/run.js CHANGED
@@ -31,7 +31,7 @@ var option = (flags, description) => {
31
31
  };
32
32
 
33
33
  // package.json
34
- var version = "0.1.26";
34
+ var version = "0.1.28";
35
35
 
36
36
  // src/commands/add/index.ts
37
37
  var import_fs_extra7 = __toESM(require("fs-extra"));
@@ -395,11 +395,6 @@ var getAvailableBlocks = async (templateInfo) => {
395
395
  return blocks;
396
396
  };
397
397
 
398
- // src/services/updater.ts
399
- var import_node_path6 = __toESM(require("path"));
400
- var import_fs_extra6 = __toESM(require("fs-extra"));
401
- var import_merge = __toESM(require("lodash/merge"));
402
-
403
398
  // src/services/template.ts
404
399
  var import_node_path5 = __toESM(require("path"));
405
400
  var import_ejs = __toESM(require("ejs"));
@@ -425,7 +420,11 @@ function getTemplateInfo(cwd = ".") {
425
420
  return templateInfo;
426
421
  }
427
422
  function getBasedOnInfo(cwd = ".") {
428
- return import_fs_extra5.default.readJSONSync(import_node_path5.default.join(cwd, basedOnFile));
423
+ try {
424
+ return import_fs_extra5.default.readJSONSync(import_node_path5.default.join(cwd, basedOnFile));
425
+ } catch {
426
+ return {};
427
+ }
429
428
  }
430
429
  function saveBasedOnInfo(info, cwd = ".") {
431
430
  debug("Save info");
@@ -453,6 +452,11 @@ function getUsedBlocks() {
453
452
  return blocks;
454
453
  }
455
454
 
455
+ // src/services/updater.ts
456
+ var import_node_path6 = __toESM(require("path"));
457
+ var import_fs_extra6 = __toESM(require("fs-extra"));
458
+ var import_merge = __toESM(require("lodash/merge"));
459
+
456
460
  // src/shared/prompts/index.ts
457
461
  var import_prompts4 = require("@clack/prompts");
458
462
  var checkIfCanceled = (value) => {
@@ -597,20 +601,17 @@ async function updateBlock(block, blocks) {
597
601
  debug(`${block} already updated`);
598
602
  return;
599
603
  }
600
- const blockInfo = blocks[block];
604
+ const blockDef = blocks[block];
605
+ const blockPath = import_node_path7.default.join(blocksDir, block);
601
606
  await runTask({ start: `Update block: ${block}`, end: `Updated block: ${block}` }, async () => {
602
- if (!blockInfo) {
607
+ if (!blockDef) {
603
608
  error("Selected block not available, try to sync registries", false);
604
609
  return;
605
610
  }
606
- await updateFromRemote(
607
- block,
608
- blockInfo.source,
609
- blockInfo.ignore,
610
- import_node_path7.default.join(blocksDir, block)
611
- );
611
+ await updateFromRemote(block, blockDef.source, blockDef.ignore, blockPath);
612
612
  updatedBlocks.add(block);
613
613
  });
614
+ const blockInfo = getTemplateInfo(blockPath);
614
615
  for (const dep of blockInfo?.dependencies || []) {
615
616
  debug(`${block} has dependency on ${dep.name}, will be updated`);
616
617
  await updateBlock(dep.name, blocks);
@@ -646,7 +647,8 @@ var addBlock = async (block, blocks) => {
646
647
  debug(`${block} already exists, will be updated`);
647
648
  await updateBlock(block, blocks);
648
649
  }
649
- for (const dep of blockDef?.dependencies || []) {
650
+ const blockInfo = getTemplateInfo(blockPath);
651
+ for (const dep of blockInfo?.dependencies || []) {
650
652
  await addBlock(dep.name, blocks);
651
653
  }
652
654
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naseej/blox",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "blox cli",
5
5
  "bin": {
6
6
  "blox": "./bin/run"