@lowdefy/build 4.0.0-alpha.5 → 4.0.0-alpha.8
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 +36 -41
- package/dist/build/addDefaultPages/addDefaultPages.js +6 -2
- package/dist/build/buildAuth/getPageRoles.js +1 -2
- package/dist/build/buildConnections.js +1 -2
- package/dist/build/buildIcons.js +42 -14
- package/dist/build/buildPages/buildBlock/buildEvents.js +4 -1
- package/dist/build/buildPages/buildBlock/buildRequests.js +1 -2
- package/dist/build/buildPages/buildBlock/countBlockOperators.js +2 -4
- package/dist/build/buildRefs/buildRefs.js +2 -2
- package/dist/build/buildRefs/evaluateBuildOperators.js +35 -0
- package/dist/build/buildRefs/getRefContent.js +1 -1
- package/dist/build/buildRefs/getUserJavascriptFunction.js +6 -3
- package/dist/build/buildRefs/makeRefDefinition.js +1 -2
- package/dist/build/buildRefs/parseRefContent.js +2 -2
- package/dist/build/buildRefs/recursiveBuild.js +9 -4
- package/dist/build/buildRefs/runTransformer.js +7 -3
- package/dist/build/buildStyles.js +2 -2
- package/dist/build/buildTypes.js +35 -31
- package/dist/build/cleanBuildDirectory.js +1 -1
- package/dist/build/copyPublicFolder.js +23 -0
- package/dist/build/updateServerPackageJson.js +2 -6
- package/dist/build/validateApp.js +2 -8
- package/dist/build/validateConfig.js +12 -8
- package/dist/build/writeApp.js +1 -5
- package/dist/build/writeConfig.js +1 -5
- package/dist/build/writeConnections.js +1 -4
- package/dist/build/writeGlobal.js +2 -6
- package/dist/build/writeMenus.js +1 -4
- package/dist/build/writePages.js +2 -13
- package/dist/build/writePluginImports/generateImportFile.js +6 -6
- 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 +10 -16
- 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/defaultTypesMap.json +1499 -0
- package/dist/index.js +133 -124
- package/dist/lowdefySchema.js +69 -28
- package/dist/scripts/generateDefaultTypes.js +34 -70
- package/dist/scripts/run.js +7 -3
- package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +2 -5
- 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/test/testContext.js +8 -17
- package/dist/utils/createPluginTypesMap.js +85 -0
- 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 +47 -23
- package/dist/defaultTypes.json +0 -896
package/dist/index.js
CHANGED
|
@@ -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,116 +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
|
-
|
|
185
|
-
}
|
|
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
|
+
});
|
|
186
195
|
}
|
|
187
|
-
export { createContext };
|
|
196
|
+
export { createContext, createPluginTypesMap };
|
|
188
197
|
export default build;
|
package/dist/lowdefySchema.js
CHANGED
|
@@ -24,12 +24,9 @@ export default {
|
|
|
24
24
|
type: 'Action "id" should be a string.'
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
messages: {
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
skip: {
|
|
32
|
-
},
|
|
27
|
+
messages: {},
|
|
28
|
+
params: {},
|
|
29
|
+
skip: {},
|
|
33
30
|
type: {
|
|
34
31
|
type: 'string',
|
|
35
32
|
errorMessage: {
|
|
@@ -68,12 +65,6 @@ export default {
|
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
},
|
|
72
|
-
styles: {
|
|
73
|
-
type: 'object',
|
|
74
|
-
errorMessage: {
|
|
75
|
-
type: 'App "app.styles" should be an object.'
|
|
76
|
-
}
|
|
77
68
|
}
|
|
78
69
|
}
|
|
79
70
|
},
|
|
@@ -253,8 +244,7 @@ export default {
|
|
|
253
244
|
type: 'Block "style" should be an object.'
|
|
254
245
|
}
|
|
255
246
|
},
|
|
256
|
-
visible: {
|
|
257
|
-
},
|
|
247
|
+
visible: {},
|
|
258
248
|
blocks: {
|
|
259
249
|
type: 'array',
|
|
260
250
|
items: {
|
|
@@ -273,8 +263,7 @@ export default {
|
|
|
273
263
|
type: 'Block "requests" should be an array.'
|
|
274
264
|
}
|
|
275
265
|
},
|
|
276
|
-
required: {
|
|
277
|
-
},
|
|
266
|
+
required: {},
|
|
278
267
|
validate: {
|
|
279
268
|
type: 'array',
|
|
280
269
|
items: {
|
|
@@ -547,6 +536,41 @@ export default {
|
|
|
547
536
|
}
|
|
548
537
|
}
|
|
549
538
|
},
|
|
539
|
+
plugin: {
|
|
540
|
+
type: 'object',
|
|
541
|
+
additionalProperties: false,
|
|
542
|
+
required: [
|
|
543
|
+
'name',
|
|
544
|
+
'version'
|
|
545
|
+
],
|
|
546
|
+
properties: {
|
|
547
|
+
name: {
|
|
548
|
+
type: 'string',
|
|
549
|
+
errorMessage: {
|
|
550
|
+
type: 'Plugin "name" should be a string.'
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
version: {
|
|
554
|
+
type: 'string',
|
|
555
|
+
errorMessage: {
|
|
556
|
+
type: 'Plugin "version" should be a string.'
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
typePrefix: {
|
|
560
|
+
type: 'string',
|
|
561
|
+
errorMessage: {
|
|
562
|
+
type: 'Plugin "typePrefix" should be a string.'
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
errorMessage: {
|
|
567
|
+
type: 'Plugin should be an object.',
|
|
568
|
+
required: {
|
|
569
|
+
name: 'Plugin should have required property "name".',
|
|
570
|
+
version: 'Plugin should have required property "version".'
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
},
|
|
550
574
|
request: {
|
|
551
575
|
type: 'object',
|
|
552
576
|
additionalProperties: false,
|
|
@@ -636,6 +660,16 @@ export default {
|
|
|
636
660
|
},
|
|
637
661
|
additionalProperties: false,
|
|
638
662
|
properties: {
|
|
663
|
+
auth: {
|
|
664
|
+
$ref: '#/definitions/authConfig'
|
|
665
|
+
},
|
|
666
|
+
basePath: {
|
|
667
|
+
type: 'string',
|
|
668
|
+
description: 'App base path to apply to all routes. Base path must start with "/".',
|
|
669
|
+
errorMessage: {
|
|
670
|
+
type: 'App "config.basePath" should be a string.'
|
|
671
|
+
}
|
|
672
|
+
},
|
|
639
673
|
homePageId: {
|
|
640
674
|
type: 'string',
|
|
641
675
|
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.',
|
|
@@ -643,23 +677,30 @@ export default {
|
|
|
643
677
|
type: 'App "config.homePageId" should be a string.'
|
|
644
678
|
}
|
|
645
679
|
},
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
types: {
|
|
652
|
-
type: 'object',
|
|
653
|
-
patternProperties: {
|
|
654
|
-
'^.*$': {
|
|
655
|
-
url: 'string',
|
|
680
|
+
theme: {
|
|
681
|
+
type: 'object',
|
|
656
682
|
errorMessage: {
|
|
657
|
-
|
|
683
|
+
type: 'App "config.theme" should be an object.'
|
|
684
|
+
},
|
|
685
|
+
properties: {
|
|
686
|
+
lessVariables: {
|
|
687
|
+
type: 'object',
|
|
688
|
+
description: 'App theme less variables.',
|
|
689
|
+
errorMessage: {
|
|
690
|
+
type: 'App "config.theme.lessVariables" should be an object.'
|
|
691
|
+
}
|
|
692
|
+
}
|
|
658
693
|
}
|
|
659
694
|
}
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
plugins: {
|
|
698
|
+
type: 'array',
|
|
699
|
+
items: {
|
|
700
|
+
$ref: '#/definitions/plugin'
|
|
660
701
|
},
|
|
661
702
|
errorMessage: {
|
|
662
|
-
type: 'App "
|
|
703
|
+
type: 'App "plugins" should be an array.'
|
|
663
704
|
}
|
|
664
705
|
},
|
|
665
706
|
global: {
|
|
@@ -14,95 +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
|
-
|
|
23
|
+
'@lowdefy/blocks-color-selectors',
|
|
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',
|
|
32
|
+
'@lowdefy/connection-redis',
|
|
33
|
+
'@lowdefy/connection-sendgrid',
|
|
34
|
+
'@lowdefy/connection-stripe',
|
|
35
|
+
'@lowdefy/operators-change-case',
|
|
36
|
+
'@lowdefy/operators-diff',
|
|
27
37
|
'@lowdefy/operators-js',
|
|
28
|
-
'@lowdefy/operators-
|
|
38
|
+
'@lowdefy/operators-mql',
|
|
39
|
+
'@lowdefy/operators-nunjucks',
|
|
40
|
+
'@lowdefy/operators-uuid',
|
|
41
|
+
'@lowdefy/operators-yaml',
|
|
29
42
|
];
|
|
30
|
-
function
|
|
31
|
-
if (type.isArray(typeNames)) {
|
|
32
|
-
typeNames.forEach((typeName)=>{
|
|
33
|
-
store[typeName] = {
|
|
34
|
-
package: packageName,
|
|
35
|
-
version
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async function generateDefaultTypes() {
|
|
43
|
+
async function generateDefaultTypesMap() {
|
|
41
44
|
const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
|
|
42
|
-
const
|
|
43
|
-
actions: {
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
connections: {
|
|
48
|
-
},
|
|
49
|
-
requests: {
|
|
50
|
-
},
|
|
45
|
+
const defaultTypesMap = {
|
|
46
|
+
actions: {},
|
|
47
|
+
blocks: {},
|
|
48
|
+
connections: {},
|
|
49
|
+
icons: {},
|
|
51
50
|
operators: {
|
|
52
|
-
client: {
|
|
53
|
-
}
|
|
54
|
-
server: {
|
|
55
|
-
}
|
|
51
|
+
client: {},
|
|
52
|
+
server: {}
|
|
56
53
|
},
|
|
54
|
+
requests: {},
|
|
57
55
|
styles: {
|
|
56
|
+
packages: {},
|
|
57
|
+
blocks: {}
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
await Promise.all(defaultPackages.map(async (packageName)=>{
|
|
61
61
|
const { default: types } = await import(`${packageName}/types`);
|
|
62
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,
|
|
63
|
+
createPluginTypesMap({
|
|
64
|
+
packageTypes: types,
|
|
65
|
+
typesMap: defaultTypesMap,
|
|
84
66
|
packageName,
|
|
85
67
|
version
|
|
86
68
|
});
|
|
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,
|
|
96
|
-
packageName,
|
|
97
|
-
version
|
|
98
|
-
});
|
|
99
|
-
if (type.isObject(types.styles)) {
|
|
100
|
-
defaultTypes.styles[packageName] = types.styles;
|
|
101
|
-
}
|
|
102
69
|
}));
|
|
103
|
-
await writeFile(
|
|
104
|
-
filePath: path.resolve(process.cwd(), './dist/defaultTypes.json'),
|
|
105
|
-
content: JSON.stringify(defaultTypes, null, 2)
|
|
106
|
-
});
|
|
70
|
+
await writeFile(path.resolve(process.cwd(), './dist/defaultTypesMap.json'), JSON.stringify(defaultTypesMap, null, 2));
|
|
107
71
|
}
|
|
108
|
-
|
|
72
|
+
generateDefaultTypesMap();
|
package/dist/scripts/run.js
CHANGED
|
@@ -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.
|
|
23
|
-
config: path.resolve(process.env.
|
|
24
|
-
server: path.resolve(process.env.
|
|
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
|
}
|
|
@@ -12,14 +12,11 @@
|
|
|
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
|
-
return new Promise((resolve)=>setTimeout(resolve, ms)
|
|
17
|
-
);
|
|
18
|
-
};
|
|
15
|
+
*/ import { wait } from '@lowdefy/helpers';
|
|
19
16
|
async function asyncFn() {
|
|
20
17
|
await wait(20);
|
|
21
18
|
return {
|
|
22
19
|
async: true
|
|
23
20
|
};
|
|
24
21
|
}
|
|
25
|
-
|
|
22
|
+
export default asyncFn;
|