All posts

NPM modules

Billi way Repo: https://github.com/Camiloruiiz/handsome-button Blog Post: https://www.telerik.com/blogs/vuejs-how-to-build-your-first-package-publish-it-on-npm you will need to…

Software packages moving through a modular dependency system

Archive note: this guide was recovered from my former WordPress notebook. The original date is preserved; commands and links may be updated as I verify them.

Billi way

Repo: https://github.com/Camiloruiiz/handsome-button

Blog Post: https://www.telerik.com/blogs/vuejs-how-to-build-your-first-package-publish-it-on-npm

$ npm install -g @vue/cli
$ npm install -g @vue/cli-service-global
$ npm install --save-dev bili

# We'll need these two packages to transpile .vue files
# https://bili.egoist.moe/#/recipes/vue-component
$ npm install --save-dev rollup-plugin-vue
$ npm install --save-dev vue-template-compiler

you will need to pass and Install function like:

https://github.com/Camiloruiiz/handsome-button/blob/master/src/index.js

import NiceHandsomeButton from "./NiceHandsomeButton.vue";

export default {
 install(Vue, options) {
  // Let's register our component globally
  // https://vuejs.org/v2/guide/components-registration.html
  Vue.component("nice-handsome-button", NiceHandsomeButton);
 }
};

Babel way

Repo: https://github.com/casualcoders/responder

vue-cli way (vue plugins)

you will use a index.js like:

// Import vue component
import component from "./components/FormBuilder.vue";

// install function executed by Vue.use()
function install(Vue) {
  if (install.installed) return;
  install.installed = true;
  // Let's register our component globally
  // https://vuejs.org/v2/guide/components-registration.html
  Vue.component("FormBuilder", component);
}

// Create module definition for Vue.use()
const plugin = {
  install,
};

// To auto-install when vue is found on the global scope.
let GlobalVue = null;
if (typeof window !== "undefined") {
  GlobalVue = window.Vue;
} else if (typeof global !== "undefined") {
  GlobalVue = global.Vue;
}
if (GlobalVue) {
  GlobalVue.use(plugin);
}

export default plugin;

Repo: https://github.com/Camiloruiiz/form-builder