webiny 0.8.32 → 6.0.0-rc.0

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 (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -15
  3. package/admin/aco.d.ts +2 -0
  4. package/admin/aco.js +4 -0
  5. package/admin/aco.js.map +1 -0
  6. package/admin/buildParams.d.ts +1 -0
  7. package/admin/buildParams.js +3 -0
  8. package/admin/buildParams.js.map +1 -0
  9. package/admin/cms/entry/editor.d.ts +11 -0
  10. package/admin/cms/entry/editor.js +13 -0
  11. package/admin/cms/entry/editor.js.map +1 -0
  12. package/admin/cms/entry/list.d.ts +2 -0
  13. package/admin/cms/entry/list.js +4 -0
  14. package/admin/cms/entry/list.js.map +1 -0
  15. package/admin/cms/fieldRenderers/dynamicZone.d.ts +7 -0
  16. package/admin/cms/fieldRenderers/dynamicZone.js +9 -0
  17. package/admin/cms/fieldRenderers/dynamicZone.js.map +1 -0
  18. package/admin/cms/fieldRenderers/object.d.ts +1 -0
  19. package/admin/cms/fieldRenderers/object.js +3 -0
  20. package/admin/cms/fieldRenderers/object.js.map +1 -0
  21. package/admin/cms/lexical.d.ts +16 -0
  22. package/admin/cms/lexical.js +17 -0
  23. package/admin/cms/lexical.js.map +1 -0
  24. package/admin/cms.d.ts +8 -0
  25. package/admin/cms.js +9 -0
  26. package/admin/cms.js.map +1 -0
  27. package/admin/configs.d.ts +1 -0
  28. package/admin/configs.js +3 -0
  29. package/admin/configs.js.map +1 -0
  30. package/admin/envConfig.d.ts +1 -0
  31. package/admin/envConfig.js +3 -0
  32. package/admin/envConfig.js.map +1 -0
  33. package/admin/form.d.ts +11 -0
  34. package/admin/form.js +12 -0
  35. package/admin/form.js.map +1 -0
  36. package/admin/graphqlClient.d.ts +1 -0
  37. package/admin/graphqlClient.js +3 -0
  38. package/admin/graphqlClient.js.map +1 -0
  39. package/admin/lexical.d.ts +15 -0
  40. package/admin/lexical.js +16 -0
  41. package/admin/lexical.js.map +1 -0
  42. package/admin/localStorage.d.ts +2 -0
  43. package/admin/localStorage.js +4 -0
  44. package/admin/localStorage.js.map +1 -0
  45. package/admin/router.d.ts +4 -0
  46. package/admin/router.js +6 -0
  47. package/admin/router.js.map +1 -0
  48. package/admin/security.d.ts +9 -0
  49. package/admin/security.js +11 -0
  50. package/admin/security.js.map +1 -0
  51. package/admin/tenancy.d.ts +2 -0
  52. package/admin/tenancy.js +4 -0
  53. package/admin/tenancy.js.map +1 -0
  54. package/admin/ui.d.ts +62 -0
  55. package/admin/ui.js +64 -0
  56. package/admin/ui.js.map +1 -0
  57. package/admin/website-builder/lexical.d.ts +17 -0
  58. package/admin/website-builder/lexical.js +18 -0
  59. package/admin/website-builder/lexical.js.map +1 -0
  60. package/admin/website-builder/page/editor.d.ts +2 -0
  61. package/admin/website-builder/page/editor.js +4 -0
  62. package/admin/website-builder/page/editor.js.map +1 -0
  63. package/admin/website-builder/page/list.d.ts +1 -0
  64. package/admin/website-builder/page/list.js +3 -0
  65. package/admin/website-builder/page/list.js.map +1 -0
  66. package/admin/website-builder/redirect/list.d.ts +1 -0
  67. package/admin/website-builder/redirect/list.js +3 -0
  68. package/admin/website-builder/redirect/list.js.map +1 -0
  69. package/admin/website-builder.d.ts +2 -0
  70. package/admin/website-builder.js +4 -0
  71. package/admin/website-builder.js.map +1 -0
  72. package/admin.d.ts +13 -0
  73. package/admin.js +15 -0
  74. package/admin.js.map +1 -0
  75. package/ambient/images.d.ts +22 -0
  76. package/api/buildParams.d.ts +1 -0
  77. package/api/buildParams.js +3 -0
  78. package/api/buildParams.js.map +1 -0
  79. package/api/cms/entry.d.ts +40 -0
  80. package/api/cms/entry.js +41 -0
  81. package/api/cms/entry.js.map +1 -0
  82. package/api/cms/group.d.ts +10 -0
  83. package/api/cms/group.js +11 -0
  84. package/api/cms/group.js.map +1 -0
  85. package/api/cms/model.d.ts +18 -0
  86. package/api/cms/model.js +17 -0
  87. package/api/cms/model.js.map +1 -0
  88. package/api/eventPublisher.d.ts +1 -0
  89. package/api/eventPublisher.js +3 -0
  90. package/api/eventPublisher.js.map +1 -0
  91. package/api/graphql.d.ts +3 -0
  92. package/api/graphql.js +5 -0
  93. package/api/graphql.js.map +1 -0
  94. package/api/keyValueStore.d.ts +1 -0
  95. package/api/keyValueStore.js +3 -0
  96. package/api/keyValueStore.js.map +1 -0
  97. package/api/logger.d.ts +1 -0
  98. package/api/logger.js +3 -0
  99. package/api/logger.js.map +1 -0
  100. package/api/security/apiKey.d.ts +7 -0
  101. package/api/security/apiKey.js +9 -0
  102. package/api/security/apiKey.js.map +1 -0
  103. package/api/security/authentication.d.ts +1 -0
  104. package/api/security/authentication.js +3 -0
  105. package/api/security/authentication.js.map +1 -0
  106. package/api/security/role.d.ts +5 -0
  107. package/api/security/role.js +7 -0
  108. package/api/security/role.js.map +1 -0
  109. package/api/security/user.d.ts +6 -0
  110. package/api/security/user.js +8 -0
  111. package/api/security/user.js.map +1 -0
  112. package/api/security.d.ts +6 -0
  113. package/api/security.js +8 -0
  114. package/api/security.js.map +1 -0
  115. package/api/system.d.ts +1 -0
  116. package/api/system.js +3 -0
  117. package/api/system.js.map +1 -0
  118. package/api/tasks.d.ts +2 -0
  119. package/api/tasks.js +4 -0
  120. package/api/tasks.js.map +1 -0
  121. package/api/tenancy.d.ts +6 -0
  122. package/api/tenancy.js +8 -0
  123. package/api/tenancy.js.map +1 -0
  124. package/api/tenant-manager.d.ts +2 -0
  125. package/api/tenant-manager.js +3 -0
  126. package/api/tenant-manager.js.map +1 -0
  127. package/api/website-builder/nextjs.d.ts +1 -0
  128. package/api/website-builder/nextjs.js +3 -0
  129. package/api/website-builder/nextjs.js.map +1 -0
  130. package/api/website-builder/page.d.ts +12 -0
  131. package/api/website-builder/page.js +14 -0
  132. package/api/website-builder/page.js.map +1 -0
  133. package/api/website-builder/redirect.d.ts +8 -0
  134. package/api/website-builder/redirect.js +10 -0
  135. package/api/website-builder/redirect.js.map +1 -0
  136. package/api.d.ts +1 -0
  137. package/api.js +3 -0
  138. package/api.js.map +1 -0
  139. package/cli/command.d.ts +1 -0
  140. package/cli/command.js +3 -0
  141. package/cli/command.js.map +1 -0
  142. package/cli/index.d.ts +2 -0
  143. package/cli/index.js +4 -0
  144. package/cli/index.js.map +1 -0
  145. package/configs/tsconfig.json +52 -0
  146. package/extensions.d.ts +8 -0
  147. package/extensions.js +10 -0
  148. package/extensions.js.map +1 -0
  149. package/global.d.ts +8 -0
  150. package/global.js +14 -0
  151. package/global.js.map +1 -0
  152. package/infra/admin.d.ts +7 -0
  153. package/infra/admin.js +9 -0
  154. package/infra/admin.js.map +1 -0
  155. package/infra/api.d.ts +7 -0
  156. package/infra/api.js +9 -0
  157. package/infra/api.js.map +1 -0
  158. package/infra/core.d.ts +6 -0
  159. package/infra/core.js +8 -0
  160. package/infra/core.js.map +1 -0
  161. package/infra/index.d.ts +8 -0
  162. package/infra/index.js +10 -0
  163. package/infra/index.js.map +1 -0
  164. package/package.json +108 -33
  165. package/.gitattributes +0 -39
  166. package/.npmignore +0 -162
  167. package/bin/webiny.js +0 -7
  168. package/index.js +0 -94
  169. package/lib/app.js +0 -27
  170. package/lib/boot/checkRequirements.js +0 -144
  171. package/lib/boot/checkUpdates.js +0 -55
  172. package/lib/boot/setup.js +0 -26
  173. package/lib/menu.js +0 -31
  174. package/lib/navigation.js +0 -134
  175. package/lib/plugin.js +0 -28
  176. package/lib/webiny.js +0 -287
  177. package/postinstall.js +0 -26
package/lib/navigation.js DELETED
@@ -1,134 +0,0 @@
1
- const inquirer = require('inquirer');
2
- const chalk = require('chalk');
3
- const _ = require('lodash');
4
- const Webiny = require('./webiny');
5
-
6
- class Menu {
7
- constructor() {
8
- this.plugins = Webiny.getPlugins();
9
- this.webinyConfig = Webiny.getConfig();
10
- this.lastRun = this.webinyConfig.lastRun;
11
- this.apps = Webiny.getApps();
12
- this.appChoices = [
13
- {name: 'All', value: 'all'}
14
- ];
15
-
16
- if (_.get(this.lastRun, 'apps.length', 0) > 0) {
17
- this.appChoices.push({
18
- name: 'Last selection: ' + chalk.cyan(this.lastRun.apps.join(', ')),
19
- value: 'last'
20
- });
21
- }
22
-
23
- this.appChoices.push(new inquirer.Separator());
24
- this.apps.map(app => {
25
- this.appChoices.push({
26
- name: app.getName(),
27
- value: app
28
- });
29
- });
30
- }
31
-
32
- normalizeApps(answers, config) {
33
- if (_.has(answers, 'apps')) {
34
- config.apps = [];
35
-
36
- // If more than 1 option is selected - remove 'all' from the selected options
37
- if (answers.apps.length > 1) {
38
- _.remove(answers.apps, function (a) {
39
- return a === 'all';
40
- });
41
- }
42
-
43
- if (answers.apps[0] === 'all') {
44
- config.apps = this.apps;
45
- } else {
46
- // Combine 'Last selection' (if selected) with other selected apps
47
- _.map(answers.apps, a => {
48
- if (a === 'last') {
49
- // Select last selected apps but skip those not present in the project
50
- _.merge(config.apps, _.map(this.lastRun.apps, appName => {
51
- const found = _.find(this.apps, app => app.getName() === appName);
52
- if (found) {
53
- config.apps.push(found);
54
- }
55
- }));
56
- } else {
57
- config.apps.push(a);
58
- }
59
- });
60
- }
61
- }
62
-
63
- return config.apps;
64
- }
65
-
66
- render() {
67
- const choices = [];
68
-
69
- _.each(this.plugins, plugin => {
70
- const menu = plugin.getMenu();
71
- if (menu) {
72
- if (menu.getLineBefore()) {
73
- choices.push(new inquirer.Separator());
74
- }
75
-
76
- choices.push({name: menu.getTitle(), value: plugin.getTask()});
77
-
78
- if (menu.getLineAfter()) {
79
- choices.push(new inquirer.Separator());
80
- }
81
- }
82
- });
83
-
84
- // Output a blank line
85
- Webiny.log('');
86
- inquirer.prompt([{
87
- type: 'list',
88
- name: 'task',
89
- message: 'What would you like to do?',
90
- choices,
91
- filter: function (val) {
92
- return val.toLowerCase();
93
- }
94
- }, {
95
- type: 'checkbox',
96
- name: 'apps',
97
- message: 'Select apps',
98
- choices: this.appChoices,
99
- default: ['all'],
100
- when: answers => {
101
- const plugin = _.find(this.plugins, pl => pl.getTask() === answers.task);
102
- if (!plugin) {
103
- return false;
104
- }
105
- return plugin.getSelectApps();
106
- },
107
- validate: answer => {
108
- if (answer.length < 1) {
109
- return 'You must choose at least one option';
110
- }
111
-
112
- return true;
113
- }
114
- }]).then(answers => {
115
- const task = answers.task;
116
- const config = {};
117
- config.apps = this.normalizeApps(answers, config);
118
-
119
- this.lastRun.apps = _.map(config.apps, app => app.getName());
120
- Webiny.saveConfig(_.assign(this.webinyConfig, {lastRun: this.lastRun}));
121
-
122
- return this.runTask(task, config);
123
- }).catch(err => {
124
- Webiny.failure(err.message, err.stack);
125
- });
126
- }
127
-
128
- runTask(task, config) {
129
- return this.plugins[task].runWizard(config, () => this.render(), (task, config) => this.runTask(task, config));
130
- }
131
- }
132
-
133
-
134
- module.exports = Menu;
package/lib/plugin.js DELETED
@@ -1,28 +0,0 @@
1
- class Plugin {
2
- constructor(program) {
3
- this.task = null;
4
- this.selectApps = true;
5
- }
6
-
7
- getTask() {
8
- return this.task;
9
- }
10
-
11
- getMenu() {
12
- return null;
13
- }
14
-
15
- getSelectApps() {
16
- return this.selectApps;
17
- }
18
-
19
- runTask(config, onFinish) {
20
- // Override to implement
21
- }
22
-
23
- runWizard(config, onFinish) {
24
- return this.runTask(config, onFinish);
25
- }
26
- }
27
-
28
- module.exports = Plugin;
package/lib/webiny.js DELETED
@@ -1,287 +0,0 @@
1
- /* eslint-disable */
2
- const fs = require('fs-extra');
3
- const path = require('path');
4
- const chalk = require('chalk');
5
- const _ = require('lodash');
6
- const yaml = require('js-yaml');
7
- const program = require('commander');
8
- const execSync = require('child_process').execSync;
9
- const App = require('./app');
10
-
11
- const folders = {};
12
-
13
- function getFolders(dir, force) {
14
- if (!force && folders[dir]) {
15
- return folders[dir];
16
- }
17
-
18
- try {
19
- folders[dir] = fs.readdirSync(dir).filter(file => {
20
- return fs.statSync(path.join(dir, file)).isDirectory() && file !== '.git';
21
- });
22
- return folders[dir];
23
- } catch (e) {
24
- return [];
25
- }
26
- }
27
-
28
- function readJsApps(app, dir, Webiny) {
29
- const jsApps = [];
30
- getFolders(dir).map(jsApp => {
31
- jsApps.push(
32
- new App(app, jsApp, _.trimStart(dir.replace(Webiny.projectRoot(), '') + '/' + jsApp, '/'))
33
- );
34
- });
35
-
36
- return jsApps;
37
- }
38
-
39
-
40
- class Webiny {
41
- constructor() {
42
- this.plugins = {};
43
- this.apps = null;
44
- this.config = null;
45
-
46
- this.validate = {
47
- email(value) {
48
- const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
49
- if (!re.test(value)) {
50
- return 'Please enter a valid e-mail';
51
- }
52
- return true;
53
- },
54
- url(value) {
55
- const regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
56
- if (regex.test(value)) {
57
- return true;
58
- }
59
-
60
- return 'Please enter a valid domain (e.g. http://domain.app:8001)';
61
- },
62
- writable(path) {
63
- const error = 'Given path is not writable! Please check your permissions or specify a different file path.';
64
- try {
65
- // Check if file exists
66
- fs.statSync(path).isFile();
67
- try {
68
- fs.accessSync(path, fs.W_OK);
69
- return true;
70
- } catch (err) {
71
- return error;
72
- }
73
- } catch (err) {
74
- // If file does not exist - try creating it, and remove it on success
75
- try {
76
- fs.ensureFileSync(path);
77
- fs.removeSync(path);
78
- } catch (err) {
79
- return error;
80
- }
81
- }
82
- return true;
83
- }
84
- }
85
- }
86
-
87
- getConfig() {
88
- if (this.config) {
89
- return this.config;
90
- }
91
-
92
- try {
93
- this.config = JSON.parse(this.readFile(this.projectRoot('webiny.json')));
94
- } catch (e) {
95
- this.config = {
96
- lastRun: {
97
- apps: [],
98
- host: ''
99
- }
100
- };
101
- }
102
- return this.config;
103
- }
104
-
105
- saveConfig(config) {
106
- this.writeFile(this.projectRoot('webiny.json'), JSON.stringify(config, null, 4));
107
- this.config = config;
108
- }
109
-
110
- getPlugins(force = false) {
111
- if (!force && Object.keys(this.plugins).length) {
112
- return this.plugins;
113
- }
114
-
115
- const dir = this.projectRoot('Apps');
116
- let files;
117
- try {
118
- files = this.shellExecute(`cd ${dir} && find . -maxdepth 2 -name "webiny.json"`, {stdio: 'pipe'});
119
- } catch (err) {
120
- return [];
121
- }
122
- this.plugins = {};
123
- files = files.toString().split("\n").filter(line => line !== '');
124
- files.map(file => {
125
- const webinyJson = this.projectRoot('Apps/' + file);
126
- const wjson = JSON.parse(this.readFile(webinyJson));
127
- if (_.has(wjson, 'cliPlugins') && _.isArray(wjson.cliPlugins)) {
128
- wjson.cliPlugins.map(plPath => {
129
- if (plPath.startsWith('./')) {
130
- const pluginClass = require(this.projectRoot('Apps/' + file.replace('webiny.json', plPath)));
131
- const pl = new pluginClass(program);
132
- this.plugins[pl.getTask()] = pl;
133
- }
134
- });
135
- }
136
- });
137
- return this.plugins;
138
- }
139
-
140
- /**
141
- * Read platform apps
142
- * @param app
143
- * @param jsApp
144
- * @returns {Array}
145
- */
146
- getApps() {
147
- if (!this.apps) {
148
- this.apps = [];
149
- }
150
- const dir = this.projectRoot('Apps');
151
- getFolders(dir).map(appSubfolder => {
152
- const appDir = this.projectRoot('Apps/' + appSubfolder);
153
- if (fs.existsSync(appDir + '/App.yaml')) {
154
- const dir = appDir + '/Js';
155
- // Read JS apps from given dir
156
- readJsApps(appSubfolder, dir, this).map(appObj => {
157
- this.apps.push(appObj);
158
- });
159
- }
160
- });
161
-
162
- return this.apps;
163
- }
164
-
165
- projectRoot(path) {
166
- if (!path) {
167
- return fs.realpathSync(process.env.PWD);
168
- }
169
-
170
- return fs.realpathSync(process.env.PWD) + '/' + path;
171
- }
172
-
173
- success(msg) {
174
- let prefix = '';
175
- if (msg.startsWith("\n")) {
176
- prefix = "\n";
177
- msg = _.trimStart(msg, "\n");
178
- }
179
- this.log(prefix + chalk.green('\u2713') + ' ' + msg);
180
- }
181
-
182
- exclamation(msg, extra = null) {
183
- let prefix = '';
184
- if (msg.startsWith("\n")) {
185
- prefix = "\n";
186
- msg = _.trimStart(msg, "\n");
187
- }
188
-
189
- this.log(prefix + chalk.red('\u2757') + ' ' + msg);
190
-
191
- if (extra) {
192
- this.log(extra);
193
- }
194
- }
195
-
196
- failure(msg, extra = null) {
197
- let prefix = '';
198
- if (msg.startsWith("\n")) {
199
- prefix = "\n";
200
- msg = _.trimStart(msg, "\n");
201
- }
202
-
203
- this.log(prefix + chalk.red('\u2718') + ' ' + msg);
204
- if (extra) {
205
- this.log(extra);
206
- }
207
- }
208
-
209
- log(msg) {
210
- console.log(msg);
211
- }
212
-
213
- warning(msg) {
214
- console.log('[' + chalk.red('WARNING') + ']: ' + msg);
215
- }
216
-
217
- info(msg) {
218
- let prefix = '';
219
- if (msg.startsWith("\n")) {
220
- prefix = "\n";
221
- msg = _.trimStart(msg, "\n");
222
- }
223
-
224
- this.log(prefix + chalk.blue('>') + ' ' + msg);
225
- }
226
-
227
- projectRoot(path) {
228
- if (!path) {
229
- return fs.realpathSync(process.env.PWD);
230
- }
231
-
232
- return fs.realpathSync(process.env.PWD) + '/' + path;
233
- }
234
-
235
- fileExists(path) {
236
- try {
237
- return fs.statSync(path).isFile();
238
- } catch (err) {
239
- return false;
240
- }
241
- }
242
-
243
- isSymbolicLink(path) {
244
- try {
245
- return fs.lstatSync(path).isSymbolicLink();
246
- } catch (err) {
247
- return false;
248
- }
249
- }
250
-
251
- folderExists(path) {
252
- try {
253
- return fs.statSync(path).isDirectory();
254
- } catch (err) {
255
- return false;
256
- }
257
- }
258
-
259
- copy(from, to) {
260
- try {
261
- fs.copySync(from, to);
262
- return true;
263
- } catch (err) {
264
- console.log(err);
265
- return false;
266
- }
267
- }
268
-
269
- readFile(path) {
270
- return fs.readFileSync(path, 'utf8');
271
- }
272
-
273
- writeFile(file, data) {
274
- fs.outputFileSync(file, data);
275
- }
276
-
277
- deleteFile(file) {
278
- fs.unlinkSync(file);
279
- }
280
-
281
- shellExecute(cmd, options) {
282
- options = options || {cwd: fs.realpathSync(process.env.PWD), env: process.env, stdio: 'inherit'};
283
- return execSync(cmd, options);
284
- }
285
- }
286
-
287
- module.exports = new Webiny;
package/postinstall.js DELETED
@@ -1,26 +0,0 @@
1
- #! /usr/bin/env node
2
- const username = require('username');
3
- const chalk = require('chalk');
4
- const binDir = './node_modules/.bin';
5
- const Webiny = require('./lib/webiny');
6
- const profilePath = process.platform === 'darwin' ? `/Users/${username.sync()}/profile` : `/home/${username.sync()}/.profile`;
7
- const {magenta} = chalk;
8
-
9
- try {
10
- let config = Webiny.readFile(profilePath);
11
-
12
- if (config.match(binDir)) {
13
- Webiny.info(`${magenta(profilePath)} already exports ${magenta(binDir)} to PATH.`);
14
- return;
15
- }
16
-
17
- config += `# Added by webiny\nexport PATH="$PATH:${binDir}"`;
18
- Webiny.writeFile(profilePath, config);
19
- Webiny.success(`Added ${magenta('./node_modules/.bin')} executables to PATH in ${magenta(profilePath)}`);
20
- Webiny.info('If not using Webiny vagrant box, please restart your shell or execute the export command yourself as follows:');
21
- Webiny.info(magenta('export PATH="$PATH:./node_modules/.bin"'));
22
- } catch (err) {
23
- Webiny.failure('Could not export PATH!');
24
- Webiny.log(err);
25
- }
26
-