@appsemble/cli 0.23.9 → 0.24.1
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/asset/publish.d.ts +2 -1
- package/commands/asset/publish.js +7 -1
- package/commands/{cleanupResources.d.ts → cleanupResourcesAndAssets.d.ts} +2 -2
- package/commands/{cleanupResources.js → cleanupResourcesAndAssets.js} +5 -5
- package/commands/serve.js +2 -0
- package/index.js +2 -4
- package/lib/app.js +1 -1
- package/lib/asset.d.ts +5 -1
- package/lib/asset.js +2 -1
- package/lib/serverImport.d.ts +1 -1
- package/package.json +5 -5
- package/server/models/Resource.d.ts +2 -0
- package/server/options/checkSeededResources.d.ts +1 -0
- package/server/options/checkSeededResources.js +4 -0
- package/server/options/index.d.ts +1 -0
- package/server/options/index.js +1 -0
- package/server/options/options.js +2 -1
- 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/commands/cleanupTemplateResources.d.ts +0 -6
- package/commands/cleanupTemplateResources.js +0 -40
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.24.1)
|
|
7
7
|
[](https://prettier.io)
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
@@ -304,5 +304,5 @@ appsemble run-cronjobs --interval 30
|
|
|
304
304
|
|
|
305
305
|
## License
|
|
306
306
|
|
|
307
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.
|
|
307
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.24.1/LICENSE.md) ©
|
|
308
308
|
[Appsemble](https://appsemble.com)
|
|
@@ -7,9 +7,10 @@ interface PublishAssetArguments extends BaseArguments {
|
|
|
7
7
|
appId: number;
|
|
8
8
|
context: string;
|
|
9
9
|
app: string;
|
|
10
|
+
clonable: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const command = "publish <paths...>";
|
|
12
13
|
export declare const description = "Publish assets for an existing app.";
|
|
13
14
|
export declare function builder(yargs: Argv): Argv<any>;
|
|
14
|
-
export declare function handler({ app, appId, clientCredentials, context, name, paths, remote, useFileName, }: PublishAssetArguments): Promise<void>;
|
|
15
|
+
export declare function handler({ app, appId, clientCredentials, clonable, context, name, paths, remote, useFileName, }: PublishAssetArguments): Promise<void>;
|
|
15
16
|
export {};
|
|
@@ -30,9 +30,14 @@ export function builder(yargs) {
|
|
|
30
30
|
})
|
|
31
31
|
.option('context', {
|
|
32
32
|
describe: 'If specified, use the specified context from .appsemblerc.yaml',
|
|
33
|
+
})
|
|
34
|
+
.option('clonable', {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
default: false,
|
|
37
|
+
describe: 'If true, all published assets will be clonable',
|
|
33
38
|
});
|
|
34
39
|
}
|
|
35
|
-
export async function handler({ app, appId, clientCredentials, context, name, paths, remote, useFileName, }) {
|
|
40
|
+
export async function handler({ app, appId, clientCredentials, clonable, context, name, paths, remote, useFileName, }) {
|
|
36
41
|
const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
|
|
37
42
|
await authenticate(resolvedRemote, 'assets:write', clientCredentials);
|
|
38
43
|
const normalizedPaths = paths.map((path) => normalizePath(path));
|
|
@@ -48,6 +53,7 @@ export async function handler({ app, appId, clientCredentials, context, name, pa
|
|
|
48
53
|
appId: resolvedAppId,
|
|
49
54
|
path,
|
|
50
55
|
remote: resolvedRemote,
|
|
56
|
+
clonable,
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Argv } from 'yargs';
|
|
2
2
|
import { type BaseArguments } from '../types.js';
|
|
3
|
-
export declare const command = "cleanup-resources";
|
|
4
|
-
export declare const description = "Deletes all expired resources from the database.";
|
|
3
|
+
export declare const command = "cleanup-resources-and-assets";
|
|
4
|
+
export declare const description = "Deletes all expired or ephemeral resources and assets from the database and reseeds demo apps.";
|
|
5
5
|
export declare function builder(yargs: Argv): Argv<any>;
|
|
6
6
|
export declare function handler(argv: BaseArguments): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serverImport } from '../lib/serverImport.js';
|
|
2
|
-
export const command = 'cleanup-resources';
|
|
3
|
-
export const description = 'Deletes all expired resources from the database.';
|
|
2
|
+
export const command = 'cleanup-resources-and-assets';
|
|
3
|
+
export const description = 'Deletes all expired or ephemeral resources and assets from the database and reseeds demo apps.';
|
|
4
4
|
export function builder(yargs) {
|
|
5
5
|
return yargs
|
|
6
6
|
.option('database-host', {
|
|
@@ -33,8 +33,8 @@ export function builder(yargs) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
export async function handler(argv) {
|
|
36
|
-
const {
|
|
36
|
+
const { cleanupResourcesAndAssets, setArgv } = await serverImport('setArgv', 'cleanupResourcesAndAssets');
|
|
37
37
|
setArgv(argv);
|
|
38
|
-
return
|
|
38
|
+
return cleanupResourcesAndAssets();
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=cleanupResourcesAndAssets.js.map
|
package/commands/serve.js
CHANGED
|
@@ -71,6 +71,8 @@ export async function handler(argv) {
|
|
|
71
71
|
name: 'dev',
|
|
72
72
|
primaryEmail: 'dev@example.com',
|
|
73
73
|
role: passedUserRole || (appSecurity === null || appSecurity === void 0 ? void 0 : appSecurity.default.role),
|
|
74
|
+
demo: false,
|
|
75
|
+
properties: {},
|
|
74
76
|
},
|
|
75
77
|
];
|
|
76
78
|
const allowedTeamRoles = ['manager', 'member'];
|
package/index.js
CHANGED
|
@@ -7,8 +7,7 @@ import * as app from './commands/app/index.js';
|
|
|
7
7
|
import * as asset from './commands/asset/index.js';
|
|
8
8
|
import * as block from './commands/block/index.js';
|
|
9
9
|
import * as cleanupDemoUsers from './commands/cleanupDemoUsers.js';
|
|
10
|
-
import * as
|
|
11
|
-
import * as cleanupTemplateResources from './commands/cleanupTemplateResources.js';
|
|
10
|
+
import * as cleanupResourcesAndAssets from './commands/cleanupResourcesAndAssets.js';
|
|
12
11
|
import * as config from './commands/config/index.js';
|
|
13
12
|
import * as login from './commands/login.js';
|
|
14
13
|
import * as logout from './commands/logout.js';
|
|
@@ -48,9 +47,8 @@ let parser = yargs(process.argv.slice(2))
|
|
|
48
47
|
.command(app)
|
|
49
48
|
.command(asset)
|
|
50
49
|
.command(block)
|
|
51
|
-
.command(
|
|
50
|
+
.command(cleanupResourcesAndAssets)
|
|
52
51
|
.command(cleanupDemoUsers)
|
|
53
|
-
.command(cleanupTemplateResources)
|
|
54
52
|
.command(config)
|
|
55
53
|
.command(login)
|
|
56
54
|
.command(logout)
|
package/lib/app.js
CHANGED
|
@@ -546,7 +546,7 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
|
|
|
546
546
|
}
|
|
547
547
|
if (modifyContext && appsembleContext && context && !dryRun) {
|
|
548
548
|
rc.context[context].id = data.id;
|
|
549
|
-
await writeData(join(path, '.appsemblerc.yaml'), rc);
|
|
549
|
+
await writeData(join(path, '.appsemblerc.yaml'), rc, { sort: false });
|
|
550
550
|
logger.info(`Updated .appsemblerc: Set context.${context}.id to ${data.id}`);
|
|
551
551
|
}
|
|
552
552
|
const { host, protocol } = new URL(remote);
|
package/lib/asset.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ interface PublishAssetParams {
|
|
|
16
16
|
* The remote server to publish the asset on.
|
|
17
17
|
*/
|
|
18
18
|
remote: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the asset should be clonable.
|
|
21
|
+
*/
|
|
22
|
+
clonable: boolean;
|
|
19
23
|
}
|
|
20
|
-
export declare function publishAsset({ appId, name, path, remote, }: PublishAssetParams): Promise<void>;
|
|
24
|
+
export declare function publishAsset({ appId, clonable, name, path, remote, }: PublishAssetParams): Promise<void>;
|
|
21
25
|
export {};
|
package/lib/asset.js
CHANGED
|
@@ -3,10 +3,11 @@ import { logger } from '@appsemble/node-utils';
|
|
|
3
3
|
import { normalize } from '@appsemble/utils';
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import FormData from 'form-data';
|
|
6
|
-
export async function publishAsset({ appId, name, path, remote, }) {
|
|
6
|
+
export async function publishAsset({ appId, clonable, name, path, remote, }) {
|
|
7
7
|
const formData = new FormData();
|
|
8
8
|
const file = createReadStream(path);
|
|
9
9
|
formData.append('file', file);
|
|
10
|
+
formData.append('clonable', String(clonable));
|
|
10
11
|
if (name) {
|
|
11
12
|
formData.append('name', normalize(name));
|
|
12
13
|
}
|
package/lib/serverImport.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param members The names of the exported member to import.
|
|
5
5
|
* @returns The exported member.
|
|
6
6
|
*/
|
|
7
|
-
export declare function serverImport<T extends 'cleanupDemoUsers' | '
|
|
7
|
+
export declare function serverImport<T extends 'cleanupDemoUsers' | 'cleanupResourcesAndAssets' | 'migrate' | 'runCronJobs' | 'setArgv' | 'start'>(...members: T[]): Promise<Record<T, any>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "The CLI for developing with Appsemble apps and blocks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"test": "vitest"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@appsemble/node-utils": "0.
|
|
46
|
-
"@appsemble/types": "0.
|
|
47
|
-
"@appsemble/utils": "0.
|
|
45
|
+
"@appsemble/node-utils": "0.24.1",
|
|
46
|
+
"@appsemble/types": "0.24.1",
|
|
47
|
+
"@appsemble/utils": "0.24.1",
|
|
48
48
|
"@fortawesome/fontawesome-common-types": "^6.0.0",
|
|
49
49
|
"@koa/cors": "^4.0.0",
|
|
50
50
|
"@odata/parser": "^0.2.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"yargs": "^17.0.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@appsemble/types": "0.
|
|
89
|
+
"@appsemble/types": "0.24.1",
|
|
90
90
|
"@types/concat-stream": "^2.0.0",
|
|
91
91
|
"@types/inquirer": "^9.0.0",
|
|
92
92
|
"@types/normalize-path": "^3.0.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkSeededResources(): Promise<boolean>;
|
package/server/options/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { applyAppServiceSecrets, checkRole, createAppAsset, createAppResourcesWithAssets, createSettings, createTheme, deleteAppAsset, deleteAppResource, email, getApp, getAppAssets, getAppBlockStyles, getAppDetails, getAppIcon, getAppMembers, getAppMessages, getAppResource, getAppResources, getAppScreenshots, getAppStyles, getAppTeams, getAppUrl, getAppUserInfo, getBlockAsset, getBlockMessages, getBlocksAssetsPaths, getCsp, getDbUpdated, getHost, getTheme, parseQuery, reloadUser, sendNotifications, updateAppResource, verifyResourceActionPermission, } from './index.js';
|
|
1
|
+
import { applyAppServiceSecrets, checkRole, checkSeededResources, createAppAsset, createAppResourcesWithAssets, createSettings, createTheme, deleteAppAsset, deleteAppResource, email, getApp, getAppAssets, getAppBlockStyles, getAppDetails, getAppIcon, getAppMembers, getAppMessages, getAppResource, getAppResources, getAppScreenshots, getAppStyles, getAppTeams, getAppUrl, getAppUserInfo, getBlockAsset, getBlockMessages, getBlocksAssetsPaths, getCsp, getDbUpdated, getHost, getTheme, parseQuery, reloadUser, sendNotifications, updateAppResource, verifyResourceActionPermission, } from './index.js';
|
|
2
2
|
export const options = {
|
|
3
3
|
applyAppServiceSecrets,
|
|
4
4
|
checkRole,
|
|
5
|
+
checkSeededResources,
|
|
5
6
|
createAppAsset,
|
|
6
7
|
createAppResourcesWithAssets,
|
|
7
8
|
createSettings,
|
|
@@ -6,7 +6,7 @@ pages:
|
|
|
6
6
|
- name: Example Page A
|
|
7
7
|
blocks:
|
|
8
8
|
- type: action-button
|
|
9
|
-
version: 0.
|
|
9
|
+
version: 0.24.1
|
|
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.
|
|
20
|
+
version: 0.24.1
|
|
21
21
|
parameters:
|
|
22
22
|
icon: arrow-left
|
|
23
23
|
actions:
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Argv } from 'yargs';
|
|
2
|
-
import { type BaseArguments } from '../types.js';
|
|
3
|
-
export declare const command = "cleanup-template-resources";
|
|
4
|
-
export declare const description = "Deletes all non-clonable resources belonging to template apps from the database.";
|
|
5
|
-
export declare function builder(yargs: Argv): Argv<any>;
|
|
6
|
-
export declare function handler(argv: BaseArguments): Promise<void>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { serverImport } from '../lib/serverImport.js';
|
|
2
|
-
export const command = 'cleanup-template-resources';
|
|
3
|
-
export const description = 'Deletes all non-clonable resources belonging to template apps from the database.';
|
|
4
|
-
export function builder(yargs) {
|
|
5
|
-
return yargs
|
|
6
|
-
.option('database-host', {
|
|
7
|
-
desc: 'The host of the database to connect to. This defaults to the connected database container.',
|
|
8
|
-
})
|
|
9
|
-
.option('database-port', {
|
|
10
|
-
desc: 'The port of the database to connect to.',
|
|
11
|
-
type: 'number',
|
|
12
|
-
default: 5432,
|
|
13
|
-
})
|
|
14
|
-
.option('database-ssl', {
|
|
15
|
-
desc: 'Use SSL to connect to the database.',
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
})
|
|
18
|
-
.option('database-name', {
|
|
19
|
-
desc: 'The name of the database to connect to.',
|
|
20
|
-
implies: ['database-user', 'database-password'],
|
|
21
|
-
})
|
|
22
|
-
.option('database-user', {
|
|
23
|
-
desc: 'The user to use to login to the database.',
|
|
24
|
-
implies: ['database-name', 'database-password'],
|
|
25
|
-
})
|
|
26
|
-
.option('database-password', {
|
|
27
|
-
desc: 'The password to use to login to the database.',
|
|
28
|
-
implies: ['database-name', 'database-user'],
|
|
29
|
-
})
|
|
30
|
-
.option('database-url', {
|
|
31
|
-
desc: 'A connection string for the database to connect to. This is an alternative to the separate database related variables.',
|
|
32
|
-
conflicts: ['database-host', 'database-name', 'database-user', 'database-password'],
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export async function handler(argv) {
|
|
36
|
-
const { cleanupTemplateResources, setArgv } = await serverImport('setArgv', 'cleanupTemplateResources');
|
|
37
|
-
setArgv(argv);
|
|
38
|
-
return cleanupTemplateResources();
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=cleanupTemplateResources.js.map
|