@ostack.tech/ui-kform-scaffolder 0.1.0 → 0.1.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/dist/ostack-ui-kform-scaffolder.cjs +14 -7
- package/dist/ostack-ui-kform-scaffolder.cjs.map +1 -1
- package/dist/ostack-ui-kform-scaffolder.js +14 -7
- package/dist/ostack-ui-kform-scaffolder.js.map +1 -1
- package/dist/webapp/assets/{index-A9c6aN_V.js → index-SSul4wNF.js} +8 -8
- package/dist/webapp/index.html +1 -1
- package/package.json +7 -6
|
@@ -329,9 +329,16 @@ function scaffoldField(schematic, data) {
|
|
|
329
329
|
moduleName: "@ostack.tech/ui-kform",
|
|
330
330
|
name: "ControlField"
|
|
331
331
|
});
|
|
332
|
+
let controlModuleName;
|
|
333
|
+
let controlName;
|
|
332
334
|
if (schematicKind.control) {
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
+
const controlSeparator = schematicKind.control.lastIndexOf(".");
|
|
336
|
+
controlModuleName = schematicKind.control.slice(0, controlSeparator);
|
|
337
|
+
controlName = schematicKind.control.slice(controlSeparator + 1);
|
|
338
|
+
data.currentFile.imports.push({
|
|
339
|
+
moduleName: controlModuleName,
|
|
340
|
+
name: controlName
|
|
341
|
+
});
|
|
335
342
|
}
|
|
336
343
|
let control = schematicKind.scaffoldControl?.(schematic, data);
|
|
337
344
|
if (!control) {
|
|
@@ -343,7 +350,7 @@ function scaffoldField(schematic, data) {
|
|
|
343
350
|
}
|
|
344
351
|
control = [
|
|
345
352
|
data.omitLabel ? null : `<Label>${sentenceCase(schematic.childName)}</Label>`,
|
|
346
|
-
`<${
|
|
353
|
+
`<${controlName} />`
|
|
347
354
|
].filter((s) => s).join("\n");
|
|
348
355
|
}
|
|
349
356
|
return kformScaffolder.code`
|
|
@@ -1586,7 +1593,7 @@ function scaffoldProjectMisc(_schematic, data) {
|
|
|
1586
1593
|
kformScaffolder.addTemplateFile(data, ".gitignore", gitignore);
|
|
1587
1594
|
kformScaffolder.addTemplateFile(data, ".editorconfig", editorconfig);
|
|
1588
1595
|
}
|
|
1589
|
-
const responsesKt = 'package <%= filePackage %>\n\nimport
|
|
1596
|
+
const responsesKt = 'package <%= filePackage %>\n\nimport kotlin.js.JsExport\nimport kotlin.jvm.JvmOverloads\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\nimport tech.ostack.kform.LocatedValidationIssue\n\n@JsExport\n@Serializable\nsealed interface <%= formClass %>SubmitResponse\n\n@JsExport\n@Serializable\n@SerialName("success")\nclass <%= formClass %>SubmitSuccess(val redirectTo: String) : <%= formClass %>SubmitResponse\n\n@JsExport\n@Serializable\n@SerialName("error")\nclass <%= formClass %>SubmitError @JvmOverloads constructor(override val message: String? = null) :\n Throwable(message), <%= formClass %>SubmitResponse\n\n@JsExport\n@Serializable\n@SerialName("validationError")\nclass <%= formClass %>SubmitValidationError(val issues: List<LocatedValidationIssue>) :\n <%= formClass %>SubmitResponse\n';
|
|
1590
1597
|
function scaffoldResponses(schematic, data) {
|
|
1591
1598
|
const ejsData = {
|
|
1592
1599
|
filePackage: data.currentPackage,
|
|
@@ -1626,15 +1633,15 @@ const viteSvg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www
|
|
|
1626
1633
|
const tsConfigAppJson = '{\n "compilerOptions": {\n "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",\n "target": "ES2022",\n "useDefineForClassFields": true,\n "lib": ["ES2022", "DOM", "DOM.Iterable"],\n "module": "ESNext",\n "types": ["vite/client"],\n "skipLibCheck": true,\n\n /* Bundler mode */\n "moduleResolution": "bundler",\n "allowImportingTsExtensions": true,\n "verbatimModuleSyntax": true,\n "moduleDetection": "force",\n "noEmit": true,\n "jsx": "react-jsx",\n\n /* Linting */\n "strict": true,\n "noUnusedLocals": true,\n "noUnusedParameters": true,\n "erasableSyntaxOnly": true,\n "noFallthroughCasesInSwitch": true,\n "noUncheckedSideEffectImports": true\n },\n "include": ["src"]\n}\n';
|
|
1627
1634
|
const tsConfigJson = '{\n "files": [],\n "references": [\n { "path": "./tsconfig.app.json" },\n { "path": "./tsconfig.node.json" }\n ]\n}\n';
|
|
1628
1635
|
const tsConfigNodeJson = '{\n "compilerOptions": {\n "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",\n "target": "ES2023",\n "lib": ["ES2023"],\n "module": "ESNext",\n "types": ["node"],\n "skipLibCheck": true,\n\n /* Bundler mode */\n "moduleResolution": "bundler",\n "allowImportingTsExtensions": true,\n "verbatimModuleSyntax": true,\n "moduleDetection": "force",\n "noEmit": true,\n\n /* Linting */\n "strict": true,\n "noUnusedLocals": true,\n "noUnusedParameters": true,\n "erasableSyntaxOnly": true,\n "noFallthroughCasesInSwitch": true,\n "noUncheckedSideEffectImports": true\n },\n "include": ["vite.config.ts"]\n}\n';
|
|
1629
|
-
const viteConfigTsEjs = 'import path from "node:path";\n\nimport react from "@vitejs/plugin-react-swc";\nimport { defineConfig } from "vite";\n\n// https://vite.dev/config/\nexport default defineConfig({\n plugins: [react()],\n build: {\n outDir: "build/dist",\n rollupOptions: {\n input: {\n "<%= formId %>-app":\n process.env.VITE_BUILD_REASON === "preview"\n ? "index.html"\n : "src/main.tsx",\n },\n output: {\n // Output files without hashes, making it easier to serve them in the\n // server. However, the server is expected to somehow "version" them for\n // cache busting purposes.\n entryFileNames:
|
|
1636
|
+
const viteConfigTsEjs = 'import path from "node:path";\n\nimport react from "@vitejs/plugin-react-swc";\nimport { defineConfig } from "vite";\n\n// https://vite.dev/config/\nexport default defineConfig({\n plugins: [react()],\n build: {\n outDir: "build/dist",\n rollupOptions: {\n input: {\n "<%= formId %>-app":\n process.env.VITE_BUILD_REASON === "preview"\n ? "index.html"\n : "src/main.tsx",\n },\n output: {\n // Output files without hashes, making it easier to serve them in the\n // server. However, the server is expected to somehow "version" them for\n // cache busting purposes.\n entryFileNames: "assets/[name].js",\n chunkFileNames: "assets/[name].js",\n assetFileNames: "assets/[name].[ext]",\n },\n },\n },\n resolve: {\n alias: [\n // Due to how Kotlin "bundles" dependencies, we need to use the\n // `@ostack.tech/kform` produced by the shared module.\n {\n find: "@ostack.tech/kform",\n replacement: path.resolve(\n import.meta.dirname,\n "node_modules/<%= formId %>-shared/ostack-kform.mjs",\n ),\n },\n ],\n },\n server: {\n proxy: { "/api": "http://127.0.0.1:8080" },\n },\n});\n';
|
|
1630
1637
|
function scaffoldViteProject(schematic, data) {
|
|
1631
1638
|
const ejsData = {
|
|
1632
1639
|
formId: kebabCase(schematic.name),
|
|
1633
1640
|
formClass: schematic.name,
|
|
1634
1641
|
formTitle: capitalCase(schematic.name),
|
|
1635
|
-
ostackUiVersion: "0.1.
|
|
1642
|
+
ostackUiVersion: "0.1.2",
|
|
1636
1643
|
kFormVersion: "0.31.0",
|
|
1637
|
-
dependencyVersions: JSON.parse('{"@eslint/js":"^9.37.0","@fortawesome/fontawesome-svg-core":"^7.1.0","@fortawesome/free-brands-svg-icons":"^7.1.0","@fortawesome/free-regular-svg-icons":"^7.1.0","@fortawesome/free-solid-svg-icons":"^7.1.0","@ostack.tech/kform":"~0.31.0","@ostack.tech/kform-react":"~0.31.0","@ostack.tech/kform-scaffolder":"~0.31.0","@storybook/addon-docs":"^9.1.10","@storybook/addon-links":"^9.1.10","@storybook/react-vite":"^9.1.10","@types/node":"^22.18.9","@types/react":"^19.2.2","@types/react-dom":"^19.2.1","@vitejs/plugin-react-swc":"^4.1.0","colorjs.io":"^0.5.2","cpy-cli":"^6.0.0","date-fns":"^4.1.0","eslint":"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-react-hooks":"^6.1.1","eslint-plugin-react-refresh":"^0.4.23","eslint-plugin-simple-import-sort":"^12.1.1","eslint-plugin-storybook":"^9.1.10","globals":"^16.4.0","happy-dom":"^20.0.0","
|
|
1644
|
+
dependencyVersions: JSON.parse('{"@eslint/js":"^9.37.0","@fortawesome/fontawesome-svg-core":"^7.1.0","@fortawesome/free-brands-svg-icons":"^7.1.0","@fortawesome/free-regular-svg-icons":"^7.1.0","@fortawesome/free-solid-svg-icons":"^7.1.0","@ostack.tech/kform":"~0.31.0","@ostack.tech/kform-react":"~0.31.0","@ostack.tech/kform-scaffolder":"~0.31.0","@storybook/addon-docs":"^9.1.10","@storybook/addon-links":"^9.1.10","@storybook/react-vite":"^9.1.10","@types/node":"^22.18.9","@types/react":"^19.2.2","@types/react-dom":"^19.2.1","@vitejs/plugin-react-swc":"^4.1.0","colorjs.io":"^0.5.2","cpy-cli":"^6.0.0","date-fns":"^4.1.0","eslint":"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-react-hooks":"^6.1.1","eslint-plugin-react-refresh":"^0.4.23","eslint-plugin-simple-import-sort":"^12.1.1","eslint-plugin-storybook":"^9.1.10","globals":"^16.4.0","happy-dom":"^20.0.0","lint-staged":"^16.2.3","prettier":"^3.6.2","prettier-plugin-jsdoc":"^1.3.3","react":"^19.2.0","react-dom":"^19.2.0","react-router":"^7.9.4","react-router-dom":"^7.9.4","rimraf":"^6.0.1","sass-embedded":"^1.93.2","simple-git-hooks":"^2.13.1","storybook":"^9.1.10","tslib":"^2.8.1","typescript":"~5.9.3","typescript-eslint":"^8.46.0","vite":"^7.1.9","vitest":"^3.2.4","zustand":"^5.0.8"}'),
|
|
1638
1645
|
externalContextsData: data.serializationFormat === "json" ? "{}" : `<${schematic.name}ExternalContexts />`
|
|
1639
1646
|
};
|
|
1640
1647
|
kformScaffolder.addEjsTemplateFile(data, "react-app/package.json", packageJsonEjs, ejsData);
|