Skip to content

Commit

Permalink
Init 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
anteriovieira committed Feb 6, 2018
0 parents commit d041ee9
Show file tree
Hide file tree
Showing 15 changed files with 8,221 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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

# Coverage
- run:
name: Coverage
command: 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
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
env: {
jest: true
},
extends: [
'buefy'
],
plugins: [
'jest'
],
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
17 changes: 17 additions & 0 deletions .release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"non-interactive": true,
"increment": "minor",
"github": {
"release": true,
"releaseName": "🚀 Release %s",
"tokenRef": "GITHUB_TOKEN"
},
"npm": {
"publish": true
},
"src": {
"commitMessage": "🔖 %s",
"tagName": "v%s"
},
"changelogCommand": "git log --pretty=format:'* %s (%h)' [REV_RANGE]"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CHANGELOG
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Antério Vieira <anteriovieira@gmail.com>

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

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

## Install

```bash
npm i nux-buefy
# or
yarn add nuxt-buefy
```

## Usage

```js
{
modules: [
// Simple usage
'nuxt-buefy',

['nuxt-buefy', { /* buefy options */ }]
]
}
```

or

```js
{
modules: [
// Simple usage
'nuxt-buefy',
],
buefy: { /* buefy options */ }
}
```

## Development

- Clone this repository
- Install dependnecies using `yarn install` or `npm install`
- Start development server using `yarn run dev`

## License

[MIT License](./LICENSE)

Copyright (c) Rafael Beraldo
31 changes: 31 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { resolve } = require('path')

const defaults = {
css: true,
materialDesignIcons: true
}

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

// Add Material Design Icons font
if (options.materialDesignIcons !== false) {
this.options.head.link.push({
rel: 'stylesheet',
type: 'text/css',
href: '//cdn.materialdesignicons.com/2.0.46/css/materialdesignicons.min.css'
})
}

// Add css
if (options.css !== false) {
this.options.css.unshift('buefy/lib/buefy.css')
}

// Register plugin
this.addPlugin({
src: resolve(__dirname, 'templates/plugin.js'),
fileName: 'buefy.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 @@
import Vue from 'vue'
import Buefy from 'buefy'

Vue.use(Buefy, <%= JSON.stringify(options, null, 2) %>)
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "nuxt-buefy",
"version": "0.0.1",
"description": "Nuxt buefy",
"license": "MIT",
"contributors": [
{
"name": "Antério Vieira <anteriovieira@gmail.com>"
}
],
"main": "lib/module.js",
"repository": "https://github.com/buefy/nuxt-buefy",
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "nuxt test/fixture",
"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",
"collectCoverage": true
},
"dependencies": {
"buefy": "^0.6.3"
},
"devDependencies": {
"codecov": "latest",
"eslint": "latest",
"eslint-config-buefy": "^0.0.1",
"eslint-plugin-jest": "latest",
"jest": "latest",
"jsdom": "latest",
"nuxt": "latest",
"standard-version": "latest"
}
}
11 changes: 11 additions & 0 deletions test/fixture/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { resolve } = require('path')

module.exports = {
rootDir: resolve(__dirname, '../..'),
srcDir: __dirname,
dev: false,
render: {
resourceHints: false
},
modules: ['@@']
}
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>
<section>
<b-tag type="is-success">Works!</b-tag>
</section>
</template>

<script>
export default {
}
</script>
26 changes: 26 additions & 0 deletions test/module.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { Nuxt, Builder } = require('nuxt')
const request = require('request-promise-native')

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

const url = (path) => `http://localhost:3000${path}`
const get = (path) => request(url(path))

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

beforeAll(async () => {
nuxt = new Nuxt(config)
await new Builder(nuxt).build()
await nuxt.listen(3000)
}, 60000)

afterAll(async () => {
await nuxt.close()
})

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

0 comments on commit d041ee9

Please sign in to comment.