@jay-framework/jay-cli 0.8.0 → 0.10.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.
- package/dist/index.js +13 -5
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -22,7 +22,8 @@ function checkFileExists(filepath) {
|
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
async function generateFiles(dir, codeGenerationFunction, afterGenerationFunction, outputExtension, destinationDir, compilationTarget) {
|
|
25
|
+
async function generateFiles(dir, codeGenerationFunction, afterGenerationFunction, outputExtension, destinationDir, compilationTarget, projectRoot) {
|
|
26
|
+
const resolvedProjectRoot = projectRoot || process.cwd();
|
|
26
27
|
console.log(chalk.whiteBright("Jay generating files for ", dir));
|
|
27
28
|
let jayFiles = await findAllJayFiles(dir);
|
|
28
29
|
console.log(dir, jayFiles);
|
|
@@ -35,7 +36,8 @@ async function generateFiles(dir, codeGenerationFunction, afterGenerationFunctio
|
|
|
35
36
|
path.basename(jayFile.replace(".jay-html", "")),
|
|
36
37
|
path.dirname(jayFile),
|
|
37
38
|
{},
|
|
38
|
-
JAY_IMPORT_RESOLVER
|
|
39
|
+
JAY_IMPORT_RESOLVER,
|
|
40
|
+
resolvedProjectRoot
|
|
39
41
|
)
|
|
40
42
|
);
|
|
41
43
|
const generateTarget = compilationTarget === "react" ? GenerateTarget.react : GenerateTarget.jay;
|
|
@@ -89,8 +91,14 @@ async function generateFiles(dir, codeGenerationFunction, afterGenerationFunctio
|
|
|
89
91
|
function getJayHtmlOrContractFileInputs(source) {
|
|
90
92
|
return Object.fromEntries(
|
|
91
93
|
glob$1.sync(`${source}/**/*{${JAY_EXTENSION},${JAY_CONTRACT_EXTENSION}}`).map((file) => {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
+
const relativePath = path$1.relative(source, file);
|
|
95
|
+
let moduleName;
|
|
96
|
+
if (file.endsWith(JAY_CONTRACT_EXTENSION)) {
|
|
97
|
+
moduleName = relativePath.slice(0, -JAY_CONTRACT_EXTENSION.length) + ".contract";
|
|
98
|
+
} else {
|
|
99
|
+
moduleName = relativePath.slice(0, -JAY_EXTENSION.length);
|
|
100
|
+
}
|
|
101
|
+
return [moduleName, file];
|
|
94
102
|
})
|
|
95
103
|
);
|
|
96
104
|
}
|
|
@@ -99,7 +107,7 @@ const noop = () => void 0;
|
|
|
99
107
|
program.command("definitions").argument("<source>", "source folder to scan for .jay-html files").description("generate definition files (.d.ts) for jay files").action(async (source) => {
|
|
100
108
|
await rollup({
|
|
101
109
|
input: getJayHtmlOrContractFileInputs(source),
|
|
102
|
-
plugins: [jayDefinitions()]
|
|
110
|
+
plugins: [jayDefinitions(process.cwd())]
|
|
103
111
|
});
|
|
104
112
|
});
|
|
105
113
|
program.command("runtime").argument("<source>", "source folder to scan for .jay-html files").argument("[destination]", "destination folder for generated files").argument("[compilationTarget]", "jay | react. target runtime to compile for. Defaults to jay").description("generate code files (.ts) for jay files").action(async (source, dest, compilationTarget) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/jay-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "dist/index.js",
|
|
@@ -17,24 +17,25 @@
|
|
|
17
17
|
"build:cli-link": "cd ../../../node_modules/.bin && ln -sf ../../../packages/cli/dist/index.js jay-cli",
|
|
18
18
|
"clean": "rimraf dist",
|
|
19
19
|
"confirm": "npm run clean && npm run build && npm run build:check-types && npm run test",
|
|
20
|
-
"test": "
|
|
21
|
-
"test:watch": "
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jay-framework/compiler": "^0.
|
|
25
|
-
"@jay-framework/rollup-plugin": "^0.
|
|
24
|
+
"@jay-framework/compiler": "^0.10.0",
|
|
25
|
+
"@jay-framework/rollup-plugin": "^0.10.0",
|
|
26
26
|
"chalk": "^4.1.2",
|
|
27
27
|
"commander": "^14.0.0",
|
|
28
28
|
"glob": "^10.4.5",
|
|
29
29
|
"rollup": "^4.9.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@jay-framework/dev-environment": "^0.
|
|
32
|
+
"@jay-framework/dev-environment": "^0.10.0",
|
|
33
33
|
"@types/node": "^20.11.5",
|
|
34
34
|
"@types/shelljs": "^0.8.15",
|
|
35
35
|
"rimraf": "^5.0.5",
|
|
36
36
|
"shelljs": "^0.8.5",
|
|
37
37
|
"typescript": "^5.3.3",
|
|
38
|
-
"vite": "^5.0.11"
|
|
38
|
+
"vite": "^5.0.11",
|
|
39
|
+
"vitest": "^1.2.1"
|
|
39
40
|
}
|
|
40
41
|
}
|