create-forgeon 0.1.5 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-forgeon",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Forgeon project generator CLI",
5
5
  "license": "MIT",
6
6
  "author": "Forgeon",
@@ -134,6 +134,42 @@ function patchApiDockerfile(targetRoot) {
134
134
  fs.writeFileSync(dockerfilePath, `${content.trimEnd()}\n`, 'utf8');
135
135
  }
136
136
 
137
+ function patchProxyDockerfile(filePath) {
138
+ if (!fs.existsSync(filePath)) {
139
+ return;
140
+ }
141
+
142
+ let content = fs.readFileSync(filePath, 'utf8').replace(/\r\n/g, '\n');
143
+
144
+ content = ensureLineAfter(
145
+ content,
146
+ 'COPY apps/web/package.json apps/web/package.json',
147
+ 'COPY packages/i18n-contracts/package.json packages/i18n-contracts/package.json',
148
+ );
149
+ content = ensureLineAfter(
150
+ content,
151
+ 'COPY packages/i18n-contracts/package.json packages/i18n-contracts/package.json',
152
+ 'COPY packages/i18n-web/package.json packages/i18n-web/package.json',
153
+ );
154
+ content = ensureLineAfter(
155
+ content,
156
+ 'COPY apps/web apps/web',
157
+ 'COPY packages/i18n-contracts packages/i18n-contracts',
158
+ );
159
+ content = ensureLineAfter(
160
+ content,
161
+ 'COPY packages/i18n-contracts packages/i18n-contracts',
162
+ 'COPY packages/i18n-web packages/i18n-web',
163
+ );
164
+
165
+ fs.writeFileSync(filePath, `${content.trimEnd()}\n`, 'utf8');
166
+ }
167
+
168
+ function patchProxyDockerfiles(targetRoot) {
169
+ patchProxyDockerfile(path.join(targetRoot, 'infra', 'docker', 'caddy.Dockerfile'));
170
+ patchProxyDockerfile(path.join(targetRoot, 'infra', 'docker', 'nginx.Dockerfile'));
171
+ }
172
+
137
173
  function patchCompose(targetRoot) {
138
174
  const composePath = path.join(targetRoot, 'infra', 'docker', 'compose.yml');
139
175
  if (!fs.existsSync(composePath)) {
@@ -230,6 +266,7 @@ export function applyI18nModule({ packageRoot, targetRoot }) {
230
266
  patchApiPackage(targetRoot);
231
267
  patchWebPackage(targetRoot);
232
268
  patchApiDockerfile(targetRoot);
269
+ patchProxyDockerfiles(targetRoot);
233
270
 
234
271
  upsertEnvLines(path.join(targetRoot, 'apps', 'api', '.env.example'), [
235
272
  'I18N_ENABLED=true',
@@ -26,8 +26,8 @@ export function applyI18nDisabled(targetRoot) {
26
26
  }
27
27
 
28
28
  const apiDockerfile = path.join(targetRoot, 'apps', 'api', 'Dockerfile');
29
- if (fs.existsSync(apiDockerfile)) {
30
- let content = fs.readFileSync(apiDockerfile, 'utf8');
29
+ if (fs.existsSync(apiDockerfile)) {
30
+ let content = fs.readFileSync(apiDockerfile, 'utf8');
31
31
  content = content
32
32
  .replace(/^COPY packages\/i18n\/package\.json packages\/i18n\/package\.json\r?\n/gm, '')
33
33
  .replace(
@@ -41,6 +41,28 @@ export function applyI18nDisabled(targetRoot) {
41
41
  fs.writeFileSync(apiDockerfile, content, 'utf8');
42
42
  }
43
43
 
44
+ const proxyDockerfiles = [
45
+ path.join(targetRoot, 'infra', 'docker', 'caddy.Dockerfile'),
46
+ path.join(targetRoot, 'infra', 'docker', 'nginx.Dockerfile'),
47
+ ];
48
+ for (const dockerfilePath of proxyDockerfiles) {
49
+ if (!fs.existsSync(dockerfilePath)) {
50
+ continue;
51
+ }
52
+
53
+ const content = fs
54
+ .readFileSync(dockerfilePath, 'utf8')
55
+ .replace(
56
+ /^COPY packages\/i18n-contracts\/package\.json packages\/i18n-contracts\/package\.json\r?\n/gm,
57
+ '',
58
+ )
59
+ .replace(/^COPY packages\/i18n-web\/package\.json packages\/i18n-web\/package\.json\r?\n/gm, '')
60
+ .replace(/^COPY packages\/i18n-contracts packages\/i18n-contracts\r?\n/gm, '')
61
+ .replace(/^COPY packages\/i18n-web packages\/i18n-web\r?\n/gm, '');
62
+
63
+ fs.writeFileSync(dockerfilePath, content, 'utf8');
64
+ }
65
+
44
66
  const webPackagePath = path.join(targetRoot, 'apps', 'web', 'package.json');
45
67
  if (fs.existsSync(webPackagePath)) {
46
68
  const webPackage = JSON.parse(fs.readFileSync(webPackagePath, 'utf8'));