@saltcorn/cli 1.5.0-beta.9 → 1.5.0-rc.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.
- package/README.md +88 -58
- package/npm-shrinkwrap.json +1128 -1293
- package/oclif.manifest.json +65 -3
- package/package.json +8 -8
- package/src/commands/build-app.js +23 -0
- package/src/commands/dev/release.js +11 -0
- package/src/commands/pre-install-modules.js +105 -0
- package/src/commands/sync-upload-data.js +264 -182
package/oclif.manifest.json
CHANGED
|
@@ -258,6 +258,25 @@
|
|
|
258
258
|
"allowNo": false,
|
|
259
259
|
"type": "boolean"
|
|
260
260
|
},
|
|
261
|
+
"syncOnReconnect": {
|
|
262
|
+
"description": "Run Synchronizations and return into online mode when the network connection is restored. When disabled, you still can do this manually.",
|
|
263
|
+
"name": "syncOnReconnect",
|
|
264
|
+
"allowNo": false,
|
|
265
|
+
"type": "boolean"
|
|
266
|
+
},
|
|
267
|
+
"pushSync": {
|
|
268
|
+
"description": "When offline mode is enabled, synchronize the synchedTables tables when a push notification is received.",
|
|
269
|
+
"name": "pushSync",
|
|
270
|
+
"allowNo": false,
|
|
271
|
+
"type": "boolean"
|
|
272
|
+
},
|
|
273
|
+
"syncInterval": {
|
|
274
|
+
"description": "Perdiodic interval (in minutes) to run synchronizations in the background. This is just a min interval, depending on system conditions, the actual time may be longer.",
|
|
275
|
+
"name": "syncInterval",
|
|
276
|
+
"hasDynamicHelp": false,
|
|
277
|
+
"multiple": false,
|
|
278
|
+
"type": "option"
|
|
279
|
+
},
|
|
261
280
|
"provisioningProfile": {
|
|
262
281
|
"description": "This profile will be used to sign your app",
|
|
263
282
|
"name": "provisioningProfile",
|
|
@@ -1153,6 +1172,42 @@
|
|
|
1153
1172
|
"plugins.js"
|
|
1154
1173
|
]
|
|
1155
1174
|
},
|
|
1175
|
+
"pre-install-modules": {
|
|
1176
|
+
"aliases": [],
|
|
1177
|
+
"args": {
|
|
1178
|
+
"pluginSelector": {
|
|
1179
|
+
"description": "Either 'all' to pre-install all plugins or one specific plugin name",
|
|
1180
|
+
"name": "pluginSelector",
|
|
1181
|
+
"required": true
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1184
|
+
"description": "Pre-install modules required by Saltcorn before running the application.",
|
|
1185
|
+
"flags": {
|
|
1186
|
+
"store_endpoint": {
|
|
1187
|
+
"description": "Saltcorn Modules Store endpoint",
|
|
1188
|
+
"name": "store_endpoint",
|
|
1189
|
+
"required": false,
|
|
1190
|
+
"default": "https://store.saltcorn.com/api/extensions",
|
|
1191
|
+
"hasDynamicHelp": false,
|
|
1192
|
+
"multiple": false,
|
|
1193
|
+
"type": "option"
|
|
1194
|
+
}
|
|
1195
|
+
},
|
|
1196
|
+
"hasDynamicHelp": false,
|
|
1197
|
+
"hiddenAliases": [],
|
|
1198
|
+
"id": "pre-install-modules",
|
|
1199
|
+
"pluginAlias": "@saltcorn/cli",
|
|
1200
|
+
"pluginName": "@saltcorn/cli",
|
|
1201
|
+
"pluginType": "core",
|
|
1202
|
+
"strict": true,
|
|
1203
|
+
"enableJsonFlag": false,
|
|
1204
|
+
"isESM": false,
|
|
1205
|
+
"relativePath": [
|
|
1206
|
+
"src",
|
|
1207
|
+
"commands",
|
|
1208
|
+
"pre-install-modules.js"
|
|
1209
|
+
]
|
|
1210
|
+
},
|
|
1156
1211
|
"prepare": {
|
|
1157
1212
|
"aliases": [],
|
|
1158
1213
|
"args": {},
|
|
@@ -1860,9 +1915,16 @@
|
|
|
1860
1915
|
"multiple": false,
|
|
1861
1916
|
"type": "option"
|
|
1862
1917
|
},
|
|
1863
|
-
"
|
|
1918
|
+
"newSyncTimestamp": {
|
|
1864
1919
|
"description": "new timestamp for the sync_info rows",
|
|
1865
|
-
"name": "
|
|
1920
|
+
"name": "newSyncTimestamp",
|
|
1921
|
+
"hasDynamicHelp": false,
|
|
1922
|
+
"multiple": false,
|
|
1923
|
+
"type": "option"
|
|
1924
|
+
},
|
|
1925
|
+
"oldSyncTimestamp": {
|
|
1926
|
+
"description": "TODO",
|
|
1927
|
+
"name": "oldSyncTimestamp",
|
|
1866
1928
|
"hasDynamicHelp": false,
|
|
1867
1929
|
"multiple": false,
|
|
1868
1930
|
"type": "option"
|
|
@@ -2253,5 +2315,5 @@
|
|
|
2253
2315
|
]
|
|
2254
2316
|
}
|
|
2255
2317
|
},
|
|
2256
|
-
"version": "1.5.0-
|
|
2318
|
+
"version": "1.5.0-rc.2"
|
|
2257
2319
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@saltcorn/cli",
|
|
3
3
|
"description": "Command-line interface for Saltcorn, open-source no-code platform",
|
|
4
4
|
"homepage": "https://saltcorn.com",
|
|
5
|
-
"version": "1.5.0-
|
|
5
|
+
"version": "1.5.0-rc.2",
|
|
6
6
|
"author": "Tom Nielsen @glutamate",
|
|
7
7
|
"bin": {
|
|
8
8
|
"saltcorn": "./bin/saltcorn"
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@oclif/core": "4.4.0",
|
|
13
13
|
"@oclif/plugin-plugins": "^5.4.26",
|
|
14
|
-
"@saltcorn/admin-models": "1.5.0-
|
|
15
|
-
"@saltcorn/common-code": "1.5.0-
|
|
16
|
-
"@saltcorn/data": "1.5.0-
|
|
17
|
-
"@saltcorn/mobile-app": "1.5.0-
|
|
18
|
-
"@saltcorn/mobile-builder": "1.5.0-
|
|
19
|
-
"@saltcorn/plugins-loader": "1.5.0-
|
|
20
|
-
"@saltcorn/server": "1.5.0-
|
|
14
|
+
"@saltcorn/admin-models": "1.5.0-rc.2",
|
|
15
|
+
"@saltcorn/common-code": "1.5.0-rc.2",
|
|
16
|
+
"@saltcorn/data": "1.5.0-rc.2",
|
|
17
|
+
"@saltcorn/mobile-app": "1.5.0-rc.2",
|
|
18
|
+
"@saltcorn/mobile-builder": "1.5.0-rc.2",
|
|
19
|
+
"@saltcorn/plugins-loader": "1.5.0-rc.2",
|
|
20
|
+
"@saltcorn/server": "1.5.0-rc.2",
|
|
21
21
|
"contractis": "^0.1.0",
|
|
22
22
|
"dateformat": "^4.6.3",
|
|
23
23
|
"inquirer": "^12.3.3",
|
|
@@ -137,6 +137,9 @@ class BuildAppCommand extends Command {
|
|
|
137
137
|
autoPublicLogin: flags.autoPublicLogin,
|
|
138
138
|
showContinueAsPublicUser: flags.showContinueAsPublicUser,
|
|
139
139
|
allowOfflineMode: flags.allowOfflineMode,
|
|
140
|
+
syncOnReconnect: flags.syncOnReconnect,
|
|
141
|
+
pushSync: flags.pushSync,
|
|
142
|
+
syncInterval: flags.syncInterval,
|
|
140
143
|
allowShareTo: flags.allowShareTo,
|
|
141
144
|
plugins: await this.uniquePlugins(flags.includedPlugins),
|
|
142
145
|
copyTargetDir: flags.copyAppDirectory,
|
|
@@ -314,6 +317,26 @@ BuildAppCommand.flags = {
|
|
|
314
317
|
description:
|
|
315
318
|
"Switch to offline mode when there is no internet, sync the data when a connection is available again.",
|
|
316
319
|
}),
|
|
320
|
+
syncOnReconnect: Flags.boolean({
|
|
321
|
+
name: "Sync on connection restored",
|
|
322
|
+
string: "syncOnReconnect",
|
|
323
|
+
description:
|
|
324
|
+
"Run Synchronizations and return into online mode when the network connection is restored. " +
|
|
325
|
+
"When disabled, you still can do this manually.",
|
|
326
|
+
}),
|
|
327
|
+
pushSync: Flags.boolean({
|
|
328
|
+
name: "Push sync",
|
|
329
|
+
string: "pushSync",
|
|
330
|
+
description:
|
|
331
|
+
"When offline mode is enabled, synchronize the synchedTables tables when a push notification is received.",
|
|
332
|
+
}),
|
|
333
|
+
syncInterval: Flags.string({
|
|
334
|
+
name: "Periodic Sync Interval",
|
|
335
|
+
string: "syncInterval",
|
|
336
|
+
description:
|
|
337
|
+
"Perdiodic interval (in minutes) to run synchronizations in the background. " +
|
|
338
|
+
"This is just a min interval, depending on system conditions, the actual time may be longer.",
|
|
339
|
+
}),
|
|
317
340
|
provisioningProfile: Flags.string({
|
|
318
341
|
name: "provisioning profile",
|
|
319
342
|
string: "provisioningProfile",
|
|
@@ -234,6 +234,17 @@ class ReleaseCommand extends Command {
|
|
|
234
234
|
`cli@${version} --omit=dev`,
|
|
235
235
|
),
|
|
236
236
|
);
|
|
237
|
+
const isolatedDockerfile = fs.readFileSync(
|
|
238
|
+
`Dockerfile.isolated.release`,
|
|
239
|
+
"utf8",
|
|
240
|
+
);
|
|
241
|
+
fs.writeFileSync(
|
|
242
|
+
`Dockerfile.isolated.release`,
|
|
243
|
+
isolatedDockerfile.replace(
|
|
244
|
+
/cli@.* --omit=dev/,
|
|
245
|
+
`cli@${version} --omit=dev`,
|
|
246
|
+
),
|
|
247
|
+
);
|
|
237
248
|
//git commit tag and push
|
|
238
249
|
runCmd("git", ["commit", "-am", "v" + version], {
|
|
239
250
|
stdio: "inherit",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const { Command, Flags, Args } = require("@oclif/core");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const Plugin = require("@saltcorn/data/models/plugin");
|
|
5
|
+
const PluginInstaller = require("@saltcorn/plugins-loader/plugin_installer");
|
|
6
|
+
const {
|
|
7
|
+
getFetchProxyOptions,
|
|
8
|
+
pluginsFolderRoot,
|
|
9
|
+
} = require("@saltcorn/data/utils");
|
|
10
|
+
const npmFetch = require("npm-registry-fetch");
|
|
11
|
+
|
|
12
|
+
const upsertInfosFile = (plugins) => {
|
|
13
|
+
const entriesFile = path.join(pluginsFolderRoot, "store_entries.json");
|
|
14
|
+
if (!fs.existsSync(pluginsFolderRoot))
|
|
15
|
+
fs.mkdirSync(pluginsFolderRoot, { recursive: true });
|
|
16
|
+
if (!fs.existsSync(entriesFile))
|
|
17
|
+
fs.writeFileSync(
|
|
18
|
+
entriesFile,
|
|
19
|
+
JSON.stringify(plugins.map((plugin) => ({ ...plugin })))
|
|
20
|
+
);
|
|
21
|
+
else {
|
|
22
|
+
const existingEntries = JSON.parse(fs.readFileSync(entriesFile, "utf8"));
|
|
23
|
+
const updatedEntries = [...existingEntries];
|
|
24
|
+
for (const plugin of plugins) {
|
|
25
|
+
const index = updatedEntries.findIndex(
|
|
26
|
+
(entry) => entry.name === plugin.name
|
|
27
|
+
);
|
|
28
|
+
if (index !== -1) {
|
|
29
|
+
updatedEntries[index] = { ...plugin };
|
|
30
|
+
} else {
|
|
31
|
+
updatedEntries.push({ ...plugin });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
fs.writeFileSync(entriesFile, JSON.stringify(updatedEntries));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const latestVersion = async (packageName) => {
|
|
39
|
+
const pkgInfo = await npmFetch.json(
|
|
40
|
+
`https://registry.npmjs.org/${packageName}`,
|
|
41
|
+
getFetchProxyOptions()
|
|
42
|
+
);
|
|
43
|
+
return pkgInfo["dist-tags"].latest;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
class PreInstallModulesCommand extends Command {
|
|
47
|
+
async run() {
|
|
48
|
+
const { flags, args } = await this.parse(PreInstallModulesCommand);
|
|
49
|
+
|
|
50
|
+
if (args.pluginSelector === "all") {
|
|
51
|
+
const plugins = await Plugin.store_plugins_available_from_store(
|
|
52
|
+
flags.store_endpoint
|
|
53
|
+
);
|
|
54
|
+
for (const plugin of plugins) {
|
|
55
|
+
const latestVer = await latestVersion(plugin.location);
|
|
56
|
+
plugin.version = latestVer;
|
|
57
|
+
console.log(`Latest version of ${plugin.name} is ${latestVer}`);
|
|
58
|
+
const installer = new PluginInstaller(plugin, {
|
|
59
|
+
rootFolder: pluginsFolderRoot,
|
|
60
|
+
});
|
|
61
|
+
await installer.install(true, true);
|
|
62
|
+
}
|
|
63
|
+
upsertInfosFile(plugins);
|
|
64
|
+
} else {
|
|
65
|
+
const plugin = await Plugin.store_by_name(
|
|
66
|
+
args.pluginSelector,
|
|
67
|
+
flags.store_endpoint
|
|
68
|
+
);
|
|
69
|
+
if (!plugin)
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Plugin ${args.pluginSelector} not found in store at ${flags.store_endpoint}`
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const latestVer = await latestVersion(plugin.location);
|
|
75
|
+
plugin.version = latestVer;
|
|
76
|
+
console.log(`Latest version of ${plugin.name} is ${latestVer}`);
|
|
77
|
+
const installer = new PluginInstaller(plugin, {
|
|
78
|
+
rootFolder: pluginsFolderRoot,
|
|
79
|
+
});
|
|
80
|
+
await installer.install(true, true);
|
|
81
|
+
upsertInfosFile([plugin]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
PreInstallModulesCommand.description =
|
|
87
|
+
"Pre-install modules required by Saltcorn before running the application.";
|
|
88
|
+
|
|
89
|
+
PreInstallModulesCommand.args = {
|
|
90
|
+
pluginSelector: Args.string({
|
|
91
|
+
required: true,
|
|
92
|
+
description:
|
|
93
|
+
"Either 'all' to pre-install all plugins or one specific plugin name",
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
PreInstallModulesCommand.flags = {
|
|
98
|
+
store_endpoint: Flags.string({
|
|
99
|
+
description: "Saltcorn Modules Store endpoint",
|
|
100
|
+
required: false,
|
|
101
|
+
default: "https://store.saltcorn.com/api/extensions",
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
module.exports = PreInstallModulesCommand;
|