@alevnyacow/nzmt 0.9.5 → 0.9.6
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/bin/cli.js +8 -6
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -393,7 +393,7 @@ function generateStores(lowerCase, upperCase, withEntityPreset) {
|
|
|
393
393
|
// Contract
|
|
394
394
|
|
|
395
395
|
fs.writeFileSync(path.resolve(folder, `${entityName}.store.ts`), [
|
|
396
|
-
"import
|
|
396
|
+
"import { Store } from '@alevnyacow/nzmt'",
|
|
397
397
|
withEntity ? `import { ${upperCase} } from '@${config?.paths?.entities}/${entityName}'` : undefined,
|
|
398
398
|
"",
|
|
399
399
|
`export const ${lowerCase}StoreMetadata = {`,
|
|
@@ -415,6 +415,8 @@ function generateStores(lowerCase, upperCase, withEntityPreset) {
|
|
|
415
415
|
`\tname: '${upperCase}Store'`,
|
|
416
416
|
"} satisfies Store.Metadata",
|
|
417
417
|
"",
|
|
418
|
+
`export const { schemas: ${lowerCase}StoreSchemas } = Store.toModuleMetadata(${lowerCase}Metadata)`,
|
|
419
|
+
"",
|
|
418
420
|
`export type ${upperCase}Store = Store.Contract<typeof ${lowerCase}StoreMetadata>`
|
|
419
421
|
].filter(x => typeof x === 'string').join('\n'))
|
|
420
422
|
|
|
@@ -752,10 +754,10 @@ function generateService(lowerCase, upperCase) {
|
|
|
752
754
|
}
|
|
753
755
|
|
|
754
756
|
if (i.endsWith('Store')) {
|
|
755
|
-
return `import { ${i} } from '@${config?.paths?.stores}/${toKebabFromPascal(i).slice(0, -'-store'.length)}'`
|
|
757
|
+
return `import type { ${i} } from '@${config?.paths?.stores}/${toKebabFromPascal(i).slice(0, -'-store'.length)}'`
|
|
756
758
|
}
|
|
757
759
|
|
|
758
|
-
return `import { ${i} } from '@${config?.paths?.infrastructure}/${toKebabFromPascal(i)}'`
|
|
760
|
+
return `import type { ${i} } from '@${config?.paths?.infrastructure}/${toKebabFromPascal(i)}'`
|
|
759
761
|
})
|
|
760
762
|
|
|
761
763
|
fs.mkdirSync(folder, { recursive: true })
|
|
@@ -836,14 +838,14 @@ function generateController(upperCase, lowerCase) {
|
|
|
836
838
|
}
|
|
837
839
|
|
|
838
840
|
if (i.endsWith('Store')) {
|
|
839
|
-
return `import { ${i} } from '@${config?.paths?.stores}/${toKebabFromPascal(i).slice(0, -'-store'.length)}'`
|
|
841
|
+
return `import type { ${i} } from '@${config?.paths?.stores}/${toKebabFromPascal(i).slice(0, -'-store'.length)}'`
|
|
840
842
|
}
|
|
841
843
|
|
|
842
844
|
if (i.endsWith('Service')) {
|
|
843
|
-
return `import { ${i} } from '@${config?.paths?.services}/${toKebabFromPascal(i).slice(0, -'-service'.length)}'`
|
|
845
|
+
return `import type { ${i} } from '@${config?.paths?.services}/${toKebabFromPascal(i).slice(0, -'-service'.length)}'`
|
|
844
846
|
}
|
|
845
847
|
|
|
846
|
-
return `import { ${i} } from '@${config?.paths?.infrastructure}/${toKebabFromPascal(i)}'`
|
|
848
|
+
return `import type { ${i} } from '@${config?.paths?.infrastructure}/${toKebabFromPascal(i)}'`
|
|
847
849
|
})
|
|
848
850
|
|
|
849
851
|
fs.mkdirSync(folder, { recursive: true })
|