shuvi 1.0.28 → 1.0.30
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/commands/eslint/options.js +9 -5
- package/lib/commands/lint.js +3 -3
- package/lib/shuvi.js +6 -13
- package/lib/tasks/build.js +2 -2
- package/lib/telemetry.d.ts +2 -0
- package/lib/telemetry.js +17 -0
- package/package.json +8 -8
|
@@ -12,14 +12,18 @@ exports.optionRulesDir = new commander_1.Option('--rulesDir <path...>', `Use add
|
|
|
12
12
|
exports.optionFix = new commander_1.Option('--fix', `Automatically fix problems`).default(false);
|
|
13
13
|
exports.optionFixType = new commander_1.Option('--fix-type <type...>', `Specify the types of fixes to apply (problem, suggestion, layout)`).default(null);
|
|
14
14
|
exports.optionIgnorePath = new commander_1.Option('--ignore-path <filePath>', `Specify path of ignore file`).default(null);
|
|
15
|
-
exports.optionNoIgnore = new commander_1.Option('--no-ignore', `Disable use of ignore files and patterns`).default(
|
|
15
|
+
exports.optionNoIgnore = new commander_1.Option('--no-ignore', `Disable use of ignore files and patterns`).default(true);
|
|
16
16
|
exports.optionQuiet = new commander_1.Option('--quiet', `Report errors only`).default(false);
|
|
17
|
-
exports.optionMaxWarnings = new commander_1.Option('--max-warnings', `Number of warnings to trigger nonzero exit code`)
|
|
17
|
+
exports.optionMaxWarnings = new commander_1.Option('--max-warnings', `Number of warnings to trigger nonzero exit code`)
|
|
18
|
+
.argParser(function (value) {
|
|
19
|
+
return parseInt(value, 10);
|
|
20
|
+
})
|
|
21
|
+
.default(-1);
|
|
18
22
|
exports.optionOutputFile = new commander_1.Option('-o, --output-file <path>', `Specify file to write report to`).default(null);
|
|
19
23
|
exports.optionFormat = new commander_1.Option('-f, --format <format>', `Use a specific output format`).default(null, 'Shuvi.js custom formatter');
|
|
20
|
-
exports.optionNoInlineConfig = new commander_1.Option('--no-inline-config', `Prevent comments from changing config or rules`).default(
|
|
21
|
-
exports.optionReportUnusedDisableDirectives = new commander_1.Option('--report-unused-disable-directives', `Adds reported errors for unused eslint-disable directives ("error" | "warn" | "off")`).default(null);
|
|
22
|
-
exports.optionNoCache = new commander_1.Option('--no-cache', `Disable caching`).default(
|
|
24
|
+
exports.optionNoInlineConfig = new commander_1.Option('--no-inline-config', `Prevent comments from changing config or rules`).default(true);
|
|
25
|
+
exports.optionReportUnusedDisableDirectives = new commander_1.Option('--report-unused-disable-directives <directives>', `Adds reported errors for unused eslint-disable directives ("error" | "warn" | "off")`).default(null);
|
|
26
|
+
exports.optionNoCache = new commander_1.Option('--no-cache', `Disable caching`).default(true);
|
|
23
27
|
exports.optionCacheLocation = new commander_1.Option('--cache-location <location>', `Path to the cache file or directory`).default('.eslintcache');
|
|
24
28
|
exports.optionCacheStrategy = new commander_1.Option('--cache-strategy <strategy>', `Strategy to use for detecting changed files in the cache, either metadata or content`).default('metadata');
|
|
25
29
|
exports.optionErrorOnUnmatchedPattern = new commander_1.Option('--error-on-unmatched-pattern', `Show errors when any file patterns are unmatched - default: false`).default(false);
|
package/lib/commands/lint.js
CHANGED
|
@@ -31,10 +31,10 @@ const eslintOptions = (options, cacheLocation) => ({
|
|
|
31
31
|
fix: options.fix,
|
|
32
32
|
fixTypes: options.fixType,
|
|
33
33
|
ignorePath: options.ignorePath,
|
|
34
|
-
ignore:
|
|
35
|
-
allowInlineConfig:
|
|
34
|
+
ignore: Boolean(options.ignore),
|
|
35
|
+
allowInlineConfig: Boolean(options.inlineConfig),
|
|
36
36
|
reportUnusedDisableDirectives: options.reportUnusedDisableDirectives,
|
|
37
|
-
cache:
|
|
37
|
+
cache: Boolean(options.cache),
|
|
38
38
|
cacheLocation: cacheLocation,
|
|
39
39
|
cacheStrategy: options.cacheStrategy,
|
|
40
40
|
errorOnUnmatchedPattern: options.errorOnUnmatchedPattern
|
package/lib/shuvi.js
CHANGED
|
@@ -24,31 +24,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.initShuvi = exports.getPlatform = void 0;
|
|
27
|
-
const telemetry_1 = require("@shuvi/telemetry");
|
|
28
27
|
const service_1 = require("@shuvi/service");
|
|
29
28
|
const platform_web_1 = __importDefault(require("@shuvi/platform-web"));
|
|
30
29
|
const config_1 = require("./config");
|
|
31
|
-
|
|
32
|
-
const
|
|
30
|
+
const telemetry_1 = require("./telemetry");
|
|
31
|
+
const trace_1 = require("@shuvi/service/lib/trace");
|
|
33
32
|
function getPlatform() {
|
|
34
33
|
return (0, platform_web_1.default)({ framework: 'react' });
|
|
35
34
|
}
|
|
36
35
|
exports.getPlatform = getPlatform;
|
|
37
|
-
const TELEMETRY_ENDPOINT = '';
|
|
38
36
|
function initShuvi(_a) {
|
|
39
37
|
var { config } = _a, options = __rest(_a, ["config"]);
|
|
40
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
39
|
const { plugins, presets } = config, restConfig = __rest(config, ["plugins", "presets"]);
|
|
42
|
-
const telemetry = TELEMETRY_ENDPOINT
|
|
43
|
-
? new telemetry_1.Telemetry({
|
|
44
|
-
name: 'Shuvi.js',
|
|
45
|
-
meta: { shuviVersion: package_json_1.default.version },
|
|
46
|
-
postEndpoint: TELEMETRY_ENDPOINT
|
|
47
|
-
})
|
|
48
|
-
: undefined;
|
|
49
40
|
const shuvi = yield (0, service_1.getApi)(Object.assign(Object.assign({}, options), { plugins,
|
|
50
|
-
presets, config: restConfig, platform: getPlatform(), normalizePlatformConfig: config_1.normalizePlatformConfig
|
|
51
|
-
|
|
41
|
+
presets, config: restConfig, platform: getPlatform(), normalizePlatformConfig: config_1.normalizePlatformConfig }));
|
|
42
|
+
if (telemetry_1.telemetry) {
|
|
43
|
+
(0, trace_1.setReporter)(telemetry_1.telemetry.report);
|
|
44
|
+
}
|
|
52
45
|
return shuvi;
|
|
53
46
|
});
|
|
54
47
|
}
|
package/lib/tasks/build.js
CHANGED
|
@@ -43,6 +43,7 @@ const service_1 = require("@shuvi/service");
|
|
|
43
43
|
const constants_1 = require("@shuvi/shared/constants");
|
|
44
44
|
const logger_1 = __importDefault(require("@shuvi/utils/logger"));
|
|
45
45
|
const shuvi_1 = require("../shuvi");
|
|
46
|
+
const telemetry_1 = require("../telemetry");
|
|
46
47
|
const defaultBuildOptions = {
|
|
47
48
|
target: 'ssr'
|
|
48
49
|
};
|
|
@@ -93,8 +94,7 @@ function build(options) {
|
|
|
93
94
|
// transpile the application
|
|
94
95
|
yield bundle(bundler);
|
|
95
96
|
yield pluginContext.pluginRunner.afterBuild();
|
|
96
|
-
yield (0, service_1.analysis)({ context: api.pluginContext, telemetry:
|
|
97
|
-
yield api.telemetry.flush();
|
|
97
|
+
yield (0, service_1.analysis)({ context: api.pluginContext, telemetry: telemetry_1.telemetry });
|
|
98
98
|
return api;
|
|
99
99
|
});
|
|
100
100
|
}
|
package/lib/telemetry.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
exports.telemetry = void 0;
|
|
7
|
+
const reporters_1 = require("@shuvi/reporters");
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
10
|
+
const TELEMETRY_ENDPOINT = '';
|
|
11
|
+
exports.telemetry = TELEMETRY_ENDPOINT
|
|
12
|
+
? new reporters_1.Telemetry({
|
|
13
|
+
name: 'Shuvi.js',
|
|
14
|
+
meta: { shuviVersion: package_json_1.default.version },
|
|
15
|
+
postEndpoint: TELEMETRY_ENDPOINT
|
|
16
|
+
})
|
|
17
|
+
: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shuvi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "Full Stack Web development framework.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"find-up": "4.1.0",
|
|
31
31
|
"semver": "7.3.2",
|
|
32
32
|
"cli-select": "1.1.2",
|
|
33
|
-
"@shuvi/platform-shared": "1.0.
|
|
34
|
-
"@shuvi/platform-web": "1.0.
|
|
35
|
-
"@shuvi/service": "1.0.
|
|
36
|
-
"@shuvi/shared": "1.0.
|
|
37
|
-
"@shuvi/toolpack": "1.0.
|
|
38
|
-
"@shuvi/utils": "1.0.
|
|
39
|
-
"@shuvi/
|
|
33
|
+
"@shuvi/platform-shared": "1.0.30",
|
|
34
|
+
"@shuvi/platform-web": "1.0.30",
|
|
35
|
+
"@shuvi/service": "1.0.30",
|
|
36
|
+
"@shuvi/shared": "1.0.30",
|
|
37
|
+
"@shuvi/toolpack": "1.0.30",
|
|
38
|
+
"@shuvi/utils": "1.0.30",
|
|
39
|
+
"@shuvi/reporters": "1.0.30",
|
|
40
40
|
"cli-highlight": "^2.1.9",
|
|
41
41
|
"commander": "10.0.0",
|
|
42
42
|
"cross-spawn": "7.0.3",
|