@storybook/telemetry 7.0.0-alpha.18 → 7.0.0-alpha.20
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.metaFrameworks = exports.getStorybookMetadata = exports.computeStorybookMetadata = void 0;
|
|
6
|
+
exports.sanitizeAddonName = exports.metaFrameworks = exports.getStorybookMetadata = exports.computeStorybookMetadata = void 0;
|
|
7
7
|
|
|
8
8
|
var _readPkgUp = _interopRequireDefault(require("read-pkg-up"));
|
|
9
9
|
|
|
@@ -15,6 +15,8 @@ var _packageVersions = require("./package-versions");
|
|
|
15
15
|
|
|
16
16
|
var _getMonorepoType = require("./get-monorepo-type");
|
|
17
17
|
|
|
18
|
+
var _sanitize = require("./sanitize");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
22
|
const metaFrameworks = {
|
|
@@ -39,10 +41,16 @@ const getFrameworkOptions = mainConfig => {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
return undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const sanitizeAddonName = name => {
|
|
47
|
+
return (0, _sanitize.cleanPaths)(name).replace(/\/dist\/.*/, '').replace(/\.[mc]?[tj]?s[x]?$/, '').replace(/\/register$/, '').replace(/\/manager$/, '').replace(/\/preset$/, '');
|
|
42
48
|
}; // Analyze a combination of information from main.js and package.json
|
|
43
49
|
// to provide telemetry over a Storybook project
|
|
44
50
|
|
|
45
51
|
|
|
52
|
+
exports.sanitizeAddonName = sanitizeAddonName;
|
|
53
|
+
|
|
46
54
|
const computeStorybookMetadata = async ({
|
|
47
55
|
packageJson,
|
|
48
56
|
mainConfig
|
|
@@ -123,17 +131,17 @@ const computeStorybookMetadata = async ({
|
|
|
123
131
|
|
|
124
132
|
if (mainConfig.addons) {
|
|
125
133
|
mainConfig.addons.forEach(addon => {
|
|
126
|
-
let
|
|
134
|
+
let addonName;
|
|
127
135
|
let options;
|
|
128
136
|
|
|
129
137
|
if (typeof addon === 'string') {
|
|
130
|
-
|
|
138
|
+
addonName = sanitizeAddonName(addon);
|
|
131
139
|
} else {
|
|
132
140
|
options = addon.options;
|
|
133
|
-
|
|
141
|
+
addonName = sanitizeAddonName(addon.name);
|
|
134
142
|
}
|
|
135
143
|
|
|
136
|
-
addons[
|
|
144
|
+
addons[addonName] = {
|
|
137
145
|
options,
|
|
138
146
|
version: undefined
|
|
139
147
|
};
|
|
@@ -3,6 +3,7 @@ import { detect, getNpmVersion } from 'detect-package-manager';
|
|
|
3
3
|
import { loadMainConfig, getStorybookInfo, getStorybookConfiguration, getProjectRoot } from '@storybook/core-common';
|
|
4
4
|
import { getActualPackageVersion, getActualPackageVersions } from './package-versions';
|
|
5
5
|
import { getMonorepoType } from './get-monorepo-type';
|
|
6
|
+
import { cleanPaths } from './sanitize';
|
|
6
7
|
export const metaFrameworks = {
|
|
7
8
|
next: 'Next',
|
|
8
9
|
'react-scripts': 'CRA',
|
|
@@ -23,10 +24,13 @@ const getFrameworkOptions = mainConfig => {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
return undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const sanitizeAddonName = name => {
|
|
30
|
+
return cleanPaths(name).replace(/\/dist\/.*/, '').replace(/\.[mc]?[tj]?s[x]?$/, '').replace(/\/register$/, '').replace(/\/manager$/, '').replace(/\/preset$/, '');
|
|
26
31
|
}; // Analyze a combination of information from main.js and package.json
|
|
27
32
|
// to provide telemetry over a Storybook project
|
|
28
33
|
|
|
29
|
-
|
|
30
34
|
export const computeStorybookMetadata = async ({
|
|
31
35
|
packageJson,
|
|
32
36
|
mainConfig
|
|
@@ -105,17 +109,17 @@ export const computeStorybookMetadata = async ({
|
|
|
105
109
|
|
|
106
110
|
if (mainConfig.addons) {
|
|
107
111
|
mainConfig.addons.forEach(addon => {
|
|
108
|
-
let
|
|
112
|
+
let addonName;
|
|
109
113
|
let options;
|
|
110
114
|
|
|
111
115
|
if (typeof addon === 'string') {
|
|
112
|
-
|
|
116
|
+
addonName = sanitizeAddonName(addon);
|
|
113
117
|
} else {
|
|
114
118
|
options = addon.options;
|
|
115
|
-
|
|
119
|
+
addonName = sanitizeAddonName(addon.name);
|
|
116
120
|
}
|
|
117
121
|
|
|
118
|
-
addons[
|
|
122
|
+
addons[addonName] = {
|
|
119
123
|
options,
|
|
120
124
|
version: undefined
|
|
121
125
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StorybookConfig, PackageJson } from '@storybook/core-common';
|
|
2
2
|
import type { StorybookMetadata } from './types';
|
|
3
3
|
export declare const metaFrameworks: Record<string, string>;
|
|
4
|
+
export declare const sanitizeAddonName: (name: string) => string;
|
|
4
5
|
export declare const computeStorybookMetadata: ({ packageJson, mainConfig, }: {
|
|
5
6
|
packageJson: PackageJson;
|
|
6
7
|
mainConfig: StorybookConfig & Record<string, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/telemetry",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.20",
|
|
4
4
|
"description": "Telemetry logging for crash reports and usage statistics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"prepare": "node ../../../scripts/prepare.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
38
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
37
|
+
"@storybook/client-logger": "7.0.0-alpha.20",
|
|
38
|
+
"@storybook/core-common": "7.0.0-alpha.20",
|
|
39
39
|
"chalk": "^4.1.0",
|
|
40
40
|
"core-js": "^3.8.2",
|
|
41
41
|
"detect-package-manager": "^2.0.1",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "a6c00d2ebed21da54b4772b4a4f7fed9258f0ab4"
|
|
56
56
|
}
|