npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poc-cms

v0.8.0

Published

Proof of concept for CMS

Downloads

7

Readme

CircleCI

POC CMS Vue JS

Proof of concept of CMS with Vue JS

Installation

OS X & Linux:

# install dependencies
yarn install

# serve with hot reload at localhost:8080
yarn run dev

# build for production with minification
yarn run build

# build for production and view the bundle analyzer report
yarn run build --report

# run unit tests
yarn run unit

# run e2e tests
yarn run e2e

# run all tests
yarn test

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Check the CONTRIBUTING.md file to see the development rules.

Development

Application Structure

├── main.js
├── api                   # abstractions for making API requests
│   └── ...
├── assets                # files required inside JS
│   └── ...
├── components
│   ├── App.vue
│   └── ...
├── router                # router configurations
│   └── ...
├── store                 # store base and modules
│   ├── index.js          # where we assemble modules and export the store
│   ├── actions.js        # root actions
│   ├── mutations.js      # root mutations
│   └── modules
│       ├── module1.js    # module1 module
│       └── module2.js    # module2 module
└── templates
    ├── layout.pug        # general wrapper fot all HTMLs
    ├── index.pug         # entry point, using the layout.pug
    └── includes
        ├── head          # HTML head code
        └── ...           # other files to be included in pages and layout

Vuex

Use Vuex for data that A) comes from the API, and/or B) needs to be accessed by the entire application.

Stores:

Whenever you can, normalize data that comes in array form unless the order is important (such as when you're getting the top 20 most recent pages from your API.) Even if the data has come back from the API as an array of objects, AND your view needs to display it as an array mapped over with a v-for directive, you should consider storing it in the store as an object of objects, by some identifying key, and then just denormalizing the data back again inside the getter.

Bad:

const initialState = {
  partnersList: [], // array of all partners
  currentPartner: {}, // current partner object.
};

Good:

const initialState = {
  partnersList: {}, // object with all partners keyed by ID
  currentPartnerId: ``, // a string contining the ID of the current partner.
};

Getters:

  • Getters should not mutate data. (indeed, the purpose of a getter is to provide a "safer" way to access the vuex store values). They should only return the data you need.
  • Getters are great for taking the data from the store then formatting it the way you need it before handing it off to the Vue component. This keeps transformation logic outside of the presentational Vue component. You can also use this pattern to create different transforms on the same data without mutating that data.

Actions:

  • Wrap the action in a promise, so the componnet can respont to any compelx logic that exists inside the store action (like an API call)

Bad:

updateUrl ({ commit }, url) {
  PagesApi
    .getPageContent(url)
    .then((content) => {
      commit(types.PAGE_UPDATE_CONTENT, { content })
      commit(types.PAGE_UPDATE_URL, { url })
      resolve()
    })
  },

Good:

updateUrl ({ commit }, url) {
  return new Promise((resolve) => {
    PagesApi
      .getPageContent(url)
      .then((content) => {
        commit(types.PAGE_UPDATE_CONTENT, { content })
        commit(types.PAGE_UPDATE_URL, { url })
        resolve()
      })
  })
},

// and inside the component:

this.$store.dispatch('updateUrl', url).then(() => { ... })

Mutations:

Mutations is an object with different methods that take the Observable state as the first parameter. It is here, and ONLY here that any part of the state should be changed.

History

Check the CHANGELOG.md file to see the development rules.

Credits

Luiz Tanure – @tanure[email protected]

License

References

Deverus Vue.js Style Guide