@opencrvs/create-countryconfig 2.0.2-rc.0aa832c → 2.0.2-rc.3152b53

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.
Files changed (2) hide show
  1. package/index.js +14 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -151,7 +151,7 @@ function cloneRepository(
151
151
  repoUrl,
152
152
  ref,
153
153
  targetDir,
154
- { keepHistory = false } = {}
154
+ { keepHistory = false, replaceOriginWithUpstream = false } = {}
155
155
  ) {
156
156
  const depthFlag = keepHistory ? '' : '--depth 1 '
157
157
  execSync(
@@ -180,6 +180,17 @@ function cloneRepository(
180
180
  process.exit(1)
181
181
  }
182
182
  }
183
+ if (replaceOriginWithUpstream) {
184
+ console.log("Replacing 'origin' remote with 'upstream' in " + targetDir + "...")
185
+ execSync('git remote remove origin', {
186
+ cwd: targetDir,
187
+ stdio: 'inherit'
188
+ })
189
+ execSync('git remote add upstream ' + repoUrl, {
190
+ cwd: targetDir,
191
+ stdio: 'inherit'
192
+ })
193
+ }
183
194
  }
184
195
 
185
196
  const projectName = process.argv[2]
@@ -251,7 +262,8 @@ console.log(
251
262
 
252
263
  try {
253
264
  cloneRepository(INFRASTRUCTURE_REPO_URL, ref, infrastructureDirName, {
254
- keepHistory: true
265
+ keepHistory: true,
266
+ replaceOriginWithUpstream: true
255
267
  })
256
268
  } catch (err) {
257
269
  console.error('Failed to clone the infrastructure repository:', err.message)
@@ -267,4 +279,3 @@ console.log(' git init')
267
279
  console.log(' npm install\n')
268
280
  console.log('To get started with the infrastructure:\n')
269
281
  console.log(' cd ' + infrastructureDirName)
270
- console.log(' git init\n')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/create-countryconfig",
3
- "version": "2.0.2-rc.0aa832c",
3
+ "version": "2.0.2-rc.3152b53",
4
4
  "description": "Scaffold a new OpenCRVS country configuration",
5
5
  "bin": {
6
6
  "create-countryconfig": "./index.js"