├── template
├── .eslintrc.js
├── templates
│ └── plugin.js
├── .gitignore
├── test
│ ├── fixture
│ │ ├── pages
│ │ │ └── index.vue
│ │ └── nuxt.config.js
│ └── module.test.js
├── .editorconfig
├── src
│ └── index.js
├── .circleci
│ └── config.yml
├── LICENSE
├── package.json
└── README.md
├── package.json
├── .gitignore
├── meta.js
├── LICENSE
└── README.md
/template/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = require('nuxt-module-builder/eslint')
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-module-template-rollup",
3 | "version": "0.0.0"
4 | }
--------------------------------------------------------------------------------
/template/templates/plugin.js:
--------------------------------------------------------------------------------
1 | export default async function ({ router, store }) {
2 |
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/template/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.iml
3 | .idea
4 | *.log*
5 | .nuxt
6 | .vscode
7 | .DS_STORE
8 | coverage
9 | dist
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | template/yarn.lock
2 | node_modules
3 | *.iml
4 | .idea
5 | *.log*
6 | .nuxt
7 | .vscode
8 | .DS_STORE
9 | coverage
10 | dist
--------------------------------------------------------------------------------
/template/test/fixture/pages/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | Works!
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/template/test/fixture/nuxt.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | srcDir: __dirname,
3 | dev: false,
4 | render: {
5 | resourceHints: false
6 | },
7 | modules: [
8 | ['~/../..', {}]
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/template/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_size = 2
6 | indent_style = space
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/template/src/index.js:
--------------------------------------------------------------------------------
1 | // const { resolve } = require('path')
2 |
3 | export default async function module (moduleOptions) {
4 | // const options = Object.assign({}, moduleOptions)
5 |
6 | // this.addPlugin({
7 | // src: resolve(__dirname, '../templates/plugin.js'),
8 | // options
9 | // })
10 | }
11 |
--------------------------------------------------------------------------------
/meta.js:
--------------------------------------------------------------------------------
1 |
2 | module.exports = {
3 | helpers: {
4 | raw: options => options.fn(this)
5 | },
6 | skipInterpolation: [
7 | "**/*.vue",
8 | ".circleci/*.*"
9 | ],
10 | prompts: {
11 | name: {
12 | 'type': 'string',
13 | 'required': true,
14 | 'message': 'NPM package name'
15 | },
16 | description: {
17 | 'type': 'string',
18 | 'message': 'Module description',
19 | },
20 | github: {
21 | 'type': 'string',
22 | 'message': 'Github repository (user/repo)'
23 | },
24 | author: {
25 | 'type': 'string',
26 | 'message': 'Author'
27 | },
28 | },
29 | completeMessage: '{{#inPlace}}To get started:\n\n npm install # Or yarn\n npm run watch{{else}}To get started:\n\n cd {{destDirName}}\n npm install # Or yarn\n npm run watch{{/inPlace}}'
30 | };
--------------------------------------------------------------------------------
/template/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | jobs:
3 | build:
4 | working_directory: /usr/src/app
5 | docker:
6 | - image: banian/node
7 | steps:
8 | # Checkout repository
9 | - checkout
10 |
11 | # Restore cache
12 | - restore_cache:
13 | key: yarn-{{ checksum "yarn.lock" }}
14 |
15 | # Install dependencies
16 | - run:
17 | name: Install Dependencies
18 | command: NODE_ENV=dev yarn
19 |
20 | # Keep cache
21 | - save_cache:
22 | key: yarn-{{ checksum "yarn.lock" }}
23 | paths:
24 | - "node_modules"
25 |
26 | # Build
27 | # - run:
28 | # name: Build
29 | # command: |
30 | # mkdir -p dist
31 | # yarn build
32 |
33 | # Test
34 | - run:
35 | name: Tests
36 | command: yarn test && yarn codecov
--------------------------------------------------------------------------------
/template/test/module.test.js:
--------------------------------------------------------------------------------
1 | jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000
2 | process.env.PORT = process.env.PORT || 5060
3 | process.env.NODE_ENV = 'production'
4 |
5 | const { Nuxt, Builder } = require('nuxt')
6 | const request = require('request-promise-native')
7 |
8 | const config = require('./fixture/nuxt.config')
9 |
10 | const url = path => `http://localhost:${process.env.PORT}${path}`
11 | const get = path => request(url(path))
12 |
13 | describe('Module', () => {
14 | let nuxt
15 |
16 | beforeAll(async () => {
17 | config.modules.unshift(function () {
18 | // Add test specific test only hooks on nuxt life cycle
19 | })
20 |
21 | // Build a fresh nuxt
22 | nuxt = new Nuxt(config)
23 | await new Builder(nuxt).build()
24 | await nuxt.listen(process.env.PORT)
25 | })
26 |
27 | afterAll(async () => {
28 | // Close all opened resources
29 | await nuxt.close()
30 | })
31 |
32 | test('render', async () => {
33 | let html = await get('/')
34 | expect(html).toContain('Works!')
35 | })
36 | })
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Nuxt Community
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/template/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) {{ author }}
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/template/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "{{ name }}",
3 | "version": "0.0.0",
4 | "description": "{{ description }}",
5 | "license": "MIT",
6 | "contributors": [
7 | {
8 | "name": "{{ author }}"
9 | }
10 | ],
11 | "main": "dist/index.js",
12 | "repository": "https://github.com/{{ github }}",
13 | "publishConfig": {
14 | "access": "public"
15 | },
16 | "scripts": {
17 | "build": "nuxt-module",
18 | "watch": "nuxt-module --watch",
19 | "lint": "eslint lib src test",
20 | "lint-fix": "eslint --fix lib src test",
21 | "test": "NODE_ENV=test npm run build && npm run lint && jest",
22 | "release": "standard-version && git push --follow-tags && npm publish",
23 | "prepare": "npm run build"
24 | },
25 | "eslintIgnore": [
26 | "*.template.*"
27 | ],
28 | "files": [
29 | "lib",
30 | "src",
31 | "dist",
32 | "templates"
33 | ],
34 | "jest": {
35 | "testEnvironment": "node",
36 | "coverageDirectory": "./coverage/",
37 | "collectCoverage": true,
38 | "collectCoverageFrom": [
39 | "lib",
40 | "src"
41 | ]
42 | },
43 | "dependencies": {
44 |
45 | },
46 | "devDependencies": {
47 | "nuxt-module-builder": "latest"
48 | }
49 | }
--------------------------------------------------------------------------------
/template/README.md:
--------------------------------------------------------------------------------
1 | # {{ name }}
2 | [](https://npmjs.com/package/{{ name }})
3 | [](https://npmjs.com/package/{{ name }})
4 | [](https://circleci.com/gh/{{ github }})
5 | [](https://codecov.io/gh/{{ github }})
6 | [](https://david-dm.org/{{ github }})
7 |
8 |
9 | [](http://standardjs.com)
10 |
11 | > {{ description }}
12 |
13 | [📖 **Release Notes**](./CHANGELOG.md)
14 |
15 | ## Features
16 |
17 | The module features
18 |
19 | ## Setup
20 | - Add `{{ name }}` dependency using yarn or npm to your project
21 | - Add `{{ name }}` to `modules` section of `nuxt.config.js`
22 |
23 | ```js
24 | {
25 | modules: [
26 | // Simple usage
27 | '{{ name }}',
28 |
29 | // With options
30 | ['{{ name }}', { /* module options */ }],
31 | ]
32 | }
33 | ```
34 |
35 | ## Usage
36 |
37 | Module Description
38 |
39 | ## License
40 |
41 | [MIT License](./LICENSE)
42 |
43 | Copyright (c) {{ author }}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Module Template for Nuxt.js With Rollup
2 |
3 | > Starter template for Nuxt.js Modules
4 |
5 | If you don't need rollup transpiling it is recommended using simpler variant [module-template](https://github.com/nuxt-community/module-template).
6 |
7 | ## Features
8 |
9 | - Using [Nuxt Module Builder](https://github.com/nuxt/module-builder), You can use latest ECMAScript features, including **async/await**
10 | - ESLint
11 | - Ready tests using [Jest](https://facebook.github.io/jest)
12 | - Code coverage
13 | - Circle CI
14 | - Standard Version
15 |
16 | ## Create a Nuxt Module
17 |
18 | This is a template for [vue-cli](https://github.com/vuejs/vue-cli).
19 | Make sure to use a version of vue-cli >= 2.1 (vue -V) is installed.
20 | If you don't already have it, just install it.
21 |
22 | ```bash
23 | vue init nuxt-community/module-template-rollup
24 | cd
25 | yarn install # or npm install
26 | ```
27 |
28 | ## Development
29 | For easier development you can use [yarn link](https://yarnpkg.com/lang/en/docs/cli/link/) or [npm link](https://docs.npmjs.com/cli/link)
30 | to link to your project. Then start build using `npm run dev`. To version & publish module:
31 |
32 | ```bash
33 | npm run release
34 | ```
35 |
36 | ## Licenses
37 |
38 | - [NuxtJS license](https://github.com/nuxt/nuxt.js/blob/master/LICENSE.md)
39 | - [VueJS license](https://github.com/vuejs/vue/blob/master/LICENSE)
--------------------------------------------------------------------------------