@saltcorn/cli 1.1.0-beta.10 → 1.1.0-beta.12

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.1.0-beta.10",
2
+ "version": "1.1.0-beta.12",
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.1.0-beta.10",
5
+ "version": "1.1.0-beta.12",
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.1.0-beta.10",
15
- "@saltcorn/common-code": "1.1.0-beta.10",
16
- "@saltcorn/data": "1.1.0-beta.10",
17
- "@saltcorn/mobile-app": "1.1.0-beta.10",
18
- "@saltcorn/mobile-builder": "1.1.0-beta.10",
19
- "@saltcorn/plugins-loader": "1.1.0-beta.10",
20
- "@saltcorn/server": "1.1.0-beta.10",
14
+ "@saltcorn/admin-models": "1.1.0-beta.12",
15
+ "@saltcorn/common-code": "1.1.0-beta.12",
16
+ "@saltcorn/data": "1.1.0-beta.12",
17
+ "@saltcorn/mobile-app": "1.1.0-beta.12",
18
+ "@saltcorn/mobile-builder": "1.1.0-beta.12",
19
+ "@saltcorn/plugins-loader": "1.1.0-beta.12",
20
+ "@saltcorn/server": "1.1.0-beta.12",
21
21
  "contractis": "^0.1.0",
22
22
  "dateformat": "^3.0.3",
23
23
  "inquirer": "^7.3.3",
@@ -61,7 +61,7 @@ class BuildAppCommand extends Command {
61
61
  }
62
62
 
63
63
  async run() {
64
- const { flags } = await await this.parse(BuildAppCommand);
64
+ const { flags } = await this.parse(BuildAppCommand);
65
65
  this.validateParameters(flags);
66
66
  const mobileAppDir = path.join(
67
67
  require.resolve("@saltcorn/mobile-app"),
@@ -7,6 +7,19 @@ const fs = require("fs");
7
7
  const { spawnSync } = require("child_process");
8
8
  const { sleep } = require("../../common");
9
9
 
10
+ const runCmd = (cmd, args, options) => {
11
+ const dirStr =
12
+ options?.cwd && options.cwd !== "." ? ` [cwd=${options.cwd}]` : "";
13
+ console.log(`>${dirStr} ${cmd} ${args.join(" ")}`);
14
+ const res = spawnSync(cmd, args, options);
15
+ if (res.status !== 0)
16
+ throw new Error(
17
+ `Non-zero exit status for command: "${cmd} ${args.join(" ")}" in ${
18
+ options?.cwd || "."
19
+ }`
20
+ );
21
+ };
22
+
10
23
  /**
11
24
  * ReleaseCommand Class
12
25
  * @extends oclif.Command
@@ -21,7 +34,7 @@ class ReleaseCommand extends Command {
21
34
  args: { version },
22
35
  flags,
23
36
  } = await this.parse(ReleaseCommand);
24
- spawnSync("git", ["pull"], {
37
+ runCmd("git", ["pull"], {
25
38
  stdio: "inherit",
26
39
  cwd: ".",
27
40
  });
@@ -32,7 +45,7 @@ class ReleaseCommand extends Command {
32
45
  });
33
46
  console.log("\n");
34
47
 
35
- spawnSync("git", ["show", "--summary"], {
48
+ runCmd("git", ["show", "--summary"], {
36
49
  stdio: "inherit",
37
50
  cwd: ".",
38
51
  });
@@ -89,11 +102,11 @@ class ReleaseCommand extends Command {
89
102
  );
90
103
  };
91
104
  const compileTsFiles = () => {
92
- spawnSync("npm", ["install", "--legacy-peer-deps"], {
105
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
93
106
  stdio: "inherit",
94
107
  cwd: ".",
95
108
  });
96
- spawnSync("npm", ["run", "tsc"], {
109
+ runCmd("npm", ["run", "tsc"], {
97
110
  stdio: "inherit",
98
111
  cwd: ".",
99
112
  });
@@ -102,20 +115,22 @@ class ReleaseCommand extends Command {
102
115
  const tags = !tags0 ? [] : Array.isArray(tags0) ? tags0 : [tags0];
103
116
  if (flags.tag) tags.push(flags.tag);
104
117
  const firstTag = tags[0];
105
- console.log(
106
- `packages/${dir}$ npm publish ${firstTag ? `--tag ${firstTag}` : ""}`
118
+ runCmd(
119
+ "npm",
120
+ [
121
+ "publish",
122
+ "--access=public",
123
+ ...(firstTag ? ["--tag", firstTag] : []),
124
+ ],
125
+ {
126
+ stdio: "inherit",
127
+ cwd: `packages/${dir}/`,
128
+ }
107
129
  );
108
- spawnSync("npm", ["publish", ...(firstTag ? ["--tag", firstTag] : [])], {
109
- stdio: "inherit",
110
- cwd: `packages/${dir}/`,
111
- });
112
130
  tags.shift();
113
131
  for (const tag of tags) {
114
132
  await sleep(3000);
115
- console.log(
116
- `packages/${dir}$ npm dist-tag add @saltcorn/cli@${version} ${tag}`
117
- );
118
- spawnSync("npm", ["dist-tag", "add", `@saltcorn/cli@${version}`, tag], {
133
+ runCmd("npm", ["dist-tag", "add", `@saltcorn/cli@${version}`, tag], {
119
134
  stdio: "inherit",
120
135
  cwd: `packages/${dir}/`,
121
136
  });
@@ -125,14 +140,11 @@ class ReleaseCommand extends Command {
125
140
  const rootPackageJson = require(`../../../../../package.json`);
126
141
 
127
142
  compileTsFiles();
128
- //for each package:
143
+ //for each package:1
129
144
  // 1. update version
130
145
  // 2. update dependencies for other packages
131
146
  // 3. publish
132
- spawnSync("npm", ["install", "--legacy-peer-deps"], {
133
- stdio: "inherit",
134
- cwd: `packages/saltcorn-cli/`,
135
- });
147
+
136
148
  for (const p of Object.values(pkgs)) {
137
149
  updatePkgJson(p.dir);
138
150
  if (p.publish) {
@@ -152,25 +164,35 @@ class ReleaseCommand extends Command {
152
164
  `package.json`,
153
165
  JSON.stringify({ ...rootPackageJson, workspaces: undefined }, null, 2)
154
166
  );
155
- spawnSync("npm", ["update", "--legacy-peer-deps"], {
167
+
168
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
156
169
  stdio: "inherit",
157
170
  cwd: `packages/saltcorn-cli/`,
158
171
  });
159
- spawnSync("npm", ["install", "--legacy-peer-deps"], {
172
+
173
+ runCmd("npm", ["update", "--legacy-peer-deps"], {
160
174
  stdio: "inherit",
161
175
  cwd: `packages/saltcorn-cli/`,
162
176
  });
163
- spawnSync("npm", ["run", "manifest"], {
177
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
164
178
  stdio: "inherit",
165
179
  cwd: `packages/saltcorn-cli/`,
166
180
  });
167
- spawnSync("npm", ["install", "--legacy-peer-deps"], {
181
+ runCmd("npm", ["run", "manifest"], {
182
+ stdio: "inherit",
183
+ cwd: `packages/saltcorn-cli/`,
184
+ });
185
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
186
+ stdio: "inherit",
187
+ cwd: ".",
188
+ });
189
+ spawnSync("npm", ["run", "tsc"], {
168
190
  stdio: "inherit",
169
191
  cwd: ".",
170
192
  });
171
193
  // do not run 'audit fix' on full point releases, only on -beta.x, -rc.x etc
172
194
  /*if (version.includes("-"))
173
- spawnSync("npm", ["audit", "fix"], {
195
+ runCmd("npm", ["audit", "fix"], {
174
196
  stdio: "inherit",
175
197
  cwd: `packages/saltcorn-cli/`,
176
198
  });*/
@@ -191,21 +213,20 @@ class ReleaseCommand extends Command {
191
213
  dockerfileWithMobile.replace(/cli@.* --unsafe/, `cli@${version} --unsafe`)
192
214
  );
193
215
  //git commit tag and push
194
- spawnSync("git", ["commit", "-am", "v" + version], {
216
+ runCmd("git", ["commit", "-am", "v" + version], {
195
217
  stdio: "inherit",
196
218
  });
197
- spawnSync("git", ["tag", "-a", "v" + version, "-m", "v" + version], {
219
+ runCmd("git", ["tag", "-a", "v" + version, "-m", "v" + version], {
198
220
  stdio: "inherit",
199
221
  });
200
- spawnSync("git", ["push", "origin", "v" + version], {
222
+ runCmd("git", ["push", "origin", "v" + version], {
201
223
  stdio: "inherit",
202
224
  });
203
- spawnSync("git", ["push"], {
225
+ runCmd("git", ["push"], {
204
226
  stdio: "inherit",
205
227
  });
206
228
  console.log("Now run:\n");
207
- console.log(" rm -rf packages/saltcorn-cli/node_modules\n");
208
- console.log(" rm -rf node_modules\n");
229
+ console.log("npm install --legacy-peer-deps && npm run tsc\n");
209
230
  this.exit(0);
210
231
  }
211
232
  }
@@ -232,7 +232,7 @@ class SyncUploadData extends Command {
232
232
  async run() {
233
233
  let returnCode = 0,
234
234
  inTransaction = false;
235
- const { flags } = await await this.parse(SyncUploadData);
235
+ const { flags } = await this.parse(SyncUploadData);
236
236
  if (db.is_it_multi_tenant() && flags.tenantAppName) {
237
237
  await init_multi_tenant(loadAllPlugins, true, [flags.tenantAppName]);
238
238
  }