@ostack.tech/ui-kform-scaffolder 0.1.0 → 0.1.1
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-BcnL38iR.js} +8 -8
- package/dist/webapp/index.html +1 -1
- package/package.json +3 -2
|
@@ -310,9 +310,16 @@ function scaffoldField(schematic, data) {
|
|
|
310
310
|
moduleName: "@ostack.tech/ui-kform",
|
|
311
311
|
name: "ControlField"
|
|
312
312
|
});
|
|
313
|
+
let controlModuleName;
|
|
314
|
+
let controlName;
|
|
313
315
|
if (schematicKind.control) {
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
+
const controlSeparator = schematicKind.control.lastIndexOf(".");
|
|
317
|
+
controlModuleName = schematicKind.control.slice(0, controlSeparator);
|
|
318
|
+
controlName = schematicKind.control.slice(controlSeparator + 1);
|
|
319
|
+
data.currentFile.imports.push({
|
|
320
|
+
moduleName: controlModuleName,
|
|
321
|
+
name: controlName
|
|
322
|
+
});
|
|
316
323
|
}
|
|
317
324
|
let control = schematicKind.scaffoldControl?.(schematic, data);
|
|
318
325
|
if (!control) {
|
|
@@ -324,7 +331,7 @@ function scaffoldField(schematic, data) {
|
|
|
324
331
|
}
|
|
325
332
|
control = [
|
|
326
333
|
data.omitLabel ? null : `<Label>${sentenceCase(schematic.childName)}</Label>`,
|
|
327
|
-
`<${
|
|
334
|
+
`<${controlName} />`
|
|
328
335
|
].filter((s) => s).join("\n");
|
|
329
336
|
}
|
|
330
337
|
return code`
|
|
@@ -1567,7 +1574,7 @@ function scaffoldProjectMisc(_schematic, data) {
|
|
|
1567
1574
|
addTemplateFile(data, ".gitignore", gitignore);
|
|
1568
1575
|
addTemplateFile(data, ".editorconfig", editorconfig);
|
|
1569
1576
|
}
|
|
1570
|
-
const responsesKt = 'package <%= filePackage %>\n\nimport
|
|
1577
|
+
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';
|
|
1571
1578
|
function scaffoldResponses(schematic, data) {
|
|
1572
1579
|
const ejsData = {
|
|
1573
1580
|
filePackage: data.currentPackage,
|
|
@@ -1607,15 +1614,15 @@ const viteSvg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www
|
|
|
1607
1614
|
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';
|
|
1608
1615
|
const tsConfigJson = '{\n "files": [],\n "references": [\n { "path": "./tsconfig.app.json" },\n { "path": "./tsconfig.node.json" }\n ]\n}\n';
|
|
1609
1616
|
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';
|
|
1610
|
-
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:
|
|
1617
|
+
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';
|
|
1611
1618
|
function scaffoldViteProject(schematic, data) {
|
|
1612
1619
|
const ejsData = {
|
|
1613
1620
|
formId: kebabCase(schematic.name),
|
|
1614
1621
|
formClass: schematic.name,
|
|
1615
1622
|
formTitle: capitalCase(schematic.name),
|
|
1616
|
-
ostackUiVersion: "0.1.
|
|
1623
|
+
ostackUiVersion: "0.1.1",
|
|
1617
1624
|
kFormVersion: "0.31.0",
|
|
1618
|
-
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","
|
|
1625
|
+
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"}'),
|
|
1619
1626
|
externalContextsData: data.serializationFormat === "json" ? "{}" : `<${schematic.name}ExternalContexts />`
|
|
1620
1627
|
};
|
|
1621
1628
|
addEjsTemplateFile(data, "react-app/package.json", packageJsonEjs, ejsData);
|