@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.
35 lines (32 loc) • 1.9 kB
JavaScript
;
const node_fs = require('node:fs');
const path = require('node:path');
const node_url = require('node:url');
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
const _interopDefault = e => e && e.__esModule ? e : {
default: e
};
const path__default = /*#__PURE__*/_interopDefault(path);
/// ../static/.releaserc.yml
function findStaticConfig() {
const glob = 'static/.releaserc.yml';
let dirPath = node_url.fileURLToPath(path__default.default.dirname(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('findStaticConfig.cjs', document.baseURI).href));
let combinedPath = path__default.default.join(dirPath, glob);
while (!node_fs.existsSync(combinedPath)) {
/* file:// + dirname behavior on Windows. 'root' is empty when 'file://' is present.
* file:///C:/Repos
* file:///C:
* file://
* .
*/
// DEBUG.log(dirPath);
// DEBUG.log(combinedPath.href);
/** Throw if we reached root. */
if (path__default.default.dirname(dirPath) === '') throw new Error(`Failed to get full path for HCE.Shared's shared configuration. HCE.Shared recursively searched parent directories for '${glob}' starting from '${path__default.default.dirname(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('findStaticConfig.cjs', document.baseURI).href)}'`);
dirPath = path__default.default.dirname(dirPath);
combinedPath = path__default.default.join(dirPath, glob);
}
return combinedPath;
}
exports.findStaticConfig = findStaticConfig;
//# sourceMappingURL=findStaticConfig.cjs.map