@vanillabp/bc-module-kit 0.1.0-snapshot.3 → 0.1.0-snapshot.4
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/bin/bc-check-entries.js +3 -1
- package/package.json +1 -1
- package/src/check.js +5 -2
- package/src/entries.js +12 -11
- package/src/index.d.ts +7 -1
package/bin/bc-check-entries.js
CHANGED
|
@@ -9,7 +9,9 @@ const usage = `Usage: bc-check-entries <path to bc-manifest.json> [options]
|
|
|
9
9
|
|
|
10
10
|
Fails when an entry of the manifest has no file, or when a data entry, with
|
|
11
11
|
every file it imports, is larger than the limit, imports a bare name or
|
|
12
|
-
contains framework code.
|
|
12
|
+
contains framework code. The data entries are the four the kit knows
|
|
13
|
+
(UserTaskList, WorkflowList, UserTaskForm, WorkflowPage) and those named by
|
|
14
|
+
--data-entry.
|
|
13
15
|
|
|
14
16
|
Options:
|
|
15
17
|
--limit <size> the limit of a data entry, like 32kb (default ${DEFAULT_LIMIT_BYTES / 1024}kb)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanillabp/bc-module-kit",
|
|
3
|
-
"version": "0.1.0-snapshot.
|
|
3
|
+
"version": "0.1.0-snapshot.4",
|
|
4
4
|
"description": "The module's side of the contract between a VanillaBP Business Cockpit and a workflow module: bc-manifest.json, bc-check-entries, the event protocol, the names of the entries and the names of the web components.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Phactum Softwareentwicklung GmbH (https://www.phactum.at/)",
|
package/src/check.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
8
8
|
import { dirname, resolve, sep } from 'node:path';
|
|
9
|
-
import {
|
|
9
|
+
import { EXPORT_NAMES } from './entries.js';
|
|
10
10
|
import { readManifest } from './manifest.js';
|
|
11
11
|
|
|
12
12
|
/** The limit of a data entry with every file it imports: 32 KB before compression. */
|
|
@@ -125,13 +125,16 @@ function frameworkOfInput(input) {
|
|
|
125
125
|
* file it imports, must stay below the limit, must import nothing by a bare name, and must hold no
|
|
126
126
|
* framework code.
|
|
127
127
|
*
|
|
128
|
+
* The data entries are the keys of `EXPORT_NAMES`, together with `options.dataEntries`: the
|
|
129
|
+
* entries of the module's own, for example `Header`. A visual entry is only checked for its file.
|
|
130
|
+
*
|
|
128
131
|
* @param {string} manifestPath
|
|
129
132
|
* @param {{ limit?: number | string, dataEntries?: string[], metafile?: string }} [options]
|
|
130
133
|
* @returns {{ problems: string[], dataEntries: Array<{ entry: string, files: string[], bytes: number }> }}
|
|
131
134
|
*/
|
|
132
135
|
export function checkEntries(manifestPath, options = {}) {
|
|
133
136
|
const limit = parseLimit(options.limit ?? DEFAULT_LIMIT_BYTES);
|
|
134
|
-
const dataEntryNames = new Set([...
|
|
137
|
+
const dataEntryNames = new Set([...Object.keys(EXPORT_NAMES), ...(options.dataEntries ?? [])]);
|
|
135
138
|
const inputsOf = options.metafile ? readMetafile(resolve(options.metafile)) : () => undefined;
|
|
136
139
|
const base = dirname(resolve(manifestPath));
|
|
137
140
|
const problems = [];
|
package/src/entries.js
CHANGED
|
@@ -20,18 +20,11 @@ export const USER_TASK_FORM = 'UserTaskForm';
|
|
|
20
20
|
export const WORKFLOW_PAGE = 'WorkflowPage';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* For each data entry, the name of the function it exports. This map is the one source of the
|
|
24
|
+
* data entries: an entry which exports a function is a data entry, and a visual entry exports no
|
|
25
|
+
* function. A cockpit with entries of its own, for example `Header`, extends this map in its
|
|
26
|
+
* types library: `{ ...EXPORT_NAMES, Header: 'header' }`.
|
|
26
27
|
*/
|
|
27
|
-
export const DATA_ENTRIES = Object.freeze([
|
|
28
|
-
USER_TASK_LIST,
|
|
29
|
-
WORKFLOW_LIST,
|
|
30
|
-
USER_TASK_FORM,
|
|
31
|
-
WORKFLOW_PAGE,
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
/** For each data entry, the name of the function it exports. */
|
|
35
28
|
export const EXPORT_NAMES = Object.freeze({
|
|
36
29
|
[USER_TASK_LIST]: 'userTaskListColumns',
|
|
37
30
|
[WORKFLOW_LIST]: 'workflowListColumns',
|
|
@@ -39,6 +32,14 @@ export const EXPORT_NAMES = Object.freeze({
|
|
|
39
32
|
[WORKFLOW_PAGE]: 'workflowPage',
|
|
40
33
|
});
|
|
41
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The entries which carry no framework: the keys of `EXPORT_NAMES`, in the same order. It is
|
|
37
|
+
* derived from that map, so never list a data entry here. `bc-check-entries` checks their size
|
|
38
|
+
* and their content. A module with entries of its own, for example `Header`, names them with
|
|
39
|
+
* the option `--data-entry` of `bc-check-entries`.
|
|
40
|
+
*/
|
|
41
|
+
export const DATA_ENTRIES = Object.freeze(Object.keys(EXPORT_NAMES));
|
|
42
|
+
|
|
42
43
|
/**
|
|
43
44
|
* The area of the one web component which shows the whole page. Every cockpit knows it. A
|
|
44
45
|
* cockpit without areas of its own shows this web component.
|
package/src/index.d.ts
CHANGED
|
@@ -11,13 +11,19 @@ export declare const USER_TASK_LIST: 'UserTaskList';
|
|
|
11
11
|
export declare const WORKFLOW_LIST: 'WorkflowList';
|
|
12
12
|
export declare const USER_TASK_FORM: 'UserTaskForm';
|
|
13
13
|
export declare const WORKFLOW_PAGE: 'WorkflowPage';
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* For each data entry, the name of the function it exports. The one source of the data entries.
|
|
16
|
+
* A cockpit with entries of its own extends it in its types library, for example
|
|
17
|
+
* `{ ...EXPORT_NAMES, Header: 'header' }`.
|
|
18
|
+
*/
|
|
15
19
|
export declare const EXPORT_NAMES: Readonly<{
|
|
16
20
|
UserTaskList: 'userTaskListColumns';
|
|
17
21
|
WorkflowList: 'workflowListColumns';
|
|
18
22
|
UserTaskForm: 'userTaskForm';
|
|
19
23
|
WorkflowPage: 'workflowPage';
|
|
20
24
|
}>;
|
|
25
|
+
/** The keys of `EXPORT_NAMES`, in the same order. Derived from that map. */
|
|
26
|
+
export declare const DATA_ENTRIES: ReadonlyArray<keyof typeof EXPORT_NAMES>;
|
|
21
27
|
export declare const AREA_ALL: 'all';
|
|
22
28
|
|
|
23
29
|
/** A text per language. The keys are language codes like 'en' or 'de'. */
|