chore(rocket-preset-extend-lion-docs): make it work on windows
This commit is contained in:
parent
4708fe9462
commit
0764d2ce92
3 changed files with 12 additions and 8 deletions
|
|
@ -28,12 +28,16 @@ export async function getPublicApiOfPkg(pkgJsonPath) {
|
||||||
pkgExports[pkgExportDefinition].default ||
|
pkgExports[pkgExportDefinition].default ||
|
||||||
pkgExports[pkgExportDefinition].module ||
|
pkgExports[pkgExportDefinition].module ||
|
||||||
pkgExports[pkgExportDefinition];
|
pkgExports[pkgExportDefinition];
|
||||||
const entryPointFilePath = path.join(pkgPath, pkgExportPath);
|
const entryPointFilePath = path.join(pkgPath, pkgExportPath.split('/').join(path.sep));
|
||||||
|
|
||||||
if (glob.hasMagic(entryPointFilePath)) {
|
const globifiedEntryPointFilePath = entryPointFilePath
|
||||||
const globifiedEntryPointFilePath = entryPointFilePath.replace(/\*/, '**');
|
.split(path.sep)
|
||||||
|
.join('/')
|
||||||
|
.replace(/\*/, '**');
|
||||||
|
|
||||||
|
if (glob.hasMagic(globifiedEntryPointFilePath)) {
|
||||||
for (const entryPointFile of glob.sync(globifiedEntryPointFilePath, { nodir: true })) {
|
for (const entryPointFile of glob.sync(globifiedEntryPointFilePath, { nodir: true })) {
|
||||||
const fullPkgExportPath = path.join(pkgPath, pkgExportPath);
|
const fullPkgExportPath = path.join(pkgPath, pkgExportPath).split(path.sep).join('/');
|
||||||
const reg = new RegExp(`^${fullPkgExportPath.replace('*', '(.*)')}$`);
|
const reg = new RegExp(`^${fullPkgExportPath.replace('*', '(.*)')}$`);
|
||||||
const match = reg.exec(entryPointFile);
|
const match = reg.exec(entryPointFile);
|
||||||
if (match) {
|
if (match) {
|
||||||
|
|
@ -48,7 +52,7 @@ export async function getPublicApiOfPkg(pkgJsonPath) {
|
||||||
name: pkgEntryPoint,
|
name: pkgEntryPoint,
|
||||||
namePath: pkgEntryPointPath,
|
namePath: pkgEntryPointPath,
|
||||||
exports,
|
exports,
|
||||||
path: entryPointFile,
|
path: entryPointFile.split('/').join(path.sep),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function execute(input, options = {}) {
|
async function execute(input, options = {}) {
|
||||||
const nodeModulesDir = path.join(__dirname, input);
|
const nodeModulesDir = path.join(__dirname, input.split('/').join(path.sep));
|
||||||
|
|
||||||
const result = await generateExtendDocsConfig({
|
const result = await generateExtendDocsConfig({
|
||||||
// used tsc version does not recognize optional jsdoc params
|
// used tsc version does not recognize optional jsdoc params
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function execute(input) {
|
async function execute(input) {
|
||||||
const pkgJsonPath = path.join(__dirname, input);
|
const pkgJsonPath = path.join(__dirname, input.split('/').join(path.sep));
|
||||||
const result = await getPublicApiOfPkg(pkgJsonPath);
|
const result = await getPublicApiOfPkg(pkgJsonPath);
|
||||||
return {
|
return {
|
||||||
...result,
|
...result,
|
||||||
entryPoints: result.entryPoints.map(ep => ({
|
entryPoints: result.entryPoints.map(ep => ({
|
||||||
...ep,
|
...ep,
|
||||||
path: ep.path.replace(__dirname, 'abs::'),
|
path: ep.path.replace(__dirname, 'abs::').replace(/\\/g, '/'),
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue