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].module ||
|
||||
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.replace(/\*/, '**');
|
||||
const globifiedEntryPointFilePath = entryPointFilePath
|
||||
.split(path.sep)
|
||||
.join('/')
|
||||
.replace(/\*/, '**');
|
||||
|
||||
if (glob.hasMagic(globifiedEntryPointFilePath)) {
|
||||
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 match = reg.exec(entryPointFile);
|
||||
if (match) {
|
||||
|
|
@ -48,7 +52,7 @@ export async function getPublicApiOfPkg(pkgJsonPath) {
|
|||
name: pkgEntryPoint,
|
||||
namePath: pkgEntryPointPath,
|
||||
exports,
|
||||
path: entryPointFile,
|
||||
path: entryPointFile.split('/').join(path.sep),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|||
* @returns
|
||||
*/
|
||||
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({
|
||||
// used tsc version does not recognize optional jsdoc params
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|||
* @returns
|
||||
*/
|
||||
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);
|
||||
return {
|
||||
...result,
|
||||
entryPoints: result.entryPoints.map(ep => ({
|
||||
...ep,
|
||||
path: ep.path.replace(__dirname, 'abs::'),
|
||||
path: ep.path.replace(__dirname, 'abs::').replace(/\\/g, '/'),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue