MCPcopy Create free account
hub / github.com/vercel/vercel / makePackage

Function makePackage

packages/python/test/diagnostics.test.ts:59–104  ·  view source on GitHub ↗
(opts: {
  name?: string;
  dependencies?: string[];
  optionalDependencies?: Record<string, string[]>;
  dependencyGroups?: Record<string, DependencyGroupEntry[]>;
  uvDevDependencies?: string[];
  requiresPython?: string;
  requiresPythonSource?: string;
})

Source from the content-addressed store, hash-verified

57}
58
59function makePackage(opts: {
60 name?: string;
61 dependencies?: string[];
62 optionalDependencies?: Record<string, string[]>;
63 dependencyGroups?: Record<string, DependencyGroupEntry[]>;
64 uvDevDependencies?: string[];
65 requiresPython?: string;
66 requiresPythonSource?: string;
67}): PythonPackage {
68 const pkg: PythonPackage = {
69 manifest: {
70 path: 'pyproject.toml',
71 data: {
72 project: {
73 name: opts.name ?? 'test-app',
74 ...(opts.dependencies ? { dependencies: opts.dependencies } : {}),
75 ...(opts.requiresPython
76 ? { 'requires-python': opts.requiresPython }
77 : {}),
78 ...(opts.optionalDependencies
79 ? { 'optional-dependencies': opts.optionalDependencies }
80 : {}),
81 },
82 ...(opts.dependencyGroups
83 ? { 'dependency-groups': opts.dependencyGroups }
84 : {}),
85 ...(opts.uvDevDependencies
86 ? { tool: { uv: { 'dev-dependencies': opts.uvDevDependencies } } }
87 : {}),
88 },
89 },
90 };
91
92 if (opts.requiresPython) {
93 pkg.requiresPython = [
94 {
95 request: [],
96 source: opts.requiresPythonSource ?? 'pyproject.toml',
97 prettySource: `"requires-python" key in pyproject.toml`,
98 specifier: opts.requiresPython,
99 },
100 ];
101 }
102
103 return pkg;
104}
105
106describe('generateProjectManifest', () => {
107 let tempDir: string;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected