lincd-cli 0.2.37 → 0.2.38

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.
@@ -0,0 +1,22 @@
1
+ node_modules
2
+ frontend/build
3
+ frontend/web/assets
4
+ data/uploads
5
+ data/metadata
6
+ data/sessions
7
+ .yarn/*
8
+ !.yarn/patches
9
+ !.yarn/plugins
10
+ !.yarn/releases
11
+ !.yarn/sdks
12
+ !.yarn/versions
13
+ packages/**/dist
14
+ packages/**/lib
15
+ packages/**/.yarn/*
16
+ !packages/**/.yarn/patches
17
+ !packages/**/.yarn/plugins
18
+ !packages/**/.yarn/releases
19
+ !packages/**/.yarn/sdks
20
+ !packages/**/.yarn/versions
21
+ android/app/build
22
+ ios/App/App/public
@@ -0,0 +1,8 @@
1
+ nodeLinker: "node-modules"
2
+ npmRegistryServer: "https://registry.npmjs.org/"
3
+
4
+ plugins:
5
+ - path: .yarn/plugins/@yarnpkg/plugin-version.cjs
6
+ spec: "@yarnpkg/plugin-version"
7
+
8
+ yarnPath: .yarn/releases/yarn-3.6.1.cjs
@@ -64,7 +64,8 @@ const createApp = (name, basePath = process.cwd()) => __awaiter(void 0, void 0,
64
64
  fs_extra_1.default.copySync(path_1.default.join(__dirname, '..', 'defaults', 'app-with-backend'), targetFolder);
65
65
  //make sure the data folder exists (even though its empty).. copying empty folders does not work with fs.copySync
66
66
  fs_extra_1.default.mkdirSync(path_1.default.join(targetFolder, 'data'), { recursive: true });
67
- // fs.renameSync(path.join(targetFolder, '.yarnrc.yml.template'), path.join(targetFolder, '.yarnrc.yml'));
67
+ fs_extra_1.default.renameSync(path_1.default.join(targetFolder, 'gitignore.template'), path_1.default.join(targetFolder, '.gitignore'));
68
+ fs_extra_1.default.renameSync(path_1.default.join(targetFolder, 'yarnrc.yml.template'), path_1.default.join(targetFolder, '.yarnrc.yml'));
68
69
  // fs.copySync(path.join(__dirname, '..', 'defaults', 'app'), targetFolder);
69
70
  log("Creating new LINCD application '" + name + "'");
70
71
  //replace variables in some copied files
@@ -235,8 +236,12 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
235
236
  });
236
237
  if (stack.length <= 0 && done.size < lincdPackages.size) {
237
238
  console.log(chalk_1.default.red('Only ' + done.size + ' out of ' + lincdPackages.size + ' packages have been built'));
238
- console.log('ALL remaining packages have dependencies that have not been met. This may point to ' + chalk_1.default.red('circular dependencies.'));
239
- console.log('Already built: ' + Array.from(done).map(p => chalk_1.default.green(p.packageName)).join(', '));
239
+ console.log('ALL remaining packages have dependencies that have not been met. This may point to ' +
240
+ chalk_1.default.red('circular dependencies.'));
241
+ console.log('Already built: ' +
242
+ Array.from(done)
243
+ .map((p) => chalk_1.default.green(p.packageName))
244
+ .join(', '));
240
245
  console.log(chalk_1.default.blue('\nTo solve this issue') + ': find the circular dependencies below and fix the dependencies:\n\n');
241
246
  //TODO: actually find and name the packages that have circular dependencies
242
247
  // let circular = [];
@@ -254,15 +259,20 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
254
259
  // process.exit();
255
260
  // }
256
261
  // });
257
- lincdPackages.forEach(pkg => {
262
+ lincdPackages.forEach((pkg) => {
258
263
  let deps = dependencies.get(pkg);
259
264
  if (!done.has(pkg)) {
260
- console.log(chalk_1.default.red(pkg.packageName) + ' has not been built yet. Unbuilt dependencies:\n' + deps.filter(dependency => {
261
- return !Array.from(done).some(p => {
262
- // console.log(p.packageName,dependency.packageName,p===dependency)
263
- return p === dependency;
264
- });
265
- }).map(p => chalk_1.default.red('\t- ' + ((p === null || p === void 0 ? void 0 : p.packageName) ? p.packageName : p.toString()) + '\n')).join(" "));
265
+ console.log(chalk_1.default.red(pkg.packageName) +
266
+ ' has not been built yet. Unbuilt dependencies:\n' +
267
+ deps
268
+ .filter((dependency) => {
269
+ return !Array.from(done).some((p) => {
270
+ // console.log(p.packageName,dependency.packageName,p===dependency)
271
+ return p === dependency;
272
+ });
273
+ })
274
+ .map((p) => chalk_1.default.red('\t- ' + ((p === null || p === void 0 ? void 0 : p.packageName) ? p.packageName : p.toString()) + '\n'))
275
+ .join(' '));
266
276
  // console.log(chalk.red(pkg.packageName)+' has not been built yet. Built dependencies:\n' + deps.filter(dependency => {
267
277
  // return Array.from(done).some(p => p.packageName === pkg.packageName)
268
278
  // }).map(p => chalk.green('\t- '+p.packageName+'\n')).join(" "))
@@ -282,19 +292,19 @@ function runOnPackagesGroupedByDependencies(lincdPackages, onBuildStack, onStack
282
292
  runStack(startStack);
283
293
  }
284
294
  function hasDependency(pkg, childPkg, dependencies, depth = 1) {
285
- console.log("Does " + pkg.packageName + " have dep " + childPkg.packageName + " ?");
295
+ console.log('Does ' + pkg.packageName + ' have dep ' + childPkg.packageName + ' ?');
286
296
  let deps = dependencies.get(pkg);
287
- if (deps.some(dependency => {
297
+ if (deps.some((dependency) => {
288
298
  console.log(dependency.packageName, childPkg.packageName, dependency === childPkg);
289
299
  if (depth === 2)
290
300
  return false;
291
301
  // return dependency === childPkg;
292
302
  return dependency === childPkg || hasDependency(dependency, childPkg, dependencies, depth++);
293
303
  })) {
294
- console.log("##YES");
304
+ console.log('##YES');
295
305
  return true;
296
306
  }
297
- console.log("going up");
307
+ console.log('going up');
298
308
  return false;
299
309
  }
300
310
  function buildAll(target, target2, target3) {
@@ -353,7 +363,11 @@ function buildAll(target, target2, target3) {
353
363
  }
354
364
  //unless told otherwise, build the package
355
365
  if (!command) {
356
- command = (0, utils_1.execPromise)('cd ' + pkg.path + ' && yarn exec lincd build' + (target ? ' ' + target : '') + (target2 ? ' ' + target2 : ''), false, false, {}, false);
366
+ command = (0, utils_1.execPromise)('cd ' +
367
+ pkg.path +
368
+ ' && yarn exec lincd build' +
369
+ (target ? ' ' + target : '') +
370
+ (target2 ? ' ' + target2 : ''), false, false, {}, false);
357
371
  debugInfo(chalk_1.default.cyan('Building ' + pkg.packageName));
358
372
  }
359
373
  return command
@@ -487,8 +501,8 @@ function setVariable(name, replacement) {
487
501
  variables[name] = replacement;
488
502
  }
489
503
  var replaceVariablesInFile = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
490
- var fileContent = yield fs_extra_1.default.readFile(filePath, 'utf8').catch(err => {
491
- console.warn(chalk_1.default.red("Could not read file " + filePath));
504
+ var fileContent = yield fs_extra_1.default.readFile(filePath, 'utf8').catch((err) => {
505
+ console.warn(chalk_1.default.red('Could not read file ' + filePath));
492
506
  });
493
507
  if (fileContent) {
494
508
  var newContent = replaceCurlyVariables(fileContent);
@@ -712,9 +726,9 @@ const depCheck = () => __awaiter(void 0, void 0, void 0, function* () {
712
726
  if (results.missing) {
713
727
  let missing = Object.keys(results.missing);
714
728
  //currently react is not an explicit dependency, but we should add it as a peer dependency
715
- missing.splice(missing.indexOf("react"));
729
+ missing.splice(missing.indexOf('react'));
716
730
  if (missing.length > 0) {
717
- console.warn(chalk_1.default.red("Missing dependencies:\n\t" + missing.join(",\n\t")));
731
+ console.warn(chalk_1.default.red('Missing dependencies:\n\t' + missing.join(',\n\t')));
718
732
  }
719
733
  }
720
734
  // if(Object.keys(results.invalidFiles).length > 0) {
@@ -929,7 +943,7 @@ const buildMetadata = () => __awaiter(void 0, void 0, void 0, function* () {
929
943
  }
930
944
  else {
931
945
  if (!response.packageUri) {
932
- console.warn("No package URI from meta data. Not building meta data for this package");
946
+ console.warn('No package URI from meta data. Not building meta data for this package');
933
947
  return;
934
948
  }
935
949
  let pkgNode = models_1.NamedNode.getOrCreate(response.packageUri);
@@ -1043,7 +1057,7 @@ const getLastCommitTime = (packagePath) => {
1043
1057
  // process.exit();
1044
1058
  return (0, utils_1.execPromise)(`git log -1 --format="%h %ci" -- ${packagePath}`)
1045
1059
  .then((result) => __awaiter(void 0, void 0, void 0, function* () {
1046
- let commitId = result.substring(0, result.indexOf(" "));
1060
+ let commitId = result.substring(0, result.indexOf(' '));
1047
1061
  let date = result.substring(commitId.length + 1);
1048
1062
  let lastCommitDate = new Date(date);
1049
1063
  let changes = yield (0, utils_1.execPromise)(`git show --stat --oneline ${commitId} -- ${packagePath}`);
@@ -1103,10 +1117,10 @@ var publishUpdated = function (test = false) {
1103
1117
  return chalk_1.default.gray(pckg.packageName + ' is private');
1104
1118
  // return previousResult + ' ' + chalk.gray(pckg.packageName + ' is private\n');
1105
1119
  }
1106
- console.log("testing npm");
1120
+ console.log('testing npm');
1107
1121
  return (0, utils_1.execPromise)('npm info ' + pckg.packageName + ' --json')
1108
1122
  .then((output) => __awaiter(this, void 0, void 0, function* () {
1109
- console.log("testing npm done");
1123
+ console.log('testing npm done');
1110
1124
  var info;
1111
1125
  try {
1112
1126
  if (output == '' || output.includes('E404')) {
@@ -1146,10 +1160,10 @@ var publishUpdated = function (test = false) {
1146
1160
  shouldPublish = lastPublishDate.getTime() < lastCommitInfo.date.getTime();
1147
1161
  //ignore changes to package.json if that's the only change, because when we publish the version number changes, which is then committed
1148
1162
  //(note there is always 2 lines for commit info + number of files changed)
1149
- let changedFiles = lastCommitInfo.changes.split("\n").filter(line => line.includes("|"));
1163
+ let changedFiles = lastCommitInfo.changes.split('\n').filter((line) => line.includes('|'));
1150
1164
  let numberOfFilesChanges = changedFiles.length;
1151
1165
  // console.log("CHECK "+lastCommitInfo.changes.includes("package.json")+" - "+numberOfFilesChanges)
1152
- if (shouldPublish && lastCommitInfo.changes.includes("package.json") && numberOfFilesChanges === 1) {
1166
+ if (shouldPublish && lastCommitInfo.changes.includes('package.json') && numberOfFilesChanges === 1) {
1153
1167
  shouldPublish = false;
1154
1168
  }
1155
1169
  if (shouldPublish) {
@@ -1159,7 +1173,10 @@ var publishUpdated = function (test = false) {
1159
1173
  lastPublishDate.toTimeString() +
1160
1174
  ' published ' +
1161
1175
  info.version);
1162
- log(lastCommitInfo.date.toDateString() + ' ' + new Date(lastCommitInfo.date).toTimeString() + ' source last committed:');
1176
+ log(lastCommitInfo.date.toDateString() +
1177
+ ' ' +
1178
+ new Date(lastCommitInfo.date).toTimeString() +
1179
+ ' source last committed:');
1163
1180
  log(lastCommitInfo.changes);
1164
1181
  }
1165
1182
  }
@@ -1222,7 +1239,7 @@ function getEnvJsonPath(relativeToPath = process.cwd()) {
1222
1239
  }
1223
1240
  // let path = './';
1224
1241
  for (let i = 0; i <= 10; i++) {
1225
- let envFile = yield (0, get_env_vars_1.getEnvFile)({ filePath: relativeToPath + path + '.env.json' }).catch(err => {
1242
+ let envFile = yield (0, get_env_vars_1.getEnvFile)({ filePath: relativeToPath + path + '.env.json' }).catch((err) => {
1226
1243
  return null;
1227
1244
  });
1228
1245
  if (envFile) {
@@ -1296,7 +1313,7 @@ var buildUpdated = function (back, target, target2, test = false) {
1296
1313
  let packagesLeft = packages.size;
1297
1314
  runOnPackagesGroupedByDependencies(packages, (packageGroup, dependencies) => {
1298
1315
  debugInfo('Now checking: ' + chalk_1.default.blue(packageGroup.map((i) => i.packageName)));
1299
- debugInfo((packagesLeft) + " packages left.");
1316
+ debugInfo(packagesLeft + ' packages left.');
1300
1317
  packagesLeft = packagesLeft - packageGroup.length;
1301
1318
  return (pkg) => __awaiter(this, void 0, void 0, function* () {
1302
1319
  // debugInfo('# Checking package ' + pkg.packageName);
@@ -1470,7 +1487,7 @@ var gitIgnore = function (...entries) {
1470
1487
  };
1471
1488
  var addLinesToFile = function (filePath, entries) {
1472
1489
  let fileContents = fs_extra_1.default.readFileSync(filePath, { encoding: 'utf8' });
1473
- entries.forEach(entry => {
1490
+ entries.forEach((entry) => {
1474
1491
  fileContents += '\n' + entry;
1475
1492
  });
1476
1493
  fs_extra_1.default.writeFileSync(filePath, fileContents);
@@ -1484,12 +1501,12 @@ var addCapacitor = function (basePath = process.cwd()) {
1484
1501
  let envCmdPath = path_1.default.resolve(basePath, '.env-cmdrc.json');
1485
1502
  let envCmd = JSON.parse(fs_extra_1.default.readFileSync(envCmdPath, { encoding: 'utf8' }));
1486
1503
  envCmd['static-dev'] = {
1487
- "NODE_ENV": "production",
1488
- "SITE_ROOT": "http://localhost:4000",
1489
- "DATA_ROOT": "http://localhost:4000/data",
1490
- "OUTPUT_PATH": "./frontend/web/assets",
1491
- "ASSET_PATH": "./assets/",
1492
- "ENTRY_PATH": "./frontend/src/index-static.tsx"
1504
+ NODE_ENV: 'production',
1505
+ SITE_ROOT: 'http://localhost:4000',
1506
+ DATA_ROOT: 'http://localhost:4000/data',
1507
+ OUTPUT_PATH: './frontend/web/assets',
1508
+ ASSET_PATH: './assets/',
1509
+ ENTRY_PATH: './frontend/src/index-static.tsx',
1493
1510
  };
1494
1511
  fs_extra_1.default.writeFile(envCmdPath, JSON.stringify(envCmd, null, 2));
1495
1512
  log('Edited .env-cmdrc.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lincd-cli",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "description": "Command line tools for the lincd.js library",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {