@saltcorn/cli 1.0.0-beta.9 → 1.0.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-beta.9",
2
+ "version": "1.0.0-rc.2",
3
3
  "commands": {
4
4
  "add-schema": {
5
5
  "id": "add-schema",
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.0.0-beta.9",
5
+ "version": "1.0.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": "^2.16.0",
13
13
  "@oclif/plugin-plugins": "^3.9.4",
14
- "@saltcorn/admin-models": "1.0.0-beta.9",
15
- "@saltcorn/common-code": "1.0.0-beta.9",
16
- "@saltcorn/data": "1.0.0-beta.9",
17
- "@saltcorn/mobile-app": "1.0.0-beta.9",
18
- "@saltcorn/mobile-builder": "1.0.0-beta.9",
19
- "@saltcorn/plugins-loader": "1.0.0-beta.9",
20
- "@saltcorn/server": "1.0.0-beta.9",
14
+ "@saltcorn/admin-models": "1.0.0-rc.2",
15
+ "@saltcorn/common-code": "1.0.0-rc.2",
16
+ "@saltcorn/data": "1.0.0-rc.2",
17
+ "@saltcorn/mobile-app": "1.0.0-rc.2",
18
+ "@saltcorn/mobile-builder": "1.0.0-rc.2",
19
+ "@saltcorn/plugins-loader": "1.0.0-rc.2",
20
+ "@saltcorn/server": "1.0.0-rc.2",
21
21
  "contractis": "^0.1.0",
22
22
  "dateformat": "^3.0.3",
23
23
  "inquirer": "^7.3.3",
@@ -36,7 +36,7 @@
36
36
  "ts-node": "^9.1.1"
37
37
  },
38
38
  "engines": {
39
- "node": ">=14.0.0"
39
+ "node": ">=16.14.0"
40
40
  },
41
41
  "files": [
42
42
  "/bin",
@@ -22,7 +22,8 @@ class BuildCordovaBuilder extends Command {
22
22
  "-f",
23
23
  join(dockerDir, "Dockerfile"),
24
24
  "-t",
25
- "saltcorn/cordova-builder"
25
+ "saltcorn/cordova-builder",
26
+ "--progress=plain"
26
27
  );
27
28
  const result = spawnSync("docker", dArgs, { cwd: ".", stdio: "inherit" });
28
29
  if (result.error) console.log(result.error.toString());
@@ -3,6 +3,7 @@
3
3
  * @module commands/create-tenant
4
4
  */
5
5
  const { Command, Flags, Args } = require("@oclif/core");
6
+ const { init_some_tenants } = require("../common");
6
7
 
7
8
  //const {
8
9
  // getConfig,
@@ -26,6 +27,7 @@ class CreateTenantCommand extends Command {
26
27
  this.exit(0);
27
28
  return;
28
29
  }
30
+ await init_some_tenants(); //init root tenant
29
31
  const {
30
32
  insertTenant,
31
33
  switchToTenant,
@@ -98,19 +98,31 @@ class ReleaseCommand extends Command {
98
98
  cwd: ".",
99
99
  });
100
100
  };
101
- const publish = (dir) =>
101
+ const publish = async (dir, tags0) => {
102
+ const tags = !tags0 ? [] : Array.isArray(tags0) ? tags0 : [tags0];
103
+ if (flags.tag) tags.push(flags.tag);
104
+ const firstTag = tags[0];
102
105
  spawnSync(
103
106
  "npm",
104
107
  [
105
108
  "publish",
106
109
  "--access=public",
107
- ...(flags.tag ? [`--tag=${flags.tag}`] : []),
110
+ ...(firstTag ? [`--tag ${firstTag}`] : []),
108
111
  ],
109
112
  {
110
113
  stdio: "inherit",
111
114
  cwd: `packages/${dir}/`,
112
115
  }
113
116
  );
117
+ tags.shift();
118
+ for (const tag of tags) {
119
+ await sleep(3000);
120
+ spawnSync("npm", ["dist-tag", "add", `@saltcorn/cli@${version}`, tag], {
121
+ stdio: "inherit",
122
+ cwd: `packages/${dir}/`,
123
+ });
124
+ }
125
+ };
114
126
 
115
127
  const rootPackageJson = require(`../../../../../package.json`);
116
128
 
@@ -126,7 +138,7 @@ class ReleaseCommand extends Command {
126
138
  for (const p of Object.values(pkgs)) {
127
139
  updatePkgJson(p.dir);
128
140
  if (p.publish) {
129
- publish(p.dir);
141
+ await publish(p.dir);
130
142
  await sleep(3000);
131
143
  }
132
144
  }
@@ -152,7 +164,7 @@ class ReleaseCommand extends Command {
152
164
  stdio: "inherit",
153
165
  cwd: `packages/saltcorn-cli/`,
154
166
  });
155
- publish("saltcorn-cli");
167
+ await publish("saltcorn-cli", ["latest", "stable-1.0.x"]);
156
168
  fs.writeFileSync(`package.json`, JSON.stringify(rootPackageJson, null, 2));
157
169
  // update Dockerfile
158
170
  const dockerfile = fs.readFileSync(`Dockerfile.release`, "utf8");
@@ -15,7 +15,10 @@ class PluginsCommand extends Command {
15
15
  */
16
16
  async run() {
17
17
  const db = require("@saltcorn/data/db");
18
- const { requirePlugin } = require("@saltcorn/server/load_plugins");
18
+ const {
19
+ requirePlugin,
20
+ ensurePluginSupport,
21
+ } = require("@saltcorn/server/load_plugins");
19
22
  const { getAllTenants } = require("@saltcorn/admin-models/models/tenant");
20
23
  const Plugin = require("@saltcorn/data/models/plugin");
21
24
  var plugins = [];
@@ -57,10 +60,19 @@ class PluginsCommand extends Command {
57
60
  if (flags.upgrade || flags.dryRun) {
58
61
  var new_versions = {};
59
62
  for (let plugin of plugins) {
60
- plugin.version = "latest";
61
- const { version } = await requirePlugin(plugin, true);
62
- //console.log(plinfo)
63
- if (version) new_versions[plugin.location] = version;
63
+ const oldVersion = plugin.version;
64
+ try {
65
+ plugin.version = "latest";
66
+ await ensurePluginSupport(plugin, true);
67
+ const { version } = await requirePlugin(plugin, true);
68
+ //console.log(plinfo)
69
+ if (version) new_versions[plugin.location] = version;
70
+ } catch (e) {
71
+ plugin.version = oldVersion;
72
+ console.log(
73
+ `Unable to find a supported version for '${plugin.location}'`
74
+ );
75
+ }
64
76
  }
65
77
  console.log(new_versions);
66
78
  for (const domain of tenantList) {
@@ -19,7 +19,7 @@ class ScheduleCommand extends Command {
19
19
  const db = require("@saltcorn/data/db");
20
20
  db.set_sql_logging();
21
21
  }
22
- const runScheduler = require("@saltcorn/data/models/scheduler");
22
+ const { runScheduler } = require("@saltcorn/data/models/scheduler");
23
23
  await runScheduler({});
24
24
  }
25
25
  }