zcatalyst-cli 1.18.0-beta.11-slate → 1.18.0-beta.12
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/docs/endpoints/lib/env.toml +3 -1
- package/docs/option-filter.toml +0 -5
- package/lib/authentication/login.js +3 -2
- package/lib/commands/init.js +0 -10
- package/lib/commands/slate/create.js +1 -2
- package/lib/commands/slate/link.js +0 -1
- package/lib/commands/slate/unlink.js +3 -2
- package/lib/config-store.js +2 -1
- package/lib/endpoints/lib/env.js +2 -1
- package/lib/init/features/slate/index.js +16 -11
- package/lib/prompt/index.js +22 -6
- package/lib/prompt/types/file-path.js +4 -4
- package/lib/serve/server/lib/master/slate.js +1 -1
- package/lib/serve/server/lib/slate/index.js +23 -52
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/fs/lib/async.js +6 -2
- package/package.json +1 -1
package/docs/option-filter.toml
CHANGED
|
@@ -43,8 +43,3 @@ link = ''
|
|
|
43
43
|
context = '''The API Gateway cannot be served seperately in local.'''
|
|
44
44
|
aid = '''Please include atleast one other component like functions or client along with the APIG to serve the APIG in local.'''
|
|
45
45
|
link = ''
|
|
46
|
-
|
|
47
|
-
[OPT-FILTER-10]
|
|
48
|
-
context = '''Slate does not have a serve support.'''
|
|
49
|
-
aid = '''Please start your Slate apps using the framework-specific commands.'''
|
|
50
|
-
link = ''
|
|
@@ -34,10 +34,11 @@ const option_1 = require("../util_modules/option");
|
|
|
34
34
|
const crypto_1 = require("crypto");
|
|
35
35
|
exports.missingScopes = {
|
|
36
36
|
[constants_1.DC_TYPE.in.value]: getScopes(['zest', 'dataverse']),
|
|
37
|
-
[constants_1.DC_TYPE.eu.value]: getScopes(['zest', '
|
|
37
|
+
[constants_1.DC_TYPE.eu.value]: getScopes(['zest', 'dataverse']),
|
|
38
38
|
[constants_1.DC_TYPE.au.value]: getScopes(['zest', 'dataverse']),
|
|
39
39
|
[constants_1.DC_TYPE.ca.value]: getScopes(['zest', 'quick_ml', 'dataverse']),
|
|
40
|
-
[constants_1.DC_TYPE.sa.value]: getScopes(['zest', 'quick_ml', 'dataverse'])
|
|
40
|
+
[constants_1.DC_TYPE.sa.value]: getScopes(['zest', 'quick_ml', 'dataverse']),
|
|
41
|
+
[constants_1.DC_TYPE.jp.value]: getScopes(['zest', 'dataverse'])
|
|
41
42
|
};
|
|
42
43
|
function getScopes(keys) {
|
|
43
44
|
return Object.keys(constants_1.SCOPE).filter((scope) => keys.some((prefix) => scope.startsWith(prefix)));
|
package/lib/commands/init.js
CHANGED
|
@@ -41,7 +41,6 @@ const command_1 = __importDefault(require("../internal/command"));
|
|
|
41
41
|
const prompt_1 = __importDefault(require("../prompt"));
|
|
42
42
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
43
43
|
const constants_1 = require("../util_modules/constants");
|
|
44
|
-
const env_1 = require("../util_modules/env");
|
|
45
44
|
const fs_1 = require("../util_modules/fs");
|
|
46
45
|
const js_1 = require("../util_modules/js");
|
|
47
46
|
const logger_1 = require("../util_modules/logger");
|
|
@@ -90,15 +89,6 @@ exports.default = new command_1.default('init [feature]')
|
|
|
90
89
|
(0, ansi_colors_1.bold)(runtime_store_1.default.get('project.root')) +
|
|
91
90
|
'\n' +
|
|
92
91
|
warningText);
|
|
93
|
-
const windownConfirmation = env_1.isWindows
|
|
94
|
-
? yield prompt_1.default.ask(prompt_1.default.question('confirmation', 'Are you ready to proceed?', {
|
|
95
|
-
type: 'confirm'
|
|
96
|
-
}))
|
|
97
|
-
: { confirmation: true };
|
|
98
|
-
if (!windownConfirmation.confirmation) {
|
|
99
|
-
(0, logger_1.message)('Aborted by user.');
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
92
|
if (feature !== 'project') {
|
|
103
93
|
try {
|
|
104
94
|
yield (0, features_1.project)();
|
|
@@ -43,10 +43,9 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
43
43
|
exports.default = new command_1.default('slate:create')
|
|
44
44
|
.description('Configure a new slate service in catalyst')
|
|
45
45
|
.option('--name <app_name>', 'Please provide name for your slate')
|
|
46
|
-
.option('--framework <framework_name>', 'Specify
|
|
46
|
+
.option('--framework <framework_name>', 'Specify framework name for your slate')
|
|
47
47
|
.option('--template <template_url>', 'Provide template url for your slate')
|
|
48
48
|
.option('--default', 'Set default app configurations')
|
|
49
|
-
.option('--production', 'Set production app configurations')
|
|
50
49
|
.needs('auth')
|
|
51
50
|
.needs('config', { optional: true })
|
|
52
51
|
.needs('rc', { optional: true, generateRc: true })
|
|
@@ -46,7 +46,6 @@ exports.default = new command_1.default('slate:link')
|
|
|
46
46
|
.option('--framework <framework_name>', 'Specify frame work name for your slate')
|
|
47
47
|
.option('--template <template_url>', 'Provide template url for your slate')
|
|
48
48
|
.option('--default', 'Set default app configurations')
|
|
49
|
-
.option('--production', 'Create a app with production configurations')
|
|
50
49
|
.needs('auth')
|
|
51
50
|
.needs('config', { optional: true })
|
|
52
51
|
.needs('rc', { optional: true, generateRc: true })
|
|
@@ -59,11 +59,12 @@ exports.default = new command_1.default('slate:unlink')
|
|
|
59
59
|
type: 'confirm',
|
|
60
60
|
default: false
|
|
61
61
|
}));
|
|
62
|
+
yield fs_1.ASYNC.deleteDir((0, path_1.join)(slateDetails.source, constants_1.FILENAME.cli_config));
|
|
62
63
|
if (removeSource) {
|
|
63
|
-
fs_1.ASYNC.deleteDir(slateDetails.source);
|
|
64
|
+
yield fs_1.ASYNC.deleteDir(slateDetails.source);
|
|
64
65
|
}
|
|
65
66
|
else {
|
|
66
|
-
fs_1.ASYNC.deleteDir((0, path_1.join)(slateDetails.source, '.catalyst'));
|
|
67
|
+
yield fs_1.ASYNC.deleteDir((0, path_1.join)(slateDetails.source, '.catalyst'));
|
|
67
68
|
}
|
|
68
69
|
config.unset('slate');
|
|
69
70
|
config.set('slate', slateServices.filter((slateCon) => slateCon.name !== appName));
|
package/lib/config-store.js
CHANGED
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const conf_1 = __importDefault(require("conf"));
|
|
7
7
|
const runtime_store_1 = __importDefault(require("./runtime-store"));
|
|
8
8
|
const name = runtime_store_1.default.get('context.cli.package.name');
|
|
9
|
-
|
|
9
|
+
const path = process.env['X_ZC_CREDENTIAL_PATH'];
|
|
10
|
+
exports.default = new conf_1.default({ configName: name, projectName: name, cwd: path });
|
package/lib/endpoints/lib/env.js
CHANGED
|
@@ -37,7 +37,8 @@ class Env {
|
|
|
37
37
|
(0, ansi_colors_1.bold)(constants_1.DEFAULT.env_name),
|
|
38
38
|
(0, ansi_colors_1.bold)(projectId),
|
|
39
39
|
ansi_colors_1.bold.red('blocked'),
|
|
40
|
-
ansi_colors_1.italic.underline('support@zohocatalyst.com')
|
|
40
|
+
ansi_colors_1.italic.underline('support@zohocatalyst.com'),
|
|
41
|
+
ansi_colors_1.italic.red(JSON.stringify(devEnv.blocked_reason) || 'Unknown')
|
|
41
42
|
]
|
|
42
43
|
});
|
|
43
44
|
}
|
|
@@ -49,7 +49,6 @@ const console_1 = require("console");
|
|
|
49
49
|
const error_1 = __importDefault(require("../../../error"));
|
|
50
50
|
const constants_1 = require("../../../util_modules/constants");
|
|
51
51
|
const project_1 = require("../../../util_modules/project");
|
|
52
|
-
const slate_1 = require("../../../deploy/features/slate");
|
|
53
52
|
const toml_1 = require("../../../util_modules/parser/toml");
|
|
54
53
|
const async_1 = require("../../../util_modules/fs/lib/async");
|
|
55
54
|
function getFrameworkOption(frameworks, source) {
|
|
@@ -86,7 +85,6 @@ function validateAppName(appName) {
|
|
|
86
85
|
function getAppName(existingSlates, frameworkOpt) {
|
|
87
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
87
|
let appName = (0, option_1.getOptionValue)('name');
|
|
89
|
-
const remoteApps = yield (yield (0, endpoints_1.slateAPI)({ env: (0, slate_1.getEnvironmentType)() })).getAllApps();
|
|
90
88
|
if (!appName) {
|
|
91
89
|
const { name } = yield prompt_1.default.ask(prompt_1.default.question('name', 'Please provide the name for your app:', {
|
|
92
90
|
type: 'input',
|
|
@@ -94,8 +92,6 @@ function getAppName(existingSlates, frameworkOpt) {
|
|
|
94
92
|
validate: (name) => {
|
|
95
93
|
if (existingSlates.findIndex((targ) => targ.name === name) !== -1)
|
|
96
94
|
return 'Slate already configured with this name.';
|
|
97
|
-
if (remoteApps.findIndex((targ) => targ.name === name) !== -1)
|
|
98
|
-
return 'App with this name already exists in remote.';
|
|
99
95
|
return validateAppName(name);
|
|
100
96
|
}
|
|
101
97
|
}));
|
|
@@ -105,8 +101,6 @@ function getAppName(existingSlates, frameworkOpt) {
|
|
|
105
101
|
if (existingSlates.findIndex((targ) => targ.name === appName) !== -1) {
|
|
106
102
|
throw new error_1.default('Slate already configured with this name.');
|
|
107
103
|
}
|
|
108
|
-
else if (remoteApps.findIndex((targ) => targ.name === appName) !== -1)
|
|
109
|
-
return 'App with this name already exists in remote.';
|
|
110
104
|
else {
|
|
111
105
|
const isValidApp = validateAppName(appName);
|
|
112
106
|
if (isValidApp !== true) {
|
|
@@ -161,8 +155,12 @@ function addExistingSlate(existingSlates) {
|
|
|
161
155
|
}),
|
|
162
156
|
depth: 5,
|
|
163
157
|
empTxt: ' ',
|
|
164
|
-
rootPath: projectRoot
|
|
158
|
+
rootPath: projectRoot,
|
|
159
|
+
ignoreFiles: true,
|
|
160
|
+
excludeDir: true,
|
|
161
|
+
exclude: ['**/node_modules', '**/.git', '**/.catalyst']
|
|
165
162
|
}));
|
|
163
|
+
prompt_1.default.deregister('file-path');
|
|
166
164
|
return sourcePath;
|
|
167
165
|
});
|
|
168
166
|
}
|
|
@@ -194,7 +192,8 @@ function detectFramework(source, frameworkList) {
|
|
|
194
192
|
if (isNextJs) {
|
|
195
193
|
return { name: 'nextjs', source };
|
|
196
194
|
}
|
|
197
|
-
|
|
195
|
+
frameworkList = frameworkList.filter((framework) => !['static', 'react-vite', 'nextjs'].includes(framework.name));
|
|
196
|
+
const framework = frameworkList.find(({ keywords }) => keywords.every((keyword) => dependencies[keyword] !== undefined));
|
|
198
197
|
if (!framework) {
|
|
199
198
|
(0, logger_1.warning)('No matching framework found in package.json dependencies');
|
|
200
199
|
return getFrameworkOption(frameworkList);
|
|
@@ -236,6 +235,7 @@ function getConfigDetails(frameworkOpt, frameworks) {
|
|
|
236
235
|
const config = yield prompt_1.default.ask(prompt_1.default.question('installCommand', 'Provide your Install Command:', {
|
|
237
236
|
type: 'input',
|
|
238
237
|
validate: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
value = value.trim();
|
|
239
239
|
if (value === '')
|
|
240
240
|
return 'Please provide a valid install command';
|
|
241
241
|
else if (value.length > 50)
|
|
@@ -245,6 +245,7 @@ function getConfigDetails(frameworkOpt, frameworks) {
|
|
|
245
245
|
}), prompt_1.default.question('buildCommand', 'Provide your Build Command:', {
|
|
246
246
|
type: 'input',
|
|
247
247
|
validate: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
value = value.trim();
|
|
248
249
|
if (value === '')
|
|
249
250
|
return 'Please provide a valid build command';
|
|
250
251
|
else if (value.length > 50)
|
|
@@ -254,16 +255,19 @@ function getConfigDetails(frameworkOpt, frameworks) {
|
|
|
254
255
|
}), prompt_1.default.question('buildPath', 'Provide your Build Path:', {
|
|
255
256
|
type: 'input',
|
|
256
257
|
validate: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
value = value.trim();
|
|
257
259
|
if (value === '')
|
|
258
260
|
return 'Please provide a valid build path';
|
|
261
|
+
else if (/[#%*$@?]/.test(value))
|
|
262
|
+
return 'Build path containing invalid characters.';
|
|
259
263
|
else if (value.length > 50)
|
|
260
264
|
return 'Cannot exceed 50 characters.';
|
|
261
265
|
return true;
|
|
262
266
|
})
|
|
263
267
|
}));
|
|
264
268
|
(slateConfigDetails.install_command = config.installCommand),
|
|
265
|
-
(slateConfigDetails.build_path = config.
|
|
266
|
-
(slateConfigDetails.build_command = config.
|
|
269
|
+
(slateConfigDetails.build_path = config.buildPath),
|
|
270
|
+
(slateConfigDetails.build_command = config.buildCommand);
|
|
267
271
|
}
|
|
268
272
|
return slateConfigDetails || {};
|
|
269
273
|
});
|
|
@@ -286,8 +290,9 @@ exports.default = (add) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
286
290
|
type: 'input',
|
|
287
291
|
default: 'npm start',
|
|
288
292
|
validate: (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
293
|
+
value = value.trim();
|
|
289
294
|
if (value === '')
|
|
290
|
-
return 'Please provide a valid
|
|
295
|
+
return 'Please provide a valid development command';
|
|
291
296
|
else if (value.length > 50)
|
|
292
297
|
return 'Cannot exceed 50 characters.';
|
|
293
298
|
return true;
|
package/lib/prompt/index.js
CHANGED
|
@@ -56,30 +56,46 @@ const choice = (name, _a = {}) => {
|
|
|
56
56
|
disabled,
|
|
57
57
|
checked }, otherOpts);
|
|
58
58
|
};
|
|
59
|
+
const registeredTypes = new Map();
|
|
59
60
|
exports.default = {
|
|
60
61
|
register: (type) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
if (registeredTypes.has(type))
|
|
63
|
+
return;
|
|
64
|
+
let module;
|
|
61
65
|
switch (type) {
|
|
62
66
|
case 'file-path':
|
|
63
|
-
|
|
64
|
-
inquirer_1.default.registerPrompt('file-path', filePathExt.default);
|
|
67
|
+
module = yield Promise.resolve().then(() => __importStar(require('./types/file-path')));
|
|
65
68
|
break;
|
|
66
69
|
case 'tree':
|
|
67
|
-
|
|
68
|
-
inquirer_1.default.registerPrompt('tree', treeExt.default);
|
|
70
|
+
module = yield Promise.resolve().then(() => __importStar(require('./types/tree')));
|
|
69
71
|
break;
|
|
70
72
|
case 'search-box':
|
|
71
|
-
|
|
72
|
-
inquirer_1.default.registerPrompt('search-box', searchExt.default);
|
|
73
|
+
module = yield Promise.resolve().then(() => __importStar(require('./types/search-box')));
|
|
73
74
|
break;
|
|
74
75
|
default:
|
|
75
76
|
throw new error_1.default('No such type registered', { exit: 2 });
|
|
76
77
|
}
|
|
78
|
+
inquirer_1.default.registerPrompt(type, module.default);
|
|
79
|
+
registeredTypes.set(type, module.default);
|
|
77
80
|
}),
|
|
81
|
+
deregister: (type) => {
|
|
82
|
+
registeredTypes.delete(type);
|
|
83
|
+
inquirer_1.default.restoreDefaultPrompts();
|
|
84
|
+
},
|
|
78
85
|
separator: (line) => {
|
|
79
86
|
return new inquirer_1.default.Separator(line);
|
|
80
87
|
},
|
|
81
88
|
choice,
|
|
82
89
|
ask: (...questions) => {
|
|
90
|
+
for (const question of questions) {
|
|
91
|
+
if (question.type && ['file-path', 'tree', 'search-box'].includes(question.type)) {
|
|
92
|
+
if (!registeredTypes.has(question.type)) {
|
|
93
|
+
throw new error_1.default(`Prompt type "${question.type}" is not registered.`, {
|
|
94
|
+
exit: 2
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
83
99
|
return inquirer_1.default.prompt(questions);
|
|
84
100
|
},
|
|
85
101
|
question: (name, question, _a = {}) => {
|
|
@@ -17,10 +17,10 @@ const inquirer_autocomplete_prompt_1 = __importDefault(require("inquirer-autocom
|
|
|
17
17
|
const fuzzy_1 = __importDefault(require("fuzzy"));
|
|
18
18
|
const fs_1 = require("../../util_modules/fs");
|
|
19
19
|
const ansi_colors_1 = require("ansi-colors");
|
|
20
|
-
function getPaths(rootPath, pattern, exclude, defaultItem, depth) {
|
|
20
|
+
function getPaths(rootPath, pattern, exclude, excludeDir, ignoreFiles, defaultItem, depth) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const nodeList = yield fs_1.ASYNC.walk(rootPath, {
|
|
23
|
-
filter: { exclude, excludeDir
|
|
23
|
+
filter: { exclude, excludeDir, ignoreFiles },
|
|
24
24
|
depth,
|
|
25
25
|
includeDirPaths: true
|
|
26
26
|
});
|
|
@@ -35,7 +35,7 @@ function getPaths(rootPath, pattern, exclude, defaultItem, depth) {
|
|
|
35
35
|
}
|
|
36
36
|
class InquirerFilePath extends inquirer_autocomplete_prompt_1.default {
|
|
37
37
|
constructor(question, rl, answers) {
|
|
38
|
-
const { rootPath = '.', exclude = [] } = question;
|
|
38
|
+
const { rootPath = '.', exclude = [], excludeDir = false, ignoreFiles = false } = question;
|
|
39
39
|
const questionBase = Object.assign({
|
|
40
40
|
emptyText: question.empTxt
|
|
41
41
|
? question.empTxt
|
|
@@ -43,7 +43,7 @@ class InquirerFilePath extends inquirer_autocomplete_prompt_1.default {
|
|
|
43
43
|
(0, ansi_colors_1.cyan)('<return> ') +
|
|
44
44
|
'key'
|
|
45
45
|
}, question, {
|
|
46
|
-
source: (_, pattern) => getPaths(rootPath, pattern, exclude, question.default, question.depth)
|
|
46
|
+
source: (_, pattern) => getPaths(rootPath, pattern, exclude, excludeDir, ignoreFiles, question.default, question.depth)
|
|
47
47
|
});
|
|
48
48
|
super(questionBase, rl, answers);
|
|
49
49
|
}
|
|
@@ -36,18 +36,8 @@ const startSlate = (port, opts) => {
|
|
|
36
36
|
child.on('error', (reason) => _rej(reason));
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
|
-
const installPackages = (opts) => {
|
|
40
|
-
const child = (0, shell_1.spawn)(opts.command, [], {
|
|
41
|
-
cwd: opts.target,
|
|
42
|
-
shell: true
|
|
43
|
-
}).RAW();
|
|
44
|
-
return new Promise((_res, _rej) => {
|
|
45
|
-
child.on('spawn', () => _res(child));
|
|
46
|
-
child.on('error', (reason) => _rej(reason));
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
39
|
exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
-
var _a
|
|
40
|
+
var _a;
|
|
51
41
|
const targetSlate = serverDetails.target;
|
|
52
42
|
if (!targetSlate || !targetSlate.config) {
|
|
53
43
|
throw new error_1.default('Slate details not found');
|
|
@@ -71,9 +61,9 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
71
61
|
});
|
|
72
62
|
}
|
|
73
63
|
if (!(yield fs_1.ASYNC.isPathExists(targetSlate.source))) {
|
|
74
|
-
throw new error_1.default('The given Slate source path does not
|
|
64
|
+
throw new error_1.default('The given Slate source path does not exist', {
|
|
75
65
|
exit: 1,
|
|
76
|
-
errorId: 'SERVE-
|
|
66
|
+
errorId: 'SERVE-SLATE-2',
|
|
77
67
|
arg: [ansi_colors_1.italic.underline.red(targetSlate.source), (0, ansi_colors_1.bold)(targetSlate.name)]
|
|
78
68
|
});
|
|
79
69
|
}
|
|
@@ -81,56 +71,37 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
81
71
|
if (!configJson) {
|
|
82
72
|
throw new error_1.default('Development command not found', {
|
|
83
73
|
exit: 1,
|
|
84
|
-
errorId: 'SERVE-SLATE-
|
|
74
|
+
errorId: 'SERVE-SLATE-3',
|
|
85
75
|
arg: ['catalyst slate:create']
|
|
86
76
|
});
|
|
87
77
|
}
|
|
88
|
-
if ((_a = targetSlate.config) === null || _a === void 0 ? void 0 : _a.install_command) {
|
|
89
|
-
const spwnProcess = yield installPackages({
|
|
90
|
-
target: targetSlate.source,
|
|
91
|
-
command: (_b = targetSlate.config) === null || _b === void 0 ? void 0 : _b.install_command
|
|
92
|
-
});
|
|
93
|
-
spwnProcess.once('exit', (code) => {
|
|
94
|
-
if (code === 150) {
|
|
95
|
-
targetSlate.validity = {
|
|
96
|
-
valid: false,
|
|
97
|
-
reason: 'Unable to install the dependencies'
|
|
98
|
-
};
|
|
99
|
-
throw new error_1.default('Unable to start the Slate', {
|
|
100
|
-
exit: 1,
|
|
101
|
-
errorId: 'SERVE-SLATE-3',
|
|
102
|
-
arg: [(0, ansi_colors_1.bold)('catalyst serve')]
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
78
|
child = yield startSlate(targetSlate.port.slate, {
|
|
108
79
|
target: targetSlate.source,
|
|
109
|
-
command: (
|
|
110
|
-
});
|
|
111
|
-
child.once('exit', (code) => {
|
|
112
|
-
if (code === 150) {
|
|
113
|
-
targetSlate.validity = {
|
|
114
|
-
valid: false,
|
|
115
|
-
reason: 'Unable to start the Slate'
|
|
116
|
-
};
|
|
117
|
-
throw new error_1.default('Unable to start the Slate', {
|
|
118
|
-
exit: 1,
|
|
119
|
-
errorId: 'SERVE-SLATE-2',
|
|
120
|
-
arg: [(0, ansi_colors_1.bold)(targetSlate.name), (0, ansi_colors_1.underline)((configJson === null || configJson === void 0 ? void 0 : configJson.dev_command) || '')]
|
|
121
|
-
});
|
|
122
|
-
}
|
|
80
|
+
command: (_a = configJson === null || configJson === void 0 ? void 0 : configJson.slate) === null || _a === void 0 ? void 0 : _a.dev_command
|
|
123
81
|
});
|
|
124
82
|
}
|
|
125
83
|
const masterServe = yield (0, master_1.default)(targetSlate.port.proxy, {
|
|
126
84
|
slateDetails: serverDetails
|
|
127
85
|
});
|
|
128
|
-
child.once('exit', () => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
86
|
+
child.once('exit', (code) => {
|
|
87
|
+
child.once('exit', () => {
|
|
88
|
+
masterServe.close((err) => {
|
|
89
|
+
if (err) {
|
|
90
|
+
(0, logger_1.debug)('Error stopping the Slate proxy server: ', err);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
133
93
|
});
|
|
94
|
+
if (code === 150) {
|
|
95
|
+
targetSlate.validity = {
|
|
96
|
+
valid: false,
|
|
97
|
+
reason: 'Unable to start the Slate'
|
|
98
|
+
};
|
|
99
|
+
throw new error_1.default('Slate start failed', {
|
|
100
|
+
exit: 1,
|
|
101
|
+
errorId: 'SERVE-SLATE-5',
|
|
102
|
+
arg: [(0, ansi_colors_1.bold)(targetSlate.name)]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
134
105
|
});
|
|
135
106
|
process.on('SIGINT', () => {
|
|
136
107
|
masterServe.close((err) => {
|
|
@@ -84,7 +84,8 @@ function dirList(dir) {
|
|
|
84
84
|
exports.dirList = dirList;
|
|
85
85
|
function walk(dir, { filter = {
|
|
86
86
|
exclude: [],
|
|
87
|
-
excludeDir: true
|
|
87
|
+
excludeDir: true,
|
|
88
|
+
ignoreFiles: false
|
|
88
89
|
}, depth = -1, includeDirPaths = false } = {}) {
|
|
89
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
91
|
const stats = yield fs_extra_1.default.lstat(dir);
|
|
@@ -98,7 +99,7 @@ function walk(dir, { filter = {
|
|
|
98
99
|
const entryPathStats = yield fs_extra_1.default.lstat(entryPath);
|
|
99
100
|
const isEntryPthDir = entryPathStats.isDirectory() && !entryPathStats.isSymbolicLink();
|
|
100
101
|
let excludeMatch = false;
|
|
101
|
-
if (!
|
|
102
|
+
if (!isEntryPthDir || filter.excludeDir) {
|
|
102
103
|
if (typeof filter.exclude === 'function') {
|
|
103
104
|
excludeMatch = excludeMatch || (yield filter.exclude(entryPath));
|
|
104
105
|
}
|
|
@@ -108,6 +109,9 @@ function walk(dir, { filter = {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
}
|
|
112
|
+
if (!isEntryPthDir && filter.ignoreFiles && !excludeMatch) {
|
|
113
|
+
excludeMatch = true;
|
|
114
|
+
}
|
|
111
115
|
if (excludeMatch) {
|
|
112
116
|
return [];
|
|
113
117
|
}
|