@lowdefy/build 4.0.0-alpha.6 → 4.0.0-alpha.7
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/dist/build/addDefaultPages/addDefaultPages.js +6 -2
- package/dist/build/buildPages/buildBlock/buildEvents.js +4 -1
- package/dist/build/buildRefs/getUserJavascriptFunction.js +6 -3
- package/dist/build/buildRefs/parseRefContent.js +2 -2
- package/dist/build/buildRefs/runTransformer.js +5 -1
- package/dist/build/buildTypes.js +23 -14
- package/dist/build/cleanBuildDirectory.js +1 -1
- package/dist/build/copyPublicFolder.js +23 -0
- package/dist/build/updateServerPackageJson.js +1 -4
- package/dist/build/validateConfig.js +5 -0
- package/dist/build/writeApp.js +1 -4
- package/dist/build/writeConfig.js +1 -4
- package/dist/build/writeConnections.js +1 -4
- package/dist/build/writeGlobal.js +1 -4
- package/dist/build/writeMenus.js +1 -4
- package/dist/build/writePages.js +2 -13
- package/dist/build/writePluginImports/writeActionImports.js +22 -0
- package/dist/build/writePluginImports/writeBlockImports.js +4 -7
- package/dist/build/writePluginImports/writeConnectionImports.js +4 -7
- package/dist/build/writePluginImports/writeIconImports.js +3 -6
- package/dist/build/writePluginImports/writeOperatorImports.js +8 -15
- package/dist/build/writePluginImports/writeStyleImports.js +3 -6
- package/dist/build/writeRequests.js +2 -7
- package/dist/build/writeTypes.js +1 -4
- package/dist/defaultTypes.json +543 -243
- package/dist/index.js +118 -113
- package/dist/lowdefySchema.js +7 -0
- package/dist/scripts/generateDefaultTypes.js +11 -7
- package/dist/scripts/run.js +7 -3
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +1 -1
- package/dist/test/buildRefs/testBuildRefsErrorResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsNullResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsParsingResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsResolver.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransform.js +1 -1
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +1 -1
- package/dist/utils/formatErrorMessage.js +1 -1
- package/dist/utils/{files/readConfigFile.js → readConfigFile.js} +0 -0
- package/dist/utils/{files/writeBuildArtifact.js → writeBuildArtifact.js} +2 -5
- package/package.json +36 -27
|
@@ -26,8 +26,12 @@ async function addDefaultPages({ components }) {
|
|
|
26
26
|
if (!type.isArray(components.pages)) {
|
|
27
27
|
throw new Error('lowdefy.pages is not an array.');
|
|
28
28
|
}
|
|
29
|
-
const pageIds = components.pages.map((page)=>
|
|
30
|
-
|
|
29
|
+
const pageIds = components.pages.map((page, index)=>{
|
|
30
|
+
if (!type.isObject(page)) {
|
|
31
|
+
throw new Error(`pages[${index}] is not an object. Received ${JSON.stringify(page)}`);
|
|
32
|
+
}
|
|
33
|
+
return page.id;
|
|
34
|
+
});
|
|
31
35
|
// deep copy to avoid mutating defaultConfig
|
|
32
36
|
const filteredDefaultPages = defaultPages.filter((defaultPage)=>!pageIds.includes(defaultPage.id)
|
|
33
37
|
);
|
|
@@ -44,7 +44,10 @@ function buildEvents(block, pageContext) {
|
|
|
44
44
|
if (!type.isArray(block.events[key].try)) {
|
|
45
45
|
throw new Error(`Events must be an array of actions at "${block.blockId}" in event "${key}" on page "${pageContext.pageId}". Received ${JSON.stringify(block.events[key].try)}`);
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
47
|
+
if (type.isNone(block.events[key].catch)) {
|
|
48
|
+
block.events[key].catch = [];
|
|
49
|
+
}
|
|
50
|
+
if (!type.isArray(block.events[key].catch)) {
|
|
48
51
|
throw new Error(`Catch events must be an array of actions at "${block.blockId}" in event "${key}" on page "${pageContext.pageId}". Received ${JSON.stringify(block.events[key].catch)}`);
|
|
49
52
|
}
|
|
50
53
|
const checkDuplicateActionId = createCheckDuplicateId({
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import path from 'path';
|
|
16
|
-
import { readFile } from '@lowdefy/node-utils';
|
|
17
16
|
async function getUserJavascriptFunction({ context , filePath }) {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
try {
|
|
18
|
+
return (await import(path.resolve(context.directories.config, filePath))).default;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
context.logger.error(`Error importing ${filePath}.`);
|
|
21
|
+
throw Error(error);
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
export default getUserJavascriptFunction;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import { getFileExtension, getFileSubExtension } from '@lowdefy/node-utils';
|
|
17
17
|
import JSON5 from 'json5';
|
|
18
|
-
import YAML from '
|
|
18
|
+
import YAML from 'yaml';
|
|
19
19
|
import parseNunjucks from './parseNunjucks.js';
|
|
20
20
|
function parseRefContent({ content , refDef }) {
|
|
21
21
|
const { path , vars } = refDef;
|
|
@@ -26,7 +26,7 @@ function parseRefContent({ content , refDef }) {
|
|
|
26
26
|
ext = getFileSubExtension(path);
|
|
27
27
|
}
|
|
28
28
|
if (ext === 'yaml' || ext === 'yml') {
|
|
29
|
-
return YAML.
|
|
29
|
+
return YAML.parse(content);
|
|
30
30
|
}
|
|
31
31
|
if (ext === 'json') {
|
|
32
32
|
return JSON5.parse(content);
|
|
@@ -19,7 +19,11 @@ async function runTransformer({ context , parsedFile , refDef }) {
|
|
|
19
19
|
context,
|
|
20
20
|
filePath: refDef.transformer
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
try {
|
|
23
|
+
return transformerFn(parsedFile, refDef.vars);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
throw Error(`Error calling transformer "${refDef.transformer}" from "${refDef.path}": ${error.message}`);
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
return parsedFile;
|
|
25
29
|
}
|
package/dist/build/buildTypes.js
CHANGED
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ function buildTypeClass({ counter , definitions , store , typeClass }) {
|
|
15
|
+
*/ function buildTypeClass(context, { counter , definitions , store , typeClass , warnIfMissing =false }) {
|
|
16
16
|
const counts = counter.getCounts();
|
|
17
17
|
Object.keys(counts).forEach((typeName)=>{
|
|
18
18
|
if (!definitions[typeName]) {
|
|
19
|
+
if (warnIfMissing) {
|
|
20
|
+
context.logger.warn(`${typeClass} type "${typeName}" was used but is not defined.`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
19
23
|
throw new Error(`${typeClass} type "${typeName}" was used but is not defined.`);
|
|
20
24
|
}
|
|
21
25
|
store[typeName] = {
|
|
@@ -27,6 +31,9 @@
|
|
|
27
31
|
}
|
|
28
32
|
function buildTypes({ components , context }) {
|
|
29
33
|
const { typeCounters } = context;
|
|
34
|
+
// Add operators used by form validation
|
|
35
|
+
typeCounters.operators.client.increment('_not');
|
|
36
|
+
typeCounters.operators.client.increment('_type');
|
|
30
37
|
components.types = {
|
|
31
38
|
actions: {},
|
|
32
39
|
blocks: {},
|
|
@@ -37,41 +44,43 @@ function buildTypes({ components , context }) {
|
|
|
37
44
|
server: {}
|
|
38
45
|
}
|
|
39
46
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
buildTypeClass({
|
|
47
|
+
buildTypeClass(context, {
|
|
48
|
+
counter: typeCounters.actions,
|
|
49
|
+
definitions: context.types.actions,
|
|
50
|
+
store: components.types.actions,
|
|
51
|
+
typeClass: 'Action'
|
|
52
|
+
});
|
|
53
|
+
buildTypeClass(context, {
|
|
47
54
|
counter: typeCounters.blocks,
|
|
48
55
|
definitions: context.types.blocks,
|
|
49
56
|
store: components.types.blocks,
|
|
50
57
|
typeClass: 'Block'
|
|
51
58
|
});
|
|
52
|
-
buildTypeClass({
|
|
59
|
+
buildTypeClass(context, {
|
|
53
60
|
counter: typeCounters.connections,
|
|
54
61
|
definitions: context.types.connections,
|
|
55
62
|
store: components.types.connections,
|
|
56
63
|
typeClass: 'Connection'
|
|
57
64
|
});
|
|
58
|
-
buildTypeClass({
|
|
65
|
+
buildTypeClass(context, {
|
|
59
66
|
counter: typeCounters.requests,
|
|
60
67
|
definitions: context.types.requests,
|
|
61
68
|
store: components.types.requests,
|
|
62
69
|
typeClass: 'Request'
|
|
63
70
|
});
|
|
64
|
-
buildTypeClass({
|
|
71
|
+
buildTypeClass(context, {
|
|
65
72
|
counter: typeCounters.operators.client,
|
|
66
73
|
definitions: context.types.operators.client,
|
|
67
74
|
store: components.types.operators.client,
|
|
68
|
-
typeClass: 'Operator'
|
|
75
|
+
typeClass: 'Operator',
|
|
76
|
+
warnIfMissing: true
|
|
69
77
|
});
|
|
70
|
-
buildTypeClass({
|
|
78
|
+
buildTypeClass(context, {
|
|
71
79
|
counter: typeCounters.operators.server,
|
|
72
80
|
definitions: context.types.operators.server,
|
|
73
81
|
store: components.types.operators.server,
|
|
74
|
-
typeClass: 'Operator'
|
|
82
|
+
typeClass: 'Operator',
|
|
83
|
+
warnIfMissing: true
|
|
75
84
|
});
|
|
76
85
|
}
|
|
77
86
|
export default buildTypes;
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { cleanDirectory } from '@lowdefy/node-utils';
|
|
16
16
|
async function cleanBuildDirectory({ context }) {
|
|
17
|
-
|
|
17
|
+
await cleanDirectory(context.directories.build);
|
|
18
18
|
}
|
|
19
19
|
export default cleanBuildDirectory;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import path from 'path';
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import { copyDirectory } from '@lowdefy/node-utils';
|
|
18
|
+
async function copyPublicFolder({ context }) {
|
|
19
|
+
if (context.directories.config === context.directories.server) return;
|
|
20
|
+
if (!fs.existsSync(path.resolve(context.directories.config, 'public'))) return;
|
|
21
|
+
await copyDirectory(path.resolve(context.directories.config, 'public'), path.resolve(context.directories.server, 'public'));
|
|
22
|
+
}
|
|
23
|
+
export default copyPublicFolder;
|
|
@@ -40,10 +40,7 @@ async function updateServerPackageJson({ components , context }) {
|
|
|
40
40
|
// be watching the file to trigger reinstalls
|
|
41
41
|
if (newPackageJsonContent !== packageJsonContent) {
|
|
42
42
|
context.logger.warn('Plugin dependencies have changed. Updating "package.json".');
|
|
43
|
-
await writeFile(
|
|
44
|
-
filePath,
|
|
45
|
-
content: newPackageJsonContent
|
|
46
|
-
});
|
|
43
|
+
await writeFile(filePath, newPackageJsonContent);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
export default updateServerPackageJson;
|
|
@@ -34,6 +34,11 @@ async function validateConfig({ components }) {
|
|
|
34
34
|
if (type.isNone(components.config.theme)) {
|
|
35
35
|
components.config.theme = {};
|
|
36
36
|
}
|
|
37
|
+
if (type.isString(components.config.basePath)) {
|
|
38
|
+
if (components.config.basePath[0] !== '/') {
|
|
39
|
+
throw Error('Base path must start with "/".');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
37
42
|
validate({
|
|
38
43
|
schema: lowdefySchema.definitions.authConfig,
|
|
39
44
|
data: components.config.auth
|
package/dist/build/writeApp.js
CHANGED
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ async function writeApp({ components , context }) {
|
|
16
|
-
await context.writeBuildArtifact({
|
|
17
|
-
filePath: 'app.json',
|
|
18
|
-
content: JSON.stringify(components.app || {}, null, 2)
|
|
19
|
-
});
|
|
16
|
+
await context.writeBuildArtifact('app.json', JSON.stringify(components.app || {}, null, 2));
|
|
20
17
|
}
|
|
21
18
|
export default writeApp;
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ async function writeConfig({ components , context }) {
|
|
16
|
-
await context.writeBuildArtifact({
|
|
17
|
-
filePath: 'config.json',
|
|
18
|
-
content: JSON.stringify(components.config || {}, null, 2)
|
|
19
|
-
});
|
|
16
|
+
await context.writeBuildArtifact('config.json', JSON.stringify(components.config || {}, null, 2));
|
|
20
17
|
}
|
|
21
18
|
export default writeConfig;
|
|
@@ -19,10 +19,7 @@ async function writeConnections({ components , context }) {
|
|
|
19
19
|
throw new Error(`Connections is not an array.`);
|
|
20
20
|
}
|
|
21
21
|
const writePromises = components.connections.map(async (connection)=>{
|
|
22
|
-
await context.writeBuildArtifact({
|
|
23
|
-
filePath: `connections/${connection.connectionId}.json`,
|
|
24
|
-
content: JSON.stringify(connection, null, 2)
|
|
25
|
-
});
|
|
22
|
+
await context.writeBuildArtifact(`connections/${connection.connectionId}.json`, JSON.stringify(connection, null, 2));
|
|
26
23
|
});
|
|
27
24
|
return Promise.all(writePromises);
|
|
28
25
|
}
|
|
@@ -20,9 +20,6 @@ async function writeGlobal({ components , context }) {
|
|
|
20
20
|
if (!type.isObject(components.global)) {
|
|
21
21
|
throw new Error('Global is not an object.');
|
|
22
22
|
}
|
|
23
|
-
await context.writeBuildArtifact(
|
|
24
|
-
filePath: 'global.json',
|
|
25
|
-
content: JSON.stringify(components.global, null, 2)
|
|
26
|
-
});
|
|
23
|
+
await context.writeBuildArtifact('global.json', JSON.stringify(components.global, null, 2));
|
|
27
24
|
}
|
|
28
25
|
export default writeGlobal;
|
package/dist/build/writeMenus.js
CHANGED
|
@@ -17,9 +17,6 @@ async function writeMenus({ components , context }) {
|
|
|
17
17
|
if (!type.isArray(components.menus)) {
|
|
18
18
|
throw new Error('Menus is not an array.');
|
|
19
19
|
}
|
|
20
|
-
await context.writeBuildArtifact(
|
|
21
|
-
filePath: 'menus.json',
|
|
22
|
-
content: JSON.stringify(components.menus, null, 2)
|
|
23
|
-
});
|
|
20
|
+
await context.writeBuildArtifact('menus.json', JSON.stringify(components.menus, null, 2));
|
|
24
21
|
}
|
|
25
22
|
export default writeMenus;
|
package/dist/build/writePages.js
CHANGED
|
@@ -12,21 +12,10 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
if (!type.isObject(page)) {
|
|
18
|
-
throw new Error(`Page is not an object. Received ${JSON.stringify(page)}`);
|
|
19
|
-
}
|
|
20
|
-
await context.writeBuildArtifact({
|
|
21
|
-
filePath: `pages/${page.pageId}/${page.pageId}.json`,
|
|
22
|
-
content: JSON.stringify(page, null, 2)
|
|
23
|
-
});
|
|
15
|
+
*/ async function writePage({ page , context }) {
|
|
16
|
+
await context.writeBuildArtifact(`pages/${page.pageId}/${page.pageId}.json`, JSON.stringify(page, null, 2));
|
|
24
17
|
}
|
|
25
18
|
async function writePages({ components , context }) {
|
|
26
|
-
if (type.isNone(components.pages)) return;
|
|
27
|
-
if (!type.isArray(components.pages)) {
|
|
28
|
-
throw new Error(`Pages is not an array.`);
|
|
29
|
-
}
|
|
30
19
|
const writePromises = components.pages.map((page)=>writePage({
|
|
31
20
|
page,
|
|
32
21
|
context
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import generateImportFile from './generateImportFile.js';
|
|
16
|
+
async function writeActionImports({ components , context }) {
|
|
17
|
+
await context.writeBuildArtifact('plugins/actions.js', generateImportFile({
|
|
18
|
+
types: components.types.actions,
|
|
19
|
+
importPath: 'actions'
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export default writeActionImports;
|
|
@@ -14,12 +14,9 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeBlockImports({ components , context }) {
|
|
17
|
-
await context.writeBuildArtifact({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
importPath: 'blocks'
|
|
22
|
-
})
|
|
23
|
-
});
|
|
17
|
+
await context.writeBuildArtifact('plugins/blocks.js', generateImportFile({
|
|
18
|
+
types: components.types.blocks,
|
|
19
|
+
importPath: 'blocks'
|
|
20
|
+
}));
|
|
24
21
|
}
|
|
25
22
|
export default writeBlockImports;
|
|
@@ -14,12 +14,9 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeConnectionImports({ components , context }) {
|
|
17
|
-
await context.writeBuildArtifact({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
importPath: 'connections'
|
|
22
|
-
})
|
|
23
|
-
});
|
|
17
|
+
await context.writeBuildArtifact('plugins/connections.js', generateImportFile({
|
|
18
|
+
types: components.types.connections,
|
|
19
|
+
importPath: 'connections'
|
|
20
|
+
}));
|
|
24
21
|
}
|
|
25
22
|
export default writeConnectionImports;
|
|
@@ -24,11 +24,8 @@ export default {
|
|
|
24
24
|
};`;
|
|
25
25
|
async function writeIconImports({ components , context }) {
|
|
26
26
|
const templateFn = nunjucksFunction(template);
|
|
27
|
-
await context.writeBuildArtifact({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
packages: components.icons
|
|
31
|
-
})
|
|
32
|
-
});
|
|
27
|
+
await context.writeBuildArtifact('plugins/icons.js', templateFn({
|
|
28
|
+
packages: components.icons
|
|
29
|
+
}));
|
|
33
30
|
}
|
|
34
31
|
export default writeIconImports;
|
|
@@ -14,20 +14,13 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import generateImportFile from './generateImportFile.js';
|
|
16
16
|
async function writeOperatorImports({ components , context }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
await context.writeBuildArtifact({
|
|
26
|
-
filePath: 'plugins/operatorsServer.js',
|
|
27
|
-
content: generateImportFile({
|
|
28
|
-
types: components.types.operators.server,
|
|
29
|
-
importPath: 'operators/server'
|
|
30
|
-
})
|
|
31
|
-
});
|
|
17
|
+
await context.writeBuildArtifact('plugins/operatorsClient.js', generateImportFile({
|
|
18
|
+
types: components.types.operators.client,
|
|
19
|
+
importPath: 'operators/client'
|
|
20
|
+
}));
|
|
21
|
+
await context.writeBuildArtifact('plugins/operatorsServer.js', generateImportFile({
|
|
22
|
+
types: components.types.operators.server,
|
|
23
|
+
importPath: 'operators/server'
|
|
24
|
+
}));
|
|
32
25
|
}
|
|
33
26
|
export default writeOperatorImports;
|
|
@@ -20,11 +20,8 @@ const template = `@import '@lowdefy/layout/style.less';
|
|
|
20
20
|
`;
|
|
21
21
|
async function writeStyleImports({ components , context }) {
|
|
22
22
|
const templateFn = nunjucksFunction(template);
|
|
23
|
-
await context.writeBuildArtifact({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
styles: components.styles
|
|
27
|
-
})
|
|
28
|
-
});
|
|
23
|
+
await context.writeBuildArtifact('plugins/styles.less', templateFn({
|
|
24
|
+
styles: components.styles
|
|
25
|
+
}));
|
|
29
26
|
}
|
|
30
27
|
export default writeStyleImports;
|
|
@@ -12,13 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
async function writeRequestsOnPage({ page , context }) {
|
|
15
|
+
*/ async function writeRequestsOnPage({ page , context }) {
|
|
17
16
|
return Promise.all(page.requests.map(async (request)=>{
|
|
18
|
-
await context.writeBuildArtifact({
|
|
19
|
-
filePath: `pages/${page.pageId}/requests/${request.requestId}.json`,
|
|
20
|
-
content: JSON.stringify(request, null, 2)
|
|
21
|
-
});
|
|
17
|
+
await context.writeBuildArtifact(`pages/${page.pageId}/requests/${request.requestId}.json`, JSON.stringify(request, null, 2));
|
|
22
18
|
delete request.properties;
|
|
23
19
|
delete request.type;
|
|
24
20
|
delete request.connectionId;
|
|
@@ -26,7 +22,6 @@ async function writeRequestsOnPage({ page , context }) {
|
|
|
26
22
|
}));
|
|
27
23
|
}
|
|
28
24
|
async function writeRequests({ components , context }) {
|
|
29
|
-
if (type.isNone(components.pages)) return;
|
|
30
25
|
const writePromises = components.pages.map((page)=>writeRequestsOnPage({
|
|
31
26
|
page,
|
|
32
27
|
context
|
package/dist/build/writeTypes.js
CHANGED
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ async function writeTypes({ components , context }) {
|
|
16
|
-
await context.writeBuildArtifact(
|
|
17
|
-
filePath: 'types.json',
|
|
18
|
-
content: JSON.stringify(components.types, null, 2)
|
|
19
|
-
});
|
|
16
|
+
await context.writeBuildArtifact('types.json', JSON.stringify(components.types, null, 2));
|
|
20
17
|
}
|
|
21
18
|
export default writeTypes;
|