grunt-init grunt-init-commonjs --force

This commit is contained in:
Vahagn Khachatryan
2018-12-21 16:29:41 +00:00
parent 52e165a6f3
commit 1359c7b2c5
9 changed files with 279 additions and 6 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/node_modules/

14
.jshintrc Normal file
View File

@@ -0,0 +1,14 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
"boss": true,
"eqnull": true,
"node": true
}

80
Gruntfile.js Normal file
View File

@@ -0,0 +1,80 @@
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['lib/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
},
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
},
},
nodeunit: {
files: ['test/**/*_test.js']
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
options: {
jshintrc: 'lib/.jshintrc'
},
src: ['lib/**/*.js']
},
test: {
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib: {
files: '<%= jshint.lib.src %>',
tasks: ['jshint:lib', 'nodeunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'nodeunit']
},
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task.
grunt.registerTask('default', ['jshint', 'nodeunit', 'concat', 'uglify']);
};

22
LICENSE-MIT Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2018 Vahagn Khachatryan
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.

View File

@@ -1,6 +1,57 @@
#Gragir.JS
Gragir (Armenian: գրագիր) - per google translate: writer.
գիր (gir) - from Old Armenian գիր (gir). From Proto-Indo-European *wēr-, from *wer- (“to cut, scratch, tear, sketch an outline”).
# gragir.js
This is an experimental javascript library to generate EPUB v3 books right
from the browser.
EPUB v3 generator.
## Getting Started
### On the server
Install the module with: `npm install gragir.js`
```javascript
var gragir_js = require('gragir.js');
gragir_js.awesome(); // "awesome"
```
### In the browser
Download the [production version][min] or the [development version][max].
[min]: https://raw.github.com/KhachatryanVahagn/gragir.js/master/dist/gragir.js.min.js
[max]: https://raw.github.com/KhachatryanVahagn/gragir.js/master/dist/gragir.js.js
In your web page:
```html
<script src="dist/gragir.js.min.js"></script>
<script>
awesome(); // "awesome"
</script>
```
In your code, you can attach gragir.js's methods to any object.
```html
<script>
var exports = Bocoup.utils;
</script>
<script src="dist/gragir.js.min.js"></script>
<script>
Bocoup.utils.awesome(); // "awesome"
</script>
```
## Documentation
_(Coming soon)_
## Examples
_(Coming soon)_
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
_Also, please don't edit files in the "dist" subdirectory as they are generated via Grunt. You'll find source code in the "lib" subdirectory!_
## Release History
_(Nothing yet)_
## License
Copyright (c) 2018 Vahagn Khachatryan
Licensed under the MIT license.

13
lib/.jshintrc Normal file
View File

@@ -0,0 +1,13 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"predef": ["exports"]
}

17
lib/gragir.js.js Normal file
View File

@@ -0,0 +1,17 @@
/*
* gragir.js
* https://github.com/vishap/gragir.js
*
* Copyright (c) 2018 Vahagn Khachatryan
* Licensed under the MIT license.
*/
(function(exports) {
'use strict';
exports.awesome = function() {
return 'awesome';
};
}(typeof exports === 'object' && exports || this));

39
package.json Normal file
View File

@@ -0,0 +1,39 @@
{
"name": "gragir.js",
"description": "EPUB v3 generator.",
"version": "0.1.0",
"homepage": "https://github.com/vishap/gragir.js",
"author": {
"name": "Vahagn Khachatryan",
"email": "vahagn.khachatryan@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/vishap/gragir.js.git"
},
"bugs": {
"url": "https://github.com/vishap/gragir.js/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/vishap/gragir.js/blob/master/LICENSE-MIT"
}
],
"main": "lib/gragir.js",
"engines": {
"node": "10.14.2"
},
"scripts": {
"test": "grunt nodeunit"
},
"devDependencies": {
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-watch": "~0.4.0",
"grunt": "~0.4.5"
},
"keywords": []
}

36
test/gragir.js_test.js Normal file
View File

@@ -0,0 +1,36 @@
'use strict';
var gragir_js = require('../lib/gragir.js.js');
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/
exports['awesome'] = {
setUp: function(done) {
// setup here
done();
},
'no args': function(test) {
test.expect(1);
// tests here
test.equal(gragir_js.awesome(), 'awesome', 'should be awesome.');
test.done();
}
};