@halospv3/hce.shared-config
Version:
Automate commit message quality, changelogs, and CI/CD releases. Exports a semantic-release shareable configuration deserialized from this package's '.releaserc.yml'. Shared resources for .NET projects are also distributed with this package.
30 lines (26 loc) • 1.26 kB
JavaScript
;
require('core-js/stable/string/replace-all');
const node_child_process = require('node:child_process');
const node_fs = require('node:fs');
const path = require('node:path');
const tmp = require('tmp');
/// <reference lib="ES2021.string" />
function createDummyNupkg() {
const dirResult = tmp.dirSync({
unsafeCleanup: true
});
const dummyPkgFullPath = path.join(dirResult.name, 'DUMMY.1.0.0.nupkg');
// delete old and possibly-poisoned nupkg
if (node_fs.existsSync(dummyPkgFullPath)) node_fs.unlinkSync(dummyPkgFullPath);
const options = {
cwd: dirResult.name,
encoding: 'utf8'
};
node_child_process.execSync('dotnet new console --name DUMMY', options);
const packOut = node_child_process.execSync(`dotnet pack DUMMY --configuration Release --output ${path.dirname(dummyPkgFullPath)}`, options);
const createdLine = packOut.replaceAll('\r', '').split('\n').find(line => line.includes('Successfully created package'))?.trim();
if (!node_fs.existsSync(dummyPkgFullPath)) throw new Error(`The dummy nupkg was created, but could not be found at ${dummyPkgFullPath}. See '${createdLine}'.`);
return dummyPkgFullPath;
}
exports.createDummyNupkg = createDummyNupkg;
//# sourceMappingURL=createDummyNupkg.cjs.map