Skip to content

Commit

Permalink
Merge pull request #28853 from storybookjs/norbert/fix-no-install-bug
Browse files Browse the repository at this point in the history
Bug: CLI `init` failure when `--no-install` passed fixed
  • Loading branch information
ndelangen authored Aug 9, 2024
2 parents 81cdbba + a3ce081 commit e5960ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,23 @@ jobs:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
STORYBOOK_DISABLE_TELEMETRY: true
- when:
condition:
equal: ["react-vite-ts", << parameters.template >>]
steps:
- run:
name: Storybook init from empty directory (--skip-install)
command: |
cd code
yarn local-registry --open &
cd ../../
mkdir empty-<< parameters.template >>-no-install
cd empty-<< parameters.template >>-no-install
npx storybook init --yes --skip-install
environment:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
STORYBOOK_DISABLE_TELEMETRY: true
- report-workflow-on-failure
test-portable-stories:
parameters:
Expand Down
13 changes: 10 additions & 3 deletions code/core/src/cli/dirs.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { dirname, join } from 'node:path';

import type { JsPackageManager } from '@storybook/core/common';
import { temporaryDirectory, versions } from '@storybook/core/common';
import type { SupportedFrameworks } from '@storybook/core/types';

import downloadTarball from '@ndelangen/get-tarball';
import getNpmTarballUrl from 'get-npm-tarball-url';
import { dirname, join } from 'path';
import downloadTarballDefault from '@ndelangen/get-tarball';
import getNpmTarballUrlDefault from 'get-npm-tarball-url';
import invariant from 'tiny-invariant';

import { externalFrameworks } from './project_types';
Expand All @@ -17,6 +18,12 @@ const resolveUsingBranchInstall = async (packageManager: JsPackageManager, reque
// FIXME: this might not be the right version for community packages
const version = versions[name] || (await packageManager.latestVersion(request));

// an artifact of esbuild + type=commonjs + exportmap
// @ts-expect-error (default export)
const getNpmTarballUrl = getNpmTarballUrlDefault.default || getNpmTarballUrlDefault;
// @ts-expect-error (default export)
const downloadTarball = downloadTarballDefault.default || downloadTarballDefault;

const url = getNpmTarballUrl(request, version, {
registry: await packageManager.getRegistryURL(),
});
Expand Down

0 comments on commit e5960ff

Please sign in to comment.