storybooker 0.19.0 → 0.19.3-pre.3
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/dist/index.js +9 -9
- package/package.json +3 -3
- package/src/commands/create.ts +4 -1
- package/src/utils/auth-utils.ts +2 -1
- package/src/utils/sb-build.ts +7 -3
- package/src/utils/sb-test.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -14,14 +14,14 @@ import { tmpdir } from "node:os";
|
|
|
14
14
|
|
|
15
15
|
//#region package.json
|
|
16
16
|
var name = "storybooker";
|
|
17
|
-
var version = "0.19.
|
|
17
|
+
var version = "0.19.3-pre.3";
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/utils/auth-utils.ts
|
|
21
21
|
function createAuthMiddleware(options) {
|
|
22
22
|
const { authType, authValue } = options;
|
|
23
23
|
return { onRequest: ({ request }) => {
|
|
24
|
-
if (
|
|
24
|
+
if (authValue === void 0 || authValue === "") return request;
|
|
25
25
|
if (!authType) return request;
|
|
26
26
|
switch (authType) {
|
|
27
27
|
case "auth-header":
|
|
@@ -63,7 +63,7 @@ function buildStoryBook({ build, cwd, silent }) {
|
|
|
63
63
|
output = spawnSync(detectPackageManager(cwd), ["run", build], {
|
|
64
64
|
cwd,
|
|
65
65
|
shell: true,
|
|
66
|
-
stdio: silent ? void 0 : "inherit",
|
|
66
|
+
stdio: silent === true ? void 0 : "inherit",
|
|
67
67
|
encoding: "utf8"
|
|
68
68
|
}).stdout;
|
|
69
69
|
} else {
|
|
@@ -74,12 +74,12 @@ function buildStoryBook({ build, cwd, silent }) {
|
|
|
74
74
|
"build"
|
|
75
75
|
], {
|
|
76
76
|
cwd,
|
|
77
|
-
stdio: silent ? void 0 : "inherit",
|
|
77
|
+
stdio: silent === true ? void 0 : "inherit",
|
|
78
78
|
encoding: "utf8"
|
|
79
79
|
}).stdout;
|
|
80
80
|
}
|
|
81
81
|
const outputDirpath = output?.split("Output directory: ").at(1)?.trim();
|
|
82
|
-
if (
|
|
82
|
+
if (outputDirpath === void 0 || outputDirpath === "" || !fs$1.existsSync(outputDirpath)) {
|
|
83
83
|
console.error(`Could not find build output at '${outputDirpath}'.`);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
@@ -90,7 +90,7 @@ function buildStoryBook({ build, cwd, silent }) {
|
|
|
90
90
|
//#endregion
|
|
91
91
|
//#region src/utils/sb-test.ts
|
|
92
92
|
function testStoryBook({ test, cwd, silent, testReportDir = ".test/report", testCoverageDir = ".test/coverage" }) {
|
|
93
|
-
if (test) try {
|
|
93
|
+
if (typeof test === "string" || test === true) try {
|
|
94
94
|
runTest(test, {
|
|
95
95
|
cwd,
|
|
96
96
|
silent,
|
|
@@ -121,7 +121,7 @@ function runTest(test, options) {
|
|
|
121
121
|
spawnSync(detectPackageManager(cwd), ["run", test], {
|
|
122
122
|
cwd,
|
|
123
123
|
shell: true,
|
|
124
|
-
stdio: silent ? void 0 : "inherit"
|
|
124
|
+
stdio: silent === true ? void 0 : "inherit"
|
|
125
125
|
});
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
@@ -145,7 +145,7 @@ function runTest(test, options) {
|
|
|
145
145
|
"--coverage.reporter=json-summary"
|
|
146
146
|
], {
|
|
147
147
|
cwd,
|
|
148
|
-
stdio: silent ? void 0 : "inherit"
|
|
148
|
+
stdio: silent === true ? void 0 : "inherit"
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -367,7 +367,7 @@ const createCommandModule = {
|
|
|
367
367
|
handler: async (args) => {
|
|
368
368
|
const result = CreateSchema.safeParse(args);
|
|
369
369
|
if (!result.success) throw new Error(z.prettifyError(result.error));
|
|
370
|
-
const cwd = result.data.cwd ? path$1.resolve(result.data.cwd) : process.cwd();
|
|
370
|
+
const cwd = result.data.cwd !== void 0 && result.data.cwd !== "" ? path$1.resolve(result.data.cwd) : process.cwd();
|
|
371
371
|
if (cwd && !fs$1.existsSync(cwd)) throw new Error(`Path provided to CWD does not exists: '${cwd}'`);
|
|
372
372
|
const { build, silent, url, project, sha, ignoreError, test, testCoverageDir, testReportDir, authType, authValue } = result.data;
|
|
373
373
|
const client = createClient({ baseUrl: url });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybooker",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3-pre.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"description": "Storybooker CLI for uploading builds and files.",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@types/yargs": "^17.0.33",
|
|
42
42
|
"@typescript/native-preview": "^7.0.0-dev.20251024.1",
|
|
43
43
|
"openapi-typescript": "^7.9.1",
|
|
44
|
-
"oxlint": "^1.
|
|
45
|
-
"oxlint-tsgolint": "^0.
|
|
44
|
+
"oxlint": "^1.31.0",
|
|
45
|
+
"oxlint-tsgolint": "^0.8.0",
|
|
46
46
|
"prettier": "^3.6.2",
|
|
47
47
|
"tsdown": "^0.15.9",
|
|
48
48
|
"typescript": "^5.9.2"
|
package/src/commands/create.ts
CHANGED
|
@@ -85,7 +85,10 @@ export const createCommandModule: CommandModule = {
|
|
|
85
85
|
throw new Error(z.prettifyError(result.error));
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const cwd =
|
|
88
|
+
const cwd =
|
|
89
|
+
result.data.cwd !== undefined && result.data.cwd !== ""
|
|
90
|
+
? path.resolve(result.data.cwd)
|
|
91
|
+
: process.cwd();
|
|
89
92
|
if (cwd && !fs.existsSync(cwd)) {
|
|
90
93
|
throw new Error(`Path provided to CWD does not exists: '${cwd}'`);
|
|
91
94
|
}
|
package/src/utils/auth-utils.ts
CHANGED
|
@@ -9,7 +9,7 @@ export function createAuthMiddleware(options: {
|
|
|
9
9
|
const { authType, authValue } = options;
|
|
10
10
|
return {
|
|
11
11
|
onRequest: ({ request }) => {
|
|
12
|
-
if (
|
|
12
|
+
if (authValue === undefined || authValue === "") {
|
|
13
13
|
return request;
|
|
14
14
|
}
|
|
15
15
|
if (!authType) {
|
|
@@ -21,6 +21,7 @@ export function createAuthMiddleware(options: {
|
|
|
21
21
|
request.headers.set("Authorization", authValue);
|
|
22
22
|
return request;
|
|
23
23
|
}
|
|
24
|
+
//
|
|
24
25
|
default: {
|
|
25
26
|
return request;
|
|
26
27
|
}
|
package/src/utils/sb-build.ts
CHANGED
|
@@ -24,21 +24,25 @@ export function buildStoryBook({
|
|
|
24
24
|
output = spawnSync(pkgManager, ["run", build], {
|
|
25
25
|
cwd,
|
|
26
26
|
shell: true,
|
|
27
|
-
stdio: silent ? undefined : "inherit",
|
|
27
|
+
stdio: silent === true ? undefined : "inherit",
|
|
28
28
|
encoding: "utf8",
|
|
29
29
|
}).stdout;
|
|
30
30
|
} else {
|
|
31
31
|
console.log("> Building StoryBook with storybook CLI");
|
|
32
32
|
output = spawnSync("npx", ["-y", "storybook", "build"], {
|
|
33
33
|
cwd,
|
|
34
|
-
stdio: silent ? undefined : "inherit",
|
|
34
|
+
stdio: silent === true ? undefined : "inherit",
|
|
35
35
|
encoding: "utf8",
|
|
36
36
|
}).stdout;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const outputDirpath = output?.split("Output directory: ").at(1)?.trim();
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (
|
|
42
|
+
outputDirpath === undefined ||
|
|
43
|
+
outputDirpath === "" ||
|
|
44
|
+
!fs.existsSync(outputDirpath)
|
|
45
|
+
) {
|
|
42
46
|
console.error(`Could not find build output at '${outputDirpath}'.`);
|
|
43
47
|
return undefined;
|
|
44
48
|
}
|
package/src/utils/sb-test.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function testStoryBook({
|
|
|
22
22
|
testCoverageDirpath: string | undefined;
|
|
23
23
|
testReportDirpath: string | undefined;
|
|
24
24
|
} {
|
|
25
|
-
if (test) {
|
|
25
|
+
if (typeof test === "string" || test === true) {
|
|
26
26
|
try {
|
|
27
27
|
runTest(test, { cwd, silent, testCoverageDir, testReportDir });
|
|
28
28
|
} catch (error) {
|
|
@@ -79,7 +79,7 @@ function runTest(
|
|
|
79
79
|
spawnSync(pkgManager, ["run", test], {
|
|
80
80
|
cwd,
|
|
81
81
|
shell: true,
|
|
82
|
-
stdio: silent ? undefined : "inherit",
|
|
82
|
+
stdio: silent === true ? undefined : "inherit",
|
|
83
83
|
});
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
@@ -108,7 +108,7 @@ function runTest(
|
|
|
108
108
|
],
|
|
109
109
|
{
|
|
110
110
|
cwd,
|
|
111
|
-
stdio: silent ? undefined : "inherit",
|
|
111
|
+
stdio: silent === true ? undefined : "inherit",
|
|
112
112
|
},
|
|
113
113
|
);
|
|
114
114
|
return;
|