-
-
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.
Merge pull request #9 from doug-wade/generator-clefs-plugin
Add yeoman generator and boilerplate as clefs-googledrive
- Loading branch information
Showing
28 changed files
with
469 additions
and
4 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,3 @@ | ||
{ | ||
"presets": ["es2015", "stage-0"] | ||
} |
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,3 @@ | ||
npm-debug.log* | ||
node_modules | ||
/index.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 @@ | ||
src |
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 @@ | ||
# clefs-googledrive | ||
|
||
A [clefs](https://npmjs.com/package/clefs) layer. | ||
|
||
 | ||
|
||
# Getting started | ||
|
||
## Installing | ||
|
||
npm i -S clefs clefs-googledrive | ||
|
||
|
||
## Usage | ||
|
||
import clefs from 'clefs'; | ||
import googledrive from 'clefs-googledrive'; | ||
|
||
const fs = clefs([simpleobject]); | ||
const fileContents = await fs.readFile('/path/to/file.txt'); | ||
console.log(fileContents); |
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,36 @@ | ||
{ | ||
"name": "clefs-googledrive", | ||
"version": "0.0.4", | ||
"description": "An fs layer backed by googledrive", | ||
"main": "index.js", | ||
"scripts": { | ||
"clean": "del-cli npm-debug.log* index.js", | ||
"test": "xo src/index.js && snyk test", | ||
"compile": "babel src/index.js --presets es2015,stage-0 -o index.js", | ||
"prepublish": "npm run clean && npm run compile", | ||
"nuke": "del-cli node_modules" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/doug-wade/clefs.git" | ||
}, | ||
"keywords": [ | ||
"fs", | ||
"isomorphic", | ||
"layers" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/doug-wade/clefs/issues" | ||
}, | ||
"homepage": "https://github.com/doug-wade/clefs#readme", | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"babel-cli": "^6.9.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"del-cli": "^0.2.0", | ||
"snyk": "^1.14.3", | ||
"xo": "^0.15.1" | ||
} | ||
} |
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,20 @@ | ||
const fs = {}; | ||
|
||
module.exports = { | ||
writeFile(file, data) { | ||
return new Promise((resolve) => { | ||
fs[file] = data; | ||
resolve(); | ||
}); | ||
}, | ||
readFile(file) { | ||
return new Promise((resolve, reject) => { | ||
if (fs[file]) { | ||
resolve(fs[file]); | ||
} else { | ||
reject(new Error(`file not found ${file}`)); | ||
} | ||
}); | ||
}, | ||
name: 'googledrive' | ||
}; |
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
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,2 @@ | ||
node_modules | ||
coverage |
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 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Doug Wade <[email protected]> (dougwade.io) | ||
|
||
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,38 @@ | ||
# generator-clefs-plugin [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] | ||
> Generate a new clefs plugin | ||
|
||
## Installation | ||
|
||
First, install [Yeoman](http://yeoman.io) and generator-clefs-plugin using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). | ||
|
||
```bash | ||
npm install -g yo | ||
npm install -g generator-clefs-plugin | ||
``` | ||
|
||
Then generate your new project: | ||
|
||
```bash | ||
yo clefs-plugin | ||
``` | ||
|
||
## Getting To Know Yeoman | ||
|
||
* Yeoman has a heart of gold. | ||
* Yeoman is a person with feelings and opinions, but is very easy to work with. | ||
* Yeoman can be too opinionated at times but is easily convinced not to be. | ||
* Feel free to [learn more about Yeoman](http://yeoman.io/). | ||
|
||
## License | ||
|
||
MIT © [Doug Wade](dougwade.io) | ||
|
||
|
||
[npm-image]: https://badge.fury.io/js/generator-clefs-plugin.svg | ||
[npm-url]: https://npmjs.org/package/generator-clefs-plugin | ||
[travis-image]: https://travis-ci.org/doug-wade/generator-clefs-plugin.svg?branch=master | ||
[travis-url]: https://travis-ci.org/doug-wade/generator-clefs-plugin | ||
[daviddm-image]: https://david-dm.org/doug-wade/generator-clefs-plugin.svg?theme=shields.io | ||
[daviddm-url]: https://david-dm.org/doug-wade/generator-clefs-plugin | ||
[coveralls-image]: https://coveralls.io/repos/doug-wade/generator-clefs-plugin/badge.svg | ||
[coveralls-url]: https://coveralls.io/r/doug-wade/generator-clefs-plugin |
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,53 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const yeoman = require('yeoman-generator'); | ||
const chalk = require('chalk'); | ||
const yosay = require('yosay'); | ||
|
||
module.exports = yeoman.Base.extend({ | ||
prompting: function () { | ||
let _this = this; | ||
_this.log(yosay( | ||
'Welcome to the shining ' + chalk.green('clefs plugin') + ' generator!' | ||
)); | ||
|
||
let prompts = [{ | ||
type: 'input', | ||
name: 'name', | ||
message: 'What would you like to call your plugin?', | ||
default: this.appname | ||
}]; | ||
|
||
return _this.prompt(prompts).then((props) => { | ||
if (props.name.startsWith('clefs-')) { | ||
props.name = props.name.replace('clefs-', ''); | ||
} | ||
_this.props = props; | ||
}); | ||
}, | ||
|
||
writing: function () { | ||
let _this = this; | ||
|
||
let files = [ | ||
'src/index.js', | ||
'.babelrc', | ||
'.gitignore', | ||
'.npmignore', | ||
'package.json', | ||
'README.md' | ||
]; | ||
|
||
files.forEach((filename) => { | ||
_this.fs.copyTpl( | ||
_this.templatePath(filename), | ||
_this.destinationPath(path.join('packages', 'clefs-' + _this.props.name, filename)), | ||
_this.props | ||
); | ||
}); | ||
}, | ||
|
||
install: function () { | ||
this.npmInstall(); | ||
} | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/generator-clefs-plugin/generators/app/templates/.babelrc
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,3 @@ | ||
{ | ||
"presets": ["es2015", "stage-0"] | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/generator-clefs-plugin/generators/app/templates/.gitignore
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,3 @@ | ||
npm-debug.log* | ||
node_modules | ||
/index.js |
1 change: 1 addition & 0 deletions
1
packages/generator-clefs-plugin/generators/app/templates/.npmignore
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 @@ | ||
src |
21 changes: 21 additions & 0 deletions
21
packages/generator-clefs-plugin/generators/app/templates/README.md
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 @@ | ||
# clefs-<%= name %> | ||
|
||
A [clefs](https://npmjs.com/package/clefs) layer. | ||
|
||
 | ||
|
||
# Getting started | ||
|
||
## Installing | ||
|
||
npm i -S clefs clefs-<%= name %> | ||
|
||
|
||
## Usage | ||
|
||
import clefs from 'clefs'; | ||
import <%= name %> from 'clefs-<%= name %>'; | ||
|
||
const fs = clefs([simpleobject]); | ||
const fileContents = await fs.readFile('/path/to/file.txt'); | ||
console.log(fileContents); |
36 changes: 36 additions & 0 deletions
36
packages/generator-clefs-plugin/generators/app/templates/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,36 @@ | ||
{ | ||
"name": "clefs-<%= name %>", | ||
"version": "0.0.4", | ||
"description": "An fs layer backed by <%= name %>", | ||
"main": "index.js", | ||
"scripts": { | ||
"clean": "del-cli npm-debug.log* index.js", | ||
"test": "xo src/index.js && snyk test", | ||
"compile": "babel src/index.js --presets es2015,stage-0 -o index.js", | ||
"prepublish": "npm run clean && npm run compile", | ||
"nuke": "del-cli node_modules" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/doug-wade/clefs.git" | ||
}, | ||
"keywords": [ | ||
"fs", | ||
"isomorphic", | ||
"layers" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/doug-wade/clefs/issues" | ||
}, | ||
"homepage": "https://github.com/doug-wade/clefs#readme", | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"babel-cli": "^6.9.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"del-cli": "^0.2.0", | ||
"snyk": "^1.14.3", | ||
"xo": "^0.15.1" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/generator-clefs-plugin/generators/app/templates/src/index.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,20 @@ | ||
const fs = {}; | ||
|
||
module.exports = { | ||
writeFile(file, data) { | ||
return new Promise((resolve) => { | ||
fs[file] = data; | ||
resolve(); | ||
}); | ||
}, | ||
readFile(file) { | ||
return new Promise((resolve, reject) => { | ||
if (fs[file]) { | ||
resolve(fs[file]); | ||
} else { | ||
reject(new Error(`file not found ${file}`)); | ||
} | ||
}); | ||
}, | ||
name: '<%= name %>' | ||
}; |
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,49 @@ | ||
'use strict'; | ||
var path = require('path'); | ||
var gulp = require('gulp'); | ||
var ava = require('gulp-ava'); | ||
var xo = require('gulp-xo'); | ||
var nsp = require('gulp-nsp'); | ||
var plumber = require('gulp-plumber'); | ||
var coveralls = require('gulp-coveralls'); | ||
|
||
gulp.task('static', function () { | ||
return gulp.src('generators/app/index.js') | ||
.pipe(xo({ | ||
esnext: true | ||
})); | ||
}); | ||
|
||
gulp.task('nsp', function (cb) { | ||
nsp({package: path.resolve('package.json')}, cb); | ||
}); | ||
|
||
gulp.task('test', function (cb) { | ||
var avaErr; | ||
|
||
gulp.src('test/**/*.js') | ||
.pipe(plumber()) | ||
.pipe(ava()) | ||
.on('error', function (err) { | ||
avaErr = err; | ||
}) | ||
.on('end', function () { | ||
cb(avaErr); | ||
}); | ||
}); | ||
|
||
gulp.task('watch', function () { | ||
gulp.watch(['generators/**/*.js', 'test/**'], ['test']); | ||
}); | ||
|
||
gulp.task('coveralls', ['test'], function () { | ||
if (!process.env.CI) { | ||
return; | ||
} | ||
|
||
return gulp.src(path.join(__dirname, 'coverage/lcov.info')) | ||
.pipe(coveralls()); | ||
}); | ||
|
||
gulp.task('prepublish', ['nsp']); | ||
gulp.task('default', ['static', 'test', 'coveralls']); |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Oops, something went wrong.