@digest/scripts 3.4.4 → 3.5.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.
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const path_1 = __importDefault(require("path"));
30
+ const find_up_1 = __importDefault(require("find-up"));
31
+ const package_1 = __importDefault(require("../package"));
32
+ const production_1 = __importDefault(require("../production"));
33
+ const consume_1 = __importDefault(require("./consume"));
34
+ const resolvePath_1 = __importDefault(require("./resolvePath"));
35
+ const settings_1 = __importStar(require("./settings"));
36
+ const cwd = process.cwd();
37
+ const { DIGEST_NAME = 'digest.config.json' } = process.env;
38
+ const digestPath = find_up_1.default.sync(DIGEST_NAME);
39
+ const digestConfig = digestPath ?
40
+ require(digestPath) :
41
+ {};
42
+ const config = settings_1.keys.reduce((prev, key) => {
43
+ var _a, _b, _c, _d, _e;
44
+ const { defaults, env: envKey, packageName, resolve, type } = settings_1.default[key];
45
+ const envSetting = process.env[envKey];
46
+ const transformedEnvSetting = (0, consume_1.default)(type, envSetting);
47
+ const configSetting = digestConfig[key];
48
+ const transformedConfigSetting = (0, consume_1.default)(type, configSetting);
49
+ const userSetting = (_a = transformedEnvSetting !== null && transformedEnvSetting !== void 0 ? transformedEnvSetting : transformedConfigSetting) !== null && _a !== void 0 ? _a : defaults;
50
+ const verifiedSetting = userSetting &&
51
+ packageName ?
52
+ ((0, resolvePath_1.default)(packageName) ?
53
+ userSetting :
54
+ false) :
55
+ userSetting;
56
+ const resolveSetting = verifiedSetting &&
57
+ resolve ?
58
+ (0, resolvePath_1.default)(verifiedSetting, true) :
59
+ verifiedSetting;
60
+ switch (key) {
61
+ case 'cache': {
62
+ prev[key] = resolveSetting ?
63
+ path_1.default.join(cwd, resolveSetting) :
64
+ resolveSetting;
65
+ break;
66
+ }
67
+ case 'shortName': {
68
+ prev[key] = (_e = (_b = transformedEnvSetting !== null && transformedEnvSetting !== void 0 ? transformedEnvSetting : transformedConfigSetting) !== null && _b !== void 0 ? _b : (_d = (_c = package_1.default === null || package_1.default === void 0 ? void 0 : package_1.default.name) === null || _c === void 0 ? void 0 : _c.replace('@', '')) === null || _d === void 0 ? void 0 : _d.replace('/', '-')) !== null && _e !== void 0 ? _e : 'nd';
69
+ break;
70
+ }
71
+ case 'reports': {
72
+ prev[key] = resolveSetting === 'reports' ?
73
+ path_1.default.join(cwd, 'reports') :
74
+ resolveSetting;
75
+ break;
76
+ }
77
+ default: {
78
+ prev[key] = resolveSetting;
79
+ }
80
+ }
81
+ return prev;
82
+ }, {
83
+ digestName: DIGEST_NAME
84
+ });
85
+ config.cache = config.cache ?
86
+ path_1.default.join(config.cache, config.library ?
87
+ 'library' :
88
+ (production_1.default ?
89
+ 'production' :
90
+ 'development')) :
91
+ config.cache;
92
+ config.staticPath = config.staticPath === 'public' ?
93
+ path_1.default.join(cwd, config.library ?
94
+ 'lib' :
95
+ 'public') :
96
+ config.staticPath;
97
+ config.context = path_1.default.join(process.cwd(), config.sourcePath);
98
+ exports.default = config;
@@ -0,0 +1,2 @@
1
+ declare const resolvePath: (givenPath: string, up?: boolean) => string | false;
2
+ export default resolvePath;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const find_up_1 = __importDefault(require("find-up"));
7
+ const resolvePath = (givenPath, up = false) => {
8
+ var _a;
9
+ try {
10
+ return require.resolve(givenPath);
11
+ }
12
+ catch (_b) {
13
+ if (up) {
14
+ return (_a = find_up_1.default.sync(givenPath)) !== null && _a !== void 0 ? _a : false;
15
+ }
16
+ else {
17
+ return false;
18
+ }
19
+ }
20
+ };
21
+ exports.default = resolvePath;
@@ -0,0 +1,158 @@
1
+ declare const settings: {
2
+ [key: string]: {
3
+ defaults: boolean | number | string;
4
+ env: string;
5
+ ignore?: boolean | undefined;
6
+ packageName: string | false;
7
+ resolve: boolean;
8
+ type: 'bool' | 'both' | 'false' | 'number' | 'obj' | 'string' | 'true';
9
+ };
10
+ };
11
+ declare const keys: (keyof completeDigest)[];
12
+ declare type completeDigest = {
13
+ angular: boolean;
14
+ appHost: string;
15
+ appPort: number;
16
+ babel: string | false;
17
+ babelAngular: boolean;
18
+ babelEmotion: boolean;
19
+ babelFlow: boolean;
20
+ babelGraphQL: boolean;
21
+ babelPolyfills: string;
22
+ babelPreset: boolean;
23
+ babelReact: boolean;
24
+ babelReactNative: boolean;
25
+ babelTypeScript: boolean;
26
+ baseHref: string;
27
+ cache: string | false;
28
+ compression: boolean;
29
+ context: string;
30
+ cssModules: boolean;
31
+ digestName: string;
32
+ e2ePath: string;
33
+ emotion: boolean;
34
+ env: {
35
+ [key: string]: number | string;
36
+ };
37
+ eslint: string | false;
38
+ eslintAngular: boolean;
39
+ eslintBabel: boolean;
40
+ eslintEmotion: boolean;
41
+ eslintFlow: boolean;
42
+ eslintGraphQL: boolean;
43
+ eslintJest: boolean;
44
+ eslintReact: boolean;
45
+ eslintReactNative: boolean;
46
+ eslintTypeScript: boolean;
47
+ favicon: string | false;
48
+ flow: string | false;
49
+ graphql: boolean;
50
+ graphqlSchema: string;
51
+ hashLimit: number;
52
+ indexHtml: string | false;
53
+ jest: boolean;
54
+ jestBabel: boolean;
55
+ jestEmotion: boolean;
56
+ jestGraphQL: boolean;
57
+ jestJUnit: boolean;
58
+ jestReact: boolean;
59
+ jestSetup: string;
60
+ jestTypeScript: boolean;
61
+ library: boolean;
62
+ minimize: boolean;
63
+ parallel: boolean;
64
+ polyfills: string | false;
65
+ postcss: string;
66
+ postcssWhitelist: string;
67
+ pwa: boolean;
68
+ react: boolean;
69
+ reactNative: boolean;
70
+ reports: string | false;
71
+ seleniumChromeDriver: string;
72
+ seleniumDriver: string;
73
+ seleniumGeckoDriver: string;
74
+ seleniumHeadless: boolean;
75
+ seleniumHost: string;
76
+ seleniumPort: number;
77
+ seleniumStart: boolean;
78
+ shortName: string;
79
+ sourceMaps: boolean;
80
+ sourcePath: string;
81
+ staticPath: string;
82
+ stylelint: string | false;
83
+ stylelintIgnore: string;
84
+ typescript: string;
85
+ webpackAngular: boolean;
86
+ webpackBabel: boolean;
87
+ webpackDashboard: boolean;
88
+ webpackESLint: boolean;
89
+ webpackFlow: boolean;
90
+ webpackGraphQL: boolean;
91
+ webpackPostCSS: boolean;
92
+ webpackReact: boolean;
93
+ webpackStyleLint: boolean;
94
+ webpackTypeScript: boolean;
95
+ webpackWorkbox: boolean;
96
+ };
97
+ declare type digest = Omit<Partial<completeDigest>, 'context'> & {
98
+ angular?: false;
99
+ babel?: string | false;
100
+ babelAngular?: false;
101
+ babelEmotion?: false;
102
+ babelFlow?: false;
103
+ babelGraphQL?: false;
104
+ babelPolyfills?: false;
105
+ babelPreset?: false;
106
+ babelReact?: false;
107
+ babelReactNative?: false;
108
+ babelTypeScript?: false;
109
+ cache?: string | false;
110
+ compression?: false;
111
+ cssModules?: true;
112
+ eslint?: string | false;
113
+ eslintAngular?: false;
114
+ eslintBabel?: false;
115
+ eslintEmotion?: false;
116
+ eslintFlow?: false;
117
+ eslintGraphQL?: false;
118
+ eslintJest?: false;
119
+ eslintReact?: false;
120
+ eslintReactNative?: false;
121
+ eslintTypeScript?: false;
122
+ favicon?: string | false;
123
+ flow?: string | false;
124
+ graphql?: false;
125
+ jest?: false;
126
+ jestBabel?: false;
127
+ jestEmotion?: false;
128
+ jestGraphQL?: false;
129
+ jestJUnit?: false;
130
+ jestReact?: false;
131
+ jestTypeScript?: false;
132
+ library?: true;
133
+ minimize?: false;
134
+ parallel?: false;
135
+ polyfills?: string | false;
136
+ postcss?: string | false;
137
+ pwa?: true;
138
+ react?: false;
139
+ reactNative?: false;
140
+ reports?: string | false;
141
+ sourceMaps?: false;
142
+ stylelint?: string | false;
143
+ typescript?: string | false;
144
+ webpackAngular?: false;
145
+ webpackBabel?: false;
146
+ webpackDashboard?: false;
147
+ webpackESLint?: false;
148
+ webpackFlow?: false;
149
+ webpackGraphQL?: false;
150
+ webpackPostCSS?: false;
151
+ webpackReact?: false;
152
+ webpackStyleLint?: false;
153
+ webpackTypeScript?: false;
154
+ webpackWorkbox?: false;
155
+ };
156
+ export default settings;
157
+ export { keys };
158
+ export type { completeDigest, digest };