Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions packages/addons/_tests/storybook/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import process from 'node:process';
import { expect } from '@playwright/test';
import { setupTest } from '../_setup/suite.ts';
import storybook from '../../storybook/index.ts';
import eslint from '../../eslint/index.ts';

const { test, variants, prepareServer } = setupTest({ storybook });
// we're including the `eslint` add-on to prevent `storybook` from modifying this repo's `eslint.config.js`
const { test, variants, prepareServer } = setupTest({ storybook, eslint });

let port = 6006;

test.for(variants)(
'storybook loaded - %s',
{ concurrent: !process.env.CI },
async (variant, { page, ...ctx }) => {
const cwd = await ctx.run(variant, { storybook: {} });
const cwd = await ctx.run(variant, { storybook: {}, eslint: {} });

const { close } = await prepareServer({
cwd,
Expand Down
8 changes: 7 additions & 1 deletion packages/addons/storybook/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'node:process';
import { defineAddon } from '@sveltejs/cli-core';
import { getNodeTypesVersion } from '../common.ts';

Expand All @@ -11,7 +12,12 @@ export default defineAddon({
runsAfter('eslint');
},
run: async ({ sv }) => {
await sv.execute(['storybook@latest', 'init', '--skip-install', '--no-dev'], 'inherit');
const args = ['storybook@latest', 'init', '--skip-install', '--no-dev'];

// skips the onboarding prompt during tests
if (process.env.NODE_ENV?.toLowerCase() === 'test') args.push('--yes');

await sv.execute(args, 'inherit');
sv.devDependency(`@types/node`, getNodeTypesVersion());
}
});
21 changes: 11 additions & 10 deletions packages/cli/commands/add/fetch-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import path from 'node:path';
import { createGunzip } from 'node:zlib';
import { fileURLToPath } from 'node:url';
import { pipeline } from 'node:stream/promises';
import { extract } from 'tar-fs';
// TODO: replace tar-fs
// import { extract } from 'tar-fs';
import type { AddonWithoutExplicitArgs } from '@sveltejs/cli-core';

// path to the `node_modules` directory of `sv`
Expand Down Expand Up @@ -65,15 +66,15 @@ export async function downloadPackage(options: DownloadOptions): Promise<AddonWi
// so that we can dynamically import the package via `import(pkg-name)`
await pipeline(
data.body,
createGunzip(),
extract(NODE_MODULES, {
map: (header) => {
// file paths from the tarball will always have a `package/` prefix,
// so we'll need to replace it with the name of the package
header.name = header.name.replace('package', pkg.name);
return header;
}
})
createGunzip()
// extract(NODE_MODULES, {
// map: (header) => {
// // file paths from the tarball will always have a `package/` prefix,
// // so we'll need to replace it with the name of the package
// header.name = header.name.replace('package', pkg.name);
// return header;
// }
// })
);

const { default: details } = await import(pkg.name);
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@
"@sveltejs/create": "workspace:*",
"@types/degit": "^2.8.6",
"@types/ps-tree": "^1.1.6",
"@types/tar-fs": "^2.0.4",
"commander": "^13.1.0",
"degit": "^2.8.4",
"empathic": "^1.0.0",
"package-manager-detector": "^0.2.11",
"picocolors": "^1.1.1",
"ps-tree": "^1.2.0",
"tar-fs": "^3.0.8",
"tinyexec": "^0.3.2",
"valibot": "^0.41.0"
},
Expand Down
152 changes: 0 additions & 152 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading