@opencrvs/toolkit 2.0.2-rc.95f6102 → 2.0.2

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.
@@ -147,11 +147,52 @@ function resolveRef() {
147
147
  process.exit(1)
148
148
  }
149
149
 
150
- function cloneRepository(repoUrl, ref, targetDir) {
150
+ function cloneRepository(
151
+ repoUrl,
152
+ ref,
153
+ targetDir,
154
+ { keepHistory = false } = {}
155
+ ) {
156
+ const depthFlag = keepHistory ? '' : '--depth 1 '
151
157
  execSync(
152
- 'git clone --depth 1 --branch ' + ref + ' ' + repoUrl + ' ' + targetDir,
158
+ 'git clone ' +
159
+ depthFlag +
160
+ '--branch ' +
161
+ ref +
162
+ ' ' +
163
+ repoUrl +
164
+ ' ' +
165
+ targetDir,
153
166
  { stdio: 'inherit' }
154
167
  )
168
+
169
+ if (!keepHistory) {
170
+ try {
171
+ fs.rmSync(path.join(targetDir, '.git'), {
172
+ recursive: true,
173
+ force: true
174
+ })
175
+ } catch (err) {
176
+ console.error(
177
+ 'Failed to remove .git directory from ' + targetDir + ':',
178
+ err.message
179
+ )
180
+ process.exit(1)
181
+ }
182
+ return
183
+ }
184
+
185
+ console.log(
186
+ "Replacing 'origin' remote with 'upstream' in " + targetDir + '...'
187
+ )
188
+ execSync('git remote remove origin', {
189
+ cwd: targetDir,
190
+ stdio: 'inherit'
191
+ })
192
+ execSync('git remote add upstream ' + repoUrl, {
193
+ cwd: targetDir,
194
+ stdio: 'inherit'
195
+ })
155
196
  }
156
197
 
157
198
  const projectName = process.argv[2]
@@ -199,19 +240,6 @@ try {
199
240
  process.exit(1)
200
241
  }
201
242
 
202
- try {
203
- fs.rmSync(path.join(countryconfigTargetDir, '.git'), {
204
- recursive: true,
205
- force: true
206
- })
207
- } catch (err) {
208
- console.error(
209
- 'Failed to remove .git directory from country config:',
210
- err.message
211
- )
212
- process.exit(1)
213
- }
214
-
215
243
  const pkgPath = path.join(countryconfigTargetDir, 'package.json')
216
244
  if (fs.existsSync(pkgPath)) {
217
245
  try {
@@ -235,22 +263,11 @@ console.log(
235
263
  )
236
264
 
237
265
  try {
238
- cloneRepository(INFRASTRUCTURE_REPO_URL, ref, infrastructureDirName)
239
- } catch (err) {
240
- console.error('Failed to clone the infrastructure repository:', err.message)
241
- process.exit(1)
242
- }
243
-
244
- try {
245
- fs.rmSync(path.join(infrastructureTargetDir, '.git'), {
246
- recursive: true,
247
- force: true
266
+ cloneRepository(INFRASTRUCTURE_REPO_URL, ref, infrastructureDirName, {
267
+ keepHistory: true
248
268
  })
249
269
  } catch (err) {
250
- console.error(
251
- 'Failed to remove .git directory from infrastructure:',
252
- err.message
253
- )
270
+ console.error('Failed to clone the infrastructure repository:', err.message)
254
271
  process.exit(1)
255
272
  }
256
273
 
@@ -263,4 +280,9 @@ console.log(' git init')
263
280
  console.log(' npm install\n')
264
281
  console.log('To get started with the infrastructure:\n')
265
282
  console.log(' cd ' + infrastructureDirName)
266
- console.log(' git init\n')
283
+ console.log(' git remote add origin <your-infrastructure-repo-url>')
284
+ console.log(' git push -u origin ' + ref + '\n')
285
+ console.log(
286
+ 'The "upstream" remote points at the official infrastructure repository, ' +
287
+ 'so you can pull future releases with `git fetch upstream`.\n'
288
+ )
@@ -2285,8 +2285,7 @@ var LoginConfig = z20.object({
2285
2285
  USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2286
2286
  INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2287
2287
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2288
- LOGIN_BACKGROUND: BackgroundConfig,
2289
- SENTRY: z20.string().optional()
2288
+ LOGIN_BACKGROUND: BackgroundConfig
2290
2289
  });
2291
2290
  var defineLoginConfig = (config) => {
2292
2291
  return LoginConfig.parse(config);
@@ -2294,7 +2293,6 @@ var defineLoginConfig = (config) => {
2294
2293
  var ClientConfig = z20.object({
2295
2294
  COUNTRY: z20.string(),
2296
2295
  LANGUAGES: z20.array(z20.string()),
2297
- SENTRY: z20.string().optional(),
2298
2296
  LOGIN_URL: z20.string().optional(),
2299
2297
  REGISTER_BACKGROUND: BackgroundConfig,
2300
2298
  DASHBOARDS: z20.array(
package/dist/cli.js CHANGED
@@ -1522,7 +1522,6 @@ var import_path10 = __toESM(require("path"));
1522
1522
  var CLIENT_VALID_KEYS = /* @__PURE__ */ new Set([
1523
1523
  "COUNTRY",
1524
1524
  "LANGUAGES",
1525
- "SENTRY",
1526
1525
  "REGISTER_BACKGROUND",
1527
1526
  "DASHBOARDS",
1528
1527
  "FEATURES"
@@ -1533,8 +1532,7 @@ var LOGIN_VALID_KEYS = /* @__PURE__ */ new Set([
1533
1532
  "USER_NOTIFICATION_DELIVERY_METHOD",
1534
1533
  "INFORMANT_NOTIFICATION_DELIVERY_METHOD",
1535
1534
  "PHONE_NUMBER_PATTERN",
1536
- "LOGIN_BACKGROUND",
1537
- "SENTRY"
1535
+ "LOGIN_BACKGROUND"
1538
1536
  ]);
1539
1537
  var APPLICATION_CONFIG_VALID_KEYS = /* @__PURE__ */ new Set([
1540
1538
  "APPLICATION_NAME",
@@ -1706,8 +1704,6 @@ function generateTsContent(configObj, exportName, group, isProd) {
1706
1704
  if (!init) continue;
1707
1705
  if (name === "LANGUAGES") {
1708
1706
  propertyLines.push(` LANGUAGES: ${convertLanguages(init)}`);
1709
- } else if (name === "SENTRY" && isProd) {
1710
- propertyLines.push(` SENTRY: sentry`);
1711
1707
  } else if (name === "DASHBOARDS") {
1712
1708
  propertyLines.push(
1713
1709
  ` DASHBOARDS: ${transformDashboardsValue(init, isProd)}`
@@ -1744,7 +1740,6 @@ function generateTsContent(configObj, exportName, group, isProd) {
1744
1740
  if (isProd) {
1745
1741
  headerLines.push(`const scheme = 'https'`);
1746
1742
  headerLines.push(`const hostname = env.DOMAIN`);
1747
- headerLines.push(`const sentry = env.SENTRY_DSN`);
1748
1743
  } else {
1749
1744
  headerLines.push(`const scheme = 'http'`);
1750
1745
  headerLines.push(`const hostname = 'localhost'`);
@@ -66,14 +66,12 @@ export declare const LoginConfig: z.ZodObject<{
66
66
  backgroundImage: z.ZodOptional<z.ZodString>;
67
67
  imageFit: z.ZodOptional<z.ZodString>;
68
68
  }, z.core.$strip>;
69
- SENTRY: z.ZodOptional<z.ZodString>;
70
69
  }, z.core.$strip>;
71
70
  export type LoginConfig = z.infer<typeof LoginConfig>;
72
71
  export declare const defineLoginConfig: (config: z.input<typeof LoginConfig>) => LoginConfig;
73
72
  export declare const ClientConfig: z.ZodObject<{
74
73
  COUNTRY: z.ZodString;
75
74
  LANGUAGES: z.ZodArray<z.ZodString>;
76
- SENTRY: z.ZodOptional<z.ZodString>;
77
75
  LOGIN_URL: z.ZodOptional<z.ZodString>;
78
76
  REGISTER_BACKGROUND: z.ZodObject<{
79
77
  backgroundColor: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"convert-config-files-to-ts.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-config-files-to-ts.ts"],"names":[],"mappings":"AAuuBA,wBAAsB,IAAI,kBAyPzB"}
1
+ {"version":3,"file":"convert-config-files-to-ts.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/convert-config-files-to-ts.ts"],"names":[],"mappings":"AAiuBA,wBAAsB,IAAI,kBAyPzB"}
@@ -91,7 +91,6 @@ const path_1 = __importDefault(require("path"));
91
91
  const CLIENT_VALID_KEYS = new Set([
92
92
  'COUNTRY',
93
93
  'LANGUAGES',
94
- 'SENTRY',
95
94
  'REGISTER_BACKGROUND',
96
95
  'DASHBOARDS',
97
96
  'FEATURES'
@@ -102,8 +101,7 @@ const LOGIN_VALID_KEYS = new Set([
102
101
  'USER_NOTIFICATION_DELIVERY_METHOD',
103
102
  'INFORMANT_NOTIFICATION_DELIVERY_METHOD',
104
103
  'PHONE_NUMBER_PATTERN',
105
- 'LOGIN_BACKGROUND',
106
- 'SENTRY'
104
+ 'LOGIN_BACKGROUND'
107
105
  ]);
108
106
  // Keys defined in ApplicationConfig from packages/commons/src/application-config.ts
109
107
  const APPLICATION_CONFIG_VALID_KEYS = new Set([
@@ -306,14 +304,13 @@ function transformDashboardsValue(init, isProd) {
306
304
  *
307
305
  * Prod files (isProd = true):
308
306
  * - Import `env` from './environment'
309
- * - Define `scheme = 'https'`, `hostname = env.DOMAIN`, `sentry = env.SENTRY_DSN`
310
- * - Use `sentry` for the SENTRY property
307
+ * - Define `scheme = 'https'`, `hostname = env.DOMAIN`
311
308
  * - Rewrite DASHBOARDS[].url origins to use scheme/hostname template expressions
312
309
  *
313
310
  * Dev files (isProd = false):
314
311
  * - No env import
315
312
  * - Define `scheme = 'http'`, `hostname = 'localhost'`
316
- * - Keep SENTRY and DASHBOARDS URLs as-is from the original JS file
313
+ * - Keep DASHBOARDS URLs as-is from the original JS file
317
314
  */
318
315
  function generateTsContent(configObj, exportName, group, isProd) {
319
316
  var _a;
@@ -337,9 +334,6 @@ function generateTsContent(configObj, exportName, group, isProd) {
337
334
  if (name === 'LANGUAGES') {
338
335
  propertyLines.push(` LANGUAGES: ${convertLanguages(init)}`);
339
336
  }
340
- else if (name === 'SENTRY' && isProd) {
341
- propertyLines.push(` SENTRY: sentry`);
342
- }
343
337
  else if (name === 'DASHBOARDS') {
344
338
  propertyLines.push(` DASHBOARDS: ${transformDashboardsValue(init, isProd)}`);
345
339
  }
@@ -373,7 +367,6 @@ function generateTsContent(configObj, exportName, group, isProd) {
373
367
  if (isProd) {
374
368
  headerLines.push(`const scheme = 'https'`);
375
369
  headerLines.push(`const hostname = env.DOMAIN`);
376
- headerLines.push(`const sentry = env.SENTRY_DSN`);
377
370
  }
378
371
  else {
379
372
  headerLines.push(`const scheme = 'http'`);
@@ -1534,7 +1534,6 @@ var import_path10 = __toESM(require("path"));
1534
1534
  var CLIENT_VALID_KEYS = /* @__PURE__ */ new Set([
1535
1535
  "COUNTRY",
1536
1536
  "LANGUAGES",
1537
- "SENTRY",
1538
1537
  "REGISTER_BACKGROUND",
1539
1538
  "DASHBOARDS",
1540
1539
  "FEATURES"
@@ -1545,8 +1544,7 @@ var LOGIN_VALID_KEYS = /* @__PURE__ */ new Set([
1545
1544
  "USER_NOTIFICATION_DELIVERY_METHOD",
1546
1545
  "INFORMANT_NOTIFICATION_DELIVERY_METHOD",
1547
1546
  "PHONE_NUMBER_PATTERN",
1548
- "LOGIN_BACKGROUND",
1549
- "SENTRY"
1547
+ "LOGIN_BACKGROUND"
1550
1548
  ]);
1551
1549
  var APPLICATION_CONFIG_VALID_KEYS = /* @__PURE__ */ new Set([
1552
1550
  "APPLICATION_NAME",
@@ -1718,8 +1716,6 @@ function generateTsContent(configObj, exportName, group, isProd) {
1718
1716
  if (!init) continue;
1719
1717
  if (name === "LANGUAGES") {
1720
1718
  propertyLines.push(` LANGUAGES: ${convertLanguages(init)}`);
1721
- } else if (name === "SENTRY" && isProd) {
1722
- propertyLines.push(` SENTRY: sentry`);
1723
1719
  } else if (name === "DASHBOARDS") {
1724
1720
  propertyLines.push(
1725
1721
  ` DASHBOARDS: ${transformDashboardsValue(init, isProd)}`
@@ -1756,7 +1752,6 @@ function generateTsContent(configObj, exportName, group, isProd) {
1756
1752
  if (isProd) {
1757
1753
  headerLines.push(`const scheme = 'https'`);
1758
1754
  headerLines.push(`const hostname = env.DOMAIN`);
1759
- headerLines.push(`const sentry = env.SENTRY_DSN`);
1760
1755
  } else {
1761
1756
  headerLines.push(`const scheme = 'http'`);
1762
1757
  headerLines.push(`const hostname = 'localhost'`);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.2-rc.95f6102",
3
+ "version": "2.0.2",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {