8000 chore: remove `tar-fs` (#577) · sveltejs/cli@17799cc · GitHub
[go: up one dir, main page]

Skip to content

Commit 17799cc

Browse files
authored
chore: remove tar-fs (#577)
* remove tar-fs * fix storybook test * lint * stop touching my config
1 parent adfea6b commit 17799cc

File tree

5 files changed

+22
-167
lines changed

5 files changed

+22
-167
lines changed

packages/addons/_tests/storybook/test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ import process from 'node:process';
22
import { expect } from '@playwright/test';
33
import { setupTest } from '../_setup/suite.ts';
44
import storybook from '../../storybook/index.ts';
5+
import eslint from '../../eslint/index.ts';
56

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

810
let port = 6006;
911

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

1618
const { close } = await prepareServer({
1719
cwd,

packages/addons/storybook/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import process from 'node:process';
12
import { defineAddon } from '@sveltejs/cli-core';
23
import { getNodeTypesVersion } from '../common.ts';
34

@@ -11,7 +12,12 @@ export default defineAddon({
1112
runsAfter('eslint');
1213
},
1314
run: async ({ sv }) => {
14-
await sv.execute(['storybook@latest', 'init', '--skip-install', '--no-dev'], 'inherit');
15+
const args = ['storybook@latest', 'init', '--skip-install', '--no-dev'];
16+
17+
// skips the onboarding prompt during tests
18+
if (process.env.NODE_ENV?.toLowerCase() === 'test') args.push('--yes');
19+
20+
await sv.execute(args, 'inherit');
1521
sv.devDependency(`@types/node`, getNodeTypesVersion());
1622
}
1723
});

packages/cli/commands/add/fetch-packages.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import path from 'node:path';
33
import { createGunzip } from 'node:zlib';
44
import { fileURLToPath } from 'node:url';
55
import { pipeline } from 'node:stream/promises';
6-
import { extract } from 'tar-fs';
6+
// TODO: replace tar-fs
7+
// import { extract } from 'tar-fs';
78
import type { AddonWithoutExplicitArgs } from '@sveltejs/cli-core';
89

910
// path to the `node_modules` directory of `sv`
@@ -65,15 +66,15 @@ export async function downloadPackage(options: DownloadOptions): Promise<AddonWi
6566
// so that we can dynamically import the package via `import(pkg-name)`
6667
await pipeline(
6768
data.body,
68-
createGunzip(),
69-
extract(NODE_MODULES, {
70-
map: (header) => {
71-
// file paths from the tarball will always have a `package/` prefix,
72-
// so we'll need to replace it with the name of the package
73-
header.name = header.name.replace('package', pkg.name);
74-
return header;
75-
}
76-
})
69+
createGunzip()
70+
// extract(NODE_MODULES, {
71+
// map: (header) => {
72+
// // file paths from the tarball will always have a `package/` prefix,
73+
// // so we'll need to replace it with the name of the package
74+
// header.name = header.name.replace('package', pkg.name);
75+
// return header;
76+
// }
77+
// })
7778
);
7879

7980
const { default: details } = await import(pkg.name);

packages/cli/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@
3636
"@sveltejs/create": "workspace:*",
3737
"@types/degit": "^2.8.6",
3838
"@types/ps-tree": "^1.1.6",
39-
"@types/tar-fs": "^2.0.4",
4039
"commander": "^13.1.0",
4140
"degit": "^2.8.4",
4241
"empathic": "^1.0.0",
4342
"package-manager-detector": "^0.2.11",
4443
"picocolors": "^1.1.1",
4544
"ps-tree": "^1.2.0",
46-
"tar-fs": "^3.0.8",
4745
"tinyexec": "^0.3.2",
4846
"valibot": "^0.41.0"
4947
},

pnpm-lock.yaml

Lines changed: 0 additions & 152 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0