@lowdefy/build 4.0.0-alpha.1 → 4.0.0-alpha.10

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.
Files changed (79) hide show
  1. package/dist/build/addDefaultPages/404.js +37 -42
  2. package/dist/build/addDefaultPages/addDefaultPages.js +7 -3
  3. package/dist/build/buildAuth/buildAuth.js +1 -1
  4. package/dist/build/buildAuth/getPageRoles.js +2 -3
  5. package/dist/build/buildAuth/getProtectedPages.js +1 -1
  6. package/dist/build/buildConnections.js +2 -3
  7. package/dist/build/buildIcons.js +91 -0
  8. package/dist/build/buildMenu.js +1 -1
  9. package/dist/build/buildPages/buildBlock/buildBlock.js +6 -2
  10. package/dist/build/buildPages/buildBlock/buildEvents.js +5 -2
  11. package/dist/build/buildPages/buildBlock/buildRequests.js +2 -3
  12. package/dist/build/buildPages/buildBlock/buildSubBlocks.js +1 -1
  13. package/dist/build/buildPages/buildBlock/countBlockOperators.js +4 -6
  14. package/dist/build/buildPages/buildBlock/countBlockTypes.js +18 -0
  15. package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +35 -0
  16. package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +1 -1
  17. package/dist/build/buildPages/buildBlock/setBlockId.js +1 -1
  18. package/dist/build/buildPages/buildBlock/validateBlock.js +2 -3
  19. package/dist/build/buildPages/buildPage.js +1 -1
  20. package/dist/build/buildPages/buildPages.js +1 -1
  21. package/dist/build/buildRefs/buildRefs.js +3 -3
  22. package/dist/build/buildRefs/evaluateBuildOperators.js +35 -0
  23. package/dist/build/buildRefs/getConfigFile.js +1 -1
  24. package/dist/build/buildRefs/getRefContent.js +2 -2
  25. package/dist/build/buildRefs/getRefPath.js +1 -1
  26. package/dist/build/buildRefs/getRefsFromFile.js +1 -1
  27. package/dist/build/buildRefs/getUserJavascriptFunction.js +7 -4
  28. package/dist/build/buildRefs/makeRefDefinition.js +2 -3
  29. package/dist/build/buildRefs/parseNunjucks.js +1 -1
  30. package/dist/build/buildRefs/parseRefContent.js +3 -3
  31. package/dist/build/buildRefs/populateRefs.js +1 -1
  32. package/dist/build/buildRefs/recursiveBuild.js +10 -5
  33. package/dist/build/buildRefs/runRefResolver.js +1 -1
  34. package/dist/build/buildRefs/runTransformer.js +8 -4
  35. package/dist/build/buildStyles.js +29 -0
  36. package/dist/build/buildTypes.js +50 -44
  37. package/dist/build/cleanBuildDirectory.js +2 -2
  38. package/dist/build/copyPublicFolder.js +23 -0
  39. package/dist/build/testSchema.js +1 -1
  40. package/dist/build/updateServerPackageJson.js +46 -0
  41. package/dist/build/validateApp.js +3 -5
  42. package/dist/build/validateConfig.js +13 -9
  43. package/dist/build/writeApp.js +2 -6
  44. package/dist/build/writeConfig.js +2 -6
  45. package/dist/build/writeConnections.js +2 -5
  46. package/dist/build/writeGlobal.js +3 -7
  47. package/dist/build/writeMenus.js +2 -5
  48. package/dist/build/writePages.js +3 -14
  49. package/dist/build/writePluginImports/generateImportFile.js +36 -0
  50. package/dist/build/writePluginImports/writeActionImports.js +22 -0
  51. package/dist/build/writePluginImports/writeBlockImports.js +6 -23
  52. package/dist/build/writePluginImports/writeConnectionImports.js +6 -23
  53. package/dist/build/writePluginImports/writeIconImports.js +31 -0
  54. package/dist/build/writePluginImports/writeOperatorImports.js +26 -0
  55. package/dist/build/writePluginImports/writeStyleImports.js +28 -0
  56. package/dist/build/writeRequests.js +3 -8
  57. package/dist/build/writeTypes.js +2 -5
  58. package/dist/defaultTypesMap.json +1598 -0
  59. package/dist/index.js +143 -111
  60. package/dist/lowdefySchema.js +72 -24
  61. package/dist/scripts/generateDefaultTypes.js +42 -76
  62. package/dist/scripts/run.js +13 -12
  63. package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +3 -6
  64. package/dist/test/buildRefs/testBuildRefsErrorResolver.js +2 -2
  65. package/dist/test/buildRefs/testBuildRefsNullResolver.js +2 -2
  66. package/dist/test/buildRefs/testBuildRefsParsingResolver.js +2 -2
  67. package/dist/test/buildRefs/testBuildRefsResolver.js +2 -2
  68. package/dist/test/buildRefs/testBuildRefsTransform.js +2 -2
  69. package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +2 -2
  70. package/dist/test/testContext.js +12 -19
  71. package/dist/utils/countOperators.js +1 -1
  72. package/dist/utils/createCheckDuplicateId.js +1 -1
  73. package/dist/utils/createCounter.js +1 -1
  74. package/dist/utils/createPluginTypesMap.js +85 -0
  75. package/dist/utils/formatErrorMessage.js +2 -2
  76. package/dist/utils/{files/readConfigFile.js → readConfigFile.js} +3 -3
  77. package/dist/utils/{files/writeBuildArtifact.js → writeBuildArtifact.js} +4 -7
  78. package/package.json +47 -16
  79. package/dist/defaultTypes.json +0 -60
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-console */ /*
2
- Copyright 2020-2021 Lowdefy, Inc
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,40 +12,50 @@
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 { readFile } from '@lowdefy/node-utils';
15
+ */ import { mergeObjects } from '@lowdefy/helpers';
16
+ import { readFile } from '@lowdefy/node-utils';
16
17
  import createCounter from './utils/createCounter.js';
17
- import createReadConfigFile from './utils/files/readConfigFile.js';
18
- import createWriteBuildArtifact from './utils/files/writeBuildArtifact.js';
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';
24
+ import buildIcons from './build/buildIcons.js';
22
25
  import buildMenu from './build/buildMenu.js';
23
26
  import buildPages from './build/buildPages/buildPages.js';
24
27
  import buildRefs from './build/buildRefs/buildRefs.js';
28
+ import buildStyles from './build/buildStyles.js';
25
29
  import buildTypes from './build/buildTypes.js';
26
30
  import cleanBuildDirectory from './build/cleanBuildDirectory.js';
31
+ import copyPublicFolder from './build/copyPublicFolder.js';
27
32
  import testSchema from './build/testSchema.js';
28
33
  import validateApp from './build/validateApp.js';
29
34
  import validateConfig from './build/validateConfig.js';
35
+ import updateServerPackageJson from './build/updateServerPackageJson.js';
30
36
  import writeApp from './build/writeApp.js';
37
+ import writeActionImports from './build/writePluginImports/writeActionImports.js';
31
38
  import writeBlockImports from './build/writePluginImports/writeBlockImports.js';
32
- import writeConnectionImports from './build/writePluginImports/writeConnectionImports.js';
33
39
  import writeConfig from './build/writeConfig.js';
40
+ import writeConnectionImports from './build/writePluginImports/writeConnectionImports.js';
34
41
  import writeConnections from './build/writeConnections.js';
35
42
  import writeGlobal from './build/writeGlobal.js';
43
+ import writeIconImports from './build/writePluginImports/writeIconImports.js';
36
44
  import writeMenus from './build/writeMenus.js';
45
+ import writeOperatorImports from './build/writePluginImports/writeOperatorImports.js';
37
46
  import writePages from './build/writePages.js';
38
47
  import writeRequests from './build/writeRequests.js';
48
+ import writeStyleImports from './build/writePluginImports/writeStyleImports.js';
39
49
  import writeTypes from './build/writeTypes.js';
40
- async function createContext(options) {
41
- const { blocksServerUrl , buildDirectory , cacheDirectory , configDirectory , logger , refResolver } = options;
42
- const defaultTypes = JSON.parse(await readFile(new URL('./defaultTypes.json', import.meta.url).pathname));
43
- // 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));
44
52
  const context = {
45
- blocksServerUrl,
46
- buildDirectory,
47
- cacheDirectory,
48
- configDirectory,
53
+ directories,
54
+ logger,
55
+ readConfigFile: createReadConfigFile({
56
+ directories
57
+ }),
58
+ refResolver,
49
59
  typeCounters: {
50
60
  actions: createCounter(),
51
61
  blocks: createCounter(),
@@ -56,110 +66,132 @@ async function createContext(options) {
56
66
  server: createCounter()
57
67
  }
58
68
  },
59
- logger,
60
- readConfigFile: createReadConfigFile({
61
- configDirectory
62
- }),
63
- refResolver,
64
- types: defaultTypes,
69
+ typesMap: mergeObjects([
70
+ defaultTypesMap,
71
+ customTypesMap
72
+ ]),
65
73
  writeBuildArtifact: createWriteBuildArtifact({
66
- buildDirectory
74
+ directories
67
75
  })
68
76
  };
69
77
  return context;
70
78
  }
71
79
  async function build(options) {
72
80
  const context = await createContext(options);
73
- try {
74
- const components = await buildRefs({
75
- context
76
- });
77
- await testSchema({
78
- components,
79
- context
80
- });
81
- await validateApp({
82
- components,
83
- context
84
- });
85
- await validateConfig({
86
- components,
87
- context
88
- });
89
- await addDefaultPages({
90
- components,
91
- context
92
- });
93
- await buildAuth({
94
- components,
95
- context
96
- });
97
- await buildConnections({
98
- components,
99
- context
100
- });
101
- await buildPages({
102
- components,
103
- context
104
- });
105
- await buildMenu({
106
- components,
107
- context
108
- });
109
- await buildTypes({
110
- components,
111
- context
112
- });
113
- await cleanBuildDirectory({
114
- context
115
- });
116
- await writeApp({
117
- components,
118
- context
119
- });
120
- await writeConnections({
121
- components,
122
- context
123
- });
124
- await writeRequests({
125
- components,
126
- context
127
- });
128
- await writePages({
129
- components,
130
- context
131
- });
132
- await writeConfig({
133
- components,
134
- context
135
- });
136
- await writeGlobal({
137
- components,
138
- context
139
- });
140
- await writeMenus({
141
- components,
142
- context
143
- });
144
- await writeTypes({
145
- components,
146
- context
147
- });
148
- await writeBlockImports({
149
- components,
150
- context
151
- });
152
- await writeConnectionImports({
153
- components,
154
- context
155
- });
156
- // TODO: write style file
157
- // TODO: write icons file
158
- // TODO: add plugins to package.json
159
- } catch (error) {
160
- context.logger.error(error);
161
- throw error;
162
- }
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
+ });
163
195
  }
164
- export { createContext };
196
+ export { createContext, createPluginTypesMap };
165
197
  export default build;
@@ -24,12 +24,9 @@ export default {
24
24
  type: 'Action "id" should be a string.'
25
25
  }
26
26
  },
27
- messages: {
28
- },
29
- params: {
30
- },
31
- skip: {
32
- },
27
+ messages: {},
28
+ params: {},
29
+ skip: {},
33
30
  type: {
34
31
  type: 'string',
35
32
  errorMessage: {
@@ -235,10 +232,10 @@ export default {
235
232
  type: 'Block "layout" should be an object.'
236
233
  }
237
234
  },
238
- loading: {
235
+ skeleton: {
239
236
  type: 'object',
240
237
  errorMessage: {
241
- type: 'Block "loading" should be an object.'
238
+ type: 'Block "skeleton" should be an object.'
242
239
  }
243
240
  },
244
241
  style: {
@@ -247,8 +244,8 @@ export default {
247
244
  type: 'Block "style" should be an object.'
248
245
  }
249
246
  },
250
- visible: {
251
- },
247
+ visible: {},
248
+ loading: {},
252
249
  blocks: {
253
250
  type: 'array',
254
251
  items: {
@@ -267,8 +264,7 @@ export default {
267
264
  type: 'Block "requests" should be an array.'
268
265
  }
269
266
  },
270
- required: {
271
- },
267
+ required: {},
272
268
  validate: {
273
269
  type: 'array',
274
270
  items: {
@@ -541,6 +537,41 @@ export default {
541
537
  }
542
538
  }
543
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
+ },
544
575
  request: {
545
576
  type: 'object',
546
577
  additionalProperties: false,
@@ -630,6 +661,16 @@ export default {
630
661
  },
631
662
  additionalProperties: false,
632
663
  properties: {
664
+ auth: {
665
+ $ref: '#/definitions/authConfig'
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
+ },
633
674
  homePageId: {
634
675
  type: 'string',
635
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.',
@@ -637,23 +678,30 @@ export default {
637
678
  type: 'App "config.homePageId" should be a string.'
638
679
  }
639
680
  },
640
- auth: {
641
- $ref: '#/definitions/authConfig'
642
- }
643
- }
644
- },
645
- types: {
646
- type: 'object',
647
- patternProperties: {
648
- '^.*$': {
649
- url: 'string',
681
+ theme: {
682
+ type: 'object',
650
683
  errorMessage: {
651
- enum: 'Type "url" should be a string.'
684
+ type: 'App "config.theme" should be an object.'
685
+ },
686
+ properties: {
687
+ lessVariables: {
688
+ type: 'object',
689
+ description: 'App theme less variables.',
690
+ errorMessage: {
691
+ type: 'App "config.theme.lessVariables" should be an object.'
692
+ }
693
+ }
652
694
  }
653
695
  }
696
+ }
697
+ },
698
+ plugins: {
699
+ type: 'array',
700
+ items: {
701
+ $ref: '#/definitions/plugin'
654
702
  },
655
703
  errorMessage: {
656
- type: 'App "types" should be an object.'
704
+ type: 'App "plugins" should be an array.'
657
705
  }
658
706
  },
659
707
  global: {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
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,93 +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',
21
+ '@lowdefy/blocks-antd',
20
22
  '@lowdefy/blocks-basic',
21
- '@lowdefy/connection-axios-http'
23
+ '@lowdefy/blocks-color-selectors',
24
+ '@lowdefy/blocks-echarts',
25
+ '@lowdefy/blocks-loaders',
26
+ '@lowdefy/blocks-markdown',
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',
37
+ '@lowdefy/operators-js',
38
+ '@lowdefy/operators-mql',
39
+ '@lowdefy/operators-nunjucks',
40
+ '@lowdefy/operators-uuid',
41
+ '@lowdefy/operators-yaml',
22
42
  ];
23
- function createTypeDefinitions({ typeNames , store , packageName , version }) {
24
- if (type.isArray(typeNames)) {
25
- typeNames.forEach((typeName)=>{
26
- store[typeName] = {
27
- package: packageName,
28
- version
29
- };
30
- });
31
- }
32
- }
33
- async function generateDefaultTypes() {
43
+ async function generateDefaultTypesMap() {
34
44
  const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
35
- const defaultTypes = {
36
- actions: {
37
- },
38
- blocks: {
39
- },
40
- connections: {
41
- },
42
- requests: {
43
- },
45
+ const defaultTypesMap = {
46
+ actions: {},
47
+ blocks: {},
48
+ connections: {},
49
+ icons: {},
44
50
  operators: {
45
- client: {
46
- },
47
- server: {
48
- }
51
+ client: {},
52
+ server: {}
49
53
  },
50
- styles: []
54
+ requests: {},
55
+ styles: {
56
+ packages: {},
57
+ blocks: {}
58
+ }
51
59
  };
52
60
  await Promise.all(defaultPackages.map(async (packageName)=>{
53
61
  const { default: types } = await import(`${packageName}/types`);
54
- const version = packageFile.devDependencies[packageName];
55
- createTypeDefinitions({
56
- typeNames: types.actions,
57
- store: defaultTypes.actions,
58
- packageName,
59
- version
60
- });
61
- createTypeDefinitions({
62
- typeNames: types.blocks,
63
- store: defaultTypes.blocks,
62
+ const version = packageFile.devDependencies[packageName] || packageFile.dependencies[packageName];
63
+ createPluginTypesMap({
64
+ packageTypes: types,
65
+ typesMap: defaultTypesMap,
64
66
  packageName,
65
67
  version
66
68
  });
67
- createTypeDefinitions({
68
- typeNames: types.connections,
69
- store: defaultTypes.connections,
70
- packageName,
71
- version
72
- });
73
- createTypeDefinitions({
74
- typeNames: types.requests,
75
- store: defaultTypes.requests,
76
- packageName,
77
- version
78
- });
79
- createTypeDefinitions({
80
- typeNames: type.isObject(types.operators) ? types.operators.client : [],
81
- store: defaultTypes.operators.client,
82
- packageName,
83
- version
84
- });
85
- createTypeDefinitions({
86
- typeNames: type.isObject(types.operators) ? types.operators.server : [],
87
- store: defaultTypes.operators.server,
88
- packageName,
89
- version
90
- });
91
- if (type.isArray(types.styles)) {
92
- types.styles.forEach((pathName)=>{
93
- defaultTypes.styles.push({
94
- path: pathName,
95
- package: packageName,
96
- version: packageFile.devDependencies[packageName]
97
- });
98
- });
99
- }
100
69
  }));
101
- await writeFile({
102
- filePath: path.resolve(process.cwd(), './dist/defaultTypes.json'),
103
- content: JSON.stringify(defaultTypes, null, 2)
104
- });
70
+ await writeFile(path.resolve(process.cwd(), './dist/defaultTypesMap.json'), JSON.stringify(defaultTypesMap, null, 2));
105
71
  }
106
- generateDefaultTypes();
72
+ generateDefaultTypesMap();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
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,18 +14,19 @@
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
- // TODO: resolve build with no config
20
- try {
21
- await build({
22
- logger: console,
23
- buildDirectory: path.resolve(process.cwd(), './.lowdefy/build'),
24
- cacheDirectory: path.resolve(process.cwd(), './.lowdefy/.cache'),
25
- configDirectory: process.cwd()
26
- });
27
- } catch (e) {
28
- console.error(e);
29
- }
22
+ await build({
23
+ logger: console,
24
+ refResolver: argv.refResolver || process.env.LOWDEFY_BUILD_REF_RESOLVER,
25
+ directories: {
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())
29
+ }
30
+ });
30
31
  }
31
32
  run();
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
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,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
- */ const wait = (ms)=>{
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
- module.exports = asyncFn;
22
+ export default asyncFn;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
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
- module.exports = resolver;
18
+ export default resolver;