@appsemble/cli 0.27.10 → 0.27.11

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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.10/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.11/config/assets/logo.svg) Appsemble CLI
2
2
 
3
3
  > Manage apps and blocks from the command line.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/cli)](https://www.npmjs.com/package/@appsemble/cli)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.10/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.10)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.11/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.11)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -323,5 +323,5 @@ appsemble run-cronjobs --interval 30
323
323
 
324
324
  ## License
325
325
 
326
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.10/LICENSE.md) ©
326
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.11/LICENSE.md) ©
327
327
  [Appsemble](https://appsemble.com)
@@ -0,0 +1 @@
1
+ Test App
package/commands/serve.js CHANGED
@@ -56,7 +56,7 @@ export function builder(yargs) {
56
56
  export async function handler(argv) {
57
57
  setArgv(argv);
58
58
  const appPath = join(process.cwd(), argv.path);
59
- const [, , appsembleApp] = await traverseAppDirectory(appPath, new FormData());
59
+ const [, , , appsembleApp] = await traverseAppDirectory(appPath, 'development', new FormData());
60
60
  const appRoles = appsembleApp.definition.roles;
61
61
  const passedUserRole = argv['user-role'];
62
62
  if (passedUserRole && !(appRoles === null || appRoles === void 0 ? void 0 : appRoles.includes(passedUserRole))) {
package/lib/app.d.ts CHANGED
@@ -1,8 +1,56 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import { type ReadStream } from 'node:fs';
4
- import { type App, type AppLock, type AppsembleRC, type AppVisibility } from '@appsemble/types';
4
+ import { type App, type AppLock, type AppsembleContext, type AppsembleRC, type AppVisibility } from '@appsemble/types';
5
5
  import FormData from 'form-data';
6
+ /**
7
+ * Traverses an app directory and appends the files it finds to the given FormData object.
8
+ *
9
+ * @param path The path of the app directory to traverse.
10
+ * @param context The Context to use from `.appsemblerc.yaml`.
11
+ * @param formData The FormData object to append the results into..
12
+ * @returns The context from `.appsemblerc.yaml` if a match was found.
13
+ */
14
+ export declare function traverseAppDirectory(path: string, context: string, formData: FormData): Promise<[AppsembleContext, AppsembleRC, string, App]>;
15
+ /**
16
+ * Export an app as a zip file.
17
+ *
18
+ * @param appId Id of the app to be exported.
19
+ * @param assets Boolean representing whether to include assets in the exported zip file.
20
+ * @param resources Boolean representing whether to include resources in the zip file.
21
+ * @param path Path of the folder where you want to put your downloaded file.
22
+ * @param remote The remote to fetch the app from.
23
+ */
24
+ export declare function exportAppAsZip(appId: number, assets: boolean, resources: boolean, path: string, remote: string): Promise<void>;
25
+ /**
26
+ * Upload messages for an app.
27
+ *
28
+ * @param path The path to the app directory.
29
+ * @param appId The app id to upload the messages for.
30
+ * @param remote The remote to upload the messages to.
31
+ * @param force Whether or not to force the update for locked apps.
32
+ */
33
+ export declare function uploadMessages(path: string, appId: number, remote: string, force: boolean): Promise<void>;
34
+ export declare function publishSeedResources(path: string, app: App, remote: string): Promise<void>;
35
+ export declare function publishSeedAssets(path: string, app: App, remote: string, assetsClonable: boolean): Promise<void>;
36
+ /**
37
+ * @param path The path to the app directory.
38
+ * @param languages A list of languages for which translations should be added in addition to the
39
+ * existing ones.
40
+ * @param verify A list of languages to verify.
41
+ * @param format The file format that should be used for the output.
42
+ */
43
+ export declare function writeAppMessages(path: string, languages: string[], verify: string[], format: 'json' | 'yaml'): Promise<void>;
44
+ /**
45
+ * Resolve the app’s ID and remote based on the app context.
46
+ *
47
+ * @param appPath The path to the app.
48
+ * @param name Which context to use in the AppsembleRC file.
49
+ * @param defaultRemote The remote to fall back to.
50
+ * @param defaultAppId The app ID to fall back to.
51
+ * @returns The resolved app ID and remote.
52
+ */
53
+ export declare function resolveAppIdAndRemote(appPath: string, name: string, defaultRemote: string, defaultAppId: number): Promise<[number, string]>;
6
54
  interface PublishAppParams {
7
55
  /**
8
56
  * The OAuth2 client credentials to use.
@@ -35,19 +83,15 @@ interface PublishAppParams {
35
83
  /**
36
84
  * Whether the App should be marked as a template.
37
85
  */
38
- template: boolean;
86
+ template?: boolean;
39
87
  /**
40
88
  * Whether the App should be used in demo mode.
41
89
  */
42
- demoMode: boolean;
43
- /**
44
- * Whether the App should seed resources and assets in demo mode.
45
- */
46
- seed: boolean;
90
+ demoMode?: boolean;
47
91
  /**
48
92
  * The icon to upload.
49
93
  */
50
- icon: NodeJS.ReadStream | ReadStream;
94
+ icon?: NodeJS.ReadStream | ReadStream;
51
95
  /**
52
96
  * The background color to use for the icon in opaque contexts.
53
97
  */
@@ -55,28 +99,28 @@ interface PublishAppParams {
55
99
  /**
56
100
  * The maskable icon to upload.
57
101
  */
58
- maskableIcon: NodeJS.ReadStream | ReadStream;
102
+ maskableIcon?: NodeJS.ReadStream | ReadStream;
59
103
  /**
60
104
  * Whether the API should be called with a dry run.
61
105
  */
62
- dryRun: boolean;
106
+ dryRun?: boolean;
63
107
  /**
64
108
  * Whether resources from the `resources` directory should be published after publishing the app.
65
109
  */
66
- resources: boolean;
110
+ resources?: boolean;
67
111
  /**
68
112
  * Whether assets from the `assets` directory should be published after publishing the app.
69
113
  */
70
- assets: boolean;
114
+ assets?: boolean;
71
115
  /**
72
116
  * Whether published assets should be clonable. Ignored if `assets` equals false.
73
117
  */
74
- assetsClonable: boolean;
118
+ assetsClonable?: boolean;
75
119
  /**
76
120
  * If the app context is specified,
77
121
  * modify it for the current context to include the id of the published app.
78
122
  */
79
- modifyContext: boolean;
123
+ modifyContext?: boolean;
80
124
  /**
81
125
  * The ID to use for Google Analytics for the app.
82
126
  */
@@ -90,6 +134,12 @@ interface PublishAppParams {
90
134
  */
91
135
  sentryEnvironment?: string;
92
136
  }
137
+ /**
138
+ * Publish a new app.
139
+ *
140
+ * @param options The options to use for publishing an app.
141
+ */
142
+ export declare function publishApp({ clientCredentials, context, dryRun, modifyContext, path, ...options }: PublishAppParams): Promise<void>;
93
143
  interface UpdateAppParams {
94
144
  /**
95
145
  * The OAuth2 client credentials to use.
@@ -122,23 +172,23 @@ interface UpdateAppParams {
122
172
  /**
123
173
  * Whether the App should be marked as a template.
124
174
  */
125
- template: boolean;
175
+ template?: boolean;
126
176
  /**
127
177
  * Whether the App should be used in demo mode.
128
178
  */
129
- demoMode: boolean;
179
+ demoMode?: boolean;
130
180
  /**
131
181
  * Whether resources from the `resources` directory should be published after publishing the app.
132
182
  */
133
- resources: boolean;
183
+ resources?: boolean;
134
184
  /**
135
185
  * Whether assets from the `assets` directory should be published after publishing the app.
136
186
  */
137
- assets: boolean;
187
+ assets?: boolean;
138
188
  /**
139
189
  * Whether published assets should be clonable. Ignored if `assets` equals false.
140
190
  */
141
- assetsClonable: boolean;
191
+ assetsClonable?: boolean;
142
192
  /**
143
193
  * Whether the locked property should be ignored.
144
194
  */
@@ -146,15 +196,15 @@ interface UpdateAppParams {
146
196
  /**
147
197
  * The icon to upload.
148
198
  */
149
- icon: NodeJS.ReadStream | ReadStream;
199
+ icon?: NodeJS.ReadStream | ReadStream;
150
200
  /**
151
201
  * The background color to use for the icon in opaque contexts.
152
202
  */
153
- iconBackground: string;
203
+ iconBackground?: string;
154
204
  /**
155
205
  * The maskable icon to upload.
156
206
  */
157
- maskableIcon: NodeJS.ReadStream | ReadStream;
207
+ maskableIcon?: NodeJS.ReadStream | ReadStream;
158
208
  /**
159
209
  * The ID to use for Google Analytics for the app.
160
210
  */
@@ -168,65 +218,12 @@ interface UpdateAppParams {
168
218
  */
169
219
  sentryEnvironment?: string;
170
220
  }
171
- /**
172
- * Traverses an app directory and appends the files it finds to the given FormData object.
173
- *
174
- * @param path The path of the app directory to traverse.
175
- * @param formData The FormData object to append the results into..
176
- * @returns The context from `.appsemblerc.yaml` if a match was found.
177
- */
178
- export declare function traverseAppDirectory(path: string, formData: FormData): Promise<[AppsembleRC, string, App]>;
179
- /**
180
- * Export an app as a zip file.
181
- *
182
- * @param appId Id of the app to be exported.
183
- * @param assets Boolean representing whether to include assets in the exported zip file.
184
- * @param resources Boolean representing whether to include resources in the zip file.
185
- * @param path Path of the folder where you want to put your downloaded file.
186
- * @param remote The remote to fetch the app from.
187
- */
188
- export declare function exportAppAsZip(appId: number, assets: boolean, resources: boolean, path: string, remote: string): Promise<void>;
189
- /**
190
- * Upload messages for an app.
191
- *
192
- * @param path The path to the app directory.
193
- * @param appId The app id to upload the messages for.
194
- * @param remote The remote to upload the messages to.
195
- * @param force Whether or not to force the update for locked apps.
196
- */
197
- export declare function uploadMessages(path: string, appId: number, remote: string, force: boolean): Promise<void>;
198
- export declare function publishSeedResources(path: string, app: App, remote: string): Promise<void>;
199
- export declare function publishSeedAssets(path: string, app: App, remote: string, assetsClonable: boolean): Promise<void>;
200
- /**
201
- * @param path The path to the app directory.
202
- * @param languages A list of languages for which translations should be added in addition to the
203
- * existing ones.
204
- * @param verify A list of languages to verify.
205
- * @param format The file format that should be used for the output.
206
- */
207
- export declare function writeAppMessages(path: string, languages: string[], verify: string[], format: 'json' | 'yaml'): Promise<void>;
208
221
  /**
209
222
  * Update an existing app.
210
223
  *
211
224
  * @param argv The command line options used for updating the app.
212
225
  */
213
226
  export declare function updateApp({ clientCredentials, context, force, path, ...options }: UpdateAppParams): Promise<void>;
214
- /**
215
- * Publish a new app.
216
- *
217
- * @param options The options to use for publishing an app.
218
- */
219
- export declare function publishApp({ clientCredentials, context, dryRun, modifyContext, path, ...options }: PublishAppParams): Promise<void>;
220
- /**
221
- * Resolve the app’s ID and remote based on the app context.
222
- *
223
- * @param appPath The path to the app.
224
- * @param name Which context to use in the AppsembleRC file.
225
- * @param defaultRemote The remote to fall back to.
226
- * @param defaultAppId The app ID to fall back to.
227
- * @returns The resolved app ID and remote.
228
- */
229
- export declare function resolveAppIdAndRemote(appPath: string, name: string, defaultRemote: string, defaultAppId: number): Promise<[number, string]>;
230
227
  interface PatchAppParams {
231
228
  /**
232
229
  * The path at which the app is hosted.