@intend-it/cli 1.3.1 → 1.3.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 (2) hide show
  1. package/dist/index.js +27 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -307,7 +307,15 @@ var heading = (text2) => pc2.bold(text2);
307
307
  var error = (text2) => pc2.red(text2);
308
308
  var dim = (text2) => pc2.dim(text2);
309
309
  var path = (p2) => dim(p2);
310
- var duration = (ms) => dim(`${(ms / 1000).toFixed(2)}s`);
310
+ var duration = (ms) => {
311
+ if (ms < 1000)
312
+ return dim(`${Math.round(ms)}ms`);
313
+ if (ms < 60000)
314
+ return dim(`${(ms / 1000).toFixed(2)}s`);
315
+ const minutes = Math.floor(ms / 60000);
316
+ const seconds = (ms % 60000 / 1000).toFixed(0);
317
+ return dim(`${minutes}m ${seconds}s`);
318
+ };
311
319
  var cmd = (name) => pc2.cyan(name);
312
320
  var label = (name, value) => `${dim(name + ":")} ${value}`;
313
321
  var icons = {
@@ -461,6 +469,23 @@ async function buildCommand(options) {
461
469
  const projectContext = new Map;
462
470
  const fileData = new Map;
463
471
  let parseErrors = 0;
472
+ let entryPointFile = null;
473
+ let entryPointName = null;
474
+ for (const [file, ast] of projectContext.entries()) {
475
+ for (const intent of ast.intents) {
476
+ if (intent.entryPoint) {
477
+ if (entryPointFile) {
478
+ p2.log.error(`Multiple entry points found:
479
+ 1. ${pc3.cyan(entryPointName)} in ${pc3.dim(basename(entryPointFile))}
480
+ 2. ${pc3.cyan(intent.name)} in ${pc3.dim(basename(file))}`);
481
+ p2.cancel("Only one 'entry' intent is allowed per project.");
482
+ process.exit(1);
483
+ }
484
+ entryPointFile = file;
485
+ entryPointName = intent.name;
486
+ }
487
+ }
488
+ }
464
489
  for (const file of files) {
465
490
  try {
466
491
  const content = readFileSync2(file, "utf-8");
@@ -574,7 +599,7 @@ ${pc3.red(err.message)}`);
574
599
  finalCode = generated.code;
575
600
  await cas.put(hash, finalCode);
576
601
  const fileDuration = Date.now() - fileStart;
577
- sFile.stop(`${relativePath} ${pc3.dim(`${fileDuration}ms`)}`);
602
+ sFile.stop(`${relativePath} ${duration(fileDuration)}`);
578
603
  }
579
604
  writeFileSync3(outFile, finalCode, "utf-8");
580
605
  generatedFiles.push(outFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intend-it/cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "CLI for the Intend programming language",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,8 +30,8 @@
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
32
  "@clack/prompts": "^0.11.0",
33
- "@intend-it/core": "^4.0.1",
34
- "@intend-it/parser": "^1.3.1",
33
+ "@intend-it/core": "^4.0.2",
34
+ "@intend-it/parser": "^1.3.2",
35
35
  "ora": "^8.1.1",
36
36
  "picocolors": "^1.1.1"
37
37
  },