@famgia/omnify-typescript 0.0.83 → 0.0.85
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/{chunk-LHNMWILH.js → chunk-BC2GNXUY.js} +14 -10
- package/dist/chunk-BC2GNXUY.js.map +1 -0
- package/dist/index.cjs +13 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +13 -9
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +2 -2
- package/stubs/JapaneseBankField.tsx.stub +3 -3
- package/stubs/ai-guides/cursor/omnify-schema.mdc.stub +339 -0
- package/stubs/ai-guides/cursor/react.mdc.stub +1 -0
- package/stubs/ai-guides/cursor/schema-create.mdc.stub +339 -0
- package/stubs/ai-guides/react/antd-guide.md.stub +185 -22
- package/stubs/ai-guides/react/types-guide.md.stub +2 -2
- package/stubs/components-index.ts.stub +3 -3
- package/stubs/form-validation.ts.stub +1 -1
- package/stubs/zod-i18n.ts.stub +1 -1
- package/dist/chunk-LHNMWILH.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -885,14 +885,18 @@ function generateModelRules(schema, locales, fallbackLocale, templates) {
|
|
|
885
885
|
properties
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function getImportExt(options) {
|
|
889
|
+
return options.useJsExtension ? ".js" : "";
|
|
890
|
+
}
|
|
891
|
+
function formatRulesFile(schemaName, rules, options) {
|
|
889
892
|
const parts = [];
|
|
893
|
+
const ext = getImportExt(options);
|
|
890
894
|
parts.push(`/**
|
|
891
895
|
* Auto-generated validation rules and metadata for ${schemaName}.
|
|
892
896
|
* DO NOT EDIT - This file is automatically generated and will be overwritten.
|
|
893
897
|
*/
|
|
894
898
|
|
|
895
|
-
import type { LocaleMap, ValidationRule } from '../common
|
|
899
|
+
import type { LocaleMap, ValidationRule } from '../common${ext}';
|
|
896
900
|
|
|
897
901
|
`);
|
|
898
902
|
parts.push(`/** Display name for ${schemaName} */
|
|
@@ -982,7 +986,7 @@ function generateRulesFiles(schemas, options = {}) {
|
|
|
982
986
|
if (schema.kind === "enum") continue;
|
|
983
987
|
if (schema.options?.hidden === true) continue;
|
|
984
988
|
const rules = generateModelRules(schema, locales, fallbackLocale, templates);
|
|
985
|
-
const content = formatRulesFile(schema.name, rules);
|
|
989
|
+
const content = formatRulesFile(schema.name, rules, options);
|
|
986
990
|
files.push({
|
|
987
991
|
filePath: `rules/${schema.name}.rules.ts`,
|
|
988
992
|
content,
|
|
@@ -1549,7 +1553,7 @@ var DEFAULT_OPTIONS = {
|
|
|
1549
1553
|
useJsExtension: false
|
|
1550
1554
|
// Bundlers (Vite, webpack) don't need .js extension
|
|
1551
1555
|
};
|
|
1552
|
-
function
|
|
1556
|
+
function getImportExt2(options) {
|
|
1553
1557
|
return options.useJsExtension ? ".js" : "";
|
|
1554
1558
|
}
|
|
1555
1559
|
function generateBaseHeader() {
|
|
@@ -1646,7 +1650,7 @@ function generateBaseInterfaceFile(schemaName, schemas, options) {
|
|
|
1646
1650
|
const commonImports = [];
|
|
1647
1651
|
if (dateImports.dateTime) commonImports.push("DateTimeString");
|
|
1648
1652
|
if (dateImports.date) commonImports.push("DateString");
|
|
1649
|
-
const ext =
|
|
1653
|
+
const ext = getImportExt2(options);
|
|
1650
1654
|
if (commonImports.length > 0) {
|
|
1651
1655
|
parts.push(`import type { ${commonImports.join(", ")} } from '../common${ext}';
|
|
1652
1656
|
`);
|
|
@@ -1718,14 +1722,14 @@ function generateModelFile(schemaName, options) {
|
|
|
1718
1722
|
if (options.generateZodSchemas) {
|
|
1719
1723
|
return {
|
|
1720
1724
|
filePath: `${schemaName}.ts`,
|
|
1721
|
-
content: formatZodModelFile(schemaName,
|
|
1725
|
+
content: formatZodModelFile(schemaName, getImportExt2(options)),
|
|
1722
1726
|
types: [schemaName],
|
|
1723
1727
|
overwrite: false
|
|
1724
1728
|
// Never overwrite user models
|
|
1725
1729
|
};
|
|
1726
1730
|
}
|
|
1727
1731
|
const parts = [generateModelHeader(schemaName)];
|
|
1728
|
-
const ext =
|
|
1732
|
+
const ext = getImportExt2(options);
|
|
1729
1733
|
parts.push(`import type { ${schemaName} as ${schemaName}Base } from './base/${schemaName}${ext}';
|
|
1730
1734
|
|
|
1731
1735
|
`);
|
|
@@ -1907,7 +1911,7 @@ function generateI18nFile(options) {
|
|
|
1907
1911
|
}
|
|
1908
1912
|
}
|
|
1909
1913
|
const messagesJson = JSON.stringify(mergedMessages, null, 2);
|
|
1910
|
-
const ext =
|
|
1914
|
+
const ext = getImportExt2(options);
|
|
1911
1915
|
const content = `${generateBaseHeader()}
|
|
1912
1916
|
import type { LocaleMap } from './common${ext}';
|
|
1913
1917
|
|
|
@@ -1992,7 +1996,7 @@ export function getMessages(locale: string): Record<string, string> {
|
|
|
1992
1996
|
}
|
|
1993
1997
|
function generateIndexFile(schemas, enums, pluginEnums, typeAliases, options) {
|
|
1994
1998
|
const parts = [generateBaseHeader()];
|
|
1995
|
-
const ext =
|
|
1999
|
+
const ext = getImportExt2(options);
|
|
1996
2000
|
parts.push(`// Common Types
|
|
1997
2001
|
`);
|
|
1998
2002
|
parts.push(`export type { LocaleMap, Locale, ValidationRule, DateTimeString, DateString } from './common${ext}';
|