create-forgeon 0.3.21 → 0.3.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-forgeon",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Forgeon project generator CLI",
5
5
  "license": "MIT",
6
6
  "author": "Forgeon",
@@ -611,16 +611,20 @@ function assertFilesImageWiring(projectRoot) {
611
611
  const filesPackage = fs.readFileSync(path.join(projectRoot, 'packages', 'files', 'package.json'), 'utf8');
612
612
  assert.match(filesPackage, /@forgeon\/files-image/);
613
613
 
614
- const filesModule = fs.readFileSync(
615
- path.join(projectRoot, 'packages', 'files', 'src', 'forgeon-files.module.ts'),
616
- 'utf8',
617
- );
618
- assert.match(filesModule, /ForgeonFilesImageModule/);
619
-
620
- const filesService = fs.readFileSync(
621
- path.join(projectRoot, 'packages', 'files', 'src', 'files.service.ts'),
622
- 'utf8',
623
- );
614
+ const filesModule = fs.readFileSync(
615
+ path.join(projectRoot, 'packages', 'files', 'src', 'forgeon-files.module.ts'),
616
+ 'utf8',
617
+ );
618
+ assert.match(filesModule, /ForgeonFilesImageModule/);
619
+ assert.match(
620
+ filesModule,
621
+ /imports: \[FilesConfigModule, (?:ForgeonFilesAccessModule, )?ForgeonFilesImageModule, DbPrismaModule, \.\.\.\(options\.imports \?\? \[\]\)\],/,
622
+ );
623
+
624
+ const filesService = fs.readFileSync(
625
+ path.join(projectRoot, 'packages', 'files', 'src', 'files.service.ts'),
626
+ 'utf8',
627
+ );
624
628
  assert.match(filesService, /FilesImageService/);
625
629
  assert.match(filesService, /filesImageService\.sanitizeForStorage/);
626
630
  assert.match(filesService, /sanitizeForStorage\({/);
@@ -115,21 +115,27 @@ function patchAppModule(targetRoot) {
115
115
  fs.writeFileSync(filePath, `${content.trimEnd()}\n`, 'utf8');
116
116
  }
117
117
 
118
- function patchFilesModule(targetRoot) {
119
- const filePath = path.join(targetRoot, 'packages', 'files', 'src', 'forgeon-files.module.ts');
120
- if (!fs.existsSync(filePath)) {
121
- return;
122
- }
123
-
124
- let content = fs.readFileSync(filePath, 'utf8').replace(/\r\n/g, '\n');
125
- content = ensureImportLine(content, "import { ForgeonFilesImageModule } from '@forgeon/files-image';");
126
- content = content.replace(
127
- 'imports: [FilesConfigModule],',
128
- 'imports: [FilesConfigModule, ForgeonFilesImageModule],',
129
- );
130
-
131
- fs.writeFileSync(filePath, `${content.trimEnd()}\n`, 'utf8');
132
- }
118
+ function patchFilesModule(targetRoot) {
119
+ const filePath = path.join(targetRoot, 'packages', 'files', 'src', 'forgeon-files.module.ts');
120
+ if (!fs.existsSync(filePath)) {
121
+ return;
122
+ }
123
+
124
+ let content = fs.readFileSync(filePath, 'utf8').replace(/\r\n/g, '\n');
125
+ content = ensureImportLine(content, "import { ForgeonFilesImageModule } from '@forgeon/files-image';");
126
+ if (!content.includes('imports: [FilesConfigModule, ForgeonFilesImageModule,')) {
127
+ content = content.replace(
128
+ 'imports: [FilesConfigModule, DbPrismaModule, ...(options.imports ?? [])],',
129
+ 'imports: [FilesConfigModule, ForgeonFilesImageModule, DbPrismaModule, ...(options.imports ?? [])],',
130
+ );
131
+ content = content.replace(
132
+ 'imports: [FilesConfigModule, ForgeonFilesAccessModule, DbPrismaModule, ...(options.imports ?? [])],',
133
+ 'imports: [FilesConfigModule, ForgeonFilesAccessModule, ForgeonFilesImageModule, DbPrismaModule, ...(options.imports ?? [])],',
134
+ );
135
+ }
136
+
137
+ fs.writeFileSync(filePath, `${content.trimEnd()}\n`, 'utf8');
138
+ }
133
139
 
134
140
  function patchFilesController(targetRoot) {
135
141
  const filePath = path.join(targetRoot, 'packages', 'files', 'src', 'files.controller.ts');