-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Init with
nuxt-community/module-template
- Loading branch information
0 parents
commit b176a15
Showing
18 changed files
with
312 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_size = 2 | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Common | ||
node_modules | ||
dist | ||
.nuxt | ||
coverage | ||
|
||
# Plugin | ||
lib/plugin.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
parser: 'babel-eslint', | ||
sourceType: 'module' | ||
}, | ||
extends: [ | ||
'@nuxtjs' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
node: [10, 12] | ||
|
||
steps: | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: checkout | ||
uses: actions/checkout@master | ||
|
||
- name: cache node_modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
- name: Coverage | ||
uses: codecov/codecov-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules | ||
*.iml | ||
.idea | ||
*.log* | ||
.nuxt | ||
.vscode | ||
.DS_Store | ||
coverage | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) William Chong <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# nuxt-gre-pixel-module | ||
|
||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
[![License][license-src]][license-href] | ||
|
||
> A nuxt module for integrating event pixel for Vertex AI Search for retail | ||
[📖 **Release Notes**](./CHANGELOG.md) | ||
|
||
## Setup | ||
|
||
1. Add `nuxt-gre-pixel-module` dependency to your project | ||
|
||
```bash | ||
yarn add nuxt-gre-pixel-module # or npm install nuxt-gre-pixel-module | ||
``` | ||
|
||
2. Add `nuxt-gre-pixel-module` to the `modules` section of `nuxt.config.js` | ||
|
||
```js | ||
{ | ||
modules: [ | ||
// Simple usage | ||
'nuxt-gre-pixel-module', | ||
|
||
// With options | ||
['nuxt-gre-pixel-module', { /* module options */ }] | ||
] | ||
} | ||
``` | ||
|
||
## Development | ||
|
||
1. Clone this repository | ||
2. Install dependencies using `yarn install` or `npm install` | ||
3. Start development server using `npm run dev` | ||
|
||
## License | ||
|
||
[MIT License](./LICENSE) | ||
|
||
Copyright (c) William Chong <[email protected]> | ||
|
||
<!-- Badges --> | ||
[npm-version-src]: https://img.shields.io/npm/v/nuxt-gre-pixel-module/latest.svg | ||
[npm-version-href]: https://npmjs.com/package/nuxt-gre-pixel-module | ||
|
||
[npm-downloads-src]: https://img.shields.io/npm/dt/nuxt-gre-pixel-module.svg | ||
[npm-downloads-href]: https://npmjs.com/package/nuxt-gre-pixel-module | ||
|
||
[github-actions-ci-src]: https://github.com/williamchong/nuxt-gre-pixel-module/workflows/ci/badge.svg | ||
[github-actions-ci-href]: https://github.com/williamchong/nuxt-gre-pixel-module/actions?query=workflow%3Aci | ||
|
||
[codecov-src]: https://img.shields.io/codecov/c/github/williamchong/nuxt-gre-pixel-module.svg | ||
[codecov-href]: https://codecov.io/gh/williamchong/nuxt-gre-pixel-module | ||
|
||
[license-src]: https://img.shields.io/npm/l/nuxt-gre-pixel-module.svg | ||
[license-href]: https://npmjs.com/package/nuxt-gre-pixel-module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', { | ||
targets: { | ||
esmodules: true | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
extends: [ | ||
'@commitlint/config-conventional' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { resolve } = require('path') | ||
|
||
module.exports = { | ||
rootDir: resolve(__dirname, '..'), | ||
buildDir: resolve(__dirname, '.nuxt'), | ||
srcDir: __dirname, | ||
modules: [ | ||
{ handler: require('../') } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div> | ||
Works! | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
hooks: { | ||
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS', | ||
'pre-commit': 'yarn lint', | ||
'pre-push': 'yarn lint' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
testEnvironment: 'node', | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'lib/**/*.js', | ||
'!lib/plugin.js' | ||
], | ||
moduleNameMapper: { | ||
'^~/(.*)$': '<rootDir>/lib/$1', | ||
'^~~$': '<rootDir>', | ||
'^@@$': '<rootDir>', | ||
'^@/(.*)$': '<rootDir>/lib/$1' | ||
}, | ||
transform: { | ||
'^.+\\.js$': 'babel-jest' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { resolve } = require('path') | ||
|
||
module.exports = async function (moduleOptions) { | ||
const options = { | ||
...this.options['nuxt-gre-pixel-module'], | ||
...moduleOptions | ||
} | ||
|
||
this.addPlugin({ | ||
src: resolve(__dirname, 'plugin.js'), | ||
fileName: 'nuxt-gre-pixel-module.js', | ||
options | ||
}) | ||
} | ||
|
||
module.exports.meta = require('../package.json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default async function ({ router, store }) { | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "nuxt-gre-pixel-module", | ||
"version": "0.0.0", | ||
"description": "A nuxt module for integrating event pixel for Vertex AI Search for retail", | ||
"repository": "williamchong/nuxt-gre-pixel-module", | ||
"license": "MIT", | ||
"contributors": [ | ||
{ | ||
"name": "William Chong <[email protected]>" | ||
} | ||
], | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "lib/module.js", | ||
"scripts": { | ||
"dev": "nuxt example", | ||
"lint": "eslint --ext .js,.vue .", | ||
"release": "yarn test && standard-version && git push --follow-tags && npm publish", | ||
"test": "yarn lint && jest" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/core": "latest", | ||
"@babel/preset-env": "latest", | ||
"@commitlint/cli": "latest", | ||
"@commitlint/config-conventional": "latest", | ||
"@nuxtjs/eslint-config": "latest", | ||
"@nuxtjs/module-test-utils": "latest", | ||
"babel-eslint": "latest", | ||
"babel-jest": "latest", | ||
"eslint": "latest", | ||
"husky": "latest", | ||
"jest": "latest", | ||
"nuxt-edge": "latest", | ||
"standard-version": "latest" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"@nuxtjs" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils') | ||
|
||
describe('module', () => { | ||
let nuxt | ||
|
||
beforeAll(async () => { | ||
({ nuxt } = (await setup(loadConfig(__dirname, '../../example')))) | ||
}, 60000) | ||
|
||
afterAll(async () => { | ||
await nuxt.close() | ||
}) | ||
|
||
test('render', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('Works!') | ||
}) | ||
}) |