MCPcopy
hub / github.com/nukeop/nuclear / createPluginFolder

Function createPluginFolder

packages/player/src/test/utils/testPluginFolder.ts:20–57  ·  view source on GitHub ↗
(
  basePath: string,
  opts: PluginFolderOptions,
)

Source from the content-addressed store, hash-verified

18export const AppData = '/home/user/.local/share/com.nuclearplayer';
19
20export const createPluginFolder = (
21 basePath: string,
22 opts: PluginFolderOptions,
23) => {
24 const {
25 id,
26 name = opts.id,
27 displayName,
28 version = '1.0.0',
29 description = 'Test plugin',
30 author = 'Test Author',
31 permissions = [],
32 main,
33 } = opts;
34
35 const manifest: PluginManifest = {
36 name: id,
37 version,
38 description,
39 author,
40 ...(main ? { main } : {}),
41 nuclear: {
42 displayName: displayName ?? name,
43 permissions,
44 },
45 };
46
47 PluginFsMock.setReadTextFileByMap({
48 [path.join(basePath, 'package.json')]: JSON.stringify(manifest),
49 [path.join(basePath, main ?? 'index.ts')]:
50 'module.exports = { default: {} };',
51 [path.join(AppData, 'plugins', id, version, 'package.json')]:
52 JSON.stringify(manifest),
53 [path.join(AppData, 'plugins', id, version, main ?? 'index.ts')]:
54 'module.exports = { default: {} };',
55 });
56 return manifest;
57};

Callers 3

Calls

no outgoing calls

Tested by

no test coverage detected