@jay-framework/jay-cli 0.11.0 → 0.13.0

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 +12 -7
  2. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -5,10 +5,11 @@ import { generateElementFile } from "@jay-framework/compiler";
5
5
  import { jayDefinitions } from "@jay-framework/rollup-plugin";
6
6
  import chalk from "chalk";
7
7
  import * as fastGlob from "fast-glob";
8
- import { JAY_EXTENSION, checkValidationErrors, GenerateTarget, RuntimeMode, JAY_CONTRACT_EXTENSION } from "@jay-framework/compiler-shared";
8
+ import { JAY_EXTENSION, checkValidationErrors, GenerateTarget, RuntimeMode, JAY_CONTRACT_EXTENSION, JAY_ACTION_EXTENSION } from "@jay-framework/compiler-shared";
9
9
  import fs, { promises } from "fs";
10
10
  import path from "path";
11
11
  import { parseJayFile, JAY_IMPORT_RESOLVER } from "@jay-framework/compiler-jay-html";
12
+ import { getLogger } from "@jay-framework/logger";
12
13
  import { glob as glob$1 } from "glob";
13
14
  import path$1 from "node:path";
14
15
  const { glob } = fastGlob;
@@ -24,9 +25,9 @@ function checkFileExists(filepath) {
24
25
  }
25
26
  async function generateFiles(dir, codeGenerationFunction, afterGenerationFunction, outputExtension, destinationDir, compilationTarget, projectRoot) {
26
27
  const resolvedProjectRoot = projectRoot || process.cwd();
27
- console.log(chalk.whiteBright("Jay generating files for ", dir));
28
+ getLogger().important(chalk.whiteBright("Jay generating files for ", dir));
28
29
  let jayFiles = await findAllJayFiles(dir);
29
- console.log(dir, jayFiles);
30
+ getLogger().info(`${dir} ${JSON.stringify(jayFiles)}`);
30
31
  let generationFailed = false;
31
32
  for (const jayFile of jayFiles) {
32
33
  const content = await promises.readFile(jayFile, "utf-8");
@@ -48,15 +49,15 @@ async function generateFiles(dir, codeGenerationFunction, afterGenerationFunctio
48
49
  );
49
50
  const generateFileName = jayFile + outputExtension;
50
51
  if (generatedFile.validations.length > 0) {
51
- console.log(
52
+ getLogger().error(
52
53
  `${chalk.red("failed to generate")} ${chalk.yellow(jayFile)} → ${chalk.yellow(
53
54
  generateFileName
54
55
  )}`
55
56
  );
56
- generatedFile.validations.forEach((_) => console.log(chalk.red(_)));
57
+ generatedFile.validations.forEach((_) => getLogger().error(chalk.red(_)));
57
58
  generationFailed = true;
58
59
  } else {
59
- console.log(
60
+ getLogger().important(
60
61
  `${chalk.green("generated")} ${chalk.yellow(jayFile)} → ${chalk.yellow(
61
62
  generateFileName
62
63
  )}`
@@ -90,11 +91,15 @@ async function generateFiles(dir, codeGenerationFunction, afterGenerationFunctio
90
91
  }
91
92
  function getJayHtmlOrContractFileInputs(source) {
92
93
  return Object.fromEntries(
93
- glob$1.sync(`${source}/**/*{${JAY_EXTENSION},${JAY_CONTRACT_EXTENSION}}`).map((file) => {
94
+ glob$1.sync(
95
+ `${source}/**/*{${JAY_EXTENSION},${JAY_CONTRACT_EXTENSION},${JAY_ACTION_EXTENSION}}`
96
+ ).map((file) => {
94
97
  const relativePath = path$1.relative(source, file);
95
98
  let moduleName;
96
99
  if (file.endsWith(JAY_CONTRACT_EXTENSION)) {
97
100
  moduleName = relativePath.slice(0, -JAY_CONTRACT_EXTENSION.length) + ".contract";
101
+ } else if (file.endsWith(JAY_ACTION_EXTENSION)) {
102
+ moduleName = relativePath.slice(0, -JAY_ACTION_EXTENSION.length) + ".action";
98
103
  } else {
99
104
  moduleName = relativePath.slice(0, -JAY_EXTENSION.length);
100
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/jay-cli",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",
@@ -21,15 +21,16 @@
21
21
  "test:watch": "vitest"
22
22
  },
23
23
  "dependencies": {
24
- "@jay-framework/compiler": "^0.11.0",
25
- "@jay-framework/rollup-plugin": "^0.11.0",
24
+ "@jay-framework/compiler": "^0.13.0",
25
+ "@jay-framework/logger": "^0.13.0",
26
+ "@jay-framework/rollup-plugin": "^0.13.0",
26
27
  "chalk": "^4.1.2",
27
28
  "commander": "^14.0.0",
28
29
  "glob": "^10.4.5",
29
30
  "rollup": "^4.9.5"
30
31
  },
31
32
  "devDependencies": {
32
- "@jay-framework/dev-environment": "^0.11.0",
33
+ "@jay-framework/dev-environment": "^0.13.0",
33
34
  "@types/node": "^20.11.5",
34
35
  "@types/shelljs": "^0.8.15",
35
36
  "rimraf": "^5.0.5",