MCPcopy
hub / github.com/date-fns/date-fns / getVersion

Function getVersion

pkgs/docs/src/bin.ts:135–147  ·  view source on GitHub ↗
(config: DateFnsDocs.Config)

Source from the content-addressed store, hash-verified

133const preReleaseRegExp = /-(alpha|beta|rc)(\.\d+)?$/;
134
135async function getVersion(config: DateFnsDocs.Config) {
136 const packagePath = path.resolve(configDir, config.package, "package.json");
137 const packageStr = await readFile(packagePath, "utf8");
138 const packageJSON = JSON.parse(packageStr);
139 const version = packageJSON.version;
140
141 if (!version || !versionRegExp.test(version))
142 throw Error(`(•̀o•́)ง version is invalid "${version}"`);
143
144 const preRelease = preReleaseRegExp.test(version);
145
146 return { version: "v" + version, preRelease };
147}
148
149async function getFnPages(
150 config: DateFnsDocs.Config,

Callers 1

bin.tsFile · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected