1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getRandomNumber = getRandomNumber;
|
7 | exports.getNpmErrorMessage = getNpmErrorMessage;
|
8 | function getRandomNumber(min, max) {
|
9 | return Math.floor(Math.random() * (max - min)) + min;
|
10 | }
|
11 |
|
12 | var TICK = exports.TICK = '✓';
|
13 | var CONFIG_FILE_NAME = exports.CONFIG_FILE_NAME = '.motion.json';
|
14 | var CONFIG_FILE_DEFAULT = exports.CONFIG_FILE_DEFAULT = {
|
15 | babel: {
|
16 | plugins: [],
|
17 | presets: ['babel-preset-steelbrain']
|
18 | },
|
19 | pundle: {
|
20 | presets: [],
|
21 | components: []
|
22 | },
|
23 | pathType: 'filePath',
|
24 | saveNpmModules: true,
|
25 | get webServerPort() {
|
26 | return getRandomNumber(8000, 15000);
|
27 | },
|
28 | outputDirectory: './dist'
|
29 | };
|
30 | var CONFIG_FILE_OPTIONS = exports.CONFIG_FILE_OPTIONS = {
|
31 | prettyPrint: true,
|
32 | createIfNonExistent: false
|
33 | };
|
34 |
|
35 | var NPM_ERROR_EXTRACTION_REGEX = /npm ERR! code .*?\n\nnpm ERR! .*? (.*)/gm;
|
36 | function getNpmErrorMessage(contents) {
|
37 | if (!contents.includes('npm ERR!')) {
|
38 | return contents;
|
39 | }
|
40 | var match = NPM_ERROR_EXTRACTION_REGEX.exec(contents);
|
41 | if (match) {
|
42 | return match[1];
|
43 | }
|
44 | return contents;
|
45 | } |
\ | No newline at end of file |