Skip to content

Commit 590b104

Browse files
committed
feat: add module for guess
0 parents  commit 590b104

File tree

15 files changed

+10179
-0
lines changed

15 files changed

+10179
-0
lines changed

.circleci/config.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
# Test
27+
- run:
28+
name: Tests
29+
command: yarn test
30+
31+
# Coverage
32+
- run:
33+
name: Coverage
34+
command: yarn codecov

.eslintrc.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root: true
2+
parserOptions:
3+
parser: babel-eslint
4+
env:
5+
browser: true
6+
node: true
7+
jest: true
8+
extends:
9+
- standard
10+
- plugin:vue/recommended
11+
plugins:
12+
- jest
13+
- vue
14+
rules:
15+
arrow-parens: 0
16+
generator-star-spacing: 0
17+
no-console: 2
18+
globals:
19+
jest/globals: true
20+
jasmine: true

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
*.iml
3+
.idea
4+
*.log*
5+
.nuxt
6+
.vscode
7+
.DS_Store
8+
coverage
9+
dist

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Clark Du <[email protected]>
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.

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# guess-module
2+
3+
[![David-DM][david-dm-src]][david-dm-href]
4+
[![Standard JS][standard-js-src]][standard-js-href]
5+
[![Circle CI][circle-ci-src]][circle-ci-href]
6+
[![Codecov][codecov-src]][codecov-href]
7+
[![npm version][npm-version-src]][npm-version-href]
8+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
9+
10+
> Guess.js module for Nuxt.js
11+
12+
[📖 **Release Notes**](./CHANGELOG.md)
13+
14+
TODO:
15+
16+
* Vue.js support in guess-parser [Tracked Issue](https://github.com/guess-js/guess/issues/43)
17+
18+
## Setup
19+
20+
- Add `guess-module` dependency using yarn or npm to your project
21+
- Add `guess-module` to `modules` section of `nuxt.config.js`
22+
- Config 'options' as `options` of [guess-webpack][guess-webpack-href]
23+
- Note: the default `reportProvider` when there is no `GA` and `reportProvider` specifed is the content of `router.json` under [`rootDir`][nuxt-rootDir-href] or [`srcDir`][nuxt-srcDir-href]
24+
25+
```js
26+
{
27+
modules: [
28+
// Simple usage
29+
'guess-module',
30+
31+
// With options
32+
['guess-module', {
33+
GA: 'XXXXXX'
34+
}],
35+
]
36+
}
37+
```
38+
39+
## Development
40+
41+
- Clone this repository
42+
- Install dependencies using `yarn install` or `npm install`
43+
- Start development server using `npm run dev`
44+
45+
## Credits
46+
47+
This module is inspired by [guest-nuxt][circle-ci-href] by @daliborgogic.
48+
49+
## License
50+
51+
[MIT License](./LICENSE)
52+
53+
Copyright (c) Clark Du <[email protected]>
54+
55+
<!-- Badges -->
56+
[david-dm-src]: https://david-dm.org/https://github.com/nuxt-community/guess-module/status.svg?style=flat-square
57+
[david-dm-href]: https://david-dm.org/https://github.com/nuxt-community/guess-module
58+
[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square
59+
[standard-js-href]: https://standardjs.com
60+
[circle-ci-src]: https://img.shields.io/circleci/project/github/https://github.com/nuxt-community/guess-module.svg?style=flat-square
61+
[circle-ci-href]: https://circleci.com/gh/https://github.com/nuxt-community/guess-module
62+
[codecov-src]: https://img.shields.io/codecov/c/github/https://github.com/nuxt-community/guess-module.svg?style=flat-square
63+
[codecov-href]: https://codecov.io/gh/https://github.com/nuxt-community/guess-module
64+
[npm-version-src]: https://img.shields.io/npm/dt/guess-module.svg?style=flat-square
65+
[npm-version-href]: https://npmjs.com/package/guess-module
66+
[npm-downloads-src]: https://img.shields.io/npm/v/guess-module/latest.svg?style=flat-square
67+
[npm-downloads-href]: https://npmjs.com/package/guess-module
68+
[guess-nuxt-href]: https://github.com/daliborgogic/guess-nuxt
69+
[guess-webpack-href]: https://github.com/guess-js/guess/tree/master/packages/guess-webpack/#basic-usage
70+
[nuxt-rootDir-href]: https://nuxtjs.org/api/configuration-rootdir
71+
[nuxt-srcDir-href]: https://nuxtjs.org/api/configuration-srcdir

example/nuxt.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { resolve } = require('path')
2+
3+
module.exports = {
4+
rootDir: resolve(__dirname, '..'),
5+
buildDIr: resolve(__dirname, '.nuxt'),
6+
srcDir: __dirname,
7+
modules: [
8+
'@@'
9+
]
10+
}

example/pages/about.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<div>
3+
<h1>🚀This is about page</h1>
4+
<h2><nuxt-link to="/">Home page</nuxt-link></h2>
5+
<h2><nuxt-link to="/help">Help page</nuxt-link></h2>
6+
</div>
7+
</template>

example/pages/help.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<div>
3+
<h1>💡This is help page</h1>
4+
<h2><nuxt-link to="/">Home page</nuxt-link></h2>
5+
<h2><nuxt-link to="/about">About page</nuxt-link></h2>
6+
</div>
7+
</template>

example/pages/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<div>
3+
<h1>🏠This is home page</h1>
4+
<h2><nuxt-link to="/help">Help page</nuxt-link></h2>
5+
<h2><nuxt-link to="/about">About page</nuxt-link></h2>
6+
</div>
7+
</template>

example/routes.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"/": {
3+
"/help": 80,
4+
"/about": 20
5+
},
6+
"/help": {
7+
"/": 20,
8+
"/about": 80
9+
},
10+
"/about": {
11+
"/": 80,
12+
"/help": 20
13+
}
14+
}

0 commit comments

Comments
 (0)