@appsemble/cli 0.36.5-test.6 → 0.36.6-test.0

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.36.5-test.6/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.36.6-test.0/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.36.5-test.6/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.36.5-test.6)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.36.6-test.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.36.6-test.0)
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.36.5-test.6/LICENSE.md) ©
326
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.36.6-test.0/LICENSE.md) ©
327
327
  [Appsemble](https://appsemble.com)
@@ -3,9 +3,6 @@ export const command = 'restore-data-from-backup';
3
3
  export const description = 'Restore appsemble data from a specified backup for the main database and app databases';
4
4
  export function builder(yargs) {
5
5
  return yargs
6
- .option('aesSecret', {
7
- desc: 'Aes Secret used for encrypting DB password in the backup DB',
8
- })
9
6
  .option('database-host', {
10
7
  desc: 'The host of the database to connect to. This defaults to the connected database container.',
11
8
  })
package/lib/config.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  import { type ProjectBuildConfig, type ProjectImplementations } from '@appsemble/types';
2
+ import { type PackageJson } from 'type-fest';
2
3
  import { type Configuration } from 'webpack';
4
+ /**
5
+ * Extract a repository URL from package.json's repository field.
6
+ *
7
+ * @param pkg The package.json content.
8
+ * @returns A URL to the repository, or undefined if not available.
9
+ */
10
+ export declare function getRepositoryUrl(pkg: PackageJson): string | undefined;
3
11
  /**
4
12
  * Get the build configuration from a project directory.
5
13
  *
package/lib/config.js CHANGED
@@ -9,6 +9,29 @@ import { parse } from 'comment-parser';
9
9
  import { cosmiconfig } from 'cosmiconfig';
10
10
  import normalizePath from 'normalize-path';
11
11
  import { createFormatter, createParser, SchemaGenerator, ts } from 'ts-json-schema-generator';
12
+ /**
13
+ * Extract a repository URL from package.json's repository field.
14
+ *
15
+ * @param pkg The package.json content.
16
+ * @returns A URL to the repository, or undefined if not available.
17
+ */
18
+ export function getRepositoryUrl(pkg) {
19
+ const repo = pkg.repository;
20
+ if (!repo) {
21
+ return undefined;
22
+ }
23
+ if (typeof repo === 'string') {
24
+ return repo;
25
+ }
26
+ if (!repo.url) {
27
+ return undefined;
28
+ }
29
+ const baseUrl = repo.url.replace(/\.git$/, '');
30
+ if (!repo.directory) {
31
+ return baseUrl;
32
+ }
33
+ return `${baseUrl}/-/tree/main/${repo.directory}`;
34
+ }
12
35
  /**
13
36
  * Get the build configuration from a project directory.
14
37
  *
@@ -36,6 +59,7 @@ export async function getProjectBuildConfig(dir) {
36
59
  longDescription,
37
60
  name: pkg.name,
38
61
  version: pkg.version,
62
+ repositoryUrl: getRepositoryUrl(pkg),
39
63
  dir,
40
64
  ...config,
41
65
  };
package/lib/output.d.ts CHANGED
@@ -1,2 +1,10 @@
1
1
  import { type ValidationError } from 'jsonschema';
2
+ /**
3
+ * Format validation errors from an Axios response as `file:line:col` messages when possible.
4
+ *
5
+ * @param filename The YAML file path shown in the output.
6
+ * @param yaml The YAML source text.
7
+ * @param errors The validation errors returned by the API.
8
+ * @returns A newline-separated list of formatted validation messages.
9
+ */
2
10
  export declare function printAxiosError(filename: string, yaml: string, errors: ValidationError[]): string;
package/lib/output.js CHANGED
@@ -1,15 +1,58 @@
1
- import { isNode, LineCounter, parseDocument } from 'yaml';
1
+ import { isAlias, isNode, LineCounter, parseDocument, YAMLMap, YAMLSeq, } from 'yaml';
2
+ /**
3
+ * Resolve a validation path to the original YAML node, even when the path crosses aliases.
4
+ *
5
+ * Validation errors are produced from the fully expanded app definition, but the YAML AST still
6
+ * contains alias nodes such as `*item-form-fields`. `doc.getIn()` stops at those aliases,
7
+ * so we walk the path manually and resolve aliases along the way to recover the source node.
8
+ *
9
+ * @param doc The parsed YAML document.
10
+ * @param path The validation error path, e.g. `['form', 'fields', 0, 'type']`.
11
+ * @returns The YAML node at the given path, or `undefined` if the path is invalid.
12
+ */
13
+ function getNodeAtPath(doc, path) {
14
+ function resolveNode(node, docu) {
15
+ return isAlias(node) ? node.resolve(docu) : node;
16
+ }
17
+ let current = doc.contents;
18
+ for (const segment of path) {
19
+ current = resolveNode(current, doc);
20
+ if (current instanceof YAMLMap) {
21
+ current = current.get(segment, true);
22
+ }
23
+ else if (current instanceof YAMLSeq) {
24
+ if (typeof segment !== 'number') {
25
+ return undefined;
26
+ }
27
+ const item = current.items[segment];
28
+ current = isNode(item) ? item : undefined;
29
+ }
30
+ else {
31
+ return undefined;
32
+ }
33
+ if (current == null) {
34
+ return undefined;
35
+ }
36
+ }
37
+ return resolveNode(current, doc);
38
+ }
39
+ /**
40
+ * Format validation errors from an Axios response as `file:line:col` messages when possible.
41
+ *
42
+ * @param filename The YAML file path shown in the output.
43
+ * @param yaml The YAML source text.
44
+ * @param errors The validation errors returned by the API.
45
+ * @returns A newline-separated list of formatted validation messages.
46
+ */
2
47
  export function printAxiosError(filename, yaml, errors) {
3
48
  const lineCounter = new LineCounter();
4
49
  const doc = parseDocument(yaml, { lineCounter });
5
50
  return errors
6
51
  .map((error) => {
7
- const node = doc.getIn(error.path, true);
52
+ const node = getNodeAtPath(doc, error.path);
8
53
  let result = filename;
9
- if (isNode(node)) {
10
- // @ts-expect-error 2345 argument of type is not assignable to parameter of type
11
- // (strictNullChecks)
12
- const { col, line } = lineCounter.linePos(node.range?.[0]);
54
+ if (isNode(node) && node.range) {
55
+ const { col, line } = lineCounter.linePos(node.range[0]);
13
56
  result += `:${line}:${col}`;
14
57
  }
15
58
  return `${result} ${error.message}`;
package/lib/project.js CHANGED
@@ -43,7 +43,7 @@ export async function makeProjectPayload(buildConfig) {
43
43
  const distPath = output ? resolvePath(dir, output) : undefined;
44
44
  const form = new FormData();
45
45
  const gatheredData = {};
46
- const { description, layout, longDescription, name, version, visibility, wildcardActions } = buildConfig;
46
+ const { description, layout, longDescription, name, repositoryUrl, version, visibility, wildcardActions, } = buildConfig;
47
47
  const { actions, events, messages, parameters } = getProjectImplementations(buildConfig);
48
48
  const files = await readdir(dir);
49
49
  const icon = files.find((entry) => entry.match(/^icon\.(png|svg)$/));
@@ -64,6 +64,7 @@ export async function makeProjectPayload(buildConfig) {
64
64
  append('actions', actions);
65
65
  append('description', description);
66
66
  append('longDescription', longDescription);
67
+ append('repositoryUrl', repositoryUrl);
67
68
  append('events', events);
68
69
  append('layout', layout);
69
70
  append('name', name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/cli",
3
- "version": "0.36.5-test.6",
3
+ "version": "0.36.6-test.0",
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.5-test.6",
48
- "@appsemble/types": "0.36.5-test.6",
49
- "@appsemble/lang-sdk": "0.36.5-test.6",
50
- "@appsemble/utils": "0.36.5-test.6",
47
+ "@appsemble/node-utils": "0.36.6-test.0",
48
+ "@appsemble/types": "0.36.6-test.0",
49
+ "@appsemble/lang-sdk": "0.36.6-test.0",
50
+ "@appsemble/utils": "0.36.6-test.0",
51
51
  "@fortawesome/fontawesome-common-types": "^6.0.0",
52
52
  "@inquirer/prompts": "^8.0.0",
53
53
  "@koa/cors": "^5.0.0",
@@ -89,8 +89,8 @@
89
89
  "yargs": "^17.0.0"
90
90
  },
91
91
  "devDependencies": {
92
- "@appsemble/types": "0.36.5-test.6",
93
- "@appsemble/server": "0.36.5-test.6",
92
+ "@appsemble/types": "0.36.6-test.0",
93
+ "@appsemble/server": "0.36.6-test.0",
94
94
  "@types/concat-stream": "2.0.3",
95
95
  "@types/koa__cors": "5.0.1",
96
96
  "@types/koa-compress": "4.0.7",
@@ -6,7 +6,7 @@ pages:
6
6
  - name: Example Page A
7
7
  blocks:
8
8
  - type: action-button
9
- version: 0.36.5-test.6
9
+ version: 0.36.6-test.0
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.5-test.6
20
+ version: 0.36.6-test.0
21
21
  parameters:
22
22
  icon: arrow-left
23
23
  actions:
@@ -5,7 +5,7 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/sdk": "0.36.5-test.6",
8
+ "@appsemble/sdk": "0.36.6-test.0",
9
9
  "mini-jsx": "^4.0.0"
10
10
  }
11
11
  }
@@ -5,8 +5,8 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/preact": "0.36.5-test.6",
9
- "@appsemble/sdk": "0.36.5-test.6",
8
+ "@appsemble/preact": "0.36.6-test.0",
9
+ "@appsemble/sdk": "0.36.6-test.0",
10
10
  "preact": "^10.0.0"
11
11
  }
12
12
  }
@@ -5,6 +5,6 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/sdk": "0.36.5-test.6"
8
+ "@appsemble/sdk": "0.36.6-test.0"
9
9
  }
10
10
  }