Skip to content

Commit

Permalink
Merge pull request #25600 from storybookjs/norbert/fix-cli-sandbox-ve…
Browse files Browse the repository at this point in the history
…rsioning

CLI: Fix sandbox command versioning
  • Loading branch information
JReinhold authored Jan 16, 2024
2 parents f091347 + c897845 commit 57da5d3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 149 deletions.
9 changes: 7 additions & 2 deletions code/lib/cli/src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export const sandbox = async (
force: pkgMgr,
});
const latestVersion = await packageManager.latestVersion('@storybook/cli');
const nextVersion = await packageManager.latestVersion('@storybook/cli@next');
const nextVersion = await packageManager
.latestVersion('@storybook/cli@next')
.catch((e) => '0.0.0');
const currentVersion = versions['@storybook/cli'];
const isPrerelease = prerelease(currentVersion);
const isOutdated = lt(currentVersion, isPrerelease ? nextVersion : latestVersion);
Expand Down Expand Up @@ -216,14 +218,17 @@ export const sandbox = async (
// this is to ensure we DO get the latest version of the template (output of the generator), but we initialize using the version of storybook that the CLI is.
// we warned the user about the fact they are running an old version of storybook
// we warned the user the sandbox step would take longer
if ((isOutdated || isPrerelease) && init) {
if (downloadType === 'before-storybook' && init) {
const before = process.cwd();
process.chdir(templateDestination);
// we run doInitiate, instead of initiate, to avoid sending this init event to telemetry, because it's not a real world project
await doInitiate(
{
...options,
},
pkg
);
process.chdir(before);
}
} catch (err) {
logger.error(`🚨 Failed to download sandbox template: ${String(err)}`);
Expand Down
6 changes: 6 additions & 0 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
],
"resolutions": {
"@playwright/test": "1.36.0",
"@storybook/client-logger": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/instrumenter": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/test": "workspace:*",
"@storybook/types": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/experimental-utils": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
Expand Down
159 changes: 12 additions & 147 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5320,20 +5320,6 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/channels@npm:8.0.0-alpha.9":
version: 8.0.0-alpha.9
resolution: "@storybook/channels@npm:8.0.0-alpha.9"
dependencies:
"@storybook/client-logger": "npm:8.0.0-alpha.9"
"@storybook/core-events": "npm:8.0.0-alpha.9"
"@storybook/global": "npm:^5.0.0"
qs: "npm:^6.10.0"
telejson: "npm:^7.2.0"
tiny-invariant: "npm:^1.3.1"
checksum: c7465f1d48e0be63f855849c71828906f6f3420411e17a02bebfab441b195c59c12ddbcf8da8a2d630941758b54ca4db1d2ab7850c922ceec394c8264afaf134
languageName: node
linkType: hard

"@storybook/channels@workspace:*, @storybook/channels@workspace:lib/channels":
version: 0.0.0-use.local
resolution: "@storybook/channels@workspace:lib/channels"
Expand Down Expand Up @@ -5402,24 +5388,6 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/client-logger@npm:7.5.0":
version: 7.5.0
resolution: "@storybook/client-logger@npm:7.5.0"
dependencies:
"@storybook/global": "npm:^5.0.0"
checksum: 90326c49a224bf21680c04ffee94725bf75658086093ccb839a8aae39476929c4719eafb18e498a148cf0dd956d4e9a5d3b2a34d09ca4fd25e2af553458558ac
languageName: node
linkType: hard

"@storybook/client-logger@npm:8.0.0-alpha.9":
version: 8.0.0-alpha.9
resolution: "@storybook/client-logger@npm:8.0.0-alpha.9"
dependencies:
"@storybook/global": "npm:^5.0.0"
checksum: bc0527a186d901434ea5e5b1807b56288f74c66ff43ea355762bb643f8e257e9b80be94d60f196178b1019abae2baf5c50d4ffd010ec44ec9c8349abc352bf78
languageName: node
linkType: hard

"@storybook/client-logger@workspace:*, @storybook/client-logger@workspace:lib/client-logger":
version: 0.0.0-use.local
resolution: "@storybook/client-logger@workspace:lib/client-logger"
Expand Down Expand Up @@ -5534,15 +5502,6 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/core-events@npm:8.0.0-alpha.9":
version: 8.0.0-alpha.9
resolution: "@storybook/core-events@npm:8.0.0-alpha.9"
dependencies:
ts-dedent: "npm:^2.0.0"
checksum: 8868baf90e7f5124966d762a69e06678988105b292b9093d74d2ecd5489cbdad6bc421be19b28b75e9e446074f1ef4fc4ee699ad896ed78bbe99ae0e94cfa416
languageName: node
linkType: hard

"@storybook/core-events@workspace:*, @storybook/core-events@workspace:lib/core-events":
version: 0.0.0-use.local
resolution: "@storybook/core-events@workspace:lib/core-events"
Expand Down Expand Up @@ -5817,21 +5776,6 @@ __metadata:
languageName: node
linkType: hard

"@storybook/instrumenter@npm:8.0.0-alpha.9":
version: 8.0.0-alpha.9
resolution: "@storybook/instrumenter@npm:8.0.0-alpha.9"
dependencies:
"@storybook/channels": "npm:8.0.0-alpha.9"
"@storybook/client-logger": "npm:8.0.0-alpha.9"
"@storybook/core-events": "npm:8.0.0-alpha.9"
"@storybook/global": "npm:^5.0.0"
"@storybook/preview-api": "npm:8.0.0-alpha.9"
"@vitest/utils": "npm:^0.34.6"
util: "npm:^0.12.4"
checksum: 2c1e8953a5e178bb9631878a233623f7df637164bd72d76987431926e81bb3ca6eda71ed1aeda9f21675103c6c5b7e9fba1d3d9a3dd283a821bb11aeea17ac1d
languageName: node
linkType: hard

"@storybook/instrumenter@workspace:*, @storybook/instrumenter@workspace:lib/instrumenter":
version: 0.0.0-use.local
resolution: "@storybook/instrumenter@workspace:lib/instrumenter"
Expand Down Expand Up @@ -6203,27 +6147,6 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/preview-api@npm:8.0.0-alpha.9":
version: 8.0.0-alpha.9
resolution: "@storybook/preview-api@npm:8.0.0-alpha.9"
dependencies:
"@storybook/channels": "npm:8.0.0-alpha.9"
"@storybook/client-logger": "npm:8.0.0-alpha.9"
"@storybook/core-events": "npm:8.0.0-alpha.9"
"@storybook/csf": "npm:^0.1.2"
"@storybook/global": "npm:^5.0.0"
"@storybook/types": "npm:8.0.0-alpha.9"
"@types/qs": "npm:^6.9.5"
dequal: "npm:^2.0.2"
lodash: "npm:^4.17.21"
memoizerific: "npm:^1.11.3"
qs: "npm:^6.10.0"
ts-dedent: "npm:^2.0.0"
util-deprecate: "npm:^1.0.2"
checksum: 8a911b9d937e5f458fa4f51cda4abf6c3575c11c03bb17f4ca726aa940badcf41ea801bfc947120e440f07a8d3b54a4f14cb1afca94961d28aaec52f5129b072
languageName: node
linkType: hard

"@storybook/preview-api@workspace:*, @storybook/preview-api@workspace:lib/preview-api":
version: 0.0.0-use.local
resolution: "@storybook/preview-api@workspace:lib/preview-api"
Expand Down Expand Up @@ -6694,26 +6617,6 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/test@npm:next":
version: 8.0.0-alpha.9
resolution: "@storybook/test@npm:8.0.0-alpha.9"
dependencies:
"@storybook/client-logger": "npm:8.0.0-alpha.9"
"@storybook/core-events": "npm:8.0.0-alpha.9"
"@storybook/instrumenter": "npm:8.0.0-alpha.9"
"@storybook/preview-api": "npm:8.0.0-alpha.9"
"@testing-library/dom": "npm:^9.3.1"
"@testing-library/jest-dom": "npm:^6.1.3"
"@testing-library/user-event": "npm:14.3.0"
"@types/chai": "npm:^4"
"@vitest/expect": "npm:^0.34.2"
"@vitest/spy": "npm:^0.34.1"
chai: "npm:^4.3.7"
util: "npm:^0.12.4"
checksum: c5184a0a869f9849d9ef0f02e1c6c79de16b5534746d662355278a6c8bd0f97df3a35e17e5f2c9ba3789b1fae8f8a215f6a88479005ef443275feb653b005498
languageName: node
linkType: hard

"@storybook/test@workspace:*, @storybook/test@workspace:lib/test":
version: 0.0.0-use.local
resolution: "@storybook/test@workspace:lib/test"
Expand Down Expand Up @@ -6786,17 +6689,6 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/types@npm:8.0.0-alpha.9":
version: 8.0.0-alpha.9
resolution: "@storybook/types@npm:8.0.0-alpha.9"
dependencies:
"@storybook/channels": "npm:8.0.0-alpha.9"
"@types/express": "npm:^4.7.0"
file-system-cache: "npm:2.3.0"
checksum: c40518716905b046b176f9f7ff34748e4561cc669039f02fd15841f1d4320089d3734a41532ea4551ed3b0b18c7900a10b9330e182e07e23325781d5400a8f78
languageName: node
linkType: hard

"@storybook/types@workspace:*, @storybook/types@workspace:lib/types":
version: 0.0.0-use.local
resolution: "@storybook/types@workspace:lib/types"
Expand Down Expand Up @@ -7253,13 +7145,6 @@ __metadata:
languageName: node
linkType: hard

"@types/chai@npm:^4":
version: 4.3.11
resolution: "@types/chai@npm:4.3.11"
checksum: 0c216ac4a19bfbf8318bb104d32e50704ee2ffc4b538b976c4326e6638fee121462402caa570662227a2a218810388aadb14bdbd3d3d474ec300b00695db448a
languageName: node
linkType: hard

"@types/color-convert@npm:^2.0.0":
version: 2.0.3
resolution: "@types/color-convert@npm:2.0.3"
Expand Down Expand Up @@ -8444,17 +8329,6 @@ __metadata:
languageName: node
linkType: hard

"@vitest/expect@npm:^0.34.2":
version: 0.34.7
resolution: "@vitest/expect@npm:0.34.7"
dependencies:
"@vitest/spy": "npm:0.34.7"
"@vitest/utils": "npm:0.34.7"
chai: "npm:^4.3.10"
checksum: 3ce5b63a51a8c5f585d21768c1dc48dbedbb83b01a6bad07a27db809b53d4e21cfdd059f23815ad8374dfd010e75e279ea0baa7b0fd2bdeffed8afeb53d326ee
languageName: node
linkType: hard

"@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch":
version: 1.1.3
resolution: "@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch::version=1.1.3&hash=5d51c9"
Expand Down Expand Up @@ -8488,15 +8362,6 @@ __metadata:
languageName: node
linkType: hard

"@vitest/spy@npm:0.34.7, @vitest/spy@npm:^0.34.1":
version: 0.34.7
resolution: "@vitest/spy@npm:0.34.7"
dependencies:
tinyspy: "npm:^2.1.1"
checksum: 1150b270eb72a5e8e7da997bcba90ebe5ed2ac50de1ea1f81738e16a19ab4bc77ca4d17639988df65695d4b325fe3647a1e4204d01024bcf5ecac8ba7764a2cc
languageName: node
linkType: hard

"@vitest/spy@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/spy@npm:1.0.4"
Expand All @@ -8515,17 +8380,6 @@ __metadata:
languageName: node
linkType: hard

"@vitest/utils@npm:0.34.7, @vitest/utils@npm:^0.34.6":
version: 0.34.7
resolution: "@vitest/utils@npm:0.34.7"
dependencies:
diff-sequences: "npm:^29.4.3"
loupe: "npm:^2.3.6"
pretty-format: "npm:^29.5.0"
checksum: 5f26ec5b4a53709a50efdb57aa753e8090b3411e888774f67a0d192eb7f046ed5fcc6884eb3d6275d2674926e724b731e8d28cd3cea96a7f3d27462a0d44af9e
languageName: node
linkType: hard

"@vitest/utils@npm:1.0.4":
version: 1.0.4
resolution: "@vitest/utils@npm:1.0.4"
Expand All @@ -8549,6 +8403,17 @@ __metadata:
languageName: node
linkType: hard

"@vitest/utils@npm:^0.34.6":
version: 0.34.7
resolution: "@vitest/utils@npm:0.34.7"
dependencies:
diff-sequences: "npm:^29.4.3"
loupe: "npm:^2.3.6"
pretty-format: "npm:^29.5.0"
checksum: 5f26ec5b4a53709a50efdb57aa753e8090b3411e888774f67a0d192eb7f046ed5fcc6884eb3d6275d2674926e724b731e8d28cd3cea96a7f3d27462a0d44af9e
languageName: node
linkType: hard

"@volar/language-core@npm:1.10.1, @volar/language-core@npm:~1.10.0":
version: 1.10.1
resolution: "@volar/language-core@npm:1.10.1"
Expand Down Expand Up @@ -27010,7 +26875,7 @@ __metadata:
languageName: node
linkType: hard

"tinyspy@npm:^2.1.1, tinyspy@npm:^2.2.0":
"tinyspy@npm:^2.2.0":
version: 2.2.0
resolution: "tinyspy@npm:2.2.0"
checksum: 8c7b70748dd8590e85d52741db79243746c15bc03c92d75c23160a762142db577e7f53e360ba7300e321b12bca5c42dd2522a8dbeec6ba3830302573dd8516bc
Expand Down

0 comments on commit 57da5d3

Please sign in to comment.