-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #104 from avoidwork/modernize"
- Loading branch information
Showing
20 changed files
with
3,949 additions
and
4,897 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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
node_modules | ||
.idea | ||
*.tgz | ||
node_modules/* | ||
.idea/* |
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,14 @@ | ||
/node_modules/ | ||
/lib/filesize.min.js | ||
/lib/filesize.min.js.map | ||
/lib/filesize.es6.min.js | ||
/lib/filesize.es6.min.js.map | ||
/src/ | ||
/test/ | ||
.idea | ||
.eslintrc | ||
.gitignore | ||
.travis.yml | ||
bower.json | ||
composer.json | ||
Gruntfile.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,101 @@ | ||
"use strict"; | ||
|
||
var fs = require("fs"), | ||
path = require("path"); | ||
|
||
module.exports = function (grunt) { | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON("package.json"), | ||
concat: { | ||
options: { | ||
banner: "/**\n" + | ||
" * <%= pkg.name %>\n" + | ||
" *\n" + | ||
" * @copyright <%= grunt.template.today('yyyy') %> <%= pkg.author %>\n" + | ||
" * @license <%= pkg.license %>\n" + | ||
" * @version <%= pkg.version %>\n" + | ||
" */\n" | ||
}, | ||
dist: { | ||
src: [ | ||
"<banner>", | ||
"src/intro.js", | ||
"src/filesize.js", | ||
"src/outro.js" | ||
], | ||
dest: "lib/filesize.es6.js" | ||
} | ||
}, | ||
"babel": { | ||
options: { | ||
sourceMap: false, | ||
presets: ["babel-preset-env"] | ||
}, | ||
dist: { | ||
files: { | ||
"lib/<%= pkg.name %>.js": "lib/<%= pkg.name %>.es6.js" | ||
} | ||
} | ||
}, | ||
eslint: { | ||
target: [ | ||
"Gruntfile.js", | ||
"test/*.js", | ||
"lib/<%= pkg.name %>.es6.js" | ||
] | ||
}, | ||
nodeunit: { | ||
all: ["test/*.js"] | ||
}, | ||
uglify: { | ||
options: { | ||
banner: "/*\n <%= grunt.template.today('yyyy') %> <%= pkg.author %>\n @version <%= pkg.version %>\n*/", | ||
sourceMap: true, | ||
sourceMapIncludeSources: true | ||
}, | ||
target: { | ||
files: { | ||
"lib/filesize.min.js": ["lib/filesize.js"] | ||
} | ||
} | ||
}, | ||
watch: { | ||
js: { | ||
files: "<%= concat.dist.src %>", | ||
tasks: "build" | ||
}, | ||
pkg: { | ||
files: "package.json", | ||
tasks: "build" | ||
} | ||
} | ||
}); | ||
|
||
// tasks | ||
grunt.loadNpmTasks("grunt-contrib-concat"); | ||
grunt.loadNpmTasks("grunt-contrib-nodeunit"); | ||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
grunt.loadNpmTasks("grunt-contrib-uglify"); | ||
grunt.loadNpmTasks("grunt-babel"); | ||
grunt.loadNpmTasks("grunt-eslint"); | ||
grunt.task.registerTask("babili", "Minifies ES2016+ code", function () { | ||
const data = fs.readFileSync(path.join(__dirname, "lib", "filesize.es6.js"), "utf8"), | ||
minified = require("babel-core").transform(data, { | ||
sourceFileName: "filesize.es6.js", | ||
sourceMaps: true, | ||
presets: ["minify"] | ||
}), | ||
pkg = require(path.join(__dirname, "package.json")), | ||
banner = "/*\n " + new Date().getFullYear() + " " + pkg.author + "\n @version " + pkg.version + "\n*/\n\"use strict\";"; | ||
|
||
fs.writeFileSync(path.join(__dirname, "lib", "filesize.es6.min.js"), banner + minified.code + "\n//# sourceMappingURL=filesize.es6.min.js.map", "utf8"); | ||
grunt.log.ok("1 file created."); | ||
fs.writeFileSync(path.join(__dirname, "lib", "filesize.es6.min.js.map"), JSON.stringify(minified.map), "utf8"); | ||
grunt.log.ok("1 sourcemap created."); | ||
}); | ||
|
||
// aliases | ||
grunt.registerTask("test", ["eslint", "nodeunit"]); | ||
grunt.registerTask("build", ["concat", "babel"]); | ||
grunt.registerTask("default", ["build", "test", "babili", "uglify"]); | ||
}; |
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 |
---|---|---|
@@ -1,5 +0,0 @@ | ||
export function filesize(arg: any, descriptor: object): any; | ||
|
||
export interface filesize { | ||
partial: any; | ||
} | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.