@appsemble/cli 0.34.15 → 0.34.16
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 +3 -3
- package/commands/app/publish.js +4 -0
- package/commands/app/update.js +4 -0
- package/lib/app.d.ts +9 -0
- package/lib/app.js +33 -1
- package/package.json +7 -7
- package/templates/apps/empty/app-definition.yaml +2 -2
- package/templates/blocks/mini-jsx/package.json +1 -1
- package/templates/blocks/preact/package.json +2 -2
- package/templates/blocks/vanilla/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#  Appsemble CLI
|
|
2
2
|
|
|
3
3
|
> Manage apps and blocks from the command line.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@appsemble/cli)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.34.16)
|
|
7
7
|
[](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.34.
|
|
326
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.34.16/LICENSE.md) ©
|
|
327
327
|
[Appsemble](https://appsemble.com)
|
package/commands/app/publish.js
CHANGED
|
@@ -51,6 +51,10 @@ export function builder(yargs) {
|
|
|
51
51
|
.option('resources', {
|
|
52
52
|
describe: 'Whether the resources from the `resources` directory should be created after publishing the app. The names of sub-directories are used as the name of the resource, otherwise the names of top level resource .json files are used instead.',
|
|
53
53
|
type: 'boolean',
|
|
54
|
+
})
|
|
55
|
+
.option('members', {
|
|
56
|
+
describe: '',
|
|
57
|
+
type: 'boolean',
|
|
54
58
|
})
|
|
55
59
|
.option('assets', {
|
|
56
60
|
describe: 'Whether the assets from the `assets` directory should be created after publishing the app.',
|
package/commands/app/update.js
CHANGED
|
@@ -50,6 +50,10 @@ export function builder(yargs) {
|
|
|
50
50
|
.option('resources', {
|
|
51
51
|
describe: 'Whether the resources from the `resources` directory should replace the seed resources of the app being updated. The names of sub-directories are used as the name of the resource, otherwise the names of top level resource .json files are used instead.',
|
|
52
52
|
type: 'boolean',
|
|
53
|
+
})
|
|
54
|
+
.option('members', {
|
|
55
|
+
describe: '',
|
|
56
|
+
type: 'boolean',
|
|
53
57
|
})
|
|
54
58
|
.option('assets', {
|
|
55
59
|
describe: 'Whether the assets from the `assets` directory should replace the seed assets of the app being updated.',
|
package/lib/app.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ interface DeleteAppArgs {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function deleteApp({ clientCredentials, id, remote }: DeleteAppArgs): Promise<void>;
|
|
39
39
|
export declare function publishSeedResources(path: string, app: App, remote: string): Promise<void>;
|
|
40
|
+
export declare function publishSeedAppMembers(path: string, app: App, remote: string): Promise<void>;
|
|
40
41
|
export declare function publishSeedAssets(path: string, app: App, remote: string, assetsClonable: boolean): Promise<void>;
|
|
41
42
|
export declare function parseValues(type: string, name: string, valuesToParse: Record<string, ValueFromDefinition>[]): [Record<string, ValueFromProcess>, boolean];
|
|
42
43
|
export declare function publishAppConfig(path: string, app: App, remote: string): Promise<void>;
|
|
@@ -115,6 +116,10 @@ interface PublishAppParams {
|
|
|
115
116
|
* Whether resources from the `resources` directory should be published after publishing the app.
|
|
116
117
|
*/
|
|
117
118
|
resources?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Whether to publish seed members from `members/index.json` after publishing the app.
|
|
121
|
+
*/
|
|
122
|
+
members?: boolean;
|
|
118
123
|
/**
|
|
119
124
|
* Whether assets from the `assets` directory should be published after publishing the app.
|
|
120
125
|
*/
|
|
@@ -188,6 +193,10 @@ interface UpdateAppParams {
|
|
|
188
193
|
* Whether resources from the `resources` directory should be published after publishing the app.
|
|
189
194
|
*/
|
|
190
195
|
resources?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Whether to publish seed members from `members/index.json` after publishing the app.
|
|
198
|
+
*/
|
|
199
|
+
members?: boolean;
|
|
191
200
|
/**
|
|
192
201
|
* Whether assets from the `assets` directory should be published after publishing the app.
|
|
193
202
|
*/
|
package/lib/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cpSync, createReadStream, createWriteStream, existsSync } from 'node:fs';
|
|
2
|
-
import { mkdir, readdir, rm, stat } from 'node:fs/promises';
|
|
2
|
+
import { mkdir, readdir, readFile, rm, stat } from 'node:fs/promises';
|
|
3
3
|
import { basename, dirname, join, parse, relative, resolve } from 'node:path';
|
|
4
4
|
import { inspect } from 'node:util';
|
|
5
5
|
import { normalizeBlockName } from '@appsemble/lang-sdk';
|
|
@@ -329,6 +329,30 @@ export async function publishSeedResources(path, app, remote) {
|
|
|
329
329
|
logger.warn(`Missing resources directory in ${path}. Skipping...`);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
+
export async function publishSeedAppMembers(path, app, remote) {
|
|
333
|
+
const membersPath = join(path, 'members', 'index.json');
|
|
334
|
+
logger.info(`Publishing seed app members from ${membersPath}`);
|
|
335
|
+
if (existsSync(membersPath)) {
|
|
336
|
+
logger.info(`Deleting seed app members from app ${app.id}`);
|
|
337
|
+
try {
|
|
338
|
+
await axios.delete(`/api/apps/${app.id}/demo-members`, {
|
|
339
|
+
baseURL: remote,
|
|
340
|
+
});
|
|
341
|
+
const membersContent = await readFile(membersPath, 'utf8');
|
|
342
|
+
const members = JSON.parse(membersContent);
|
|
343
|
+
await axios({
|
|
344
|
+
url: `/api/apps/${app.id}/demo-members`,
|
|
345
|
+
baseURL: remote,
|
|
346
|
+
data: members,
|
|
347
|
+
method: 'post',
|
|
348
|
+
});
|
|
349
|
+
logger.info(`Seeded ${members.length} members successfully`);
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
logger.error(error);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
332
356
|
export async function publishSeedAssets(path, app, remote, assetsClonable) {
|
|
333
357
|
const assetsPath = join(path, 'assets');
|
|
334
358
|
logger.info(`Publishing seed assets from ${assetsPath}`);
|
|
@@ -782,6 +806,7 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
|
|
|
782
806
|
const googleAnalyticsId = appsembleContext.googleAnalyticsId ?? options.googleAnalyticsId;
|
|
783
807
|
const assets = appsembleContext.assets ?? options.assets;
|
|
784
808
|
const resources = appsembleContext.resources ?? options.resources;
|
|
809
|
+
const members = appsembleContext.members ?? options.members;
|
|
785
810
|
const appLock = appsembleContext.appLock || 'unlocked';
|
|
786
811
|
logger.verbose(`App remote: ${remote}`);
|
|
787
812
|
logger.verbose(`App organization: ${organizationId}`);
|
|
@@ -863,6 +888,9 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
|
|
|
863
888
|
if (resources) {
|
|
864
889
|
await publishSeedResources(appVariantPath, data, remote);
|
|
865
890
|
}
|
|
891
|
+
if (members) {
|
|
892
|
+
await publishSeedAppMembers(appVariantPath, data, remote);
|
|
893
|
+
}
|
|
866
894
|
}
|
|
867
895
|
if (modifyContext && appsembleContext && context && !dryRun) {
|
|
868
896
|
// @ts-expect-error 2345 argument of type is not assignable to parameter of type
|
|
@@ -955,6 +983,7 @@ export async function updateApp({ clientCredentials, context, force, path, ...op
|
|
|
955
983
|
const sentryEnvironment = appsembleContext.sentryEnvironment ?? options.sentryEnvironment;
|
|
956
984
|
const googleAnalyticsId = appsembleContext.googleAnalyticsId ?? options.googleAnalyticsId;
|
|
957
985
|
const resources = appsembleContext.resources ?? options.resources;
|
|
986
|
+
const members = appsembleContext.members ?? options.members;
|
|
958
987
|
const assets = appsembleContext.assets ?? options.assets;
|
|
959
988
|
const { appLock } = appsembleContext;
|
|
960
989
|
logger.info(`App id: ${id}`);
|
|
@@ -1041,6 +1070,9 @@ export async function updateApp({ clientCredentials, context, force, path, ...op
|
|
|
1041
1070
|
if (resources && (data.locked !== 'fullLock' || force)) {
|
|
1042
1071
|
await publishSeedResources(appVariantPath, data, remote);
|
|
1043
1072
|
}
|
|
1073
|
+
if (members && (data.locked !== 'fullLock' || force)) {
|
|
1074
|
+
await publishSeedAppMembers(appVariantPath, data, remote);
|
|
1075
|
+
}
|
|
1044
1076
|
}
|
|
1045
1077
|
const { host, protocol } = new URL(remote);
|
|
1046
1078
|
logger.info(`Successfully updated app ${data.definition.name}! 🙌`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/cli",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.16",
|
|
4
4
|
"description": "The CLI for developing with Appsemble apps and blocks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"test": "vitest"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@appsemble/node-utils": "0.34.
|
|
48
|
-
"@appsemble/types": "0.34.
|
|
49
|
-
"@appsemble/lang-sdk": "0.34.
|
|
50
|
-
"@appsemble/utils": "0.34.
|
|
47
|
+
"@appsemble/node-utils": "0.34.16",
|
|
48
|
+
"@appsemble/types": "0.34.16",
|
|
49
|
+
"@appsemble/lang-sdk": "0.34.16",
|
|
50
|
+
"@appsemble/utils": "0.34.16",
|
|
51
51
|
"@fortawesome/fontawesome-common-types": "^6.0.0",
|
|
52
52
|
"@koa/cors": "^5.0.0",
|
|
53
53
|
"@odata/parser": "^0.2.0",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"yargs": "^17.0.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@appsemble/types": "0.34.
|
|
94
|
-
"@appsemble/server": "0.34.
|
|
93
|
+
"@appsemble/types": "0.34.16",
|
|
94
|
+
"@appsemble/server": "0.34.16",
|
|
95
95
|
"bcrypt": "5.1.1",
|
|
96
96
|
"axios-test-instance": "7.0.0",
|
|
97
97
|
"@types/concat-stream": "2.0.3",
|
|
@@ -6,7 +6,7 @@ pages:
|
|
|
6
6
|
- name: Example Page A
|
|
7
7
|
blocks:
|
|
8
8
|
- type: action-button
|
|
9
|
-
version: 0.34.
|
|
9
|
+
version: 0.34.16
|
|
10
10
|
parameters:
|
|
11
11
|
icon: arrow-right
|
|
12
12
|
actions:
|
|
@@ -17,7 +17,7 @@ pages:
|
|
|
17
17
|
- name: Example Page B
|
|
18
18
|
blocks:
|
|
19
19
|
- type: action-button
|
|
20
|
-
version: 0.34.
|
|
20
|
+
version: 0.34.16
|
|
21
21
|
parameters:
|
|
22
22
|
icon: arrow-left
|
|
23
23
|
actions:
|