@saltcorn/cli 1.5.0-beta.14 → 1.5.0-beta.16
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 +77 -55
- package/npm-shrinkwrap.json +795 -869
- package/oclif.manifest.json +46 -3
- package/package.json +8 -8
- 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
|
@@ -1166,6 +1166,42 @@
|
|
|
1166
1166
|
"plugins.js"
|
|
1167
1167
|
]
|
|
1168
1168
|
},
|
|
1169
|
+
"pre-install-modules": {
|
|
1170
|
+
"aliases": [],
|
|
1171
|
+
"args": {
|
|
1172
|
+
"pluginSelector": {
|
|
1173
|
+
"description": "Either 'all' to pre-install all plugins or one specific plugin name",
|
|
1174
|
+
"name": "pluginSelector",
|
|
1175
|
+
"required": true
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
"description": "Pre-install modules required by Saltcorn before running the application.",
|
|
1179
|
+
"flags": {
|
|
1180
|
+
"store_endpoint": {
|
|
1181
|
+
"description": "Saltcorn Modules Store endpoint",
|
|
1182
|
+
"name": "store_endpoint",
|
|
1183
|
+
"required": false,
|
|
1184
|
+
"default": "https://store.saltcorn.com/api/extensions",
|
|
1185
|
+
"hasDynamicHelp": false,
|
|
1186
|
+
"multiple": false,
|
|
1187
|
+
"type": "option"
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
"hasDynamicHelp": false,
|
|
1191
|
+
"hiddenAliases": [],
|
|
1192
|
+
"id": "pre-install-modules",
|
|
1193
|
+
"pluginAlias": "@saltcorn/cli",
|
|
1194
|
+
"pluginName": "@saltcorn/cli",
|
|
1195
|
+
"pluginType": "core",
|
|
1196
|
+
"strict": true,
|
|
1197
|
+
"enableJsonFlag": false,
|
|
1198
|
+
"isESM": false,
|
|
1199
|
+
"relativePath": [
|
|
1200
|
+
"src",
|
|
1201
|
+
"commands",
|
|
1202
|
+
"pre-install-modules.js"
|
|
1203
|
+
]
|
|
1204
|
+
},
|
|
1169
1205
|
"prepare": {
|
|
1170
1206
|
"aliases": [],
|
|
1171
1207
|
"args": {},
|
|
@@ -1873,9 +1909,16 @@
|
|
|
1873
1909
|
"multiple": false,
|
|
1874
1910
|
"type": "option"
|
|
1875
1911
|
},
|
|
1876
|
-
"
|
|
1912
|
+
"newSyncTimestamp": {
|
|
1877
1913
|
"description": "new timestamp for the sync_info rows",
|
|
1878
|
-
"name": "
|
|
1914
|
+
"name": "newSyncTimestamp",
|
|
1915
|
+
"hasDynamicHelp": false,
|
|
1916
|
+
"multiple": false,
|
|
1917
|
+
"type": "option"
|
|
1918
|
+
},
|
|
1919
|
+
"oldSyncTimestamp": {
|
|
1920
|
+
"description": "TODO",
|
|
1921
|
+
"name": "oldSyncTimestamp",
|
|
1879
1922
|
"hasDynamicHelp": false,
|
|
1880
1923
|
"multiple": false,
|
|
1881
1924
|
"type": "option"
|
|
@@ -2266,5 +2309,5 @@
|
|
|
2266
2309
|
]
|
|
2267
2310
|
}
|
|
2268
2311
|
},
|
|
2269
|
-
"version": "1.5.0-beta.
|
|
2312
|
+
"version": "1.5.0-beta.16"
|
|
2270
2313
|
}
|
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-beta.
|
|
5
|
+
"version": "1.5.0-beta.16",
|
|
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-beta.
|
|
15
|
-
"@saltcorn/common-code": "1.5.0-beta.
|
|
16
|
-
"@saltcorn/data": "1.5.0-beta.
|
|
17
|
-
"@saltcorn/mobile-app": "1.5.0-beta.
|
|
18
|
-
"@saltcorn/mobile-builder": "1.5.0-beta.
|
|
19
|
-
"@saltcorn/plugins-loader": "1.5.0-beta.
|
|
20
|
-
"@saltcorn/server": "1.5.0-beta.
|
|
14
|
+
"@saltcorn/admin-models": "1.5.0-beta.16",
|
|
15
|
+
"@saltcorn/common-code": "1.5.0-beta.16",
|
|
16
|
+
"@saltcorn/data": "1.5.0-beta.16",
|
|
17
|
+
"@saltcorn/mobile-app": "1.5.0-beta.16",
|
|
18
|
+
"@saltcorn/mobile-builder": "1.5.0-beta.16",
|
|
19
|
+
"@saltcorn/plugins-loader": "1.5.0-beta.16",
|
|
20
|
+
"@saltcorn/server": "1.5.0-beta.16",
|
|
21
21
|
"contractis": "^0.1.0",
|
|
22
22
|
"dateformat": "^4.6.3",
|
|
23
23
|
"inquirer": "^12.3.3",
|
|
@@ -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;
|