Merge pull request #145 from lokesh/replace-grunt

Replace Grunt and use npm tasks
This commit is contained in:
Lokesh Dhakar
2019-04-28 14:01:53 -07:00
committed by GitHub
7 changed files with 277 additions and 1981 deletions

View File

@@ -1,50 +0,0 @@
module.exports = function(grunt) {
grunt.initConfig({
connect: {
server: {
options: {
port: 8000
}
}
},
jshint: {
files: ['src/color-thief.js']
},
jscs: {
src: [
'src/color-thief.js'
],
options: {
config: ".jscsrc"
}
},
uglify: {
options: {
preserveComments: 'some',
sourceMap: false
},
dist: {
files: {
'dist/color-thief.min.js': ['src/color-thief.js']
}
}
},
watch: {
test: {
files: ['src/color-thief.js'],
tasks: ['jshint', 'jscs']
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jscs');
grunt.registerTask('default', ['connect', 'watch']);
grunt.registerTask('test', ['jshint', 'jscs']);
grunt.registerTask('build', ['uglify']);
};

View File

@@ -31,13 +31,3 @@ colorThief.getPalette(sourceImage, 8);
getPalette(sourceImage[, colorCount, quality])
returns [ [num, num, num], [num, num, num], ... ]
```
## Contributing
### Testing
```
npm run test // Run Cypress acceptance tests
```

20
build/build.js Normal file
View File

@@ -0,0 +1,20 @@
const minify = require('@node-minify/core');
const uglify = require('@node-minify/uglify-es');
minify({
compressor: uglify,
input: './src/color-thief.js',
output: './dist/color-thief.min.js',
options: {
output: {
comments: 'some'
}
},
callback: function(err, min) {
if (err) {
console.log('⚠ERROR:' + err);
} else {
console.log('✅ Minification completed');
}
}
});

File diff suppressed because one or more lines are too long

2081
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +1,45 @@
{
"name": "color-thief",
"version": "2.0.2",
"author": {
"name": "Lokesh Dhakar",
"email": "lokesh.dhakar@gmail.com",
"url": "http://lokeshdhakar.com/"
},
"description": "Get the dominant color or color palette from an image.",
"keywords": [
"color",
"palette",
"sampling",
"image",
"picture",
"photo",
"canvas"
],
"homepage": "http://lokeshdhakar.com/projects/color-thief/",
"repository": {
"type": "git",
"url": "https://github.com/lokesh/color-thief.git"
},
"licenses": [
{
"type": "MIT",
"url": "https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE/"
"name": "color-thief",
"version": "2.0.2",
"author": {
"name": "Lokesh Dhakar",
"email": "lokesh.dhakar@gmail.com",
"url": "http://lokeshdhakar.com/"
},
"description": "Get the dominant color or color palette from an image.",
"keywords": [
"color",
"palette",
"sampling",
"image",
"picture",
"photo",
"canvas"
],
"homepage": "http://lokeshdhakar.com/projects/color-thief/",
"repository": {
"type": "git",
"url": "https://github.com/lokesh/color-thief.git"
},
"licenses": [
{
"type": "MIT",
"url": "https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE/"
}
],
"scripts": {
"build": "node ./build/build.js",
"dev": "http-server ./",
"test": "./node_modules/.bin/cypress open"
},
"main": "dist/color-thief.min.js",
"devDependencies": {
"@node-minify/core": "^4.0.5",
"@node-minify/uglify-es": "^4.0.5",
"cypress": "^3.2.0",
"http-server": "^0.11.1"
},
"engines": {
"node": ">=10.15.3"
}
],
"scripts": {
"dev": "echo 'coming soon'",
"test": "./node_modules/.bin/cypress open"
},
"main": "dist/color-thief.min.js",
"devDependencies": {
"cypress": "^3.2.0",
"grunt": "~1.0.1",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-jscs": "^1.8.0"
},
"engines": {
"node": ">=10.15.3"
}
}

View File

@@ -10,7 +10,7 @@
*
* License
* -------
* Copyright 2011, 2015 Lokesh Dhakar
* Copyright Lokesh Dhakar
* Released under the MIT license
* https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE
*