@appsemble/cli 0.36.2-test.6 → 0.36.3-test.5
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/create.js +41 -59
- package/commands/block/create.js +18 -20
- package/lib/authentication.js +5 -9
- package/lib/project.js +3 -0
- package/package.json +15 -15
- 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.36.3-test.5)
|
|
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.36.
|
|
326
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.36.3-test.5/LICENSE.md) ©
|
|
327
327
|
[Appsemble](https://appsemble.com)
|
package/commands/app/create.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cp, readdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { logger, readData, writeData } from '@appsemble/node-utils';
|
|
4
|
-
import
|
|
4
|
+
import { checkbox, confirm, input, select } from '@inquirer/prompts';
|
|
5
5
|
import { format } from 'prettier';
|
|
6
6
|
import { parse, parseDocument, stringify } from 'yaml';
|
|
7
7
|
const templatesDir = new URL('../../templates/apps/', import.meta.url).pathname;
|
|
@@ -42,85 +42,67 @@ export async function builder(yargs) {
|
|
|
42
42
|
describe: 'Whether to append default cron-jobs to the app definition',
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
function validateAppName(
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
return false;
|
|
45
|
+
function validateAppName(value) {
|
|
46
|
+
if (value.length > 30 || value.length === 0) {
|
|
47
|
+
return 'Please input a valid app name. Name must be between 1 and 30 characters long.';
|
|
49
48
|
}
|
|
50
49
|
return true;
|
|
51
50
|
}
|
|
52
51
|
export async function handler(args) {
|
|
53
52
|
const templateChoices = await readdir(templatesDir);
|
|
54
53
|
const languageChoices = ['en', 'nl', 'ru', 'fr', 'de', 'da', 'id', 'hr'];
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
name: 'organization',
|
|
54
|
+
const organization = args.organization ||
|
|
55
|
+
(await input({
|
|
58
56
|
message: 'For which organisation is this app? (default "appsemble")',
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
})) ||
|
|
58
|
+
'appsemble';
|
|
59
|
+
const name = args.name ||
|
|
60
|
+
(await input({
|
|
62
61
|
message: 'What will be the name of the app.',
|
|
63
62
|
validate: validateAppName,
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
}));
|
|
64
|
+
const appDescription = args.description ||
|
|
65
|
+
(await input({
|
|
67
66
|
message: 'Please describe your app.',
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
choices: templateChoices,
|
|
67
|
+
})) ||
|
|
68
|
+
'';
|
|
69
|
+
const template = args.template ||
|
|
70
|
+
(await select({
|
|
73
71
|
message: 'Please choose a template to continue.',
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
choices: languageChoices,
|
|
72
|
+
choices: templateChoices.map((t) => ({ name: t, value: t })),
|
|
73
|
+
}));
|
|
74
|
+
const languages = args.languages ||
|
|
75
|
+
(await checkbox({
|
|
79
76
|
message: 'Please select the languages for your app.',
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
choices: languageChoices.map((language) => ({ name: language, value: language })),
|
|
78
|
+
}));
|
|
79
|
+
const resource = args.resource ||
|
|
80
|
+
(await input({
|
|
83
81
|
message: 'Please enter the name of sample resource to be added to the app definition.(leave empty for none)',
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
}));
|
|
83
|
+
const security = args.security ??
|
|
84
|
+
(await confirm({
|
|
87
85
|
message: 'Would you like to add a security definition to the app.',
|
|
88
|
-
type: 'confirm',
|
|
89
86
|
default: false,
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
}));
|
|
88
|
+
let groups = false;
|
|
89
|
+
if (security) {
|
|
90
|
+
groups = await confirm({
|
|
93
91
|
message: 'Will you be using groups in your app.',
|
|
94
|
-
type: 'confirm',
|
|
95
92
|
default: false,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const cronJobs = args.cronJobs ??
|
|
96
|
+
(await confirm({
|
|
100
97
|
message: 'Would you like to add a cron-job to the definition of the app.',
|
|
101
|
-
type: 'confirm',
|
|
102
98
|
default: false,
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
}));
|
|
100
|
+
const path = args.path ||
|
|
101
|
+
(await input({
|
|
106
102
|
message: 'Please enter the path for where you want the app folder to go (default "apps").',
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const path = args.path || answers.path || join(process.cwd(), 'apps');
|
|
110
|
-
const organization = answers.organization || args.organization || 'appsemble';
|
|
111
|
-
const name = answers.name || args.name;
|
|
112
|
-
const appDescription = answers.description || args.description || '';
|
|
113
|
-
const template = answers.template || args.template;
|
|
114
|
-
const languages = answers.languages || args.languages;
|
|
115
|
-
const resource = answers.resource || args.resource;
|
|
116
|
-
const security = answers.security || args.security;
|
|
117
|
-
const cronJobs = answers.cronJobs || args.cronJobs;
|
|
118
|
-
const { groups } = answers;
|
|
119
|
-
// @ts-expect-error 2345 argument of type is not assignable to parameter of type
|
|
120
|
-
// (strictNullChecks)
|
|
103
|
+
})) ||
|
|
104
|
+
join(process.cwd(), 'apps');
|
|
121
105
|
const outputDirectory = join(path, name);
|
|
122
|
-
// @ts-expect-error 2345 argument of type is not assignable to parameter of type
|
|
123
|
-
// (strictNullChecks)
|
|
124
106
|
const inputDirectory = join(`${templatesDir}/`, template);
|
|
125
107
|
const appsembleRcPath = join(inputDirectory, '.appsemblerc.yaml');
|
|
126
108
|
const [appsembleRc] = await readData(appsembleRcPath);
|
package/commands/block/create.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cp, readdir } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { logger, readData, version, writeData } from '@appsemble/node-utils';
|
|
4
|
-
import
|
|
4
|
+
import { input, select } from '@inquirer/prompts';
|
|
5
5
|
const templateDir = new URL('../../templates/blocks/', import.meta.url);
|
|
6
6
|
export const command = 'create';
|
|
7
7
|
export const description = 'Bootstrap a new Appsemble block.';
|
|
@@ -23,28 +23,26 @@ export async function builder(yargs) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
export async function handler(args) {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
name: 'organization',
|
|
26
|
+
const templateChoices = await readdir(templateDir);
|
|
27
|
+
const organization = args.organization ||
|
|
28
|
+
(await input({
|
|
30
29
|
message: 'For which organization is the block? (default "appsemble")',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
})) ||
|
|
31
|
+
'appsemble';
|
|
32
|
+
const name = args.name ||
|
|
33
|
+
(await input({
|
|
34
|
+
message: 'What should be the name of the block?',
|
|
35
|
+
}));
|
|
36
|
+
const path = args.path ||
|
|
37
|
+
(await input({
|
|
35
38
|
message: 'Please enter the path for where you want the block folder to go (default "blocks").',
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
choices,
|
|
39
|
+
})) ||
|
|
40
|
+
join(process.cwd(), 'blocks');
|
|
41
|
+
const template = args.template ||
|
|
42
|
+
(await select({
|
|
41
43
|
message: 'What kind of block project should be bootstrapped?',
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const organization = answers.organization || args.organization || 'appsemble';
|
|
45
|
-
const name = answers.name || args.name;
|
|
46
|
-
const template = answers.template || args.template;
|
|
47
|
-
const path = answers.path || args.path || join(process.cwd(), 'blocks');
|
|
44
|
+
choices: templateChoices.map((t) => ({ name: t, value: t })),
|
|
45
|
+
}));
|
|
48
46
|
const outputPath = join(path, name);
|
|
49
47
|
const inputPath = new URL(`${template}/`, templateDir);
|
|
50
48
|
const pkgPath = new URL('package.json', inputPath);
|
package/lib/authentication.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hostname } from 'node:os';
|
|
2
2
|
import { AppsembleError, assertKoaCondition, getKeytar, getService, logger, throwKoaError, } from '@appsemble/node-utils';
|
|
3
|
-
import
|
|
3
|
+
import { checkbox } from '@inquirer/prompts';
|
|
4
4
|
import Koa from 'koa';
|
|
5
5
|
import open from 'open';
|
|
6
6
|
import raw from 'raw-body';
|
|
@@ -67,14 +67,10 @@ export async function remove({ remote }) {
|
|
|
67
67
|
logger.warn('No client credentials are currently in use.');
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
choices: choices.map(({ account }) => account),
|
|
75
|
-
type: 'checkbox',
|
|
76
|
-
},
|
|
77
|
-
]);
|
|
70
|
+
const clientIds = await checkbox({
|
|
71
|
+
message: 'Select client ids to delete',
|
|
72
|
+
choices: choices.map(({ account }) => ({ name: account, value: account })),
|
|
73
|
+
});
|
|
78
74
|
await Promise.all(clientIds.map(async (clientId) => {
|
|
79
75
|
await deletePassword(getService(remote), clientId);
|
|
80
76
|
logger.info(`Successfully delete client id ${clientId}`);
|
package/lib/project.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/cli",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.3-test.5",
|
|
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.36.
|
|
48
|
-
"@appsemble/types": "0.36.
|
|
49
|
-
"@appsemble/lang-sdk": "0.36.
|
|
50
|
-
"@appsemble/utils": "0.36.
|
|
47
|
+
"@appsemble/node-utils": "0.36.3-test.5",
|
|
48
|
+
"@appsemble/types": "0.36.3-test.5",
|
|
49
|
+
"@appsemble/lang-sdk": "0.36.3-test.5",
|
|
50
|
+
"@appsemble/utils": "0.36.3-test.5",
|
|
51
51
|
"@fortawesome/fontawesome-common-types": "^6.0.0",
|
|
52
52
|
"@koa/cors": "^5.0.0",
|
|
53
53
|
"@odata/parser": "^0.2.0",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"fast-glob": "^3.0.0",
|
|
61
61
|
"form-data": "^4.0.4",
|
|
62
62
|
"global-cache-dir": "^6.0.0",
|
|
63
|
-
"inquirer": "^
|
|
63
|
+
"@inquirer/prompts": "^8.0.0",
|
|
64
64
|
"jsonschema": "~1.4.1",
|
|
65
|
-
"koa": "^
|
|
65
|
+
"koa": "^3.0.0",
|
|
66
66
|
"koa-compose": "^4.0.0",
|
|
67
67
|
"koa-compress": "^5.0.0",
|
|
68
68
|
"koa-range": "^0.3.0",
|
|
@@ -89,20 +89,20 @@
|
|
|
89
89
|
"yargs": "^17.0.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@appsemble/types": "0.36.
|
|
93
|
-
"@appsemble/server": "0.36.
|
|
92
|
+
"@appsemble/types": "0.36.3-test.5",
|
|
93
|
+
"@appsemble/server": "0.36.3-test.5",
|
|
94
94
|
"axios-test-instance": "7.0.0",
|
|
95
95
|
"bcrypt": "5.1.1",
|
|
96
|
+
"big-integer": "1.6.52",
|
|
96
97
|
"default-browser": "5.4.0",
|
|
97
98
|
"is-inside-container": "1.0.0",
|
|
98
99
|
"titleize": "4.0.0",
|
|
100
|
+
"untildify": "6.0.0",
|
|
99
101
|
"yoctocolors-cjs": "2.1.3",
|
|
100
|
-
"@inquirer/figures": "2.0.2",
|
|
101
102
|
"@types/concat-stream": "2.0.3",
|
|
102
|
-
"@types/
|
|
103
|
-
"@types/
|
|
104
|
-
"@types/koa-
|
|
105
|
-
"@types/koa-range": "0.3.5",
|
|
103
|
+
"@types/koa__cors": "5.0.1",
|
|
104
|
+
"@types/koa-compress": "4.0.7",
|
|
105
|
+
"@types/koa-range": "0.3.6",
|
|
106
106
|
"@types/normalize-path": "3.0.2",
|
|
107
107
|
"@types/postcss-import": "14.0.3",
|
|
108
108
|
"@types/postcss-url": "10.0.4",
|
|
@@ -114,6 +114,6 @@
|
|
|
114
114
|
"keytar": "^7.0.0"
|
|
115
115
|
},
|
|
116
116
|
"engines": {
|
|
117
|
-
"node": ">=
|
|
117
|
+
"node": ">=24"
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -6,7 +6,7 @@ pages:
|
|
|
6
6
|
- name: Example Page A
|
|
7
7
|
blocks:
|
|
8
8
|
- type: action-button
|
|
9
|
-
version: 0.36.
|
|
9
|
+
version: 0.36.3-test.5
|
|
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.36.
|
|
20
|
+
version: 0.36.3-test.5
|
|
21
21
|
parameters:
|
|
22
22
|
icon: arrow-left
|
|
23
23
|
actions:
|