@saltcorn/cli 1.1.1-beta.1 → 1.1.1-beta.3

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.1-beta.1",
2
+ "version": "1.1.1-beta.3",
3
3
  "commands": {
4
4
  "add-schema": {
5
5
  "id": "add-schema",
@@ -81,6 +81,25 @@
81
81
  "aliases": [],
82
82
  "hiddenAliases": [],
83
83
  "flags": {
84
+ "mode": {
85
+ "name": "mode",
86
+ "type": "option",
87
+ "char": "m",
88
+ "description": "Build the app completely (full), prepare the ios build directory (prepare) or finish the ios build in the prepared ios folder (finish)",
89
+ "multiple": false,
90
+ "options": [
91
+ "full",
92
+ "prepare",
93
+ "finish"
94
+ ],
95
+ "default": "full"
96
+ },
97
+ "allowShareTo": {
98
+ "name": "allowShareTo",
99
+ "type": "boolean",
100
+ "description": "Allow sharing from other apps to this app",
101
+ "allowNo": false
102
+ },
84
103
  "tenantAppName": {
85
104
  "name": "tenantAppName",
86
105
  "type": "option",
@@ -210,6 +229,12 @@
210
229
  "description": "This profile will be used to sign your app",
211
230
  "multiple": false
212
231
  },
232
+ "shareExtensionProvisioningProfile": {
233
+ "name": "shareExtensionProvisioningProfile",
234
+ "type": "option",
235
+ "description": "This profile will be used to sign your share extension on iOS",
236
+ "multiple": false
237
+ },
213
238
  "buildType": {
214
239
  "name": "buildType",
215
240
  "type": "option",
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.1-beta.1",
5
+ "version": "1.1.1-beta.3",
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.1-beta.1",
15
- "@saltcorn/common-code": "1.1.1-beta.1",
16
- "@saltcorn/data": "1.1.1-beta.1",
17
- "@saltcorn/mobile-app": "1.1.1-beta.1",
18
- "@saltcorn/mobile-builder": "1.1.1-beta.1",
19
- "@saltcorn/plugins-loader": "1.1.1-beta.1",
20
- "@saltcorn/server": "1.1.1-beta.1",
14
+ "@saltcorn/admin-models": "1.1.1-beta.3",
15
+ "@saltcorn/common-code": "1.1.1-beta.3",
16
+ "@saltcorn/data": "1.1.1-beta.3",
17
+ "@saltcorn/mobile-app": "1.1.1-beta.3",
18
+ "@saltcorn/mobile-builder": "1.1.1-beta.3",
19
+ "@saltcorn/plugins-loader": "1.1.1-beta.3",
20
+ "@saltcorn/server": "1.1.1-beta.3",
21
21
  "contractis": "^0.1.0",
22
22
  "dateformat": "^3.0.3",
23
23
  "inquirer": "^7.3.3",
@@ -2,7 +2,10 @@ const { Command, Flags } = require("@oclif/core");
2
2
  const path = require("path");
3
3
  const Plugin = require("@saltcorn/data/models/plugin");
4
4
  const { MobileBuilder } = require("@saltcorn/mobile-builder/mobile-builder");
5
- const { init_multi_tenant } = require("@saltcorn/data/db/state");
5
+ const {
6
+ decodeProvisioningProfile,
7
+ } = require("@saltcorn/mobile-builder/utils/common-build-utils");
8
+ const { init_multi_tenant, getState } = require("@saltcorn/data/db/state");
6
9
  const { loadAllPlugins } = require("@saltcorn/server/load_plugins");
7
10
  const User = require("@saltcorn/data/models/user");
8
11
 
@@ -39,8 +42,13 @@ class BuildAppCommand extends Command {
39
42
  );
40
43
  }
41
44
 
42
- if (flags.platforms.includes("ios") && !flags.provisioningProfile) {
43
- throw new Error("Please specify a provisioning profile");
45
+ if (flags.platforms.includes("ios")) {
46
+ if (!flags.provisioningProfile)
47
+ throw new Error("Please specify a provisioning profile");
48
+ if (flags.allowShareTo && !flags.shareExtensionProvisioningProfile)
49
+ throw new Error(
50
+ "Please specify a share extension provisioning profile"
51
+ );
44
52
  }
45
53
  }
46
54
 
@@ -60,6 +68,34 @@ class BuildAppCommand extends Command {
60
68
  return Array.from(pluginsMap.values());
61
69
  }
62
70
 
71
+ async buildIosParams(flags) {
72
+ let result = undefined;
73
+ if (flags.platforms.includes("ios")) {
74
+ const mainProfileVals = await decodeProvisioningProfile(
75
+ flags.buildDirectory,
76
+ flags.provisioningProfile
77
+ );
78
+ result = {
79
+ appleTeamId: mainProfileVals.teamId,
80
+ mainProvisioningProfile: {
81
+ guuid: mainProfileVals.guuid,
82
+ },
83
+ };
84
+ if (flags.allowShareTo) {
85
+ const shareExtProfileVals = await decodeProvisioningProfile(
86
+ flags.buildDirectory,
87
+ flags.shareExtensionProvisioningProfile
88
+ );
89
+ result.shareExtensionProvisioningProfile = {
90
+ guuid: shareExtProfileVals.guuid,
91
+ specifier: shareExtProfileVals.specifier,
92
+ identifier: shareExtProfileVals.identifier,
93
+ };
94
+ }
95
+ }
96
+ return result;
97
+ }
98
+
63
99
  async run() {
64
100
  const { flags } = await this.parse(BuildAppCommand);
65
101
  this.validateParameters(flags);
@@ -77,6 +113,8 @@ class BuildAppCommand extends Command {
77
113
  : undefined;
78
114
  if (!user && flags.userEmail)
79
115
  throw new Error(`The user '${flags.userEmail}' does not exist'`);
116
+
117
+ const iosParams = await this.buildIosParams(flags);
80
118
  const builder = new MobileBuilder({
81
119
  appName: flags.appName,
82
120
  appId: flags.appId,
@@ -96,17 +134,38 @@ class BuildAppCommand extends Command {
96
134
  splashPage: flags.splashPage,
97
135
  autoPublicLogin: flags.autoPublicLogin,
98
136
  allowOfflineMode: flags.allowOfflineMode,
137
+ allowShareTo: flags.allowShareTo,
99
138
  plugins: await this.uniquePlugins(flags.includedPlugins),
100
139
  copyTargetDir: flags.copyAppDirectory,
101
140
  user,
102
- provisioningProfile: flags.provisioningProfile,
141
+ iosParams: iosParams,
103
142
  tenantAppName: flags.tenantAppName,
104
143
  buildType: flags.buildType,
105
144
  keyStorePath: flags.androidKeystore,
106
145
  keyStoreAlias: flags.androidKeyStoreAlias,
107
146
  keyStorePassword: flags.androidKeystorePassword,
108
147
  });
109
- process.exit(await builder.build());
148
+ let result;
149
+ switch (flags.mode) {
150
+ case "full":
151
+ getState().log(5, "Building completely");
152
+ result = await builder.fullBuild();
153
+ break;
154
+ case "prepare":
155
+ getState().log(5, "Preparing the ios build directory");
156
+ result = await builder.prepareStep();
157
+ break;
158
+ case "finish":
159
+ getState().log(
160
+ 5,
161
+ "Finishing the ios build in the prepared ios folder"
162
+ );
163
+ result = await builder.finishStep();
164
+ break;
165
+ default:
166
+ throw new Error(`Unknown mode '${flags.mode}'`);
167
+ }
168
+ process.exit(result);
110
169
  };
111
170
  if (
112
171
  flags.tenantAppName &&
@@ -122,6 +181,21 @@ class BuildAppCommand extends Command {
122
181
  BuildAppCommand.description = "Build mobile app";
123
182
 
124
183
  BuildAppCommand.flags = {
184
+ mode: Flags.string({
185
+ name: "mode",
186
+ char: "m",
187
+ description:
188
+ "Build the app completely (full), " +
189
+ "prepare the ios build directory (prepare) or finish the ios build in the prepared ios folder (finish)",
190
+ options: ["full", "prepare", "finish"],
191
+ default: "full",
192
+ }),
193
+ allowShareTo: Flags.boolean({
194
+ name: "allow share to",
195
+ string: "allowShareTo",
196
+ description: "Allow sharing from other apps to this app",
197
+ default: false,
198
+ }),
125
199
  tenantAppName: Flags.string({
126
200
  name: "tenant",
127
201
  string: "tenant",
@@ -235,6 +309,12 @@ BuildAppCommand.flags = {
235
309
  string: "provisioningProfile",
236
310
  description: "This profile will be used to sign your app",
237
311
  }),
312
+ shareExtensionProvisioningProfile: Flags.string({
313
+ name: "share extension provisioning profile",
314
+ string: "shareExtensionProvisioningProfile",
315
+ description:
316
+ "This profile will be used to sign your share extension on iOS",
317
+ }),
238
318
  buildType: Flags.string({
239
319
  name: "build type",
240
320
  string: "buildType",
@@ -51,6 +51,10 @@ class ReleaseCommand extends Command {
51
51
  });
52
52
  console.log("Release begins in five seconds, press Ctrl-C to abort");
53
53
  await sleep(5000);
54
+ runCmd("cp", ["CHANGELOG.md", "packages/server/"], {
55
+ stdio: "inherit",
56
+ cwd: ".",
57
+ });
54
58
  const pkgs = {
55
59
  "@saltcorn/db-common": { dir: "db-common", publish: true },
56
60
  "@saltcorn/common-code": { dir: "common-code", publish: true },