@saltcorn/cli 1.1.0-beta.14 → 1.1.0-beta.21

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.14",
2
+ "version": "1.1.0-beta.21",
3
3
  "commands": {
4
4
  "add-schema": {
5
5
  "id": "add-schema",
@@ -1578,6 +1578,32 @@
1578
1578
  }
1579
1579
  }
1580
1580
  },
1581
+ "dev:release-resume": {
1582
+ "id": "dev:release-resume",
1583
+ "description": "Release a new saltcorn version",
1584
+ "strict": true,
1585
+ "pluginName": "@saltcorn/cli",
1586
+ "pluginAlias": "@saltcorn/cli",
1587
+ "pluginType": "core",
1588
+ "aliases": [],
1589
+ "hiddenAliases": [],
1590
+ "flags": {
1591
+ "tag": {
1592
+ "name": "tag",
1593
+ "type": "option",
1594
+ "char": "t",
1595
+ "description": "NPM tag",
1596
+ "multiple": false
1597
+ }
1598
+ },
1599
+ "args": {
1600
+ "version": {
1601
+ "name": "version",
1602
+ "description": "New version number",
1603
+ "required": true
1604
+ }
1605
+ }
1606
+ },
1581
1607
  "dev:release": {
1582
1608
  "id": "dev:release",
1583
1609
  "description": "Release a new saltcorn version",
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.14",
5
+ "version": "1.1.0-beta.21",
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.14",
15
- "@saltcorn/common-code": "1.1.0-beta.14",
16
- "@saltcorn/data": "1.1.0-beta.14",
17
- "@saltcorn/mobile-app": "1.1.0-beta.14",
18
- "@saltcorn/mobile-builder": "1.1.0-beta.14",
19
- "@saltcorn/plugins-loader": "1.1.0-beta.14",
20
- "@saltcorn/server": "1.1.0-beta.14",
14
+ "@saltcorn/admin-models": "1.1.0-beta.21",
15
+ "@saltcorn/common-code": "1.1.0-beta.21",
16
+ "@saltcorn/data": "1.1.0-beta.21",
17
+ "@saltcorn/mobile-app": "1.1.0-beta.21",
18
+ "@saltcorn/mobile-builder": "1.1.0-beta.21",
19
+ "@saltcorn/plugins-loader": "1.1.0-beta.21",
20
+ "@saltcorn/server": "1.1.0-beta.21",
21
21
  "contractis": "^0.1.0",
22
22
  "dateformat": "^3.0.3",
23
23
  "inquirer": "^7.3.3",
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @category saltcorn-cli
3
+ * @module commands/release-resume
4
+ */
5
+ const { Command, Flags, Args } = require("@oclif/core");
6
+ const fs = require("fs");
7
+ const { spawnSync } = require("child_process");
8
+ const { sleep } = require("../../common");
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
+
23
+ /**
24
+ * ReleaseResumeCommand Class
25
+ * @extends oclif.Command
26
+ * @category saltcorn-cli
27
+ */
28
+ class ReleaseResumeCommand extends Command {
29
+ /**
30
+ * @returns {Promise<void>}
31
+ */
32
+ async run() {
33
+ const {
34
+ args: { version },
35
+ flags,
36
+ } = await this.parse(ReleaseResumeCommand);
37
+ const pkgs = {
38
+ "@saltcorn/db-common": { dir: "db-common", publish: true },
39
+ "@saltcorn/common-code": { dir: "common-code", publish: true },
40
+ "@saltcorn/plugins-loader": { dir: "plugins-loader", publish: true },
41
+ "@saltcorn/sqlite": { dir: "sqlite", publish: true },
42
+ "@saltcorn/sqlite-mobile": { dir: "sqlite-mobile", publish: true },
43
+ "@saltcorn/postgres": { dir: "postgres", publish: true },
44
+ "@saltcorn/types": { dir: "saltcorn-types", publish: true },
45
+ "@saltcorn/builder": { dir: "saltcorn-builder", publish: true },
46
+ "@saltcorn/filemanager": { dir: "filemanager", publish: true },
47
+ "@saltcorn/data": { dir: "saltcorn-data", publish: true },
48
+ "@saltcorn/admin-models": {
49
+ dir: "saltcorn-admin-models",
50
+ publish: true,
51
+ },
52
+ "@saltcorn/random-tests": { dir: "saltcorn-random-tests" },
53
+ "@saltcorn/server": { dir: "server", publish: true },
54
+ "@saltcorn/base-plugin": { dir: "saltcorn-base-plugin", publish: true },
55
+ //"saltcorn-cli", publish: true},
56
+ "@saltcorn/markup": { dir: "saltcorn-markup", publish: true },
57
+ "@saltcorn/mobile-app": { dir: "saltcorn-mobile-app", publish: true },
58
+ "@saltcorn/mobile-builder": {
59
+ dir: "saltcorn-mobile-builder",
60
+ publish: true,
61
+ },
62
+ "@saltcorn/sbadmin2": { dir: "saltcorn-sbadmin2", publish: true },
63
+ };
64
+
65
+ const updateDependencies = (json, dpkgnm, version) => {
66
+ if (json.dependencies && json.dependencies[dpkgnm])
67
+ json.dependencies[dpkgnm] = version;
68
+ if (json.devDependencies && json.devDependencies[dpkgnm])
69
+ json.devDependencies[dpkgnm] = version;
70
+ if (json.optionalDependencies && json.optionalDependencies[dpkgnm])
71
+ json.optionalDependencies[dpkgnm] = version;
72
+ };
73
+
74
+ const updatePkgJson = (dir) => {
75
+ const json = require(`../../../../${dir}/package.json`);
76
+ json.version = version;
77
+ if (json.dependencies || json.devDependencies)
78
+ Object.keys(pkgs).forEach((dpkgnm) => {
79
+ updateDependencies(json, dpkgnm, version);
80
+ });
81
+ updateDependencies(json, "@saltcorn/cli", version);
82
+ fs.writeFileSync(
83
+ `packages/${dir}/package.json`,
84
+ JSON.stringify(json, null, 2)
85
+ );
86
+ };
87
+ const compileTsFiles = () => {
88
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
89
+ stdio: "inherit",
90
+ cwd: ".",
91
+ });
92
+ runCmd("npm", ["run", "tsc"], {
93
+ stdio: "inherit",
94
+ cwd: ".",
95
+ });
96
+ };
97
+ const publish = async (dir, tags0) => {
98
+ const tags = !tags0 ? [] : Array.isArray(tags0) ? tags0 : [tags0];
99
+ if (flags.tag) tags.push(flags.tag);
100
+ const firstTag = tags[0];
101
+ runCmd(
102
+ "npm",
103
+ [
104
+ "publish",
105
+ "--access=public",
106
+ ...(firstTag ? ["--tag", firstTag] : []),
107
+ ],
108
+ {
109
+ stdio: "inherit",
110
+ cwd: `packages/${dir}/`,
111
+ }
112
+ );
113
+ tags.shift();
114
+ for (const tag of tags) {
115
+ await sleep(7000);
116
+ runCmd("npm", ["dist-tag", "add", `@saltcorn/cli@${version}`, tag], {
117
+ stdio: "inherit",
118
+ cwd: `packages/${dir}/`,
119
+ });
120
+ }
121
+ };
122
+
123
+ const rootPackageJson = require(`../../../../../package.json`);
124
+
125
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
126
+ stdio: "inherit",
127
+ cwd: `packages/saltcorn-cli/`,
128
+ });
129
+
130
+ runCmd("npm", ["update", "--legacy-peer-deps"], {
131
+ stdio: "inherit",
132
+ cwd: `packages/saltcorn-cli/`,
133
+ });
134
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
135
+ stdio: "inherit",
136
+ cwd: `packages/saltcorn-cli/`,
137
+ });
138
+ runCmd("npm", ["run", "manifest"], {
139
+ stdio: "inherit",
140
+ cwd: `packages/saltcorn-cli/`,
141
+ });
142
+ runCmd("npm", ["install", "--legacy-peer-deps"], {
143
+ stdio: "inherit",
144
+ cwd: ".",
145
+ });
146
+ spawnSync("npm", ["run", "tsc"], {
147
+ stdio: "inherit",
148
+ cwd: ".",
149
+ });
150
+ // do not run 'audit fix' on full point releases, only on -beta.x, -rc.x etc
151
+ /*if (version.includes("-"))
152
+ runCmd("npm", ["audit", "fix"], {
153
+ stdio: "inherit",
154
+ cwd: `packages/saltcorn-cli/`,
155
+ });*/
156
+ await publish("saltcorn-cli", "next");
157
+ fs.writeFileSync(`package.json`, JSON.stringify(rootPackageJson, null, 2));
158
+ // update Dockerfile
159
+ const dockerfile = fs.readFileSync(`Dockerfile.release`, "utf8");
160
+ fs.writeFileSync(
161
+ `Dockerfile.release`,
162
+ dockerfile.replace(/cli@.* --unsafe/, `cli@${version} --unsafe`)
163
+ );
164
+ const dockerfileWithMobile = fs.readFileSync(
165
+ `Dockerfile.mobile.release`,
166
+ "utf8"
167
+ );
168
+ fs.writeFileSync(
169
+ `Dockerfile.mobile.release`,
170
+ dockerfileWithMobile.replace(/cli@.* --unsafe/, `cli@${version} --unsafe`)
171
+ );
172
+ //git commit tag and push
173
+ runCmd("git", ["commit", "-am", "v" + version], {
174
+ stdio: "inherit",
175
+ });
176
+ runCmd("git", ["tag", "-a", "v" + version, "-m", "v" + version], {
177
+ stdio: "inherit",
178
+ });
179
+ runCmd("git", ["push", "origin", "v" + version], {
180
+ stdio: "inherit",
181
+ });
182
+ runCmd("git", ["push"], {
183
+ stdio: "inherit",
184
+ });
185
+ console.log("Now run:\n");
186
+ console.log("npm install --legacy-peer-deps && npm run tsc\n");
187
+ this.exit(0);
188
+ }
189
+ }
190
+
191
+ /**
192
+ * @type {string}
193
+ */
194
+ ReleaseResumeCommand.description = `Release a new saltcorn version`;
195
+
196
+ /**
197
+ * @type {object}
198
+ */
199
+ ReleaseResumeCommand.args = {
200
+ version: Args.string({
201
+ required: true,
202
+ description: "New version number",
203
+ }),
204
+ };
205
+
206
+ ReleaseResumeCommand.flags = {
207
+ tag: Flags.string({
208
+ char: "t",
209
+ description: "NPM tag",
210
+ }),
211
+ };
212
+ module.exports = ReleaseResumeCommand;
@@ -129,7 +129,7 @@ class ReleaseCommand extends Command {
129
129
  );
130
130
  tags.shift();
131
131
  for (const tag of tags) {
132
- await sleep(3000);
132
+ await sleep(7000);
133
133
  runCmd("npm", ["dist-tag", "add", `@saltcorn/cli@${version}`, tag], {
134
134
  stdio: "inherit",
135
135
  cwd: `packages/${dir}/`,
@@ -154,6 +154,15 @@ class ReleaseCommand extends Command {
154
154
  }
155
155
  await sleep(5000);
156
156
 
157
+ runCmd("npm", ["cache", "clear", "--force"], {
158
+ stdio: "inherit",
159
+ cwd: `.`,
160
+ });
161
+ runCmd("npm", ["cache", "clean", "--force"], {
162
+ stdio: "inherit",
163
+ cwd: `.`,
164
+ });
165
+
157
166
  // for cli:
158
167
  // 1. update version
159
168
  // 2. update dependencies for other pkgs