@webqit/webflo 0.8.77 → 0.9.1
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/package.json +5 -12
- package/src/Cli.js +131 -0
- package/src/Configurator.js +97 -0
- package/src/Context.js +76 -0
- package/src/config-pi/deployment/Env.js +69 -0
- package/src/config-pi/deployment/Layout.js +65 -0
- package/src/config-pi/deployment/Origins.js +133 -0
- package/src/config-pi/deployment/Virtualization.js +65 -0
- package/src/config-pi/deployment/index.js +18 -0
- package/src/config-pi/index.js +16 -0
- package/src/config-pi/runtime/Client.js +59 -0
- package/src/config-pi/runtime/Server.js +174 -0
- package/src/config-pi/runtime/client/Worker.js +117 -0
- package/src/config-pi/runtime/client/index.js +12 -0
- package/src/config-pi/runtime/index.js +18 -0
- package/src/config-pi/runtime/server/Headers.js +90 -0
- package/src/config-pi/runtime/server/Redirects.js +108 -0
- package/src/config-pi/runtime/server/index.js +14 -0
- package/src/config-pi/static/Manifest.js +321 -0
- package/src/config-pi/static/Ssg.js +72 -0
- package/src/config-pi/static/index.js +14 -0
- package/src/deployment-pi/index.js +10 -0
- package/src/{services → deployment-pi}/origins/index.js +88 -58
- package/src/index.js +14 -147
- package/src/{runtime → runtime-pi}/Router.js +19 -19
- package/src/runtime-pi/client/Context.js +7 -0
- package/src/{runtime → runtime-pi}/client/Router.js +2 -2
- package/src/{runtime/client/Navigator.js → runtime-pi/client/Runtime.js} +148 -103
- package/src/runtime-pi/client/RuntimeClient.js +114 -0
- package/src/{runtime → runtime-pi}/client/Storage.js +1 -1
- package/src/{runtime → runtime-pi}/client/Url.js +2 -6
- package/src/{runtime/client/WorkerClient.js → runtime-pi/client/WorkerComm.js} +2 -2
- package/src/runtime-pi/client/generate.js +242 -0
- package/src/runtime-pi/client/generate.oohtml.js +7 -0
- package/src/runtime-pi/client/index.js +18 -0
- package/src/runtime-pi/client/whatwag.js +27 -0
- package/src/runtime-pi/client/worker/Context.js +7 -0
- package/src/runtime-pi/client/worker/Worker.js +243 -0
- package/src/runtime-pi/client/worker/WorkerClient.js +46 -0
- package/src/runtime-pi/client/worker/index.js +18 -0
- package/src/runtime-pi/index.js +14 -0
- package/src/runtime-pi/server/Context.js +16 -0
- package/src/{runtime → runtime-pi}/server/Router.js +6 -6
- package/src/runtime-pi/server/Runtime.js +531 -0
- package/src/runtime-pi/server/RuntimeClient.js +103 -0
- package/src/runtime-pi/server/index.js +41 -0
- package/src/runtime-pi/server/whatwag.js +35 -0
- package/src/{runtime → runtime-pi}/util.js +0 -0
- package/src/{runtime/_FormData.js → runtime-pi/xFormData.js} +2 -2
- package/src/{runtime/_Headers.js → runtime-pi/xHeaders.js} +4 -4
- package/src/runtime-pi/xHttpEvent.js +93 -0
- package/src/runtime-pi/xHttpMessage.js +179 -0
- package/src/runtime-pi/xRequest.js +67 -0
- package/src/runtime-pi/xRequestHeaders.js +95 -0
- package/src/runtime-pi/xResponse.js +62 -0
- package/src/{runtime/_ResponseHeaders.js → runtime-pi/xResponseHeaders.js} +38 -18
- package/src/{runtime/_URL.js → runtime-pi/xURL.js} +4 -4
- package/src/runtime-pi/xfetch.js +7 -0
- package/src/{services → services-pi}/certbot/http-auth-hook.js +0 -0
- package/src/{services → services-pi}/certbot/http-cleanup-hook.js +0 -0
- package/src/{services → services-pi}/certbot/index.js +21 -15
- package/src/services-pi/index.js +9 -0
- package/src/static-pi/index.js +11 -0
- package/src/webflo.js +33 -0
- package/test/index.test.js +26 -0
- package/src/build/client/index.js +0 -261
- package/src/build/index.js +0 -5
- package/src/config/client.js +0 -191
- package/src/config/headers.js +0 -121
- package/src/config/index.js +0 -14
- package/src/config/layout.js +0 -83
- package/src/config/manifest.js +0 -341
- package/src/config/origins.js +0 -165
- package/src/config/prerendering.js +0 -100
- package/src/config/redirects.js +0 -137
- package/src/config/server.js +0 -201
- package/src/config/variables.js +0 -102
- package/src/config/vhosts.js +0 -93
- package/src/runtime/_MessageStream.js +0 -195
- package/src/runtime/_NavigationEvent.js +0 -91
- package/src/runtime/_Request.js +0 -59
- package/src/runtime/_RequestHeaders.js +0 -72
- package/src/runtime/_Response.js +0 -56
- package/src/runtime/client/NavigationEvent.js +0 -21
- package/src/runtime/client/Runtime.js +0 -126
- package/src/runtime/client/Worker.js +0 -317
- package/src/runtime/client/archive/Cache.js +0 -38
- package/src/runtime/client/archive/Http.js +0 -225
- package/src/runtime/client/archive/StdRequest.js +0 -74
- package/src/runtime/client/archive/WorkerComm.js +0 -183
- package/src/runtime/client/effects/sounds.js +0 -64
- package/src/runtime/index.js +0 -5
- package/src/runtime/server/NavigationEvent.js +0 -39
- package/src/runtime/server/Runtime.js +0 -593
- package/src/runtime/server/index.js +0 -183
- package/src/runtime/server/index.mjs +0 -10
- package/src/services/index.js +0 -6
package/src/config/headers.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* imports
|
|
4
|
-
*/
|
|
5
|
-
import Fs from 'fs';
|
|
6
|
-
import Url from 'url';
|
|
7
|
-
import Path from 'path';
|
|
8
|
-
import _merge from '@webqit/util/obj/merge.js';
|
|
9
|
-
import _after from '@webqit/util/str/after.js';
|
|
10
|
-
import _isObject from '@webqit/util/js/isObject.js';
|
|
11
|
-
import { initialGetIndex } from '@webqit/backpack/src/cli/Promptx.js';
|
|
12
|
-
import { DotJson, anyExists } from '@webqit/backpack/src/dotfiles/index.js';
|
|
13
|
-
import Micromatch from 'micromatch';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Reads entries from file.
|
|
17
|
-
*
|
|
18
|
-
* @param object flags
|
|
19
|
-
* @param object layout
|
|
20
|
-
*
|
|
21
|
-
* @return object
|
|
22
|
-
*/
|
|
23
|
-
export async function read(flags = {}, layout = {}) {
|
|
24
|
-
const ext = flags.env ? `.${flags.env}` : '';
|
|
25
|
-
const configDir = Path.join(layout.ROOT || ``, `./.webqit/webflo/config/`);
|
|
26
|
-
const fileName = ext => `${configDir}/headers${ext}.json`;
|
|
27
|
-
const availableExt = anyExists([ext, '', '.example'], fileName);
|
|
28
|
-
const config = DotJson.read(fileName(availableExt));
|
|
29
|
-
return _merge({
|
|
30
|
-
entries: [],
|
|
31
|
-
}, config);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Writes entries to file.
|
|
36
|
-
*
|
|
37
|
-
* @param object config
|
|
38
|
-
* @param object flags
|
|
39
|
-
* @param object layout
|
|
40
|
-
*
|
|
41
|
-
* @return void
|
|
42
|
-
*/
|
|
43
|
-
export async function write(config, flags = {}, layout = {}) {
|
|
44
|
-
const ext = flags.env ? `.${flags.env}` : '';
|
|
45
|
-
const configDir = Path.join(layout.ROOT || ``, `./.webqit/webflo/config/`);
|
|
46
|
-
const fileName = ext => `${configDir}/headers${ext}.json`;
|
|
47
|
-
DotJson.write(config, fileName(ext));
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @match
|
|
52
|
-
*/
|
|
53
|
-
export async function match(url, flags = {}, layout = {}) {
|
|
54
|
-
if (!_isObject(url)) {
|
|
55
|
-
url = Url.parse(url);
|
|
56
|
-
}
|
|
57
|
-
return ((await read(flags, layout)).entries || []).filter(header => {
|
|
58
|
-
var regex = Micromatch.makeRe(header.url, {dot: true});
|
|
59
|
-
var rootMatch = url.pathname.split('/').filter(seg => seg).map(seg => seg.trim()).reduce((str, seg) => str.endsWith(' ') ? str : ((str = str + '/' + seg) && str.match(regex) ? str + ' ' : str), '');
|
|
60
|
-
return rootMatch.endsWith(' ');
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Configures entries.
|
|
66
|
-
*
|
|
67
|
-
* @param object config
|
|
68
|
-
* @param object choices
|
|
69
|
-
* @param object layout
|
|
70
|
-
*
|
|
71
|
-
* @return Array
|
|
72
|
-
*/
|
|
73
|
-
export async function questions(config, choices = {}, layout = {}) {
|
|
74
|
-
|
|
75
|
-
const CHOICES = _merge({
|
|
76
|
-
type: [
|
|
77
|
-
{value: 'request', title: 'Request Header'},
|
|
78
|
-
{value: 'response', title: 'Response Header'},
|
|
79
|
-
]
|
|
80
|
-
}, choices);
|
|
81
|
-
|
|
82
|
-
// Questions
|
|
83
|
-
return [
|
|
84
|
-
{
|
|
85
|
-
name: 'entries',
|
|
86
|
-
type: 'recursive',
|
|
87
|
-
controls: {
|
|
88
|
-
name: 'header',
|
|
89
|
-
},
|
|
90
|
-
initial: config.entries,
|
|
91
|
-
questions: [
|
|
92
|
-
{
|
|
93
|
-
name: 'type',
|
|
94
|
-
type: 'text',
|
|
95
|
-
message: 'Choose header type',
|
|
96
|
-
validation: ['important'],
|
|
97
|
-
initial: function() { return initialGetIndex(CHOICES.type, this.value); },
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'url',
|
|
101
|
-
type: 'text',
|
|
102
|
-
message: 'Enter URL',
|
|
103
|
-
validation: ['important'],
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'name',
|
|
107
|
-
type: 'text',
|
|
108
|
-
message: 'Enter header name',
|
|
109
|
-
validation: ['important'],
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'value',
|
|
113
|
-
type: 'text',
|
|
114
|
-
message: 'Enter header value',
|
|
115
|
-
validation: ['important'],
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
];
|
|
121
|
-
};
|
package/src/config/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* exports
|
|
4
|
-
*/
|
|
5
|
-
export * as layout from './layout.js';
|
|
6
|
-
export * as client from './client.js';
|
|
7
|
-
export * as manifest from './manifest.js';
|
|
8
|
-
export * as prerendering from './prerendering.js';
|
|
9
|
-
export * as headers from './headers.js';
|
|
10
|
-
export * as redirects from './redirects.js';
|
|
11
|
-
export * as origins from './origins.js';
|
|
12
|
-
export * as server from './server.js';
|
|
13
|
-
export * as variables from './variables.js';
|
|
14
|
-
export * as vhosts from './vhosts.js';
|
package/src/config/layout.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* imports
|
|
4
|
-
*/
|
|
5
|
-
import Path from 'path';
|
|
6
|
-
import _merge from '@webqit/util/obj/merge.js';
|
|
7
|
-
import { DotJson } from '@webqit/backpack/src/dotfiles/index.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Reads PROJECT from file.
|
|
11
|
-
*
|
|
12
|
-
* @param object flags
|
|
13
|
-
* @param object defaults
|
|
14
|
-
*
|
|
15
|
-
* @return object
|
|
16
|
-
*/
|
|
17
|
-
export async function read(flags, defaults = {}) {
|
|
18
|
-
const config = DotJson.read(Path.join(defaults.ROOT || '', './.webqit/webflo/config/setup.json'));
|
|
19
|
-
return _merge({
|
|
20
|
-
ROOT: defaults.ROOT || process.cwd(),
|
|
21
|
-
PUBLIC_DIR: './public',
|
|
22
|
-
SERVER_DIR: './server',
|
|
23
|
-
CLIENT_DIR: './client',
|
|
24
|
-
WORKER_DIR: './worker',
|
|
25
|
-
}, config);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Writes PROJECT to file.
|
|
30
|
-
*
|
|
31
|
-
* @param object config
|
|
32
|
-
* @param object flags
|
|
33
|
-
* @param object defaults
|
|
34
|
-
*
|
|
35
|
-
* @return void
|
|
36
|
-
*/
|
|
37
|
-
export async function write(config, flags = {}, defaults = {}) {
|
|
38
|
-
DotJson.write(config, Path.join(defaults.ROOT || '', './.webqit/webflo/config/setup.json'));
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Configures PROJECT.
|
|
43
|
-
*
|
|
44
|
-
* @param object config
|
|
45
|
-
* @param object choices
|
|
46
|
-
* @param object params
|
|
47
|
-
*
|
|
48
|
-
* @return Array
|
|
49
|
-
*/
|
|
50
|
-
export async function questions(config, choices = {}, params = {}) {
|
|
51
|
-
|
|
52
|
-
// Questions
|
|
53
|
-
return [
|
|
54
|
-
{
|
|
55
|
-
name: 'PUBLIC_DIR',
|
|
56
|
-
type: 'text',
|
|
57
|
-
message: 'Enter the application\'s public directory',
|
|
58
|
-
initial: config.PUBLIC_DIR,
|
|
59
|
-
validation: ['important'],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'SERVER_DIR',
|
|
63
|
-
type: 'text',
|
|
64
|
-
message: 'Enter the directory for the application\'s server-side route handlers',
|
|
65
|
-
initial: config.SERVER_DIR,
|
|
66
|
-
validation: ['important'],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'CLIENT_DIR',
|
|
70
|
-
type: 'text',
|
|
71
|
-
message: 'Enter the directory for the application\'s client-side route handlers',
|
|
72
|
-
initial: config.CLIENT_DIR,
|
|
73
|
-
validation: ['important'],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 'WORKER_DIR',
|
|
77
|
-
type: 'text',
|
|
78
|
-
message: 'Enter the directory for the application\'s offline route handlers',
|
|
79
|
-
initial: config.WORKER_DIR,
|
|
80
|
-
validation: ['important'],
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
};
|
package/src/config/manifest.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* imports
|
|
4
|
-
*/
|
|
5
|
-
import Fs from 'fs';
|
|
6
|
-
import Path from 'path';
|
|
7
|
-
import _merge from '@webqit/util/obj/merge.js';
|
|
8
|
-
import _all from '@webqit/util/arr/all.js';
|
|
9
|
-
import _isNumeric from '@webqit/util/js/isNumeric.js';
|
|
10
|
-
import { initialGetIndex } from '@webqit/backpack/src/cli/Promptx.js';
|
|
11
|
-
import { DotJson, anyExists } from '@webqit/backpack/src/dotfiles/index.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Reads MANIFEST from file.
|
|
15
|
-
*
|
|
16
|
-
* @param object flags
|
|
17
|
-
* @param object layout
|
|
18
|
-
*
|
|
19
|
-
* @return object
|
|
20
|
-
*/
|
|
21
|
-
export async function read(flags = {}, layout = {}) {
|
|
22
|
-
const ext = flags.env ? `.${flags.env}` : '';
|
|
23
|
-
const configDir = Path.join(layout.ROOT || ``, `./.webqit/webflo/config/`);
|
|
24
|
-
const fileName = ext => `${configDir}/manifest${ext}.json`;
|
|
25
|
-
const availableExt = anyExists([ext, '', '.example'], fileName);
|
|
26
|
-
const config = DotJson.read(fileName(availableExt));
|
|
27
|
-
// Package
|
|
28
|
-
const pkg = layout.PKG || {};
|
|
29
|
-
return _merge({
|
|
30
|
-
// -----------------
|
|
31
|
-
name: pkg.value,
|
|
32
|
-
short_name: pkg.value,
|
|
33
|
-
description: pkg.description,
|
|
34
|
-
categories: pkg.keywords,
|
|
35
|
-
theme_color: 'transparent',
|
|
36
|
-
background_color: 'transparent',
|
|
37
|
-
icons: [],
|
|
38
|
-
display: 'browser',
|
|
39
|
-
orientation: 'any',
|
|
40
|
-
// advanced
|
|
41
|
-
screenshots: [],
|
|
42
|
-
shortcuts: [],
|
|
43
|
-
scope: '/',
|
|
44
|
-
start_url: '/',
|
|
45
|
-
lang: 'en-us',
|
|
46
|
-
dir: 'ltr',
|
|
47
|
-
related_applications: '',
|
|
48
|
-
prefer_related_applications: false,
|
|
49
|
-
}, config);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Writes MANIFEST to file.
|
|
54
|
-
*
|
|
55
|
-
* @param object config
|
|
56
|
-
* @param object flags
|
|
57
|
-
* @param object layout
|
|
58
|
-
*
|
|
59
|
-
* @return void
|
|
60
|
-
*/
|
|
61
|
-
export async function write(config, flags = {}, layout = {}) {
|
|
62
|
-
const ext = flags.env ? `.${flags.env}` : '';
|
|
63
|
-
const configDir = Path.join(layout.ROOT || ``, layout.PUBLIC_DIR || '');
|
|
64
|
-
const fileName = ext => `${configDir}/manifest${ext}.json`;
|
|
65
|
-
DotJson.write(config, fileName(ext));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Configures MANIFEST.
|
|
70
|
-
*
|
|
71
|
-
* @param object config
|
|
72
|
-
* @param object choices
|
|
73
|
-
* @param object layout
|
|
74
|
-
*
|
|
75
|
-
* @return Array
|
|
76
|
-
*/
|
|
77
|
-
export async function questions(config, choices = {}, layout = {}) {
|
|
78
|
-
|
|
79
|
-
// Choices hash...
|
|
80
|
-
const CHOICES = _merge({
|
|
81
|
-
display: [
|
|
82
|
-
{value: 'browser',},
|
|
83
|
-
{value: 'fullscreen',},
|
|
84
|
-
{value: 'standalone',},
|
|
85
|
-
{value: 'minimal-ui',},
|
|
86
|
-
],
|
|
87
|
-
orientation: [
|
|
88
|
-
{value: 'any',},
|
|
89
|
-
{value: 'natural',},
|
|
90
|
-
{value: '::::::::::::::::', disabled: true,},
|
|
91
|
-
{value: 'landscape',},
|
|
92
|
-
{value: 'landscape-primary',},
|
|
93
|
-
{value: 'landscape-secondary',},
|
|
94
|
-
{value: '::::::::::::::::', disabled: true,},
|
|
95
|
-
{value: 'portrait',},
|
|
96
|
-
{value: 'portrait-primary',},
|
|
97
|
-
{value: 'portrait-secondary',},
|
|
98
|
-
],
|
|
99
|
-
}, choices);
|
|
100
|
-
|
|
101
|
-
// Gets index...
|
|
102
|
-
const getSize = src => Path.basename(src).split(/[_\.\-]/g).reduce((size, chunk) => size || (_all(chunk.split('x'), c => _isNumeric(c)) ? chunk : ''), null);
|
|
103
|
-
const getMime = src => extensions[Path.extname(src)];
|
|
104
|
-
// extensions
|
|
105
|
-
const extensions = {
|
|
106
|
-
'.png': 'image/png',
|
|
107
|
-
'.jpg': 'image/jpg',
|
|
108
|
-
'.jpeg': 'image/jpeg',
|
|
109
|
-
'.ico': 'image/ico',
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
// Questions
|
|
113
|
-
return [
|
|
114
|
-
{
|
|
115
|
-
name: 'name',
|
|
116
|
-
type: 'text',
|
|
117
|
-
message: 'Enter the application name',
|
|
118
|
-
initial: config.name,
|
|
119
|
-
validation: ['important'],
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: 'short_name',
|
|
123
|
-
type: 'text',
|
|
124
|
-
message: 'Enter the application short name',
|
|
125
|
-
initial: prev => config.short_name || prev,
|
|
126
|
-
validation: ['important'],
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: 'description',
|
|
130
|
-
type: 'text',
|
|
131
|
-
message: 'Enter the application description',
|
|
132
|
-
initial: config.description,
|
|
133
|
-
validation: ['important'],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'categories',
|
|
137
|
-
type: 'list',
|
|
138
|
-
message: 'Specify applications categories (comma-separated)',
|
|
139
|
-
initial: (config.categories || []).join(', '),
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: 'theme_color',
|
|
143
|
-
type: 'text',
|
|
144
|
-
message: 'Enter the application theme color',
|
|
145
|
-
initial: config.theme_color,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'background_color',
|
|
149
|
-
type: 'text',
|
|
150
|
-
message: 'Enter the application background color',
|
|
151
|
-
initial: config.background_color,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: 'icons',
|
|
155
|
-
type: 'recursive',
|
|
156
|
-
initial: config.icons,
|
|
157
|
-
controls: {
|
|
158
|
-
name: 'icon',
|
|
159
|
-
},
|
|
160
|
-
questions: [
|
|
161
|
-
{
|
|
162
|
-
name: 'src',
|
|
163
|
-
type: 'text',
|
|
164
|
-
message: 'Enter icon URL',
|
|
165
|
-
validation: ['important'],
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: 'type',
|
|
169
|
-
type: 'text',
|
|
170
|
-
message: 'Enter icon MIME type',
|
|
171
|
-
initial: prev => getMime(prev),
|
|
172
|
-
validation: ['important'],
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: 'sizes',
|
|
176
|
-
type: 'text',
|
|
177
|
-
message: 'Enter icon sizes',
|
|
178
|
-
initial: (prev, answers) => getSize(answers.src),
|
|
179
|
-
validation: ['important'],
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'display',
|
|
185
|
-
type: 'select',
|
|
186
|
-
message: 'Enter the application display mode',
|
|
187
|
-
choices: CHOICES.display,
|
|
188
|
-
initial: initialGetIndex(CHOICES.display, config.display),
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: 'orientation',
|
|
192
|
-
type: 'select',
|
|
193
|
-
message: 'Enter the application orientation mode',
|
|
194
|
-
choices: CHOICES.orientation,
|
|
195
|
-
initial: initialGetIndex(CHOICES.orientation, config.orientation),
|
|
196
|
-
},
|
|
197
|
-
// ------------- advanced --------------
|
|
198
|
-
{
|
|
199
|
-
name: '__advanced',
|
|
200
|
-
type: 'toggle',
|
|
201
|
-
message: 'Show advanced options?',
|
|
202
|
-
active: 'YES',
|
|
203
|
-
inactive: 'NO',
|
|
204
|
-
initial: config.__advanced,
|
|
205
|
-
exclude: true,
|
|
206
|
-
},
|
|
207
|
-
// ------------- advanced --------------
|
|
208
|
-
{
|
|
209
|
-
name: 'screenshots',
|
|
210
|
-
type: (prev, answers) => answers.__advanced ? 'recursive' : null,
|
|
211
|
-
initial: config.screenshots,
|
|
212
|
-
controls: {
|
|
213
|
-
name: 'screenshot',
|
|
214
|
-
},
|
|
215
|
-
questions: [
|
|
216
|
-
{
|
|
217
|
-
name: 'src',
|
|
218
|
-
type: 'text',
|
|
219
|
-
message: 'Enter screenshot URL',
|
|
220
|
-
validation: ['important'],
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: 'type',
|
|
224
|
-
type: 'text',
|
|
225
|
-
message: 'Enter screenshot MIME type',
|
|
226
|
-
initial: prev => getMime(prev),
|
|
227
|
-
validation: ['important'],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: 'sizes',
|
|
231
|
-
type: 'text',
|
|
232
|
-
message: 'Enter screenshot sizes',
|
|
233
|
-
initial: (prev, answers) => getSize(answers.src),
|
|
234
|
-
validation: ['important'],
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: 'shortcuts',
|
|
240
|
-
type: (prev, answers) => answers.__advanced ? 'recursive' : null,
|
|
241
|
-
initial: config.shortcuts,
|
|
242
|
-
controls: {
|
|
243
|
-
name: 'shortcut',
|
|
244
|
-
},
|
|
245
|
-
questions: [
|
|
246
|
-
{
|
|
247
|
-
name: 'name',
|
|
248
|
-
type: 'text',
|
|
249
|
-
message: 'Enter shortcut name',
|
|
250
|
-
validation: ['important'],
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: 'short_name',
|
|
254
|
-
type: 'text',
|
|
255
|
-
message: 'Enter shortcut short name',
|
|
256
|
-
validation: ['important'],
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
name: 'description',
|
|
260
|
-
type: 'text',
|
|
261
|
-
message: 'Enter shortcut description',
|
|
262
|
-
validation: ['important'],
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
name: 'url',
|
|
266
|
-
type: 'text',
|
|
267
|
-
message: 'Enter shortcut URL',
|
|
268
|
-
validation: ['important'],
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: 'icons',
|
|
272
|
-
type: 'recursive',
|
|
273
|
-
controls: {
|
|
274
|
-
name: 'shortcut icon',
|
|
275
|
-
},
|
|
276
|
-
questions: [
|
|
277
|
-
{
|
|
278
|
-
name: 'src',
|
|
279
|
-
type: 'text',
|
|
280
|
-
message: 'Enter icon URL',
|
|
281
|
-
validation: ['important'],
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
name: 'type',
|
|
285
|
-
type: 'text',
|
|
286
|
-
message: 'Enter icon MIME type',
|
|
287
|
-
initial: prev => getMime(prev),
|
|
288
|
-
validation: ['important'],
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
name: 'sizes',
|
|
292
|
-
type: 'text',
|
|
293
|
-
message: 'Enter icon sizes',
|
|
294
|
-
initial: (prev, answers) => getSize(answers.src),
|
|
295
|
-
validation: ['important'],
|
|
296
|
-
},
|
|
297
|
-
],
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: 'scope',
|
|
303
|
-
type: (prev, answers) => answers.__advanced ? 'text' : null,
|
|
304
|
-
message: 'Specify the manifest scope',
|
|
305
|
-
initial: config.scope,
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
name: 'start_url',
|
|
309
|
-
type: (prev, answers) => answers.__advanced ? 'text' : null,
|
|
310
|
-
message: 'Specify the application start URL',
|
|
311
|
-
initial: config.start_url,
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
name: 'lang',
|
|
315
|
-
type: (prev, answers) => answers.__advanced ? 'text' : null,
|
|
316
|
-
message: 'Specify the application language',
|
|
317
|
-
initial: config.lang,
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
name: 'dir',
|
|
321
|
-
type: (prev, answers) => answers.__advanced ? 'text' : null,
|
|
322
|
-
message: 'Specify the application writing mode',
|
|
323
|
-
initial: config.dir,
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: 'related_applications',
|
|
327
|
-
type: (prev, answers) => answers.__advanced ? 'list' : null,
|
|
328
|
-
message: 'Specify related applications (comma-separated)',
|
|
329
|
-
initial: (config.related_applications || []).join(', '),
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
name: 'prefer_related_applications',
|
|
333
|
-
type: (prev, answers) => answers.related_applications ? 'toggle' : null,
|
|
334
|
-
message: 'Specify whether to "prefer" related applications',
|
|
335
|
-
active: 'YES',
|
|
336
|
-
inactive: 'NO',
|
|
337
|
-
initial: config.prefer_related_applications,
|
|
338
|
-
},
|
|
339
|
-
|
|
340
|
-
];
|
|
341
|
-
};
|