MCPcopy Create free account
hub / github.com/EvoMap/evolver / makeDegitPackage

Function makeDegitPackage

test/forceUpdateFailureCodes.test.js:78–92  ·  view source on GitHub ↗
(version, name)

Source from the content-addressed store, hash-verified

76// Fake degit that "downloads" a package.json (+ a code file) of the given
77// version into TMP_TARGET (the last positional arg degit receives).
78function makeDegitPackage(version, name) {
79 return function (bin, args) {
80 if (!String(bin).includes('npx')) throw new Error('unexpected fallback call');
81 const tmpTarget = args[args.length - 1];
82 fs.mkdirSync(tmpTarget, { recursive: true });
83 fs.writeFileSync(
84 path.join(tmpTarget, 'package.json'),
85 JSON.stringify({ name: name || '@evomap/evolver', version }),
86 'utf8',
87 );
88 fs.writeFileSync(path.join(tmpTarget, 'index.js'), '// v' + version, 'utf8');
89 fs.mkdirSync(path.join(tmpTarget, 'src'), { recursive: true });
90 fs.writeFileSync(path.join(tmpTarget, 'src', 'evolve.js'), '// src v' + version, 'utf8');
91 };
92}
93
94function makeSuccessfulDegit(version) {
95 return makeDegitPackage(version, '@evomap/evolver');

Callers 2

makeSuccessfulDegitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected