underpost 2.8.41 → 2.8.42
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/build.js +22 -17
- package/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
package/bin/build.js
CHANGED
|
@@ -19,16 +19,17 @@ const logger = loggerFactory(import.meta);
|
|
|
19
19
|
|
|
20
20
|
const confName = process.argv[2];
|
|
21
21
|
const basePath = '../pwa-microservices-template';
|
|
22
|
-
const repoName = `engine-${confName.split('dd-')[1]}
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
22
|
+
const repoName = `engine-${confName.split('dd-')[1]}`;
|
|
23
|
+
const privateRepoName = `${repoName}-private`;
|
|
24
|
+
const privateRepoNameBackUp = `${repoName}-cron-backups`;
|
|
25
|
+
const gitPrivateUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${privateRepoName}.git`;
|
|
26
|
+
const gitPrivateBackUpUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${privateRepoNameBackUp}.git`;
|
|
26
27
|
|
|
27
28
|
logger.info('', {
|
|
28
29
|
confName,
|
|
29
|
-
// gitUrl,
|
|
30
30
|
repoName,
|
|
31
|
-
|
|
31
|
+
privateRepoName,
|
|
32
|
+
privateRepoNameBackUp,
|
|
32
33
|
basePath,
|
|
33
34
|
});
|
|
34
35
|
|
|
@@ -150,17 +151,17 @@ spec:
|
|
|
150
151
|
process.exit(0);
|
|
151
152
|
}
|
|
152
153
|
if (process.argv.includes('conf')) {
|
|
153
|
-
if (!fs.existsSync(`../${
|
|
154
|
-
shellExec(`cd .. && git clone ${
|
|
154
|
+
if (!fs.existsSync(`../${privateRepoName}`)) {
|
|
155
|
+
shellExec(`cd .. && git clone ${gitPrivateUrl}`, { silent: true });
|
|
155
156
|
} else {
|
|
156
|
-
shellExec(`cd ../${
|
|
157
|
+
shellExec(`cd ../${privateRepoName} && git pull`);
|
|
157
158
|
}
|
|
158
|
-
const toPath = `../${
|
|
159
|
+
const toPath = `../${privateRepoName}/conf/${confName}`;
|
|
159
160
|
fs.removeSync(toPath);
|
|
160
161
|
fs.mkdirSync(toPath, { recursive: true });
|
|
161
162
|
fs.copySync(`./engine-private/conf/${confName}`, toPath);
|
|
162
163
|
shellExec(
|
|
163
|
-
`cd ../${
|
|
164
|
+
`cd ../${privateRepoName}` +
|
|
164
165
|
` && git add .` +
|
|
165
166
|
` && git commit -m "ci(engine-core-conf): ⚙️ Update ${confName} conf"` +
|
|
166
167
|
` && git push`,
|
|
@@ -169,16 +170,16 @@ if (process.argv.includes('conf')) {
|
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
if (process.argv.includes('cron-backups')) {
|
|
172
|
-
if (!fs.existsSync(`../${
|
|
173
|
-
shellExec(`cd .. && git clone ${
|
|
173
|
+
if (!fs.existsSync(`../${privateRepoNameBackUp}`)) {
|
|
174
|
+
shellExec(`cd .. && git clone ${gitPrivateBackUpUrl}`, { silent: true });
|
|
174
175
|
} else {
|
|
175
|
-
shellExec(`cd ../${
|
|
176
|
+
shellExec(`cd ../${privateRepoNameBackUp} && git pull`);
|
|
176
177
|
}
|
|
177
178
|
const serverConf = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
178
179
|
for (const host of Object.keys(serverConf)) {
|
|
179
180
|
for (let path of Object.keys(serverConf[host])) {
|
|
180
181
|
path = path.replaceAll('/', '-');
|
|
181
|
-
const toPath = `../${
|
|
182
|
+
const toPath = `../${privateRepoNameBackUp}/${host}${path}`;
|
|
182
183
|
const fromPath = `./engine-private/cron-backups/${host}${path}`;
|
|
183
184
|
if (fs.existsSync(fromPath)) {
|
|
184
185
|
if (fs.existsSync(toPath)) fs.removeSync(toPath);
|
|
@@ -188,7 +189,7 @@ if (process.argv.includes('cron-backups')) {
|
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
shellExec(
|
|
191
|
-
`cd ../${
|
|
192
|
+
`cd ../${privateRepoNameBackUp}` +
|
|
192
193
|
` && git add .` +
|
|
193
194
|
` && git commit -m "ci(engine-core-cron-backups): ⚙️ Update ${confName} cron backups"` +
|
|
194
195
|
` && git push`,
|
|
@@ -274,5 +275,9 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
274
275
|
|
|
275
276
|
const packageJson = JSON.parse(fs.readFileSync(`${basePath}/package.json`, 'utf8'));
|
|
276
277
|
packageJson.name = repoName;
|
|
277
|
-
fs.writeFileSync(
|
|
278
|
+
fs.writeFileSync(
|
|
279
|
+
`${basePath}/package.json`,
|
|
280
|
+
JSON.stringify(packageJson, null, 4).replaceAll('pwa-microservices-template', repoName),
|
|
281
|
+
'utf8',
|
|
282
|
+
);
|
|
278
283
|
}
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED