@caleuche/cli 0.2.0 → 0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @caleuche/cli
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e4e7ca9: Fixing issue with batch compilation.
8
+
9
+ ## 0.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [d0f1a56]
14
+ - @caleuche/core@0.2.0
15
+
3
16
  ## 0.2.0
4
17
 
5
18
  ### Minor Changes
package/dist/batch.js CHANGED
@@ -7,6 +7,7 @@ exports.batchCompile = batchCompile;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const utils_1 = require("./utils");
9
9
  const common_1 = require("./common");
10
+ const path_1 = __importDefault(require("path"));
10
11
  function loadVariantDefinition(variant) {
11
12
  if ((0, utils_1.isVariantDefinition)(variant)) {
12
13
  return variant;
@@ -78,7 +79,8 @@ function batchCompile(batchFile) {
78
79
  }
79
80
  const samples = bachDefinition.samples;
80
81
  for (const sampleDefinition of samples) {
81
- const sample = (0, common_1.resolveAndParseSample)(sampleDefinition.templatePath);
82
+ const templatePath = path_1.default.join(path_1.default.dirname(batchFile), sampleDefinition.templatePath);
83
+ const sample = (0, common_1.resolveAndParseSample)(templatePath);
82
84
  if (!sample) {
83
85
  process.exit(1);
84
86
  }
@@ -87,7 +89,7 @@ function batchCompile(batchFile) {
87
89
  if (!resolvedVariant) {
88
90
  process.exit(1);
89
91
  }
90
- if (!(0, common_1.compileAndWriteOutput)(sample, resolvedVariant, variant.output, {
92
+ if (!(0, common_1.compileAndWriteOutput)(sample, resolvedVariant.data, variant.output, {
91
93
  project: true,
92
94
  })) {
93
95
  console.error(`Sample: ${sampleDefinition.templatePath}, Variant: ${JSON.stringify(variant)}`);
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const commander_1 = require("commander");
5
5
  const compile_1 = require("./compile");
6
+ const batch_1 = require("./batch");
6
7
  const package_json_1 = require("../package.json");
7
8
  commander_1.program
8
9
  .name("@caleuche/cli")
@@ -12,7 +13,5 @@ commander_1.program
12
13
  .command("compile <sample-directory> <data-file> <output-directory>")
13
14
  .option("-p, --project", "Generate project file")
14
15
  .action(compile_1.compile);
15
- commander_1.program.command("batch <batch-file>").action((batchFile) => {
16
- console.log(`Batch compiling samples from ${batchFile}`);
17
- });
16
+ commander_1.program.command("batch <batch-file>").action(batch_1.batchCompile);
18
17
  commander_1.program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caleuche/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "che": "dist/index.js"
@@ -19,7 +19,7 @@
19
19
  "license": "MIT",
20
20
  "description": "Caleuche CLI",
21
21
  "dependencies": {
22
- "@caleuche/core": "*",
22
+ "@caleuche/core": "^0.2.0",
23
23
  "commander": "^14.0.0",
24
24
  "yaml": "^2.8.0"
25
25
  },
package/src/batch.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  parse,
7
7
  } from "./utils";
8
8
  import { compileAndWriteOutput, resolveAndParseSample } from "./common";
9
+ import path from "path";
9
10
 
10
11
  function loadVariantDefinition(
11
12
  variant: SampleVariantDefinition | SampleVariantPath,
@@ -86,7 +87,11 @@ export function batchCompile(batchFile: string) {
86
87
  }
87
88
  const samples = bachDefinition.samples;
88
89
  for (const sampleDefinition of samples) {
89
- const sample = resolveAndParseSample(sampleDefinition.templatePath);
90
+ const templatePath = path.join(
91
+ path.dirname(batchFile),
92
+ sampleDefinition.templatePath,
93
+ );
94
+ const sample = resolveAndParseSample(templatePath);
90
95
  if (!sample) {
91
96
  process.exit(1);
92
97
  }
@@ -98,7 +103,7 @@ export function batchCompile(batchFile: string) {
98
103
  }
99
104
 
100
105
  if (
101
- !compileAndWriteOutput(sample, resolvedVariant, variant.output, {
106
+ !compileAndWriteOutput(sample, resolvedVariant.data, variant.output, {
102
107
  project: true,
103
108
  })
104
109
  ) {
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { program } from "commander";
4
4
  import { compile } from "./compile";
5
+ import { batchCompile } from "./batch";
5
6
  import { version } from "../package.json";
6
7
 
7
8
  program
@@ -14,8 +15,6 @@ program
14
15
  .option("-p, --project", "Generate project file")
15
16
  .action(compile);
16
17
 
17
- program.command("batch <batch-file>").action((batchFile) => {
18
- console.log(`Batch compiling samples from ${batchFile}`);
19
- });
18
+ program.command("batch <batch-file>").action(batchCompile);
20
19
 
21
20
  program.parse();