@fishawack/lab-env 5.0.2 → 5.0.3
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/CHANGELOG.md +12 -0
- package/commands/setup.js +34 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 5.0.3 (2025-10-30)
|
|
4
|
+
|
|
5
|
+
#### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* init hub configs during setup ([a32f90d](https://bitbucket.org/fishawackdigital/lab-env/commits/a32f90d5a4b15b6991abc3a6423f5567845c288c))
|
|
8
|
+
|
|
9
|
+
### 5.0.3-beta.1 (2025-10-30)
|
|
10
|
+
|
|
11
|
+
#### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* init hub configs during setup ([a32f90d](https://bitbucket.org/fishawackdigital/lab-env/commits/a32f90d5a4b15b6991abc3a6423f5567845c288c))
|
|
14
|
+
|
|
3
15
|
### 5.0.2 (2025-10-30)
|
|
4
16
|
|
|
5
17
|
#### Bug Fixes
|
package/commands/setup.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
2
|
const { existsSync } = require("fs");
|
|
3
|
+
const glob = require("glob");
|
|
4
|
+
const fs = require("fs-extra");
|
|
3
5
|
|
|
4
6
|
const _ = require("../globals.js");
|
|
7
|
+
const { getConfigurations, findRepository } = require("../hub.js");
|
|
5
8
|
|
|
6
9
|
const execSync = require("child_process").execSync;
|
|
7
10
|
|
|
@@ -9,7 +12,7 @@ module.exports = [
|
|
|
9
12
|
"setup",
|
|
10
13
|
"runs the initial setup",
|
|
11
14
|
() => {},
|
|
12
|
-
() => {
|
|
15
|
+
async () => {
|
|
13
16
|
if (
|
|
14
17
|
_.platform === "laravel" ||
|
|
15
18
|
_.platform === "wordpress" ||
|
|
@@ -43,5 +46,35 @@ module.exports = [
|
|
|
43
46
|
encoding: "utf8",
|
|
44
47
|
stdio: "inherit",
|
|
45
48
|
});
|
|
49
|
+
|
|
50
|
+
if (process.env.HUB_URL) {
|
|
51
|
+
console.log(`Syncing branch configurations from Hub...`);
|
|
52
|
+
// TODO: Fetch specific values and map to core config vlaues
|
|
53
|
+
// TODO: Add migration step of test ui to docs
|
|
54
|
+
const repository = await findRepository(_.remote);
|
|
55
|
+
const configurations = await getConfigurations(repository?.id);
|
|
56
|
+
|
|
57
|
+
// Remove existing hub configuration files
|
|
58
|
+
glob.sync("hub.*.*.json").forEach((file) => fs.removeSync(file));
|
|
59
|
+
|
|
60
|
+
configurations?.forEach(({ config, id, branch }) => {
|
|
61
|
+
const filePath = `hub.${branch}.${id}.json`;
|
|
62
|
+
|
|
63
|
+
fs.writeFileSync(
|
|
64
|
+
filePath,
|
|
65
|
+
JSON.stringify(
|
|
66
|
+
{
|
|
67
|
+
attributes: {
|
|
68
|
+
targets: {
|
|
69
|
+
[branch]: config,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
null,
|
|
74
|
+
4,
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
46
79
|
},
|
|
47
80
|
];
|