0.5.0 ā€¢ Published 2 years ago

@nsoft/vue-cli-plugin-nsoft v0.5.0

Weekly downloads
48
License
MIT
Repository
github
Last release
2 years ago

vue-cli-plugin-nsoft

NSoft General Vue CLI Plugin

:star: Features

  • Vue CLI Plugin to generate a project structure for your project.

Table of contents


Getting started

If you haven't yet installed vue-cli 3, first follow the install instructions here: https://github.com/vuejs/vue-cli

Generate a project :

vue create my-app

To install nsoft plugin:

cd my-app
vue add @nsoft/nsoft

Commands

  • npm run serve: Run app in development mode.
  • npm run build: Production ready build.
  • npm run lint: Lint the files using ESLint.
  • npm run test:coverage: Generate coverage with codecov.
  • npm run test:e2e: End-to-end tests with Nightwatch.
  • npm run test:unit Start the Jest Test Runner.
  • npm run test:unitUpdate:
  • npm run test:unitWatch: Watch changes and run unit test.

Source Structure

Folder structure:

  • api/: abstraction for external communication
  • assets/: module assets (processed by module bundler)
  • components/: all components that are not main view in flat structure
  • directives/: all directives in flat structure
  • filters/: all filters in flat structure
  • mixins/: all mixins in flat structure
  • plugins/: for plugins inclusion
  • utility/: helper functions in flat structure
  • pages/: component pages
  • layouts/: component template pages
  • store/: store stuff
  • router/: routing stuff
  • main.js: app entry file
  • App.vue: main app component

Router structure:

  • index.js: app routes
  • {pageRouter}.js: nested routes can be defined in separated file with appropriate name
  • navigatonGuards.js: definition of global guards

Store structure:

  • state.js: state tree
  • getters.js: all getters
  • mutations.js: all mutations
  • mutationTypes.js: keep all mutation types here
  • actions.js: all actions
  • plugins/: plugins in flat structure
  • modules/: keep modules with appropriate named folders with same structure of files
  • index.js: where we assemble modules and export the store

Note: public/ is outside of src/ folder, keep static assets that are directly copied there

Component styleguide: Follow vue official styleguide

Plugin options

  • Project name - name of your repository, written to package.json
  • Project description - description of your repository, written to package.json
  • Author - author of your repository, written to package.json

Additional plugins

Seven Gravity Gateway

In case Seven Gravity Gateway is accepted on project creation:

  • @nsoft/seven-gravity-gateway is added as NPM dependecy
  • two utilities are created under src/plugins/seven-gravity-gateway which are promise based wrappers around master/slave instances
Example
// Using slave
import GatewaySlave from '@/plugins/seven-gravity-gateway/slave';
const config = {
  slaveId: 'test',
  data: {
    dummyProp: 'dummyProp',
  },
  debug: true,
};
GatewaySlave.init(config).then(function() {
  // emit when slave is ready for interaction/futher message exchange
  GatewaySlave.api.emit({
    action: 'Slave.Loaded',
    data: {
      someData: 'data'
    }
  })
});

// using master
import GatewayMaster from '@/plugins/seven-gravity-gateway/master';
GatewayMaster.init({
  debug: false
});
GatewayMaster.addSlave({
  frameId: 'DummyFrame',
  slaveId: 'SlaveId',
}).then((message) => {
  // slave finished with loading and ready for interaction
});

Generated project structure

.
ā”œā”€ā”€ šŸ“‚ config
ā”‚Ā Ā  ā””ā”€ā”€ .env.js
ā”œā”€ā”€ šŸ“‚ public
ā”‚Ā Ā  ā”œā”€ā”€ favicon.ico
ā”‚Ā Ā  ā””ā”€ā”€ index.html
ā””ā”€ā”€ šŸ“‚ src
ā”‚Ā  Ā ā”œā”€ā”€ šŸ“‚ api
ā”‚   ā”‚Ā   ā”œā”€ā”€ šŸ“‚ interceptors
ā”‚   ā”‚Ā   ā”œā”€ā”€ http.js
ā”‚ Ā Ā ā”‚Ā Ā  ā””ā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ assets
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ components
ā”‚ Ā Ā ā”‚Ā Ā  ā”œā”€ā”€ SampleBox.vue
ā”‚   ā”‚   ā”œā”€ā”€ SampleBox.spec.js
ā”‚ Ā Ā ā”‚Ā Ā  ā””ā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ directives
ā”‚ Ā Ā ā”‚Ā Ā  ā””ā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ filters
ā”‚ Ā Ā ā”‚Ā Ā  ā””ā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ layouts
ā”‚ Ā Ā ā”‚Ā Ā  ā””ā”€ā”€ TemplateDefault.vue
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ mixins
ā”‚ Ā Ā ā”‚Ā Ā  ā””ā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ pages
ā”‚ Ā Ā ā”‚Ā Ā  ā”œā”€ā”€ Home.vue
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ plugins
ā”‚ Ā Ā ā”‚Ā Ā  ā”œā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ router
ā”‚ Ā Ā ā”‚   ā”œā”€ā”€ index.js
ā”‚ Ā Ā ā”‚   ā””ā”€ā”€ navigationGuards.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ store
ā”‚ Ā Ā ā”‚   ā”œā”€ā”€ šŸ“‚ modules
ā”‚ Ā Ā ā”‚   ā”œā”€ā”€ šŸ“‚ plugins
ā”‚   ā”‚   ā”œā”€ā”€ actions.js
ā”‚   ā”‚   ā”œā”€ā”€ getters.js
ā”‚   ā”‚   ā”œā”€ā”€ index.js
ā”‚   ā”‚   ā”œā”€ā”€ mutationTypes.js
ā”‚   ā”‚   ā”œā”€ā”€ mutations.js
ā”‚   ā”‚   ā”œā”€ā”€ state.js
ā”‚   ā”‚   ā””ā”€ā”€ storeConfig.js
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ utility
ā”‚   ā”‚   ā””ā”€ā”€ index.js
ā”‚ Ā Ā ā”œā”€ā”€ App.vue
ā”‚ Ā Ā ā”œā”€ā”€ main.js
ā”œā”€ā”€ šŸ“‚ tests
ā”‚ Ā Ā ā”œā”€ā”€ šŸ“‚ e2e
ā”‚ Ā Ā ā””ā”€ā”€ šŸ“‚ unit
ā”œā”€ā”€ .editorconfig
ā”œā”€ā”€ .eslintrc.js
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ CHANGELOG.md
ā”œā”€ā”€ README.md
ā”œā”€ā”€ babel.config.js
ā”œā”€ā”€ jest.config.js
ā”œā”€ā”€ package.json
ā”œā”€ā”€ postcss.config.js
ā””ā”€ā”€ vue.config.js

Testing

  • test files should be located next to file (xy.js and xy.spec.js)
0.5.0

2 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago