MCPcopy Create free account
hub / github.com/nuxt/icon / installCollection

Function installCollection

test/client-bundle.test.ts:8–28  ·  view source on GitHub ↗
(dir: string, prefix: string, icon: string)

Source from the content-addressed store, hash-verified

6
7// Install a fake `@iconify-json/<prefix>` collection into `<dir>/node_modules`
8function installCollection(dir: string, prefix: string, icon: string) {
9 const collectionDir = join(dir, 'node_modules', '@iconify-json', prefix)
10 mkdirSync(collectionDir, { recursive: true })
11 writeFileSync(join(collectionDir, 'package.json'), JSON.stringify({
12 name: `@iconify-json/${prefix}`,
13 version: '0.0.0',
14 main: 'index.js',
15 exports: {
16 './*': './*',
17 './icons.json': './icons.json',
18 },
19 }))
20 writeFileSync(join(collectionDir, 'icons.json'), JSON.stringify({
21 prefix,
22 icons: {
23 [icon]: { body: '<path d="M0 0h24v24H0z"/>' },
24 },
25 width: 24,
26 height: 24,
27 }))
28}
29
30function createContext(rootDir: string, workspaceDir: string, icons: string[], hookIcons: string[] = []) {
31 const nuxt = {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…