Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate modules on sync #864

Merged
merged 9 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added icons/chiffre.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ async function main () {
console.log('Synced', module.name)
} else {
console.log('Syncing all modules')
const modules = await syncAll()
console.log('Sync ' + modules.length + ' modules')
const { count, success } = await syncAll()
console.log('Sync ' + count + ' modules')
if (!success)
process.exit(1)
}
}
break
Expand Down
33 changes: 30 additions & 3 deletions lib/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import defu from 'defu'
import pLimit from 'p-limit'
import { categories } from './categories'
import { ModuleInfo } from './types'
import { fetchGithubPkg, modulesDir, distDir, distFile } from './utils'
import { fetchGithubPkg, modulesDir, distDir, distFile, rootDir } from './utils'
import { $fetch } from 'ofetch'
import { isCI } from 'std-env'

export async function sync (name, repo?: string, isNew: boolean = false) {
const mod = await getModule(name)
Expand Down Expand Up @@ -63,6 +65,26 @@ export async function sync (name, repo?: string, isNew: boolean = false) {
}
}

// ci is flaky with external links
if (!isCI) {
for (const key of ['website', 'learn_more']) {
if (mod[key] && !mod[key].includes('github.com')) {
// we just need to test that we get a 200 response (or a valid redirect)
await $fetch(mod[key]).catch((err) => {
throw new Error(`${key} link is invalid for ${mod.name}: ${err}`)
})
}
}
}

// validate icon
if (mod.icon) {
const file = resolve(rootDir, 'icons', mod.icon)
if (!existsSync(file)) {
throw new Error(`Icon ${mod.icon} does not exist for ${mod.name}`)
}
}

// TODO: Remove extra fields
const validFields = [
'name',
Expand Down Expand Up @@ -169,11 +191,16 @@ export async function readModules () {
export async function syncAll () {
const modules = await readModules()
const limit = pLimit(10)
let success = true
const updatedModules = await Promise.allSettled(modules.map(module => limit(() => {
console.log(`Syncing ${module.name}`)
return sync(module.name, module.repo)
return sync(module.name, module.repo).catch((err) => {
console.error(`Error syncing ${module.name}`)
console.error(err)
success = false
})
})))
return updatedModules
return { count: updatedModules.length, success }
}

export async function build () {
Expand Down
3 changes: 2 additions & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function fetchRawGithub (path) {

export function fetchGithubPkg (repo) {
let path
[repo, path = 'main'] = repo.split('#')
// HEAD will be the default branch
[repo, path = 'HEAD'] = repo.split('#')

return fetchRawGithub(repo + '/' + path + '/' + 'package.json')
}
Expand Down
4 changes: 2 additions & 2 deletions modules/chiffre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: chiffre
description: Privacy-first, end-to-end encrypted analytics
repo: chiffre-io/nuxt-chiffre
npm: nuxt-chiffre
icon: https://avatars.githubusercontent.com/u/58789215?v=4
icon: chiffre.png
github: https://github.com/chiffre-io/nuxt-chiffre
website: https://github.com/chiffre-io/nuxt-chiffre
learn_more: https://chiffre.io
learn_more: https://chiffre.io/
category: Analytics
type: 3rd-party
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion modules/form-actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: form-actions
description: A set of features and composables to interact with forms and server data.
repo: Hebilicious/form-actions-nuxt#main/packages/form-action-nuxt
repo: Hebilicious/form-actions-nuxt#main/packages/form-actions-nuxt
npm: '@hebilicious/form-actions-nuxt'
icon: form-actions.svg
github: https://github.com/Hebilicious/form-actions-nuxt
Expand Down
2 changes: 1 addition & 1 deletion modules/formkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ npm: '@formkit/nuxt'
icon: formkit.png
github: https://github.com/formkit/formkit
website: https://formkit.com
learn_more: https://formkit.com/essentials/installation#with-nuxt
learn_more: https://formkit.com/getting-started/installation
category: Libraries
type: 3rd-party
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion modules/graphql-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ npm: nuxt-graphql-client
icon: graphql-client.svg
github: https://github.com/diizzayy/nuxt-graphql-client
website: https://github.com/diizzayy/nuxt-graphql-client
learn_more: https://www.graphql-code-generator.com/plugins/typescript-graphql-request
learn_more: https://nuxt-graphql-client.web.app/
category: Request
type: 3rd-party
maintainers:
Expand Down
4 changes: 1 addition & 3 deletions modules/logrocket.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: logrocket
description: >-
LogRocket module for Nuxt to help you fix bugs and understand user
behaviour.
description: LogRocket module for Nuxt to help you fix bugs and understand user behaviour.
repo: nuxt-modules/logrocket
npm: nuxt-logrocket
icon: logrocket.png
Expand Down
13 changes: 7 additions & 6 deletions modules/maz-ui.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: maz-ui
description: >-
install easily maz-ui library to take advantage of auto-import components, plugins, composables and CSS files.
repo: louismazel/maz-ui
npm: 'maz-ui'
install easily maz-ui library to take advantage of auto-import components,
plugins, composables and CSS files.
repo: louismazel/maz-ui#master/packages/nuxt-module
npm: nuxt-module
icon: maz-ui.png
github: https://github.com/louismazel/maz-ui
website: https://louismazel.github.io/maz-ui-3/
learn_more: https://louismazel.github.io/maz-ui-3/
website: https://maz-ui.com/
learn_more: https://maz-ui.com/guide/nuxt
category: UI
type: community
type: 3rd-party
maintainers:
- name: Loïc Mazuel
github: LouisMazel
Expand Down
2 changes: 1 addition & 1 deletion modules/meilisearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ maintainers:
avatar: https://avatars.githubusercontent.com/u/13418668?v=4
compatibility:
nuxt: ^3.0.0
devtools: ^0.0.0
requires:
bridge: false
devtools: ^0.0.0
4 changes: 2 additions & 2 deletions modules/netlify-cache.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: netlify-cache
description: >-
Nuxt module that uses netlify cache to speed up redeploy for Nuxt
version < 2.14
Nuxt module that uses netlify cache to speed up redeploy for Nuxt version <
2.14
repo: DreaMinder/nuxt-netlify-cache
npm: nuxt-netlify-cache
icon: netlify.png
Expand Down
8 changes: 4 additions & 4 deletions modules/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: netlify
description: >-
Dynamically generate _headers and _redirects files for Netlify in your Nuxt
projects.
repo: bazzite/nuxt-netlify
repo: juliomrqz/nuxt-netlify
npm: '@aceforth/nuxt-netlify'
icon: netlify.png
github: https://github.com/bazzite/nuxt-netlify
website: https://marquez.co/docs/nuxt-netlify/
learn_more: ''
github: https://github.com/juliomrqz/nuxt-netlify
website: https://github.com/juliomrqz/nuxt-netlify
learn_more: https://github.com/juliomrqz/nuxt-netlify/tree/develop/docs
category: Deployment
type: 3rd-party
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion modules/nuxt-feather-icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nuxt-feather-icons
description: The Feather Icons in Nuxt 3.
repo: 4sllan/nuxt-feather-icons
npm: nuxt-feather-icons
icon: nuxt-feather-icons.svg
icon: nuxt-feather-icons.png
github: https://github.com/4sllan/nuxt-feather-icons
website: https://github.com/4sllan/nuxt-feather-icons
learn_more: https://github.com/4sllan/nuxt-feather-icons
Expand Down
4 changes: 2 additions & 2 deletions modules/nuxt-localtunnel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ repo: nuxtus/localtunnel
npm: '@nuxtus/nuxt-localtunnel'
icon: nuxt-localtunnel.svg
github: https://github.com/nuxtus/localtunnel
website: https://nuxtus.com
learn_more: https://docs.nuxtus.com/#/localtunnel
website: https://docs.nuxtus.com
learn_more: https://docs.nuxtus.com/localtunnel.html
category: Devtools
type: 3rd-party
maintainers:
Expand Down
4 changes: 3 additions & 1 deletion modules/nuxt-mail.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: nuxt-mail
description: Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
description: >-
Adds email sending capability to a Nuxt.js app. Adds a server route, an
injected variable, and uses nodemailer to send emails.
repo: dword-design/nuxt-mail
npm: nuxt-mail
icon: ''
Expand Down
2 changes: 1 addition & 1 deletion modules/nuxt-openapi-docs-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nuxt-openapi-docs-module
description: Generate pages from OpenAPI specifications
repo: on-org/nuxt-openapi-docs-module
npm: nuxt-openapi-docs-module
icon: nuxt-openapi-docs-module.svg
icon: nuxt-openapi-docs-module.png
github: https://github.com/on-org/nuxt-openapi-docs-module
website: https://github.com/on-org/nuxt-openapi-docs-module
learn_more: https://www.npmjs.com/package/nuxt-openapi-docs-module
Expand Down
2 changes: 1 addition & 1 deletion modules/nuxt-storm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nuxt-storm
description: WebStorm & PHPStorm support for Nuxt components
repo: fumeapp/nuxt-storm
npm: nuxt-storm
icon: nuxt-storm.png
icon: ''
github: https://github.com/fumeapp/nuxt-storm
website: https://github.com/fumeapp/nuxt-storm
learn_more: https://github.com/fumeapp/nuxt-storm
Expand Down
8 changes: 4 additions & 4 deletions modules/optimized-images.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: optimized-images
description: >-
Automatically optimizes images used in Nuxt projects (jpeg, png, svg, webp
and gif).
Automatically optimizes images used in Nuxt projects (jpeg, png, svg, webp and
gif).
repo: juliomrqz/nuxt-optimized-images
npm: '@aceforth/nuxt-optimized-images'
icon: ''
github: https://github.com/juliomrqz/nuxt-optimized-images
website: https://marquez.co/docs/nuxt-optimized-images/
learn_more: ''
website: https://github.com/juliomrqz/nuxt-optimized-images
learn_more: https://github.com/juliomrqz/nuxt-optimized-images/tree/develop/docs
category: Images
type: 3rd-party
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion modules/robots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ npm: '@nuxtjs/robots'
icon: robots.png
github: https://github.com/nuxt-modules/robots
website: https://github.com/nuxt-modules/robots
learn_more: https://support.google.com/webmasters/answer/6062608?hl=en
learn_more: ''
category: SEO
type: community
maintainers:
Expand Down
3 changes: 1 addition & 2 deletions modules/segment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ npm: '@dansmaculotte/nuxt-segment'
icon: segment.png
github: https://github.com/dansmaculotte/nuxt-segment
website: https://github.com/dansmaculotte/nuxt-segment
learn_more: >-
https://segment.com/docs/connections/sources/catalog/Libraries/website/javascript/
learn_more: ''
category: Analytics
type: 3rd-party
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion modules/server-block.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: server-block
description: Use <server> tags in your Nuxt pages components.
repo: Hebilicious/server-block-nuxt/packages/server-block-nuxt#main
repo: Hebilicious/server-block-nuxt#main/packages/server-block-nuxt
npm: '@hebilicious/server-block-nuxt'
icon: server-block.svg
github: https://github.com/Hebilicious/server-block-nuxt
Expand Down
4 changes: 1 addition & 3 deletions modules/storage.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: storage
description: >-
Utilities to easily read and write to the browser's storage in a Nuxt
project
description: Utilities to easily read and write to the browser's storage in a Nuxt project
repo: mazipan/nuxt-storage
npm: nuxt-storage
icon: ''
Expand Down
4 changes: 2 additions & 2 deletions modules/storyblok.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: storyblok
description: Storyblok Nuxt module
repo: storyblok/storyblok-nuxt#master/lib
repo: storyblok/storyblok-nuxt#main
npm: '@storyblok/nuxt'
icon: storyblok.png
github: https://github.com/storyblok/storyblok-nuxt
Expand All @@ -13,5 +13,5 @@ maintainers:
github: storyblok
compatibility:
nuxt: ^2.0.0 || ^3.0.0
devtools: ^0.0.0
requires: {}
devtools: ^0.0.0
3 changes: 2 additions & 1 deletion modules/unlazy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: unlazy
description: Lazy loading library for placeholder images
repo: johannschopplich/unlazy/packages/nuxt
repo: johannschopplich/unlazy#main/packages/nuxt
npm: '@unlazy/nuxt'
icon: unlazy.svg
github: https://github.com/johannschopplich/unlazy/tree/main/packages/nuxt
Expand All @@ -13,3 +13,4 @@ maintainers:
github: johannschopplich
compatibility:
nuxt: ^3.0.0
requires: {}
2 changes: 1 addition & 1 deletion modules/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ npm: nuxt-validate
icon: vee-validate.png
github: https://github.com/lewyuburi/nuxt-validate
website: https://github.com/lewyuburi/nuxt-validate
learn_more: https://logaretm.github.io/vee-validate/
learn_more: ''
category: Libraries
type: 3rd-party
maintainers:
Expand Down
4 changes: 2 additions & 2 deletions modules/vue-final-modal.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'vue-final-modal'
name: vue-final-modal
description: The most powerful yet most light-weight modal library for Vue 3.
repo: vue-final/vue-final-modal
repo: vue-final/vue-final-modal#master/packages/nuxt
npm: '@vue-final-modal/nuxt'
icon: vue-final-modal.svg
github: https://github.com/vue-final/vue-final-modal
Expand Down
2 changes: 1 addition & 1 deletion modules/vue-query.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: vue-query
description: 0 config lightweight Nuxt module for @tanstack/vue-query.
repo: Hebilicious/vue-query-nuxt/packages/vue-query-nuxt#main
repo: Hebilicious/vue-query-nuxt#main/packages/vue-query-nuxt
npm: '@hebilicious/vue-query-nuxt'
icon: vue-query.svg
github: https://github.com/Hebilicious/vue-query-nuxt
Expand Down
6 changes: 4 additions & 2 deletions modules/vue3-carousel-nuxt.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: vue3-carousel-nuxt
description: >-
This module seamlessly integrates the Vue 3 Carousel module of ismail9k into Nuxt applications.
This module seamlessly integrates the Vue 3 Carousel module of ismail9k into
Nuxt applications.
repo: gaetansenn/vue3-carousel-nuxt
npm: 'vue3-carousel-nuxt'
npm: vue3-carousel-nuxt
icon: ''
github: https://github.com/gaetansenn/vue3-carousel-nuxt
website: https://github.com/gaetansenn/vue3-carousel-nuxt
learn_more: ''
category: UI
type: 3rd-party
Expand Down
5 changes: 3 additions & 2 deletions modules/vuefire.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: vuefire
description: Idiomatic composables for the Firebase SDK
repo: vuejs/vuefire/packages/nuxt
npm: 'nuxt-vuefire'
repo: vuejs/vuefire#main/packages/nuxt
npm: nuxt-vuefire
icon: vuefire.svg
github: https://github.com/vuejs/vuefire/tree/main/packages/nuxt
website: https://vuefire.vuejs.org/
Expand All @@ -13,3 +13,4 @@ maintainers:
github: posva
compatibility:
nuxt: ^3.0.0
requires: {}
2 changes: 1 addition & 1 deletion modules/vueform-builder.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: vueform-builder
description: Official Vueform Builder module for Nuxt
repo: vueform/builder/nuxt
repo: vueform/builder#main/nuxt
npm: '@vueform/builder-nuxt'
icon: vueform.svg
github: https://github.com/vueform/builder
Expand Down
2 changes: 1 addition & 1 deletion modules/vueform.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: vueform
description: Official Vueform module for Nuxt
repo: vueform/vueform/nuxt
repo: vueform/vueform#main/nuxt
npm: '@vueform/nuxt'
icon: vueform.svg
github: https://github.com/vueform/vueform
Expand Down
4 changes: 2 additions & 2 deletions modules/vuestic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ repo: epicmaxco/vuestic-ui#develop/packages/nuxt
npm: '@vuestic/nuxt'
icon: vuestic.png
github: https://github.com/epicmaxco/vuestic-ui/tree/develop/packages/nuxt
website: https://vuestic.dev
learn_more: https://vuestic.dev/en/getting-started/nuxt
website: https://ui.vuestic.dev
learn_more: https://ui.vuestic.dev/getting-started/nuxt
category: UI
type: 3rd-party
maintainers:
Expand Down
Loading