Skip to content

Commit

Permalink
Init project with default template
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDASILVA committed Nov 6, 2017
1 parent 7ac3e06 commit bedcd7d
Show file tree
Hide file tree
Showing 12 changed files with 237 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2
jobs:
build:
working_directory: /usr/src/app
docker:
- image: banian/node
steps:
# Checkout repository
- checkout

# Restore cache
- restore_cache:
key: yarn-{{ checksum "yarn.lock" }}

# Install dependencies
- run:
name: Install Dependencies
command: NODE_ENV=dev yarn

# Keep cache
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- "node_modules"

# Test
- run:
name: Tests
command: yarn test && yarn codecov
13 changes: 13 additions & 0 deletions .editorconfig
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
30 changes: 30 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
root: true,
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true,
jest: true
},
extends: 'standard',
plugins: [
'jest',
'vue'
],
rules: {
// Allow paren-less arrow functions
'arrow-parens': 0,
// Allow async-await
'generator-star-spacing': 0,
// Allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// Do not allow console.logs etc...
'no-console': 2
},
globals: {
'jest/globals': true,
jasmine: true
}
}
9 changes: 9 additions & 0 deletions .gitignore
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 William DA SILVA
Copyright (c) WilliamDASILVA <[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
Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# nuxt-facebook-pixel-module
[![npm (scoped with tag)](https://img.shields.io/npm/v/nuxt-facebook-pixel-module/latest.svg?style=flat-square)](https://npmjs.com/package/nuxt-facebook-pixel-module)
[![npm](https://img.shields.io/npm/dt/nuxt-facebook-pixel-module.svg?style=flat-square)](https://npmjs.com/package/nuxt-facebook-pixel-module)
[![CircleCI](https://img.shields.io/circleci/project/github/.svg?style=flat-square)](https://circleci.com/gh/)
[![Codecov](https://img.shields.io/codecov/c/github/.svg?style=flat-square)](https://codecov.io/gh/)
[![Dependencies](https://david-dm.org//status.svg?style=flat-square)](https://david-dm.org/)
[![js-standard-style](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com)

>
[📖 **Release Notes**](./CHANGELOG.md)

## Features

The module features

## Setup
- Add `nuxt-facebook-pixel-module` dependency using yarn or npm to your project
- Add `nuxt-facebook-pixel-module` to `modules` section of `nuxt.config.js`

```js
{
modules: [
// Simple usage
'nuxt-facebook-pixel-module',

// With options
['nuxt-facebook-pixel-module', { /* module options */ }],
]
}
```

## Usage

Module Description

## License

[MIT License](./LICENSE)

Copyright (c) WilliamDASILVA <[email protected]>
11 changes: 11 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// const { resolve } = require('path')

module.exports = async function module (moduleOptions) {
// const options = Object.assign({}, moduleOptions)

// this.addPlugin({
// src: resolve(__dirname, '../templates/plugin.js'),
// fileName: 'nuxt-facebook-pixel-module.js',
// options
// })
}
4 changes: 4 additions & 0 deletions lib/templates/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default async function ({ router, store }) {


}
42 changes: 42 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "nuxt-facebook-pixel-module",
"version": "0.0.0",
"description": "",
"license": "MIT",
"contributors": [
{
"name": "WilliamDASILVA <[email protected]>"
}
],
"main": "lib/module.js",
"repository": "https://github.com/",
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint lib test",
"test": "npm run lint && jest",
"release": "standard-version && git push --follow-tags && npm publish"
},
"eslintIgnore": [
"lib/templates/*.*"
],
"files": [
"lib"
],
"jest": {
"testEnvironment": "node",
"coverageDirectory": "./coverage/",
"collectCoverage": true,
"collectCoverageFrom": [
"lib",
"test"
]
},
"dependencies": {

},
"devDependencies": {
"nuxt-module-builder": "latest"
}
}
10 changes: 10 additions & 0 deletions test/fixture/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
srcDir: __dirname,
dev: false,
render: {
resourceHints: false
},
modules: [
['@@', { /* Module options */ }]
]
}
11 changes: 11 additions & 0 deletions test/fixture/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div>
Works!
</div>
</template>

<script>
export default {
}
</script>
36 changes: 36 additions & 0 deletions test/module.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000
process.env.PORT = process.env.PORT || 5060
process.env.NODE_ENV = 'production'

const { Nuxt, Builder } = require('nuxt')
const request = require('request-promise-native')

const config = require('./fixture/nuxt.config')

const url = path => `http://localhost:${process.env.PORT}${path}`
const get = path => request(url(path))

describe('Module', () => {
let nuxt

beforeAll(async () => {
config.modules.unshift(function () {
// Add test specific test only hooks on nuxt life cycle
})

// Build a fresh nuxt
nuxt = new Nuxt(config)
await new Builder(nuxt).build()
await nuxt.listen(process.env.PORT)
})

afterAll(async () => {
// Close all opened resources
await nuxt.close()
})

test('render', async () => {
let html = await get('/')
expect(html).toContain('Works!')
})
})

0 comments on commit bedcd7d

Please sign in to comment.