Skip to content

Commit

Permalink
fix: remove props key and filter .DS_Store file
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokada committed Aug 22, 2023
1 parent dd7a957 commit f675e81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,23 @@ async function generateComponentData () {
await readdir(dirPath)
).map(async (entity) => {
const path = join(dirPath, entity);
return (await lstat(path)).isDirectory() ? await deepReadDir(path) : path;
// return (await lstat(path)).isDirectory() ? await deepReadDir(path) : path;
const stats = await lstat(path);

if (stats.isDirectory()) {
return await deepReadDir(path);
} else {
// Filter out unwanted files here (e.g., .DS_Store)
if (entity !== '.DS_Store') {
return path;
} else {
return null;
}
}
})
);
const files = await deepReadDir(srcLib);
const all = files.flat(Number.POSITIVE_INFINITY);
const all = files.flat(Number.POSITIVE_INFINITY).filter(Boolean);
return all;
}

Expand Down Expand Up @@ -313,9 +325,9 @@ async function generateComponentData () {
});

// Set the 'props' key in the obj to the extracted result array
obj.props = result;
// obj.props = result;

return obj;
return result;
}

// Function to extract slot names from a Svelte file
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"gen:docs": "./index.js docs",
"gen:compo-data": "./index.js compo-data",
"copy:package": "./index.js package",
"lib-helpers": "npm run gen:docs && npm run gen:compo-data && npm run build && npm run gen:exports && npm run copy:package",
"lib-helpers": "npm run gen:docs && npm run gen:compo-data && npm run gen:exports && npm run copy:package",
"package:publish": "standard-version && git push --follow-tags origin main && npm run lib-helpers && npm publish"
},
"repository": {
Expand All @@ -32,4 +32,4 @@
"url": "https://github.com/shinokada/svelte-lib-helpers/issues"
},
"homepage": "https://github.com/shinokada/svelte-lib-helpers#readme"
}
}

0 comments on commit f675e81

Please sign in to comment.