springnext 0.0.3 → 0.0.4
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 +12 -12
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ function loadConfig() {
|
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const configPath = path.join(projectRoot, "
|
|
70
|
+
const configPath = path.join(projectRoot, "springnext.config.json");
|
|
71
71
|
|
|
72
72
|
if (!fs.existsSync(configPath)) {
|
|
73
73
|
return null;
|
|
@@ -99,7 +99,7 @@ function createDefaultConfig() {
|
|
|
99
99
|
|
|
100
100
|
let prismaClientPath = prismaClientPathOption ? prismaClientPathOption.split(':')[1] : undefined
|
|
101
101
|
|
|
102
|
-
fs.writeFileSync(path.resolve(projectRoot, '
|
|
102
|
+
fs.writeFileSync(path.resolve(projectRoot, 'springnext.config.json'), JSON.stringify(prismaClientPath ? {
|
|
103
103
|
coreFolder,
|
|
104
104
|
paths: {
|
|
105
105
|
di: '/server/di',
|
|
@@ -446,7 +446,7 @@ function generateInfrastructure(upperCase, lowerCase) {
|
|
|
446
446
|
fs.mkdirSync(folder, { recursive: true })
|
|
447
447
|
|
|
448
448
|
fs.writeFileSync(path.resolve(folder, `${entityName}.ts`), [
|
|
449
|
-
`import { Module } from '
|
|
449
|
+
`import { Module } from 'springnext'`,
|
|
450
450
|
'',
|
|
451
451
|
`export const ${lowerCase}InfrastructureMetadata = {`,
|
|
452
452
|
`\tname: '${upperCase}Infrastructure',`,
|
|
@@ -496,7 +496,7 @@ function initGuards() {
|
|
|
496
496
|
fs.mkdirSync(endpointGuardsFolder, { recursive: true })
|
|
497
497
|
|
|
498
498
|
fs.writeFileSync(path.resolve(endpointGuardsFolder, 'guards.ts'), [
|
|
499
|
-
`import type { Controller } from '
|
|
499
|
+
`import type { Controller } from 'springnext'`,
|
|
500
500
|
'',
|
|
501
501
|
`export class Guards {`,
|
|
502
502
|
`\tdummyGuard: Controller.Guard = async () => { return undefined }`,
|
|
@@ -592,7 +592,7 @@ function generateStores(lowerCase, upperCase, withEntityPreset) {
|
|
|
592
592
|
// Contract
|
|
593
593
|
|
|
594
594
|
fs.writeFileSync(path.resolve(folder, `${entityName}.store.ts`), [
|
|
595
|
-
"import { Store } from '
|
|
595
|
+
"import { Store } from 'springnext'",
|
|
596
596
|
withEntity ? `import { ${upperCase} } from '@${config?.paths?.entities}/${entityName}'` : undefined,
|
|
597
597
|
"",
|
|
598
598
|
`export const ${lowerCase}StoreMetadata = {`,
|
|
@@ -623,7 +623,7 @@ function generateStores(lowerCase, upperCase, withEntityPreset) {
|
|
|
623
623
|
|
|
624
624
|
fs.writeFileSync(path.resolve(folder, `${entityName}.store.ram.ts`), [
|
|
625
625
|
"import { injectable } from 'inversify'",
|
|
626
|
-
"import { Store } from '
|
|
626
|
+
"import { Store } from 'springnext'",
|
|
627
627
|
`import { type ${upperCase}Store, ${lowerCase}StoreMetadata } from './${entityName}.store'`,
|
|
628
628
|
"",
|
|
629
629
|
`const CRUDInRAM = Store.InRAM(${lowerCase}StoreMetadata)`,
|
|
@@ -641,7 +641,7 @@ function generateStores(lowerCase, upperCase, withEntityPreset) {
|
|
|
641
641
|
`import type { Prisma, PrismaClient } from '${prismaPath}'`,
|
|
642
642
|
`import { DITokens } from '@${config?.paths?.di}'`,
|
|
643
643
|
"import { injectable, inject } from 'inversify'",
|
|
644
|
-
"import { Store } from '
|
|
644
|
+
"import { Store } from 'springnext'",
|
|
645
645
|
`import { type ${upperCase}Store, ${lowerCase}StoreMetadata } from './${entityName}.store'`,
|
|
646
646
|
"",
|
|
647
647
|
`type Types = Store.Types<${upperCase}Store>`,
|
|
@@ -874,7 +874,7 @@ function generateProvider(lowerCase, upperCase) {
|
|
|
874
874
|
|
|
875
875
|
// Provider
|
|
876
876
|
fs.writeFileSync(path.resolve(folder, `${entityName}.provider.ts`), [
|
|
877
|
-
`import { Module } from '
|
|
877
|
+
`import { Module } from 'springnext'`,
|
|
878
878
|
'',
|
|
879
879
|
`export const ${lowerCase}ProviderMetadata = {`,
|
|
880
880
|
`\tname: '${upperCase}Provider',`,
|
|
@@ -963,7 +963,7 @@ function generateService(lowerCase, upperCase, store) {
|
|
|
963
963
|
// Metadata
|
|
964
964
|
|
|
965
965
|
fs.writeFileSync(path.resolve(folder, `${entityName}.service.metadata.ts`), [
|
|
966
|
-
"import type { Module } from '
|
|
966
|
+
"import type { Module } from 'springnext'",
|
|
967
967
|
proxiedStore ? `import { ${proxiedStore.substring(0, 1).toLowerCase() + proxiedStore.substring(1)}Schemas } from '@${config?.paths?.stores}/${toKebabFromPascal(proxiedStore).slice(0, -'-store'.length)}'` : undefined,
|
|
968
968
|
"",
|
|
969
969
|
`export const ${lowerCase}ServiceMetadata = {`,
|
|
@@ -989,7 +989,7 @@ function generateService(lowerCase, upperCase, store) {
|
|
|
989
989
|
"import { injectable, inject } from 'inversify'",
|
|
990
990
|
injections.length ? `import { DITokens } from '@${config?.paths?.di}'` : undefined,
|
|
991
991
|
`import { ${lowerCase}ServiceMetadata } from './${entityName}.service.metadata'`,
|
|
992
|
-
"import { Module } from '
|
|
992
|
+
"import { Module } from 'springnext'",
|
|
993
993
|
...importInjections,
|
|
994
994
|
"",
|
|
995
995
|
`type Methods = Module.Methods<typeof ${lowerCase}ServiceMetadata>`,
|
|
@@ -1079,7 +1079,7 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
1079
1079
|
|
|
1080
1080
|
fs.writeFileSync(path.resolve(folder, `${entityName}.controller.metadata.ts`), [
|
|
1081
1081
|
crudService ? `import z from 'zod'` : undefined,
|
|
1082
|
-
`import { Controller, ValueObjects } from '
|
|
1082
|
+
`import { Controller, ValueObjects } from 'springnext'`,
|
|
1083
1083
|
crudService ? `import { ${crudServiceLowercase}Metadata } from '@${config.paths.services}/${toKebabFromPascal(crudService).slice(0, -'-service'.length)}'` : undefined,
|
|
1084
1084
|
``,
|
|
1085
1085
|
`export const ${lowerCase}ControllerMetadata = {`,
|
|
@@ -1123,7 +1123,7 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
1123
1123
|
|
|
1124
1124
|
fs.writeFileSync(path.resolve(folder, `${entityName}.controller.ts`), [
|
|
1125
1125
|
`import { injectable, inject } from 'inversify'`,
|
|
1126
|
-
`import { Controller } from '
|
|
1126
|
+
`import { Controller } from 'springnext'`,
|
|
1127
1127
|
`import { DITokens } from '@${config?.paths?.di}'`,
|
|
1128
1128
|
crudService ? `import { CommonErrorCodes } from '@${config?.paths?.sharedErrors}'` : undefined,
|
|
1129
1129
|
`import { ${lowerCase}ControllerMetadata } from './${entityName}.controller.metadata'`,
|