@lowdefy/build 4.0.0-alpha.6 → 4.0.0-alpha.9
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/404.js +1 -1
- package/dist/build/addDefaultPages/addDefaultPages.js +7 -3
- package/dist/build/buildAuth/buildAuth.js +1 -1
- package/dist/build/buildAuth/getPageRoles.js +1 -1
- package/dist/build/buildAuth/getProtectedPages.js +1 -1
- package/dist/build/buildConnections.js +1 -1
- package/dist/build/buildIcons.js +3 -3
- package/dist/build/buildMenu.js +1 -1
- package/dist/build/buildPages/buildBlock/buildBlock.js +6 -2
- package/dist/build/buildPages/buildBlock/buildEvents.js +5 -2
- package/dist/build/buildPages/buildBlock/buildRequests.js +1 -1
- package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +2 -2
- package/dist/build/buildPages/buildBlock/countBlockTypes.js +18 -0
- package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +35 -0
- package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +1 -1
- package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
- package/dist/build/buildPages/buildBlock/validateBlock.js +2 -3
- package/dist/build/buildPages/buildPage.js +1 -1
- package/dist/build/buildPages/buildPages.js +1 -1
- package/dist/build/buildRefs/buildRefs.js +2 -1
- package/dist/build/buildRefs/evaluateBuildOperators.js +35 -0
- package/dist/build/buildRefs/getConfigFile.js +1 -1
- package/dist/build/buildRefs/getRefContent.js +2 -2
- package/dist/build/buildRefs/getRefPath.js +1 -1
- package/dist/build/buildRefs/getRefsFromFile.js +1 -1
- package/dist/build/buildRefs/getUserJavascriptFunction.js +7 -4
- package/dist/build/buildRefs/makeRefDefinition.js +1 -1
- package/dist/build/buildRefs/parseNunjucks.js +1 -1
- package/dist/build/buildRefs/parseRefContent.js +3 -3
- package/dist/build/buildRefs/populateRefs.js +1 -1
- package/dist/build/buildRefs/recursiveBuild.js +9 -3
- package/dist/build/buildRefs/runRefResolver.js +1 -1
- package/dist/build/buildRefs/runTransformer.js +8 -4
- package/dist/build/buildStyles.js +3 -3
- package/dist/build/buildTypes.js +39 -20
- package/dist/build/cleanBuildDirectory.js +2 -2
- package/dist/build/copyPublicFolder.js +23 -0
- package/dist/build/testSchema.js +1 -1
- package/dist/build/updateServerPackageJson.js +2 -5
- package/dist/build/validateApp.js +1 -1
- package/dist/build/validateConfig.js +6 -1
- package/dist/build/writeApp.js +2 -5
- package/dist/build/writeConfig.js +2 -5
- package/dist/build/writeConnections.js +2 -5
- package/dist/build/writeGlobal.js +2 -5
- package/dist/build/writeMenus.js +2 -5
- package/dist/build/writePages.js +3 -14
- package/dist/build/writePluginImports/generateImportFile.js +7 -7
- package/dist/build/writePluginImports/writeActionImports.js +22 -0
- package/dist/build/writePluginImports/writeBlockImports.js +5 -8
- package/dist/build/writePluginImports/writeConnectionImports.js +5 -8
- package/dist/build/writePluginImports/writeIconImports.js +4 -7
- package/dist/build/writePluginImports/writeOperatorImports.js +9 -16
- package/dist/build/writePluginImports/writeStyleImports.js +5 -7
- package/dist/build/writeRequests.js +3 -8
- package/dist/build/writeTypes.js +2 -5
- package/dist/defaultTypesMap.json +1598 -0
- package/dist/index.js +134 -126
- package/dist/lowdefySchema.js +50 -12
- package/dist/scripts/generateDefaultTypes.js +26 -65
- package/dist/scripts/run.js +8 -4
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +2 -2
- package/dist/test/buildRefs/testBuildRefsErrorResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsNullResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsParsingResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsResolver.js +2 -2
- package/dist/test/buildRefs/testBuildRefsTransform.js +2 -2
- package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +2 -2
- package/dist/test/testContext.js +1 -1
- package/dist/utils/countOperators.js +1 -1
- package/dist/utils/createCheckDuplicateId.js +1 -1
- package/dist/utils/createCounter.js +1 -1
- package/dist/utils/createPluginTypesMap.js +85 -0
- package/dist/utils/formatErrorMessage.js +2 -2
- package/dist/utils/{files/readConfigFile.js → readConfigFile.js} +1 -1
- package/dist/utils/{files/writeBuildArtifact.js → writeBuildArtifact.js} +3 -6
- package/package.json +41 -27
- package/dist/defaultTypes.json +0 -1159
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,10 +12,12 @@
|
|
|
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
|
-
*/ import {
|
|
15
|
+
*/ import { mergeObjects } from '@lowdefy/helpers';
|
|
16
|
+
import { readFile } from '@lowdefy/node-utils';
|
|
16
17
|
import createCounter from './utils/createCounter.js';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
18
|
+
import createPluginTypesMap from './utils/createPluginTypesMap.js';
|
|
19
|
+
import createReadConfigFile from './utils/readConfigFile.js';
|
|
20
|
+
import createWriteBuildArtifact from './utils/writeBuildArtifact.js';
|
|
19
21
|
import addDefaultPages from './build/addDefaultPages/addDefaultPages.js';
|
|
20
22
|
import buildAuth from './build/buildAuth/buildAuth.js';
|
|
21
23
|
import buildConnections from './build/buildConnections.js';
|
|
@@ -26,11 +28,13 @@ import buildRefs from './build/buildRefs/buildRefs.js';
|
|
|
26
28
|
import buildStyles from './build/buildStyles.js';
|
|
27
29
|
import buildTypes from './build/buildTypes.js';
|
|
28
30
|
import cleanBuildDirectory from './build/cleanBuildDirectory.js';
|
|
31
|
+
import copyPublicFolder from './build/copyPublicFolder.js';
|
|
29
32
|
import testSchema from './build/testSchema.js';
|
|
30
33
|
import validateApp from './build/validateApp.js';
|
|
31
34
|
import validateConfig from './build/validateConfig.js';
|
|
32
35
|
import updateServerPackageJson from './build/updateServerPackageJson.js';
|
|
33
36
|
import writeApp from './build/writeApp.js';
|
|
37
|
+
import writeActionImports from './build/writePluginImports/writeActionImports.js';
|
|
34
38
|
import writeBlockImports from './build/writePluginImports/writeBlockImports.js';
|
|
35
39
|
import writeConfig from './build/writeConfig.js';
|
|
36
40
|
import writeConnectionImports from './build/writePluginImports/writeConnectionImports.js';
|
|
@@ -43,12 +47,15 @@ import writePages from './build/writePages.js';
|
|
|
43
47
|
import writeRequests from './build/writeRequests.js';
|
|
44
48
|
import writeStyleImports from './build/writePluginImports/writeStyleImports.js';
|
|
45
49
|
import writeTypes from './build/writeTypes.js';
|
|
46
|
-
async function createContext(
|
|
47
|
-
const
|
|
48
|
-
const defaultTypes = JSON.parse(await readFile(new URL('./defaultTypes.json', import.meta.url).pathname));
|
|
49
|
-
// TODO: resolve custom plugin types
|
|
50
|
+
async function createContext({ customTypesMap , directories , logger , refResolver }) {
|
|
51
|
+
const defaultTypesMap = JSON.parse(await readFile(new URL('./defaultTypesMap.json', import.meta.url).pathname));
|
|
50
52
|
const context = {
|
|
51
53
|
directories,
|
|
54
|
+
logger,
|
|
55
|
+
readConfigFile: createReadConfigFile({
|
|
56
|
+
directories
|
|
57
|
+
}),
|
|
58
|
+
refResolver,
|
|
52
59
|
typeCounters: {
|
|
53
60
|
actions: createCounter(),
|
|
54
61
|
blocks: createCounter(),
|
|
@@ -59,12 +66,10 @@ async function createContext(options) {
|
|
|
59
66
|
server: createCounter()
|
|
60
67
|
}
|
|
61
68
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
refResolver,
|
|
67
|
-
types: defaultTypes,
|
|
69
|
+
typesMap: mergeObjects([
|
|
70
|
+
defaultTypesMap,
|
|
71
|
+
customTypesMap
|
|
72
|
+
]),
|
|
68
73
|
writeBuildArtifact: createWriteBuildArtifact({
|
|
69
74
|
directories
|
|
70
75
|
})
|
|
@@ -73,117 +78,120 @@ async function createContext(options) {
|
|
|
73
78
|
}
|
|
74
79
|
async function build(options) {
|
|
75
80
|
const context = await createContext(options);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
context
|
|
185
|
-
|
|
186
|
-
|
|
81
|
+
const components = await buildRefs({
|
|
82
|
+
context
|
|
83
|
+
});
|
|
84
|
+
await testSchema({
|
|
85
|
+
components,
|
|
86
|
+
context
|
|
87
|
+
});
|
|
88
|
+
await validateApp({
|
|
89
|
+
components,
|
|
90
|
+
context
|
|
91
|
+
});
|
|
92
|
+
await validateConfig({
|
|
93
|
+
components,
|
|
94
|
+
context
|
|
95
|
+
});
|
|
96
|
+
await addDefaultPages({
|
|
97
|
+
components,
|
|
98
|
+
context
|
|
99
|
+
});
|
|
100
|
+
await buildAuth({
|
|
101
|
+
components,
|
|
102
|
+
context
|
|
103
|
+
});
|
|
104
|
+
await buildConnections({
|
|
105
|
+
components,
|
|
106
|
+
context
|
|
107
|
+
});
|
|
108
|
+
await buildPages({
|
|
109
|
+
components,
|
|
110
|
+
context
|
|
111
|
+
});
|
|
112
|
+
await buildMenu({
|
|
113
|
+
components,
|
|
114
|
+
context
|
|
115
|
+
});
|
|
116
|
+
await buildTypes({
|
|
117
|
+
components,
|
|
118
|
+
context
|
|
119
|
+
});
|
|
120
|
+
await buildIcons({
|
|
121
|
+
components,
|
|
122
|
+
context
|
|
123
|
+
});
|
|
124
|
+
await buildStyles({
|
|
125
|
+
components,
|
|
126
|
+
context
|
|
127
|
+
});
|
|
128
|
+
await cleanBuildDirectory({
|
|
129
|
+
context
|
|
130
|
+
});
|
|
131
|
+
await writeActionImports({
|
|
132
|
+
components,
|
|
133
|
+
context
|
|
134
|
+
});
|
|
135
|
+
await writeApp({
|
|
136
|
+
components,
|
|
137
|
+
context
|
|
138
|
+
});
|
|
139
|
+
await writeConnections({
|
|
140
|
+
components,
|
|
141
|
+
context
|
|
142
|
+
});
|
|
143
|
+
await writeRequests({
|
|
144
|
+
components,
|
|
145
|
+
context
|
|
146
|
+
});
|
|
147
|
+
await writePages({
|
|
148
|
+
components,
|
|
149
|
+
context
|
|
150
|
+
});
|
|
151
|
+
await writeConfig({
|
|
152
|
+
components,
|
|
153
|
+
context
|
|
154
|
+
});
|
|
155
|
+
await writeGlobal({
|
|
156
|
+
components,
|
|
157
|
+
context
|
|
158
|
+
});
|
|
159
|
+
await writeMenus({
|
|
160
|
+
components,
|
|
161
|
+
context
|
|
162
|
+
});
|
|
163
|
+
await writeTypes({
|
|
164
|
+
components,
|
|
165
|
+
context
|
|
166
|
+
});
|
|
167
|
+
await writeBlockImports({
|
|
168
|
+
components,
|
|
169
|
+
context
|
|
170
|
+
});
|
|
171
|
+
await writeConnectionImports({
|
|
172
|
+
components,
|
|
173
|
+
context
|
|
174
|
+
});
|
|
175
|
+
await writeOperatorImports({
|
|
176
|
+
components,
|
|
177
|
+
context
|
|
178
|
+
});
|
|
179
|
+
await writeStyleImports({
|
|
180
|
+
components,
|
|
181
|
+
context
|
|
182
|
+
});
|
|
183
|
+
await writeIconImports({
|
|
184
|
+
components,
|
|
185
|
+
context
|
|
186
|
+
});
|
|
187
|
+
await updateServerPackageJson({
|
|
188
|
+
components,
|
|
189
|
+
context
|
|
190
|
+
});
|
|
191
|
+
await copyPublicFolder({
|
|
192
|
+
components,
|
|
193
|
+
context
|
|
194
|
+
});
|
|
187
195
|
}
|
|
188
|
-
export { createContext };
|
|
196
|
+
export { createContext, createPluginTypesMap };
|
|
189
197
|
export default build;
|
package/dist/lowdefySchema.js
CHANGED
|
@@ -232,10 +232,10 @@ export default {
|
|
|
232
232
|
type: 'Block "layout" should be an object.'
|
|
233
233
|
}
|
|
234
234
|
},
|
|
235
|
-
|
|
235
|
+
skeleton: {
|
|
236
236
|
type: 'object',
|
|
237
237
|
errorMessage: {
|
|
238
|
-
type: 'Block "
|
|
238
|
+
type: 'Block "skeleton" should be an object.'
|
|
239
239
|
}
|
|
240
240
|
},
|
|
241
241
|
style: {
|
|
@@ -245,6 +245,7 @@ export default {
|
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
visible: {},
|
|
248
|
+
loading: {},
|
|
248
249
|
blocks: {
|
|
249
250
|
type: 'array',
|
|
250
251
|
items: {
|
|
@@ -536,6 +537,41 @@ export default {
|
|
|
536
537
|
}
|
|
537
538
|
}
|
|
538
539
|
},
|
|
540
|
+
plugin: {
|
|
541
|
+
type: 'object',
|
|
542
|
+
additionalProperties: false,
|
|
543
|
+
required: [
|
|
544
|
+
'name',
|
|
545
|
+
'version'
|
|
546
|
+
],
|
|
547
|
+
properties: {
|
|
548
|
+
name: {
|
|
549
|
+
type: 'string',
|
|
550
|
+
errorMessage: {
|
|
551
|
+
type: 'Plugin "name" should be a string.'
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
version: {
|
|
555
|
+
type: 'string',
|
|
556
|
+
errorMessage: {
|
|
557
|
+
type: 'Plugin "version" should be a string.'
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
typePrefix: {
|
|
561
|
+
type: 'string',
|
|
562
|
+
errorMessage: {
|
|
563
|
+
type: 'Plugin "typePrefix" should be a string.'
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
errorMessage: {
|
|
568
|
+
type: 'Plugin should be an object.',
|
|
569
|
+
required: {
|
|
570
|
+
name: 'Plugin should have required property "name".',
|
|
571
|
+
version: 'Plugin should have required property "version".'
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
},
|
|
539
575
|
request: {
|
|
540
576
|
type: 'object',
|
|
541
577
|
additionalProperties: false,
|
|
@@ -628,6 +664,13 @@ export default {
|
|
|
628
664
|
auth: {
|
|
629
665
|
$ref: '#/definitions/authConfig'
|
|
630
666
|
},
|
|
667
|
+
basePath: {
|
|
668
|
+
type: 'string',
|
|
669
|
+
description: 'App base path to apply to all routes. Base path must start with "/".',
|
|
670
|
+
errorMessage: {
|
|
671
|
+
type: 'App "config.basePath" should be a string.'
|
|
672
|
+
}
|
|
673
|
+
},
|
|
631
674
|
homePageId: {
|
|
632
675
|
type: 'string',
|
|
633
676
|
description: 'Page id to use as homepage. When visiting home route "/", the router will redirect to this page. If not provided, the first page in default or first menu will be used as the homePageId.',
|
|
@@ -652,18 +695,13 @@ export default {
|
|
|
652
695
|
}
|
|
653
696
|
}
|
|
654
697
|
},
|
|
655
|
-
|
|
656
|
-
type: '
|
|
657
|
-
|
|
658
|
-
'
|
|
659
|
-
url: 'string',
|
|
660
|
-
errorMessage: {
|
|
661
|
-
enum: 'Type "url" should be a string.'
|
|
662
|
-
}
|
|
663
|
-
}
|
|
698
|
+
plugins: {
|
|
699
|
+
type: 'array',
|
|
700
|
+
items: {
|
|
701
|
+
$ref: '#/definitions/plugin'
|
|
664
702
|
},
|
|
665
703
|
errorMessage: {
|
|
666
|
-
type: 'App "
|
|
704
|
+
type: 'App "plugins" should be an array.'
|
|
667
705
|
}
|
|
668
706
|
},
|
|
669
707
|
global: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
Copyright 2020-
|
|
3
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
you may not use this file except in compliance with the License.
|
|
@@ -14,98 +14,59 @@
|
|
|
14
14
|
See the License for the specific language governing permissions and
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/ import path from 'path';
|
|
17
|
-
import { type } from '@lowdefy/helpers';
|
|
18
17
|
import { readFile, writeFile } from '@lowdefy/node-utils';
|
|
18
|
+
import createPluginTypesMap from '../utils/createPluginTypesMap.js';
|
|
19
19
|
const defaultPackages = [
|
|
20
|
+
'@lowdefy/actions-core',
|
|
20
21
|
'@lowdefy/blocks-antd',
|
|
21
22
|
'@lowdefy/blocks-basic',
|
|
22
|
-
|
|
23
|
+
'@lowdefy/blocks-color-selectors',
|
|
23
24
|
'@lowdefy/blocks-echarts',
|
|
24
25
|
'@lowdefy/blocks-loaders',
|
|
25
26
|
'@lowdefy/blocks-markdown',
|
|
26
27
|
'@lowdefy/connection-axios-http',
|
|
28
|
+
'@lowdefy/connection-elasticsearch',
|
|
29
|
+
'@lowdefy/connection-google-sheets',
|
|
30
|
+
'@lowdefy/connection-knex',
|
|
31
|
+
'@lowdefy/connection-mongodb',
|
|
27
32
|
'@lowdefy/connection-redis',
|
|
33
|
+
'@lowdefy/connection-sendgrid',
|
|
34
|
+
'@lowdefy/connection-stripe',
|
|
28
35
|
'@lowdefy/operators-change-case',
|
|
29
|
-
|
|
36
|
+
'@lowdefy/operators-diff',
|
|
30
37
|
'@lowdefy/operators-js',
|
|
31
|
-
|
|
38
|
+
'@lowdefy/operators-mql',
|
|
32
39
|
'@lowdefy/operators-nunjucks',
|
|
33
40
|
'@lowdefy/operators-uuid',
|
|
34
41
|
'@lowdefy/operators-yaml',
|
|
35
42
|
];
|
|
36
|
-
function
|
|
37
|
-
if (type.isArray(typeNames)) {
|
|
38
|
-
typeNames.forEach((typeName)=>{
|
|
39
|
-
store[typeName] = {
|
|
40
|
-
package: packageName,
|
|
41
|
-
version
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
async function generateDefaultTypes() {
|
|
43
|
+
async function generateDefaultTypesMap() {
|
|
47
44
|
const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
|
|
48
|
-
const
|
|
45
|
+
const defaultTypesMap = {
|
|
49
46
|
actions: {},
|
|
50
47
|
blocks: {},
|
|
51
48
|
connections: {},
|
|
52
|
-
|
|
49
|
+
icons: {},
|
|
53
50
|
operators: {
|
|
54
51
|
client: {},
|
|
55
52
|
server: {}
|
|
56
53
|
},
|
|
57
|
-
|
|
58
|
-
styles: {
|
|
54
|
+
requests: {},
|
|
55
|
+
styles: {
|
|
56
|
+
packages: {},
|
|
57
|
+
blocks: {}
|
|
58
|
+
}
|
|
59
59
|
};
|
|
60
60
|
await Promise.all(defaultPackages.map(async (packageName)=>{
|
|
61
61
|
const { default: types } = await import(`${packageName}/types`);
|
|
62
|
-
const version = packageFile.devDependencies[packageName];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
packageName,
|
|
67
|
-
version
|
|
68
|
-
});
|
|
69
|
-
createTypeDefinitions({
|
|
70
|
-
typeNames: types.blocks,
|
|
71
|
-
store: defaultTypes.blocks,
|
|
72
|
-
packageName,
|
|
73
|
-
version
|
|
74
|
-
});
|
|
75
|
-
createTypeDefinitions({
|
|
76
|
-
typeNames: types.connections,
|
|
77
|
-
store: defaultTypes.connections,
|
|
78
|
-
packageName,
|
|
79
|
-
version
|
|
80
|
-
});
|
|
81
|
-
createTypeDefinitions({
|
|
82
|
-
typeNames: types.requests,
|
|
83
|
-
store: defaultTypes.requests,
|
|
84
|
-
packageName,
|
|
85
|
-
version
|
|
86
|
-
});
|
|
87
|
-
createTypeDefinitions({
|
|
88
|
-
typeNames: type.isObject(types.operators) ? types.operators.client : [],
|
|
89
|
-
store: defaultTypes.operators.client,
|
|
90
|
-
packageName,
|
|
91
|
-
version
|
|
92
|
-
});
|
|
93
|
-
createTypeDefinitions({
|
|
94
|
-
typeNames: type.isObject(types.operators) ? types.operators.server : [],
|
|
95
|
-
store: defaultTypes.operators.server,
|
|
62
|
+
const version = packageFile.devDependencies[packageName] || packageFile.dependencies[packageName];
|
|
63
|
+
createPluginTypesMap({
|
|
64
|
+
packageTypes: types,
|
|
65
|
+
typesMap: defaultTypesMap,
|
|
96
66
|
packageName,
|
|
97
67
|
version
|
|
98
68
|
});
|
|
99
|
-
if (type.isObject(types.styles)) {
|
|
100
|
-
defaultTypes.styles[packageName] = types.styles;
|
|
101
|
-
}
|
|
102
|
-
if (type.isObject(types.icons)) {
|
|
103
|
-
defaultTypes.icons[packageName] = types.icons;
|
|
104
|
-
}
|
|
105
69
|
}));
|
|
106
|
-
await writeFile(
|
|
107
|
-
filePath: path.resolve(process.cwd(), './dist/defaultTypes.json'),
|
|
108
|
-
content: JSON.stringify(defaultTypes, null, 2)
|
|
109
|
-
});
|
|
70
|
+
await writeFile(path.resolve(process.cwd(), './dist/defaultTypesMap.json'), JSON.stringify(defaultTypesMap, null, 2));
|
|
110
71
|
}
|
|
111
|
-
|
|
72
|
+
generateDefaultTypesMap();
|
package/dist/scripts/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
Copyright 2020-
|
|
3
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
you may not use this file except in compliance with the License.
|
|
@@ -14,14 +14,18 @@
|
|
|
14
14
|
See the License for the specific language governing permissions and
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/ import path from 'path';
|
|
17
|
+
import yargs from 'yargs';
|
|
18
|
+
import { hideBin } from 'yargs/helpers';
|
|
17
19
|
import build from '../index.js';
|
|
20
|
+
const argv = yargs(hideBin(process.argv)).argv;
|
|
18
21
|
async function run() {
|
|
19
22
|
await build({
|
|
20
23
|
logger: console,
|
|
24
|
+
refResolver: argv.refResolver || process.env.LOWDEFY_BUILD_REF_RESOLVER,
|
|
21
25
|
directories: {
|
|
22
|
-
build: path.resolve(process.env.LOWDEFY_DIRECTORY_BUILD || path.join(process.cwd(), 'build')),
|
|
23
|
-
config: path.resolve(process.env.LOWDEFY_DIRECTORY_CONFIG || process.cwd()),
|
|
24
|
-
server: path.resolve(process.env.LOWDEFY_DIRECTORY_SERVER || process.cwd())
|
|
26
|
+
build: path.resolve(argv.buildDirectory || process.env.LOWDEFY_DIRECTORY_BUILD || path.join(process.cwd(), 'build')),
|
|
27
|
+
config: path.resolve(argv.configDirectory || process.env.LOWDEFY_DIRECTORY_CONFIG || process.cwd()),
|
|
28
|
+
server: path.resolve(argv.serverDirectory || process.env.LOWDEFY_DIRECTORY_SERVER || process.cwd())
|
|
25
29
|
}
|
|
26
30
|
});
|
|
27
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,4 +19,4 @@ async function asyncFn() {
|
|
|
19
19
|
async: true
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
export default asyncFn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
*/ function resolver() {
|
|
16
16
|
throw new Error('Test error');
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
export default resolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
if (path === 'null') return null;
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
export default resolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -36,4 +36,4 @@ array:
|
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
export default resolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
contextId: context.id
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
export default resolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -22,4 +22,4 @@ function transformer(obj, vars) {
|
|
|
22
22
|
var: vars.var1
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
export default transformer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
vars
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
export default transformer;
|
package/dist/test/testContext.js
CHANGED