Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Fix init --skip-install #28853

Merged
merged 9 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,19 @@ jobs:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
STORYBOOK_DISABLE_TELEMETRY: true
- run:
name: Storybook init from empty directory (--skip-install)
command: |
cd code
yarn local-registry --open &
cd ../../
mkdir empty-<< parameters.template >>
cd empty-<< parameters.template >>
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
2 changes: 1 addition & 1 deletion code/core/scripts/prep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async function run() {
target: 'node18',
splitting: false,
platform: 'neutral',
mainFields: ['main', 'module', 'node'],
mainFields: ['module', 'main', 'node'],
conditions: ['node', 'module', 'import', 'require'],
} satisfies EsbuildContextOptions;

Expand Down
6 changes: 5 additions & 1 deletion code/core/src/cli/dirs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dirname, join } from 'path';

import downloadTarball from '@ndelangen/get-tarball';
import getNpmTarballUrl from 'get-npm-tarball-url';
import getNpmTarballUrlDefault from 'get-npm-tarball-url';

import invariant from 'tiny-invariant';
import { externalFrameworks } from './project_types';
Expand All @@ -17,6 +17,10 @@ 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;

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