lincd-cli 1.2.0 → 1.2.2

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 (106) hide show
  1. package/defaults/app-with-backend/.eslintignore +3 -1
  2. package/defaults/app-with-backend/lincd.config.js +4 -6
  3. package/defaults/app-with-backend/package.json +8 -16
  4. package/defaults/app-with-backend/scripts/storage-config.js +5 -5
  5. package/defaults/app-with-backend/src/App.module.css +17 -0
  6. package/defaults/app-with-backend/src/App.tsx +11 -15
  7. package/defaults/app-with-backend/src/backend.ts +8 -0
  8. package/defaults/app-with-backend/src/components/Error.tsx +2 -5
  9. package/defaults/app-with-backend/src/components/Spinner.tsx +3 -3
  10. package/defaults/app-with-backend/src/config-frontend.ts +6 -6
  11. package/defaults/app-with-backend/src/index.tsx +4 -3
  12. package/defaults/app-with-backend/src/layout/DefaultLayout.module.css +12 -0
  13. package/defaults/app-with-backend/src/layout/DefaultLayout.tsx +3 -4
  14. package/defaults/app-with-backend/src/layout/Header.module.css +25 -0
  15. package/defaults/app-with-backend/src/layout/Header.tsx +10 -6
  16. package/defaults/app-with-backend/src/package.ts +0 -1
  17. package/defaults/app-with-backend/src/pages/Home.tsx +3 -3
  18. package/defaults/app-with-backend/src/pages/PageNotFound.tsx +2 -1
  19. package/defaults/app-with-backend/src/routes.tsx +8 -7
  20. package/defaults/app-with-backend/src/theme.css +95 -0
  21. package/defaults/app-with-backend/src/types.ts +14 -0
  22. package/defaults/app-with-backend/tsconfig.json +9 -6
  23. package/defaults/package/package.json +30 -3
  24. package/defaults/package/src/index.ts +1 -1
  25. package/defaults/package/src/ontologies/example-ontology.ts +4 -4
  26. package/defaults/package/src/package.ts +2 -1
  27. package/defaults/shape.ts +1 -1
  28. package/lib/cjs/cli-methods.js +376 -113
  29. package/lib/cjs/cli-methods.js.map +1 -1
  30. package/lib/cjs/cli.js +15 -1
  31. package/lib/cjs/cli.js.map +1 -1
  32. package/lib/cjs/config-grunt.cjs +3 -3
  33. package/lib/cjs/config-grunt.cjs.map +1 -1
  34. package/lib/cjs/config-webpack-app.js +277 -133
  35. package/lib/cjs/config-webpack-app.js.map +1 -1
  36. package/lib/cjs/config-webpack.js +30 -22
  37. package/lib/cjs/config-webpack.js.map +1 -1
  38. package/lib/cjs/index.js +3 -1
  39. package/lib/cjs/index.js.map +1 -1
  40. package/lib/cjs/loaders/css-loader.mjs +28 -24
  41. package/lib/cjs/loaders/css-loader.mjs.map +1 -1
  42. package/lib/cjs/loaders/register.js +5 -0
  43. package/lib/cjs/loaders/register.js.map +1 -1
  44. package/lib/cjs/package.json +12 -10
  45. package/lib/cjs/plugins/check-imports.js +1 -1
  46. package/lib/cjs/plugins/check-imports.js.map +1 -1
  47. package/lib/cjs/plugins/declaration-plugin.js +17 -7
  48. package/lib/cjs/plugins/declaration-plugin.js.map +1 -1
  49. package/lib/cjs/plugins/externalise-modules.js.map +1 -1
  50. package/lib/cjs/plugins/lincd-tailwind-sources.js +32 -0
  51. package/lib/cjs/plugins/lincd-tailwind-sources.js.map +1 -0
  52. package/lib/cjs/plugins/watch-run.js.map +1 -1
  53. package/lib/cjs/tailwind.config.js +18 -0
  54. package/lib/cjs/tailwind.config.js.map +1 -0
  55. package/lib/cjs/utils.js +103 -41
  56. package/lib/cjs/utils.js.map +1 -1
  57. package/lib/esm/cli-methods.js +360 -113
  58. package/lib/esm/cli-methods.js.map +1 -1
  59. package/lib/esm/cli.js +16 -2
  60. package/lib/esm/cli.js.map +1 -1
  61. package/lib/esm/config-grunt.cjs +29 -26
  62. package/lib/esm/config-grunt.cjs.map +1 -1
  63. package/lib/esm/config-webpack-app.js +259 -123
  64. package/lib/esm/config-webpack-app.js.map +1 -1
  65. package/lib/esm/config-webpack.js +12 -13
  66. package/lib/esm/config-webpack.js.map +1 -1
  67. package/lib/esm/index.js +1 -0
  68. package/lib/esm/index.js.map +1 -1
  69. package/lib/esm/loaders/css-loader.mjs +23 -12
  70. package/lib/esm/loaders/css-loader.mjs.map +1 -1
  71. package/lib/esm/loaders/register.js +5 -0
  72. package/lib/esm/loaders/register.js.map +1 -1
  73. package/lib/esm/package.json +12 -10
  74. package/lib/esm/plugins/check-imports.js.map +1 -1
  75. package/lib/esm/plugins/declaration-plugin.js.map +1 -1
  76. package/lib/esm/plugins/externalise-modules.js.map +1 -1
  77. package/lib/esm/plugins/lincd-tailwind-sources.js +27 -0
  78. package/lib/esm/plugins/lincd-tailwind-sources.js.map +1 -0
  79. package/lib/esm/plugins/watch-run.js.map +1 -1
  80. package/lib/esm/tailwind.config.js +13 -0
  81. package/lib/esm/tailwind.config.js.map +1 -0
  82. package/lib/esm/utils.js +73 -24
  83. package/lib/esm/utils.js.map +1 -1
  84. package/lib-template/cjs/package.json +3 -0
  85. package/lib-template/esm/package.json +3 -0
  86. package/package.json +15 -12
  87. package/defaults/app-with-backend/babel.config.js +0 -4
  88. package/defaults/app-with-backend/src/App.scss +0 -6
  89. package/defaults/app-with-backend/src/App.scss.json +0 -1
  90. package/defaults/app-with-backend/src/components/Error.scss.json +0 -1
  91. package/defaults/app-with-backend/src/components/Spinner.scss.json +0 -1
  92. package/defaults/app-with-backend/src/layout/DefaultLayout.scss +0 -6
  93. package/defaults/app-with-backend/src/layout/DefaultLayout.scss.json +0 -1
  94. package/defaults/app-with-backend/src/layout/Header.scss +0 -10
  95. package/defaults/app-with-backend/src/layout/Header.scss.json +0 -1
  96. package/defaults/app-with-backend/src/pages/Home.scss.json +0 -1
  97. package/defaults/app-with-backend/src/scss/global-overwrites.scss +0 -11
  98. package/defaults/app-with-backend/src/scss/variables.scss +0 -23
  99. /package/defaults/app-with-backend/{web → public}/favicon-144x144.png +0 -0
  100. /package/defaults/app-with-backend/{web → public}/favicon-57x57.png +0 -0
  101. /package/defaults/app-with-backend/{web → public}/favicon-72x72.png +0 -0
  102. /package/defaults/app-with-backend/{web → public}/favicon.ico +0 -0
  103. /package/defaults/app-with-backend/src/components/{Error.scss → Error.module.css} +0 -0
  104. /package/defaults/app-with-backend/src/components/{Spinner.scss → Spinner.module.css} +0 -0
  105. /package/defaults/app-with-backend/src/pages/{Home.scss → Home.module.css} +0 -0
  106. /package/defaults/package/src/{types.d.ts → types.ts} +0 -0
@@ -15,18 +15,33 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.removeOldFiles = exports.executeCommandForPackage = exports.addCapacitor = exports.addLinesToFile = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.compilePackage = exports.buildPackage = exports.register = exports.createPackage = exports.upgradePackages = exports.buildApp = exports.startServer = exports.ensureEnvironmentLoaded = exports.depCheck = exports.depCheckStaged = exports.checkImports = exports.createComponent = exports.createSetComponent = exports.createShape = exports.getScriptDir = exports.setNameVariables = exports.createOntology = exports.getLincdPackages = exports.buildAll = exports.developPackage = exports.warn = exports.createApp = void 0;
39
+ exports.removeOldFiles = exports.executeCommandForPackage = exports.addCapacitor = exports.addLinesToFile = exports.executeCommandForEachPackage = exports.buildUpdated = exports.publishPackage = exports.publishUpdated = exports.compilePackageCJS = exports.compilePackageESM = exports.compilePackage = exports.buildPackage = exports.register = exports.createPackage = exports.upgradePackages = exports.buildBackend = exports.buildFrontend = exports.buildApp = exports.startServer = exports.runMethod = exports.ensureEnvironmentLoaded = exports.depCheck = exports.depCheckStaged = exports.checkImports = exports.createComponent = exports.createSetComponent = exports.createShape = exports.getScriptDir = exports.setNameVariables = exports.createOntology = exports.createApp = void 0;
40
+ exports.warn = warn;
41
+ exports.developPackage = developPackage;
42
+ exports.runOnPackagesGroupedByDependencies = runOnPackagesGroupedByDependencies;
43
+ exports.buildAll = buildAll;
44
+ exports.getLincdPackages = getLincdPackages;
30
45
  const chalk_1 = __importDefault(require("chalk"));
31
46
  const child_process_1 = require("child_process");
32
47
  const depcheck_1 = __importDefault(require("depcheck"));
@@ -37,6 +52,7 @@ const utils_js_1 = require("./utils.js");
37
52
  const fs_1 = require("fs");
38
53
  const find_nearest_package_json_1 = require("find-nearest-package-json");
39
54
  const LinkedFileStorage_1 = require("lincd/utils/LinkedFileStorage");
55
+ const child_process_2 = require("child_process");
40
56
  // import pkg from 'lincd/utils/LinkedFileStorage';
41
57
  // const { LinkedFileStorage } = pkg;
42
58
  // const config = require('lincd-server/site.webpack.config');
@@ -44,6 +60,8 @@ const glob_1 = require("glob");
44
60
  const webpack_1 = __importDefault(require("webpack"));
45
61
  const staged_git_files_1 = __importDefault(require("staged-git-files"));
46
62
  const ora_1 = __importDefault(require("ora"));
63
+ //@ts-ignore
64
+ let dirname__ = typeof __dirname !== 'undefined' ? __dirname : (0, path_1.dirname)(import.meta.url).replace('file:/', '');
47
65
  var variables = {};
48
66
  const createApp = async (name, basePath = process.cwd()) => {
49
67
  if (!name) {
@@ -54,7 +72,7 @@ const createApp = async (name, basePath = process.cwd()) => {
54
72
  if (!fs_extra_1.default.existsSync(targetFolder)) {
55
73
  fs_extra_1.default.mkdirSync(targetFolder);
56
74
  }
57
- fs_extra_1.default.copySync(path_1.default.join(__dirname, '..', 'defaults', 'app-with-backend'), targetFolder);
75
+ fs_extra_1.default.copySync(path_1.default.join(dirname__, '..', '..', 'defaults', 'app-with-backend'), targetFolder);
58
76
  //make sure the data folder exists (even though its empty).. copying empty folders does not work with fs.copySync
59
77
  fs_extra_1.default.mkdirSync(path_1.default.join(targetFolder, 'data'), { recursive: true });
60
78
  fs_extra_1.default.mkdirSync(path_1.default.join(targetFolder, 'data/uploads/resized'), {
@@ -94,7 +112,6 @@ function warn(...messages) {
94
112
  // console.log(chalk.red(message));
95
113
  });
96
114
  }
97
- exports.warn = warn;
98
115
  function developPackage(target, mode) {
99
116
  if (!target)
100
117
  target = 'es6';
@@ -120,7 +137,6 @@ function developPackage(target, mode) {
120
137
  console.warn('unknown build target. Use es5 or es6');
121
138
  }
122
139
  }
123
- exports.developPackage = developPackage;
124
140
  function checkWorkspaces(rootPath, workspaces, res) {
125
141
  // console.log('checking workspaces at '+rootPath+": "+workspaces.toString());
126
142
  if (workspaces.packages) {
@@ -546,7 +562,6 @@ function buildAll(options) {
546
562
  }
547
563
  }, sync);
548
564
  }
549
- exports.buildAll = buildAll;
550
565
  function getDependentPackages(dependencies, pkg) {
551
566
  let dependentModules = [];
552
567
  dependencies.forEach((dModuleDependencies, dModule) => {
@@ -597,7 +612,6 @@ function getLincdPackages(rootPath = process.cwd()) {
597
612
  checkWorkspaces(rootPath, pack.workspaces, res);
598
613
  return res;
599
614
  }
600
- exports.getLincdPackages = getLincdPackages;
601
615
  function setVariable(name, replacement) {
602
616
  //prepare name for regexp
603
617
  name = name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
@@ -645,18 +659,18 @@ const createOntology = async (prefix, uriBase, basePath = process.cwd()) => {
645
659
  //copy ontology accessor file
646
660
  log('Creating files for ontology \'' + prefix + '\'');
647
661
  let targetFile = path_1.default.join(targetFolder, hyphenName + '.ts');
648
- fs_extra_1.default.copySync(path_1.default.join(__dirname, '..', 'defaults', 'package', 'src', 'ontologies', 'example-ontology.ts'), targetFile);
662
+ fs_extra_1.default.copySync(path_1.default.join(dirname__, '..', '..', 'defaults', 'package', 'src', 'ontologies', 'example-ontology.ts'), targetFile);
649
663
  //copy data files
650
664
  let targetDataFile = path_1.default.join(targetFolder, '..', 'data', hyphenName + '.json');
651
665
  let targetDataFile2 = path_1.default.join(targetFolder, '..', 'data', hyphenName + '.json.d.ts');
652
- fs_extra_1.default.copySync(path_1.default.join(__dirname, '..', 'defaults', 'package', 'src', 'data', 'example-ontology.json'), targetDataFile);
653
- fs_extra_1.default.copySync(path_1.default.join(__dirname, '..', 'defaults', 'package', 'src', 'data', 'example-ontology.json.d.ts'), targetDataFile2);
666
+ fs_extra_1.default.copySync(path_1.default.join(dirname__, '..', '..', 'defaults', 'package', 'src', 'data', 'example-ontology.json'), targetDataFile);
667
+ fs_extra_1.default.copySync(path_1.default.join(dirname__, '..', '..', 'defaults', 'package', 'src', 'data', 'example-ontology.json.d.ts'), targetDataFile2);
654
668
  await replaceVariablesInFiles(targetFile, targetDataFile, targetDataFile2);
655
669
  log(`Prepared a new ontology data files in ${chalk_1.default.magenta(targetDataFile.replace(basePath, ''))}`, `And an ontology accessor file in ${chalk_1.default.magenta(targetFile.replace(basePath, ''))}`);
656
670
  //if this is not a lincd app (but a lincd package instead)
657
671
  if (!sourceFolder.includes('frontend')) {
658
672
  //then also add an import to index
659
- let indexPath = addLineToIndex(`import './ontologies/${hyphenName}';`, 'ontologies');
673
+ let indexPath = addLineToIndex(`import './ontologies/${hyphenName}.js';`, 'ontologies');
660
674
  log(`Added an import of this file from ${chalk_1.default.magenta(indexPath)}`);
661
675
  }
662
676
  };
@@ -778,15 +792,18 @@ function getSourceFolder(basePath = process.cwd()) {
778
792
  * get __dirname for either ESM/CJS
779
793
  */
780
794
  const getScriptDir = () => {
781
- // @ts-ignore
782
- if (typeof __dirname !== 'undefined') {
783
- // @ts-ignore
784
- return __dirname;
785
- }
786
- else {
787
- // @ts-ignore
788
- return (0, path_1.dirname)(import.meta.url).replace('file:/', '');
789
- }
795
+ return dirname__;
796
+ // // @ts-ignore
797
+ // if (typeof __dirname !== 'undefined')
798
+ // {
799
+ // // @ts-ignore
800
+ // return __dirname;
801
+ // }
802
+ // else
803
+ // {
804
+ // // @ts-ignore
805
+ // return dirname(import.meta.url).replace('file:/','');
806
+ // }
790
807
  };
791
808
  exports.getScriptDir = getScriptDir;
792
809
  const createShape = async (name, basePath = process.cwd()) => {
@@ -803,7 +820,7 @@ const createShape = async (name, basePath = process.cwd()) => {
803
820
  //if this is NOT a lincd app (but a lincd package)
804
821
  let indexPath;
805
822
  if (!sourceFolder.includes('frontend')) {
806
- indexPath = addLineToIndex(`import './shapes/${hyphenName}';`, 'shapes');
823
+ indexPath = addLineToIndex(`import './shapes/${hyphenName}.js';`, 'shapes');
807
824
  log(`Added an import of this file from ${chalk_1.default.magenta(indexPath)}`);
808
825
  }
809
826
  };
@@ -819,7 +836,7 @@ const createSetComponent = async (name, basePath = process.cwd()) => {
819
836
  fs_extra_1.default.copySync(path_1.default.join((0, exports.getScriptDir)(), '..', '..', 'defaults', 'component.scss'), targetFile2);
820
837
  //replace variables in some of the copied files
821
838
  await replaceVariablesInFiles(targetFile, targetFile2);
822
- let indexPath = addLineToIndex(`import './components/${hyphenName}';`, 'components');
839
+ let indexPath = addLineToIndex(`import './components/${hyphenName}.js';`, 'components');
823
840
  log(`Created a new set component in ${chalk_1.default.magenta(targetFile.replace(basePath, ''))}`, `Created a new stylesheet in ${chalk_1.default.magenta(targetFile2.replace(basePath, ''))}`, `Added an import of this file from ${chalk_1.default.magenta(indexPath)}`);
824
841
  };
825
842
  exports.createSetComponent = createSetComponent;
@@ -839,15 +856,15 @@ const createComponent = async (name, basePath = process.cwd()) => {
839
856
  //if this is not a lincd app (but a lincd package instead)
840
857
  if (!sourceFolder.includes('frontend')) {
841
858
  //then also add an import to index
842
- let indexPath = addLineToIndex(`import './components/${hyphenName}';`, 'components');
859
+ let indexPath = addLineToIndex(`import './components/${hyphenName}.js';`, 'components');
843
860
  log(`Added an import of this file from ${chalk_1.default.magenta(indexPath)}`);
844
861
  }
845
862
  };
846
863
  exports.createComponent = createComponent;
847
864
  //read the source of all ts/tsx files in the src folder
848
865
  //if there is an import that imports a lincd package with /src/ in it, then warn
849
- //if there is an import that imports outside of the src folder, then warn
850
- const checkImports = async (sourceFolder = getSourceFolder(), depth = 0, // Used to check if the import is outside of the src folder
866
+ //if there is an import that imports something from outside the src folder, then warn
867
+ const checkImports = async (sourceFolder = getSourceFolder(), depth = 0, // Used to check if the import is outside the src folder
851
868
  invalidImports = new Map()) => {
852
869
  const dir = fs_extra_1.default.readdirSync(sourceFolder);
853
870
  // Start checking each file in the source folder
@@ -857,40 +874,66 @@ invalidImports = new Map()) => {
857
874
  // INFO: For future use - if this part fails, it could be due to user permissions
858
875
  // i.e. the program not having access to check the file metadata
859
876
  if (!filename.match(/\.tsx?$/)) {
860
- if ((0, fs_1.statSync)(filename).isDirectory()) {
861
- await (0, exports.checkImports)(filename, depth + 1, invalidImports);
877
+ try {
878
+ if ((0, fs_1.statSync)(filename).isDirectory()) {
879
+ await (0, exports.checkImports)(filename, depth + 1, invalidImports);
880
+ }
881
+ else {
882
+ // Ignore all files that aren't one of the following:
883
+ // - .ts
884
+ // - .tsx
885
+ continue;
886
+ }
887
+ }
888
+ catch (e) {
889
+ console.log(e);
862
890
  }
863
- // Ignore all files that aren't one of the following:
864
- // - .ts
865
- // - .tsx
866
- continue;
867
891
  }
868
892
  const allImports = await (0, utils_js_1.getFileImports)(filename);
869
- const lincdImports = allImports.filter((i) => i.includes('lincd') || i.includes('..'));
870
- lincdImports.forEach((i) => {
871
- if (!(0, utils_js_1.isValidLINCDImport)(i, depth)) {
872
- if (!invalidImports.has(filename)) {
873
- invalidImports.set(filename, []);
874
- }
875
- invalidImports.get(filename).push(i);
893
+ if (!invalidImports.has(filename)) {
894
+ invalidImports.set(filename, []);
895
+ }
896
+ allImports.forEach((i) => {
897
+ if ((0, utils_js_1.isImportOutsideOfPackage)(i, depth)) {
898
+ invalidImports.get(filename).push({
899
+ type: 'outside_package',
900
+ importPath: i,
901
+ });
902
+ }
903
+ if ((0, utils_js_1.isInvalidLINCDImport)(i, depth)) {
904
+ invalidImports.get(filename).push({
905
+ type: 'lincd',
906
+ importPath: i,
907
+ });
908
+ }
909
+ if ((0, utils_js_1.isImportWithMissingExtension)(i)) {
910
+ invalidImports.get(filename).push({
911
+ type: 'missing_extension',
912
+ importPath: i,
913
+ });
876
914
  }
877
915
  });
878
916
  }
879
917
  let res = '';
918
+ //check if invalidImports has any
919
+ let flat = [...invalidImports.values()].flat();
880
920
  // All recursion must have finished, display any errors
881
- if (depth === 0 && invalidImports.size > 0) {
921
+ if (depth === 0 && flat.length > 0) {
882
922
  res += chalk_1.default.red('Invalid imports found.\n');
883
923
  invalidImports.forEach((value, key) => {
884
924
  // res += '- '+chalk.blueBright(key.split('/').pop()) + ':\n';
885
- value.forEach((i) => {
886
- res += chalk_1.default.red(key.split('/').pop() + ' imports from \'' + i + '\'\n');
887
- if (i.indexOf('../../') === 0) {
888
- res +=
889
- 'To fix: import from the NPM package directly.\n';
925
+ value.forEach(({ type, importPath }) => {
926
+ let message = key.split('/').pop() + ' imports from \'' + importPath + '\'';
927
+ if (type === 'outside_package') {
928
+ message += ' which is outside the package source root';
890
929
  }
891
- else if ('/src/') {
892
- res += 'To fix: you likely need to replace /src with /lib\n';
930
+ if (type === 'lincd') {
931
+ message += ' which should not contain /src/ or /lib/ in the import path';
893
932
  }
933
+ if (type === 'missing_extension') {
934
+ message += ' which should end with a file extension. Like .js or .scss';
935
+ }
936
+ res += chalk_1.default.red(message + '\n');
894
937
  });
895
938
  });
896
939
  throw res;
@@ -945,7 +988,10 @@ const depCheck = async (packagePath = process.cwd()) => {
945
988
  if (missingLincdPackages.length > 0) {
946
989
  reject(chalk_1.default.red(packagePath.split('/').pop() +
947
990
  '\n[ERROR] These LINCD packages are imported but they are not listed in package.json:\n- ' +
948
- missingLincdPackages.join(',\n- ')));
991
+ missingLincdPackages.map(missedKey => {
992
+ const files = results.missing[missedKey];
993
+ return `${missedKey} (${files.length} files: ${files.join(', ')})`;
994
+ }).join(',\n- ')));
949
995
  }
950
996
  else if (missing.length > 0) {
951
997
  resolve(chalk_1.default.redBright('warning: ' + packagePath.split('/').pop() +
@@ -1014,10 +1060,84 @@ const ensureEnvironmentLoaded = async () => {
1014
1060
  }
1015
1061
  };
1016
1062
  exports.ensureEnvironmentLoaded = ensureEnvironmentLoaded;
1063
+ const runMethod = async (packageName, method, options) => {
1064
+ await (0, exports.ensureEnvironmentLoaded)();
1065
+ if (options.spawn) {
1066
+ let lincdConfig = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'lincd.config.js')}`).then(s => __importStar(require(s)))).default;
1067
+ //@ts-ignore
1068
+ const ServerClass = (await Promise.resolve().then(() => __importStar(require('lincd-server/shapes/LincdServer')))).LincdServer;
1069
+ await Promise.resolve(`${path_1.default.join(process.cwd(), 'scripts', 'storage-config.js')}`).then(s => __importStar(require(s)));
1070
+ let server = new ServerClass({
1071
+ loadAppComponent: async () => (await Promise.resolve(`${path_1.default.join(process.cwd(), 'src', 'App')}`).then(s => __importStar(require(s)))).default,
1072
+ ...lincdConfig,
1073
+ });
1074
+ //init the server
1075
+ console.log('Initializing server...');
1076
+ server.initOnly().then(() => {
1077
+ //process the backend method call
1078
+ console.log('Running method ' + method);
1079
+ //mock the request and response objects
1080
+ let request = {
1081
+ body: {},
1082
+ query: {},
1083
+ params: {},
1084
+ headers: {},
1085
+ method: 'POST',
1086
+ url: '/' + packageName + '/' + method,
1087
+ };
1088
+ let response = {
1089
+ status: (statusCode) => {
1090
+ console.log('Response status code:', statusCode);
1091
+ return response;
1092
+ },
1093
+ json: (data) => {
1094
+ console.log('Response data:', data);
1095
+ },
1096
+ send: (data) => {
1097
+ console.log('Response data:', data);
1098
+ },
1099
+ };
1100
+ //TODO; allow sending args
1101
+ server.callBackendMethod(packageName, method, [], request, response).then(() => {
1102
+ console.log('Done');
1103
+ process.exit();
1104
+ });
1105
+ });
1106
+ }
1107
+ else {
1108
+ //reuse the existing running LincdServer instance.
1109
+ //make a HTTP call
1110
+ //'/call/:pkg/:method',
1111
+ fetch(process.env.SITE_ROOT + '/call/' + packageName + '/' + method, {
1112
+ method: 'POST',
1113
+ headers: {
1114
+ 'Content-Type': 'application/json',
1115
+ },
1116
+ }).then((response) => {
1117
+ if (!response.ok) {
1118
+ throw new Error('Network response was not ok');
1119
+ }
1120
+ return response.json();
1121
+ }).then((data) => {
1122
+ console.log('Response data:', data);
1123
+ process.exit();
1124
+ }).catch((error) => {
1125
+ var _a;
1126
+ if (error.code === 'ECONNREFUSED' || ((_a = error.cause) === null || _a === void 0 ? void 0 : _a.code) === 'ECONNREFUSED') {
1127
+ console.error(chalk_1.default.red('Could not connect to the backend server. Is it running?'));
1128
+ console.error(`Make sure you ${chalk_1.default.magenta('run "yarn start" in a separate process')} before calling this method.`);
1129
+ }
1130
+ else {
1131
+ console.error('Error during backend call:', error);
1132
+ }
1133
+ process.exit(1);
1134
+ });
1135
+ }
1136
+ };
1137
+ exports.runMethod = runMethod;
1017
1138
  const startServer = async (initOnly = false, ServerClass = null) => {
1018
- var _a, _b;
1019
1139
  await (0, exports.ensureEnvironmentLoaded)();
1020
- let lincdConfig = await (_a = path_1.default.join(process.cwd(), 'lincd.config.js'), Promise.resolve().then(() => __importStar(require(_a))));
1140
+ let lincdConfig = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'lincd.config.js')}`).then(s => __importStar(require(s)))).default;
1021
1141
  // function scssLoadcall(source, filename) {
1022
1142
  // return 'console.log("SCSS CALL: ' + filename + '");\n' + source;
1023
1143
  // process.exit();
@@ -1032,10 +1152,18 @@ const startServer = async (initOnly = false, ServerClass = null) => {
1032
1152
  //@ts-ignore
1033
1153
  ServerClass = (await Promise.resolve().then(() => __importStar(require('lincd-server/shapes/LincdServer')))).LincdServer;
1034
1154
  }
1035
- await (_b = path_1.default.join(process.cwd(), 'scripts', 'storage-config.js'), Promise.resolve().then(() => __importStar(require(_b))));
1155
+ await Promise.resolve(`${path_1.default.join(process.cwd(), 'scripts', 'storage-config.js')}`).then(s => __importStar(require(s)));
1156
+ let appPromise;
1157
+ if (process.env.NODE_ENV !== 'development') {
1158
+ appPromise = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'lib', 'App.js')}`).then(s => __importStar(require(s)))).default;
1159
+ }
1160
+ else {
1161
+ appPromise = (await Promise.resolve(`${path_1.default.join(process.cwd(), 'src', 'App.js')}`).then(s => __importStar(require(s)))).default;
1162
+ }
1036
1163
  let server = new ServerClass({
1037
- loadAppComponent: async () => { var _a; return (await (_a = path_1.default.join(process.cwd(), 'src', 'App'), Promise.resolve().then(() => __importStar(require(_a))))).default; },
1038
- ...lincdConfig,
1164
+ loadAppComponent: async () => {
1165
+ return appPromise;
1166
+ }, ...lincdConfig,
1039
1167
  });
1040
1168
  //Important to use slice, because when using clusers, child processes need to be able to read the same arguments
1041
1169
  let args = process.argv.slice(2);
@@ -1049,10 +1177,16 @@ const startServer = async (initOnly = false, ServerClass = null) => {
1049
1177
  };
1050
1178
  exports.startServer = startServer;
1051
1179
  const buildApp = async () => {
1180
+ await (0, exports.buildFrontend)();
1181
+ await (0, exports.buildBackend)();
1182
+ console.log(chalk_1.default.magenta(`✅ ${process.env.NODE_ENV} app build finished`));
1183
+ };
1184
+ exports.buildApp = buildApp;
1185
+ const buildFrontend = async () => {
1052
1186
  await (0, exports.ensureEnvironmentLoaded)();
1053
1187
  const webpackAppConfig = await (await Promise.resolve().then(() => __importStar(require('./config-webpack-app.js')))).getWebpackAppConfig();
1054
- console.log(chalk_1.default.magenta(`Building ${process.env.NODE_ENV} app bundles`));
1055
- return new Promise((resolve, reject) => {
1188
+ console.log(chalk_1.default.magenta(`🛠 Building ${process.env.NODE_ENV} frontend bundles`));
1189
+ await new Promise((resolve, reject) => {
1056
1190
  (0, webpack_1.default)(webpackAppConfig, async (err, stats) => {
1057
1191
  if (err) {
1058
1192
  console.error(err.stack || err);
@@ -1086,19 +1220,20 @@ const buildApp = async () => {
1086
1220
  // process.exit();
1087
1221
  });
1088
1222
  }).then(async () => {
1089
- var _a;
1090
1223
  // make sure environment is not development for storage config
1091
1224
  // and if we want to upload to storage, we need set S3_BUCKET_ENDPOINT
1092
1225
  if (process.env.NODE_ENV === 'development' || !process.env.S3_BUCKET_ENDPOINT) {
1093
1226
  console.warn('Upload build to storage skip in development environment or S3_BUCKET_ENDPOINT is not set');
1094
- process.exit();
1227
+ return;
1228
+ // process.exit();
1095
1229
  }
1096
1230
  if (process.env.APP_ENV) {
1097
1231
  console.warn('Not uploading to CDN for app builds');
1098
- process.exit();
1232
+ return;
1233
+ // process.exit();
1099
1234
  }
1100
1235
  // load the storage config
1101
- const storageConfig = await (_a = path_1.default.join(process.cwd(), 'scripts', 'storage-config.js'), Promise.resolve().then(() => __importStar(require(_a))));
1236
+ const storageConfig = await Promise.resolve(`${path_1.default.join(process.cwd(), 'scripts', 'storage-config.js')}`).then(s => __importStar(require(s)));
1102
1237
  // check if LincdFileStorage has a default FileStore
1103
1238
  // if yes: copy all the files in the build folder over with LincdFileStorage
1104
1239
  if (LinkedFileStorage_1.LinkedFileStorage.getDefaultStore()) {
@@ -1111,6 +1246,12 @@ const buildApp = async () => {
1111
1246
  }
1112
1247
  // get all files in the web directory and then upload them to the storage
1113
1248
  const files = await (0, utils_js_1.getFiles)(pathDir);
1249
+ console.log(chalk_1.default.magenta(`🕊 Publishing ${files.length} public files to linked file storage`));
1250
+ const clearSpinner = (0, ora_1.default)({
1251
+ discardStdin: true,
1252
+ text: `Publishing ${files.length} public files`,
1253
+ }).start();
1254
+ let counter = 0;
1114
1255
  const uploads = files.map(async (filePath) => {
1115
1256
  // read file content
1116
1257
  const fileContent = await fs_extra_1.default.promises.readFile(filePath);
@@ -1118,15 +1259,77 @@ const buildApp = async () => {
1118
1259
  // example: /Users/username/project/www/index.html -> /project/www/index.html
1119
1260
  const pathname = filePath.replace(pathDir, `/${rootDirectory}`);
1120
1261
  // upload file to storage
1121
- return await LinkedFileStorage_1.LinkedFileStorage.saveFile(pathname, fileContent);
1262
+ await LinkedFileStorage_1.LinkedFileStorage.saveFile(pathname, fileContent).then(() => {
1263
+ clearSpinner.text = `${counter++}/${files.length}: - Published ${pathname} `;
1264
+ }).catch(console.error);
1122
1265
  });
1123
1266
  const urls = await Promise.all(uploads);
1124
- console.log(`${urls.length} files uploaded to storage`);
1125
- process.exit();
1267
+ clearSpinner.succeed(`${urls.length} files uploaded to storage`);
1126
1268
  }
1127
1269
  });
1128
1270
  };
1129
- exports.buildApp = buildApp;
1271
+ exports.buildFrontend = buildFrontend;
1272
+ const buildBackend = async () => {
1273
+ console.log(chalk_1.default.magenta(`🛠 Preparing ${process.env.NODE_ENV} backend`));
1274
+ //run tsc in the backend folder
1275
+ await (0, exports.ensureEnvironmentLoaded)();
1276
+ const sourceFolder = path_1.default.join(process.cwd(), 'src');
1277
+ const targetFolder = path_1.default.join(process.cwd(), 'lib');
1278
+ // Step 1: Clear lib folder
1279
+ const clearSpinner = (0, ora_1.default)({
1280
+ discardStdin: true,
1281
+ text: 'Clearing lib folder',
1282
+ }).start();
1283
+ try {
1284
+ if (fs_extra_1.default.existsSync(targetFolder)) {
1285
+ await fs_extra_1.default.remove(targetFolder);
1286
+ }
1287
+ clearSpinner.succeed('Lib folder cleared');
1288
+ }
1289
+ catch (e) {
1290
+ console.error(e);
1291
+ clearSpinner.fail('Failed to clear lib folder');
1292
+ return;
1293
+ }
1294
+ // Step 2: Compile TS files
1295
+ const compileSpinner = (0, ora_1.default)({
1296
+ discardStdin: true,
1297
+ text: 'Compiling backend TS files',
1298
+ }).start();
1299
+ try {
1300
+ await (0, utils_js_1.execPromise)(`yarn exec tsc`);
1301
+ compileSpinner.succeed('Backend TS files compiled');
1302
+ }
1303
+ catch (e) {
1304
+ console.error(e);
1305
+ compileSpinner.fail('Failed to compile backend TS files');
1306
+ return;
1307
+ }
1308
+ // Step 3: Copy CSS files
1309
+ const copySpinner = (0, ora_1.default)({
1310
+ discardStdin: true,
1311
+ text: 'Copying CSS files',
1312
+ }).start();
1313
+ try {
1314
+ const cssFiles = await (0, utils_js_1.getFiles)(sourceFolder, '.css');
1315
+ await Promise.all(cssFiles.map((file) => {
1316
+ const targetFile = file.replace(sourceFolder, targetFolder);
1317
+ //ensure the target folder exists
1318
+ const targetDir = path_1.default.dirname(targetFile);
1319
+ if (!fs_extra_1.default.existsSync(targetDir)) {
1320
+ fs_extra_1.default.mkdirSync(targetDir, { recursive: true });
1321
+ }
1322
+ return fs_extra_1.default.copyFile(file, targetFile);
1323
+ }));
1324
+ copySpinner.succeed(`${cssFiles.length} CSS files copied`);
1325
+ }
1326
+ catch (e) {
1327
+ console.error(e);
1328
+ copySpinner.fail('Failed to copy CSS files');
1329
+ }
1330
+ return true;
1331
+ };
1332
+ exports.buildBackend = buildBackend;
1130
1333
  const upgradePackages = async () => {
1131
1334
  await (0, exports.ensureEnvironmentLoaded)();
1132
1335
  // let packages = getLincdPackages();
@@ -1411,25 +1614,30 @@ const buildPackage = async (target, target2, packagePath = process.cwd(), logRes
1411
1614
  //TODO: replace with listr so we can show multiple processes at once
1412
1615
  spinner = (0, ora_1.default)({
1413
1616
  discardStdin: true,
1414
- text: 'Compiling code',
1617
+ text: 'Compiling ESM',
1415
1618
  }).start();
1416
1619
  }
1417
1620
  let buildProcess = Promise.resolve(true);
1418
1621
  let buildStep = (step) => {
1419
1622
  buildProcess = buildProcess.then((previousResult) => {
1623
+ if (!previousResult) {
1624
+ return false;
1625
+ }
1420
1626
  if (logResults) {
1421
1627
  spinner.text = step.name;
1422
1628
  spinner.start();
1423
1629
  }
1424
1630
  return step.apply().then(stepResult => {
1631
+ //if a build step returns a string,
1632
+ //a warning is shown but the build is still successful with warnings
1425
1633
  if (typeof stepResult === 'string') {
1426
1634
  // spinner.text = step.name + ' - ' + stepResult;
1427
1635
  if (logResults) {
1428
1636
  spinner.warn(step.name + ' - ' + stepResult);
1429
1637
  spinner.stop();
1430
1638
  }
1431
- //warning is shown, but build is still succesful with warnings
1432
- return false;
1639
+ //can still continue
1640
+ return true;
1433
1641
  }
1434
1642
  else if (stepResult === true || typeof stepResult === 'undefined') {
1435
1643
  if (logResults) {
@@ -1437,13 +1645,31 @@ const buildPackage = async (target, target2, packagePath = process.cwd(), logRes
1437
1645
  }
1438
1646
  return previousResult && true;
1439
1647
  }
1648
+ else if (typeof stepResult === 'object' && stepResult.error) {
1649
+ if (logResults) {
1650
+ spinner.fail(step.name + ' - ' + stepResult.error);
1651
+ spinner.stop();
1652
+ }
1653
+ //failed and should stop
1654
+ return false;
1655
+ }
1440
1656
  });
1441
1657
  });
1442
1658
  };
1443
1659
  buildStep({
1444
- name: 'Compiling code',
1660
+ name: 'Checking imports',
1661
+ apply: () => (0, exports.checkImports)(packagePath + '/src'),
1662
+ });
1663
+ buildStep({
1664
+ name: 'Compiling ESM',
1445
1665
  apply: async () => {
1446
- return (0, exports.compilePackage)(packagePath);
1666
+ return (0, exports.compilePackageESM)(packagePath);
1667
+ },
1668
+ });
1669
+ buildStep({
1670
+ name: 'Compiling CJS',
1671
+ apply: async () => {
1672
+ return (0, exports.compilePackageCJS)(packagePath);
1447
1673
  },
1448
1674
  });
1449
1675
  buildStep({
@@ -1480,29 +1706,26 @@ const buildPackage = async (target, target2, packagePath = process.cwd(), logRes
1480
1706
  return (0, exports.removeOldFiles)(packagePath);
1481
1707
  },
1482
1708
  });
1483
- buildStep({
1484
- name: 'Checking imports',
1485
- apply: () => (0, exports.checkImports)(packagePath),
1486
- });
1487
1709
  buildStep({
1488
1710
  name: 'Checking dependencies',
1489
1711
  apply: () => (0, exports.depCheck)(packagePath),
1490
1712
  });
1491
1713
  let success = await buildProcess.catch(err => {
1492
- let msg = err.error ? err.error : err.stdout + '\n' + err.stderr;
1714
+ let msg = typeof err === 'string' || err instanceof Error ? err.toString() : (err.error && !err.error.toString().includes('Command failed:') ? err.error : err.stdout + '\n' + err.stderr);
1493
1715
  if (logResults) {
1494
1716
  spinner.stopAndPersist({
1495
1717
  symbol: chalk_1.default.red('✖'),
1496
- text: 'Build failed',
1718
+ // text: 'Build failed',
1497
1719
  });
1498
1720
  }
1499
1721
  else {
1500
1722
  console.log(chalk_1.default.red(packagePath.split('/').pop(), ' - Build failed:'));
1723
+ console.log(err);
1501
1724
  }
1502
1725
  console.log(msg);
1503
1726
  });
1504
1727
  //will be undefined if there was an error
1505
- if (typeof success !== 'undefined') {
1728
+ if (typeof success !== 'undefined' && success !== false) {
1506
1729
  if (logResults) {
1507
1730
  spinner.stopAndPersist({
1508
1731
  symbol: chalk_1.default.greenBright('✔'),
@@ -1510,33 +1733,61 @@ const buildPackage = async (target, target2, packagePath = process.cwd(), logRes
1510
1733
  });
1511
1734
  }
1512
1735
  }
1736
+ else {
1737
+ spinner.stopAndPersist({
1738
+ symbol: chalk_1.default.red('✖'),
1739
+ text: 'Build failed',
1740
+ });
1741
+ }
1513
1742
  return success;
1514
1743
  };
1515
1744
  exports.buildPackage = buildPackage;
1516
1745
  const compilePackage = async (packagePath = process.cwd()) => {
1517
1746
  //echo 'compiling CJS' && tsc -p tsconfig-cjs.json && echo 'compiling ESM' && tsc -p tsconfig-esm.json
1518
- let cjsConfig = fs_extra_1.default.existsSync(path_1.default.join(packagePath, 'tsconfig-cjs.json'));
1519
- let esmConfig = fs_extra_1.default.existsSync(path_1.default.join(packagePath, 'tsconfig-esm.json'));
1520
- let compileCJS = `yarn exec tsc -p tsconfig-cjs.json`;
1521
- let compileESM = `yarn exec tsc -p tsconfig-esm.json`;
1522
- let compileCommand;
1523
- if (cjsConfig && esmConfig) {
1524
- compileCommand = `${compileCJS} && ${compileESM}`;
1525
- }
1526
- else if (cjsConfig) {
1527
- compileCommand = compileCJS;
1528
- }
1529
- else if (esmConfig) {
1530
- compileCommand = compileESM;
1531
- }
1532
- else {
1533
- compileCommand = `yarn exec tsc`;
1534
- }
1747
+ // let cjsConfig = fs.existsSync(path.join(packagePath,'tsconfig-cjs.json'));
1748
+ // let esmConfig = fs.existsSync(path.join(packagePath,'tsconfig-esm.json'));
1749
+ // let compileCJS = `yarn exec tsc -p tsconfig-cjs.json`;
1750
+ // let compileESM = `yarn exec tsc -p tsconfig-esm.json`;
1751
+ // let compileCommand;
1752
+ // if (cjsConfig && esmConfig)
1753
+ // {
1754
+ // compileCommand = `${compileCJS} && ${compileESM}`;
1755
+ // }
1756
+ // else if (cjsConfig)
1757
+ // {
1758
+ // compileCommand = compileCJS;
1759
+ // }
1760
+ // else if (esmConfig)
1761
+ // {
1762
+ // compileCommand = compileESM;
1763
+ // }
1764
+ // else
1765
+ // {
1766
+ // compileCommand = `yarn exec tsc`;
1767
+ // }
1768
+ await (0, exports.compilePackageESM)(packagePath);
1769
+ await (0, exports.compilePackageCJS)(packagePath);
1770
+ };
1771
+ exports.compilePackage = compilePackage;
1772
+ const compilePackageESM = async (packagePath = process.cwd()) => {
1773
+ //echo 'compiling CJS' && tsc -p tsconfig-cjs.json && echo 'compiling ESM' && tsc -p tsconfig-esm.json
1774
+ let compileCommand = `yarn exec tsc -p tsconfig-esm.json`;
1535
1775
  return (0, utils_js_1.execPromise)(compileCommand, false, false, { cwd: packagePath }).then(res => {
1536
1776
  return res === '';
1537
1777
  });
1538
1778
  };
1539
- exports.compilePackage = compilePackage;
1779
+ exports.compilePackageESM = compilePackageESM;
1780
+ const compilePackageCJS = async (packagePath = process.cwd()) => {
1781
+ let compileCommand = `yarn exec tsc -p tsconfig-cjs.json`;
1782
+ return (0, utils_js_1.execPromise)(compileCommand, false, false, { cwd: packagePath }).then(res => {
1783
+ return res === '';
1784
+ }).catch(err => {
1785
+ return {
1786
+ error: err.stdout,
1787
+ };
1788
+ });
1789
+ };
1790
+ exports.compilePackageCJS = compilePackageCJS;
1540
1791
  var publishUpdated = function (test = false) {
1541
1792
  let packages = getLocalLincdModules();
1542
1793
  var p = Promise.resolve('');
@@ -1753,16 +2004,26 @@ var buildUpdated = async function (back, target, target2, useGitForLastModified
1753
2004
  // let packages = getLocalLincdModules();
1754
2005
  let packages = getLocalLincdPackageMap();
1755
2006
  // console.log(packages);
1756
- let jsonldPkgUpdated = await (0, utils_js_1.needsRebuilding)(packages.get('lincd-jsonld'), useGitForLastModified);
2007
+ // let jsonldPkgUpdated = await needsRebuilding(
2008
+ // packages.get('lincd-jsonld'),
2009
+ // useGitForLastModified,
2010
+ // );
1757
2011
  // let cliPkgUpdated = await needsRebuilding(packages.get('lincd-cli'), useGitForLastModified);
1758
2012
  //if either cli or jsonldPkg needs to be rebuilt
1759
2013
  // if (jsonldPkgUpdated || cliPkgUpdated) {
1760
- if (jsonldPkgUpdated) {
1761
- await (0, utils_js_1.execPromise)('yarn exec tsc && echo "compiled lincd-jsonld"', false, false, {
1762
- cwd: packages.get('lincd-jsonld').path,
1763
- }, true);
1764
- // await execPromise('yarn build-core', false, false, {}, true);
1765
- }
2014
+ // if (jsonldPkgUpdated)
2015
+ // {
2016
+ // await execPromise(
2017
+ // 'yarn exec tsc && echo "compiled lincd-jsonld"',
2018
+ // false,
2019
+ // false,
2020
+ // {
2021
+ // cwd: packages.get('lincd-jsonld').path,
2022
+ // },
2023
+ // true,
2024
+ // );
2025
+ // // await execPromise('yarn build-core', false, false, {}, true);
2026
+ // }
1766
2027
  let rebuildAllModules = false;
1767
2028
  // if (cliPkgUpdated) {
1768
2029
  // rebuildAllModules = true;
@@ -1776,9 +2037,10 @@ var buildUpdated = async function (back, target, target2, useGitForLastModified
1776
2037
  return async (pkg) => {
1777
2038
  // debugInfo('# Checking package ' + pkg.packageName);
1778
2039
  let needRebuild = await (0, utils_js_1.needsRebuilding)(pkg, useGitForLastModified);
1779
- if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated) {
1780
- needRebuild = true;
1781
- }
2040
+ // if (pkg.packageName === 'lincd-jsonld' && jsonldPkgUpdated)
2041
+ // {
2042
+ // needRebuild = true;
2043
+ // }
1782
2044
  if (needRebuild || rebuildAllModules) {
1783
2045
  //TODO: when building a pkg, also rebuild all packages that depend on this package.. and iteratively build packages that depend on those packages..
1784
2046
  // log(packageName+' modified since last commit on '+now.toString());
@@ -1957,13 +2219,14 @@ var executeCommandForPackage = function (packageName, command) {
1957
2219
  if (packageDetails) {
1958
2220
  log('Executing \'cd ' +
1959
2221
  packageDetails.path +
1960
- ' && yarn exec lincd' +
2222
+ ' && yarn lincd' +
1961
2223
  (command ? ' ' + command : '') +
1962
2224
  '\'');
1963
- return (0, utils_js_1.execp)('cd ' +
1964
- packageDetails.path +
1965
- ' && yarn exec lincd' +
1966
- (command ? ' ' + command : ''));
2225
+ (0, child_process_2.spawn)(process.platform === 'win32' ? 'yarn.cmd' : 'yarn', // Windows quirk
2226
+ ['lincd', command || null], {
2227
+ cwd: packageDetails.path,
2228
+ stdio: 'inherit',
2229
+ });
1967
2230
  }
1968
2231
  else {
1969
2232
  warn('Could not find a pkg who\'s name (partially) matched ' +