-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add script to check if packages pass publint (#523)
* Add zod schemas for CI validation * Require npm field for components.json * Remove svelte-layout-resizable * Stricter Zod validation * Stricter repository field validation * Implement requested changes * Add back accidentally removed field * Move SvelteStore to templates.json * Update category and tags * Add script to get npm data * Add script to get publint data * Re-run updateNpm.js * Re-run updatePublint.js * Implement initial feedback * Use npm.json data * Update npm.js * Switch async/await to then/catch Co-authored-by: MacFJA <[email protected]> * Fix prettier * Run script * Re-run updateNpm * Also read tools.json * Add @types/node * Restructure npm.json output * Fix updatePublint.js * Display last update on components page * Add to weekly workflow * Clarify updating npm data * Update src/lib/utils/injectNpmData.ts Co-authored-by: MacFJA <[email protected]> * Smaller date font, add version * Improve error text * Fix property title * Move json to lib/data directory * Fix npm.json path * Also check tools.json * Add to automated PR * Add injectPublintData function * Update publint --------- Co-authored-by: MacFJA <[email protected]>
- Loading branch information
1 parent
02dc9df
commit 156f654
Showing
10 changed files
with
894 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// @ts-check | ||
// Source: https://github.com/bluwy/publint/blob/master/site/src/utils/tarball.js | ||
|
||
/** @typedef {{ name: string, buffer: ArrayBuffer }} TarballFile */ | ||
|
||
/** | ||
* @param {TarballFile[]} files | ||
* @return {import('publint').Vfs} | ||
* */ | ||
export function createTarballVfs(files) { | ||
return { | ||
getDirName: (path) => path.replace(/\/[^/]*$/, ''), | ||
getExtName: (path) => path.replace(/^.*\./, '.'), | ||
isPathDir: async (path) => { | ||
path = path.endsWith('/') ? path : path + '/'; | ||
return files.some((file) => file.name.startsWith(path)); | ||
}, | ||
isPathExist: async (path) => { | ||
const pathDirVariant = path.endsWith('/') ? path : path + '/'; | ||
return files.some((file) => file.name === path || file.name.startsWith(pathDirVariant)); | ||
}, | ||
pathJoin: (...parts) => | ||
parts | ||
.map((v) => (v.startsWith('./') ? v.slice(2) : v)) | ||
.join('/') | ||
.replace('///', '/') | ||
.replace('//', '/'), // TODO: optimize this please | ||
pathRelative: (from, to) => to.replace(from, '').slice(1), | ||
readDir: async (path) => { | ||
path = path.endsWith('/') ? path : path + '/'; | ||
return files | ||
.filter((file) => file.name.startsWith(path) && file.name !== path) | ||
.map((file) => file.name.slice(path.length)); | ||
}, | ||
readFile: async (path) => { | ||
const file = files.find((file) => file.name === path); | ||
if (file) { | ||
return new TextDecoder('utf-8').decode(file.buffer); | ||
} else { | ||
throw new Error(`Unable to read file at path: ${path}`); | ||
} | ||
} | ||
}; | ||
} |
Oops, something went wrong.