freeschema 1.0.3 → 1.0.4
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/freeschema.js
CHANGED
|
@@ -161,6 +161,37 @@ function makeProgressBar(label) {
|
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
// Patches known issues in the local docker-compose.yml so existing installs
|
|
165
|
+
// are automatically healed on start/update without requiring a re-init.
|
|
166
|
+
const COMPOSE_PATCHES = [
|
|
167
|
+
{
|
|
168
|
+
find: /- \.\/mosquitto\/config:\/mosquitto\/config:ro/g,
|
|
169
|
+
replace: '- ./mosquitto/config:/mosquitto/config',
|
|
170
|
+
label: 'mosquitto config mount (removed :ro)',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
find: /(image: eclipse-mosquitto:[^\n]+\n)(?! user:)/,
|
|
174
|
+
replace: '$1 user: "1883:1883"\n',
|
|
175
|
+
label: 'mosquitto user (1883:1883 to skip chown on Windows)',
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
function patchComposeFile() {
|
|
180
|
+
const composePath = path.join(process.cwd(), 'docker-compose.yml');
|
|
181
|
+
if (!fs.existsSync(composePath)) return;
|
|
182
|
+
let content = fs.readFileSync(composePath, 'utf8');
|
|
183
|
+
let patched = false;
|
|
184
|
+
for (const { find, replace, label } of COMPOSE_PATCHES) {
|
|
185
|
+
if (find.test(content)) {
|
|
186
|
+
content = content.replace(find, replace);
|
|
187
|
+
patched = true;
|
|
188
|
+
console.log(` Patched docker-compose.yml: ${label}`);
|
|
189
|
+
}
|
|
190
|
+
find.lastIndex = 0;
|
|
191
|
+
}
|
|
192
|
+
if (patched) fs.writeFileSync(composePath, content);
|
|
193
|
+
}
|
|
194
|
+
|
|
164
195
|
function runCompose(composeArgs, opts = {}) {
|
|
165
196
|
const cwd = process.cwd();
|
|
166
197
|
if (!fs.existsSync(path.join(cwd, 'docker-compose.yml'))) {
|
|
@@ -433,6 +464,7 @@ function waitForMySQL(container, user, pass, maxAttempts = 30) {
|
|
|
433
464
|
}
|
|
434
465
|
|
|
435
466
|
function cmdStart() {
|
|
467
|
+
patchComposeFile();
|
|
436
468
|
const cwd = process.cwd();
|
|
437
469
|
const missing = ['.env', '.env.frontend'].filter(f => !fs.existsSync(path.join(cwd, f)));
|
|
438
470
|
if (missing.length) {
|
|
@@ -501,6 +533,7 @@ function cmdPull() {
|
|
|
501
533
|
|
|
502
534
|
function cmdUpdate() {
|
|
503
535
|
console.log('Updating FreeSchema…\n');
|
|
536
|
+
patchComposeFile();
|
|
504
537
|
|
|
505
538
|
// 1. Update the CLI itself via npm
|
|
506
539
|
console.log('Step 1/2 — Updating freeschema CLI…');
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
listener 1883
|
|
2
|
-
allow_anonymous false
|
|
3
|
-
password_file /mosquitto/config/password.txt
|
|
4
|
-
|
|
5
|
-
listener 9001
|
|
6
|
-
protocol websockets
|
|
7
|
-
allow_anonymous false
|
|
8
|
-
|
|
9
|
-
persistence true
|
|
10
|
-
persistence_location /mosquitto/data/
|
|
11
|
-
log_dest file /mosquitto/log/mosquitto.log
|
|
1
|
+
listener 1883
|
|
2
|
+
allow_anonymous false
|
|
3
|
+
password_file /mosquitto/config/password.txt
|
|
4
|
+
|
|
5
|
+
listener 9001
|
|
6
|
+
protocol websockets
|
|
7
|
+
allow_anonymous false
|
|
8
|
+
|
|
9
|
+
persistence true
|
|
10
|
+
persistence_location /mosquitto/data/
|
|
11
|
+
log_dest file /mosquitto/log/mosquitto.log
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
freeschema:$7$101$orXdSDv8OTk6tUnW$XhsqgkbuoDKh0PqtwNBfXZxyPVSKkv7zgHrjAKL5uBnl79kX0AXrSn8o4TWbeVYFVEE4q+r2IiadBPAKORw4kQ==
|