nuxt-swell's Introduction
nuxt-swell's People
nuxt-swell's Issues
Nicely done! Some recommendations to consider :)
First of all, big kudos for developing your very first module!
I really enjoy looking at it and I think it has a potential to help developers built better storefronts.
Below, I listed some recommendations that you may add to your module that can make it a bit better ;)
- Composables should start with
useSomething
. I am a big fan of simple composables that do one thing only so they are easier to test and maintain. useSwell work really well, but for product and products fetch I think it would require some refactor. In my algolia module I am using the nameuseAlgoliaSearch
where I destructure it in a way like thisconst { result, search } = useAlgoliaSearch('index_name')
. It allows the user to define when he would like to fetch the data (for example, maybe he would like to fetch it on onMounted hook instead of useAsyncData. But you can also keep it as a composable that will just fetch the results and name it for example:useSwellProducts
oruseSwellProduct
. In here, you could do something similar to what Storyblok did in their composable (trigger either useAsyncData or onMounted inside based on condition). I think it will be easier then to distinguish composables from your module inside a nuxt application. - Pass options apart from the mandatory key and id. In your configuration, I can see that you have this useCamelCase. I would recommend to add it to the
options
object inside configuration. Thanks to that, when you develop more configuration options that are not mandatory for the users to set, you will just populate the options object instead of the main configuration.
swell: {
storeId: "YOUR_STORE_ID",
apiKey: "YOUR_PUBLIC_ACCESS_TOKEN",
options?: {
useCamelCase: true //Default is true change it to false to switch to snake_case responses,
someOtherOption in the future
}
}
- Full module options type. I would recommend to keep your module configuration type up to date with the actual configuration. Nuxt 3 has a great TS support so it would be great to have a typing support for all configuration and separate composables :)
Optional (later):
- Write Docus docs for the module with examples of usage.
- Write content about your module (even a simple dev.to article)
- Create a simple storefront app with this module implemented.
And that basically it! This module serves its purpose even now, so by adding these recommendations I think you will make it even better. With time, I would add more composable to fetch certain data (like category, user, checkout, etc) so that users will have less steps to do in order to build their storefronts.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.