@shuvi/service 1.0.21 → 1.0.23
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/lib/config/config.d.ts +6 -1
- package/lib/config/config.js +8 -0
- package/lib/core/api.d.ts +1 -1
- package/lib/core/api.js +1 -0
- package/package.json +10 -10
package/lib/config/config.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ShuviConfig } from '../core';
|
|
2
2
|
export interface LoadConfigOptions {
|
|
3
3
|
rootDir?: string;
|
|
4
|
-
filepath?: string;
|
|
4
|
+
filepath?: string | false;
|
|
5
5
|
forceReloadEnv?: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* when filePath is false, do not read config file
|
|
9
|
+
* when filePath is '' or undefined, read default config file (shuvi.config.*)
|
|
10
|
+
* when filePath is non-null string, read from filePath
|
|
11
|
+
*/
|
|
7
12
|
export declare function loadConfig({ rootDir, filepath, forceReloadEnv }?: LoadConfigOptions): Promise<ShuviConfig>;
|
package/lib/config/config.js
CHANGED
|
@@ -21,12 +21,20 @@ const logger_1 = __importDefault(require("@shuvi/utils/logger"));
|
|
|
21
21
|
const constants_1 = require("../constants");
|
|
22
22
|
const env_1 = require("./env");
|
|
23
23
|
const validExts = ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs'];
|
|
24
|
+
/**
|
|
25
|
+
* when filePath is false, do not read config file
|
|
26
|
+
* when filePath is '' or undefined, read default config file (shuvi.config.*)
|
|
27
|
+
* when filePath is non-null string, read from filePath
|
|
28
|
+
*/
|
|
24
29
|
function loadConfig({ rootDir = '.', filepath = '', forceReloadEnv = false } = {}) {
|
|
25
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
31
|
rootDir = path_1.default.resolve(rootDir);
|
|
27
32
|
// read dotenv so we can get env in shuvi.config.js
|
|
28
33
|
(0, env_1.loadDotenvConfig)({ rootDir, forceReloadEnv });
|
|
29
34
|
let configFilePath;
|
|
35
|
+
if (filepath === false) {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
30
38
|
if (filepath) {
|
|
31
39
|
configFilePath = path_1.default.resolve(rootDir, filepath);
|
|
32
40
|
if (!fs_1.default.existsSync(configFilePath)) {
|
package/lib/core/api.d.ts
CHANGED
package/lib/core/api.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/service",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"@babel/generator": "7.14.5",
|
|
30
30
|
"@babel/parser": "7.14.7",
|
|
31
31
|
"@babel/traverse": "7.14.7",
|
|
32
|
-
"@shuvi/hook": "1.0.
|
|
33
|
-
"@shuvi/router": "1.0.
|
|
34
|
-
"@shuvi/runtime": "1.0.
|
|
35
|
-
"@shuvi/shared": "1.0.
|
|
36
|
-
"@shuvi/toolpack": "1.0.
|
|
37
|
-
"@shuvi/utils": "1.0.
|
|
38
|
-
"@shuvi/error-overlay": "1.0.
|
|
39
|
-
"@shuvi/telemetry": "1.0.
|
|
40
|
-
"@shuvi/trace": "1.0.
|
|
32
|
+
"@shuvi/hook": "1.0.23",
|
|
33
|
+
"@shuvi/router": "1.0.23",
|
|
34
|
+
"@shuvi/runtime": "1.0.23",
|
|
35
|
+
"@shuvi/shared": "1.0.23",
|
|
36
|
+
"@shuvi/toolpack": "1.0.23",
|
|
37
|
+
"@shuvi/utils": "1.0.23",
|
|
38
|
+
"@shuvi/error-overlay": "1.0.23",
|
|
39
|
+
"@shuvi/telemetry": "1.0.23",
|
|
40
|
+
"@shuvi/trace": "1.0.23",
|
|
41
41
|
"commander": "5.1.0",
|
|
42
42
|
"comment-json": "4.2.2",
|
|
43
43
|
"cross-spawn": "7.0.3",
|