@saltcorn/cli 1.1.0-beta.11 → 1.1.0-beta.13

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.11",
2
+ "version": "1.1.0-beta.13",
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.11",
5
+ "version": "1.1.0-beta.13",
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.11",
15
- "@saltcorn/common-code": "1.1.0-beta.11",
16
- "@saltcorn/data": "1.1.0-beta.11",
17
- "@saltcorn/mobile-app": "1.1.0-beta.11",
18
- "@saltcorn/mobile-builder": "1.1.0-beta.11",
19
- "@saltcorn/plugins-loader": "1.1.0-beta.11",
20
- "@saltcorn/server": "1.1.0-beta.11",
14
+ "@saltcorn/admin-models": "1.1.0-beta.13",
15
+ "@saltcorn/common-code": "1.1.0-beta.13",
16
+ "@saltcorn/data": "1.1.0-beta.13",
17
+ "@saltcorn/mobile-app": "1.1.0-beta.13",
18
+ "@saltcorn/mobile-builder": "1.1.0-beta.13",
19
+ "@saltcorn/plugins-loader": "1.1.0-beta.13",
20
+ "@saltcorn/server": "1.1.0-beta.13",
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 --access=public ${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", "--access=public", ...(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,19 +164,25 @@ 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"], {
169
+ stdio: "inherit",
170
+ cwd: `packages/saltcorn-cli/`,
171
+ });
172
+
173
+ runCmd("npm", ["update", "--legacy-peer-deps"], {
156
174
  stdio: "inherit",
157
175
  cwd: `packages/saltcorn-cli/`,
158
176
  });
159
- spawnSync("npm", ["install", "--legacy-peer-deps"], {
177
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
160
178
  stdio: "inherit",
161
179
  cwd: `packages/saltcorn-cli/`,
162
180
  });
163
- spawnSync("npm", ["run", "manifest"], {
181
+ runCmd("npm", ["run", "manifest"], {
164
182
  stdio: "inherit",
165
183
  cwd: `packages/saltcorn-cli/`,
166
184
  });
167
- spawnSync("npm", ["install", "--legacy-peer-deps"], {
185
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
168
186
  stdio: "inherit",
169
187
  cwd: ".",
170
188
  });
@@ -174,7 +192,7 @@ class ReleaseCommand extends Command {
174
192
  });
175
193
  // do not run 'audit fix' on full point releases, only on -beta.x, -rc.x etc
176
194
  /*if (version.includes("-"))
177
- spawnSync("npm", ["audit", "fix"], {
195
+ runCmd("npm", ["audit", "fix"], {
178
196
  stdio: "inherit",
179
197
  cwd: `packages/saltcorn-cli/`,
180
198
  });*/
@@ -195,21 +213,20 @@ class ReleaseCommand extends Command {
195
213
  dockerfileWithMobile.replace(/cli@.* --unsafe/, `cli@${version} --unsafe`)
196
214
  );
197
215
  //git commit tag and push
198
- spawnSync("git", ["commit", "-am", "v" + version], {
216
+ runCmd("git", ["commit", "-am", "v" + version], {
199
217
  stdio: "inherit",
200
218
  });
201
- spawnSync("git", ["tag", "-a", "v" + version, "-m", "v" + version], {
219
+ runCmd("git", ["tag", "-a", "v" + version, "-m", "v" + version], {
202
220
  stdio: "inherit",
203
221
  });
204
- spawnSync("git", ["push", "origin", "v" + version], {
222
+ runCmd("git", ["push", "origin", "v" + version], {
205
223
  stdio: "inherit",
206
224
  });
207
- spawnSync("git", ["push"], {
225
+ runCmd("git", ["push"], {
208
226
  stdio: "inherit",
209
227
  });
210
228
  console.log("Now run:\n");
211
- console.log(" rm -rf packages/saltcorn-cli/node_modules\n");
212
- console.log(" rm -rf node_modules\n");
229
+ console.log("npm install --legacy-peer-deps && npm run tsc\n");
213
230
  this.exit(0);
214
231
  }
215
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
  }