Skip to content

Commit

Permalink
Merge pull request #25 from kucrut/develop
Browse files Browse the repository at this point in the history
0.5.0
  • Loading branch information
kucrut committed Feb 4, 2017
2 parents fa4919a + f1a44e6 commit 8bbe9df
Show file tree
Hide file tree
Showing 43 changed files with 4,661 additions and 2,618 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Based on WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.{json,yml,yaml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/*.min.js
**/node_modules/**
**/vendor/**
**/plugins/brightcove-video-connect/**
**/dist/*
js/src/media.js
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": "humanmade",
"env": {
"browser": true
},
"globals": {
"_": false,
"Backbone": false,
"jQuery": false,
"wp": false,
"iconPicker": true
},
"rules": {
"key-spacing": [ "error", { "mode": "minimum" }],
"no-var": 0,
"object-curly-newline": 0,
"object-curly-spacing": [ "error", "always" ],
"space-in-parens": [ "error", "always", { "exceptions": [ "{}", "[]" ] } ],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "ignore"
}],
"comma-dangle": [ "error", "never" ]
}
}
12 changes: 7 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
.editorconfig export-ignore
.eslintignore export-ignore
.eslintrc.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.jscsrc export-ignore
.jshintrc export-ignore
.jshintignore export-ignore
.travis.yml export-ignore
assets export-ignore
composer.json export-ignore
composer.lock export-ignore
Gruntfile.js export-ignore
package.json export-ignore
phpcs.ruleset.xml export-ignore
phpunit.xml export-ignore
readme.md export-ignore
dev-lib export-ignore
webpack.config.babel.js export-ignore
tests export-ignore
js/src export-ignore
phpunit.xml export-ignore
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
vendor
/node_modules
*.sublime-*
npm-debug.log
*.css*.map
*.js*.map
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

12 changes: 0 additions & 12 deletions .jscsrc

This file was deleted.

5 changes: 0 additions & 5 deletions .jshintignore

This file was deleted.

27 changes: 0 additions & 27 deletions .jshintrc

This file was deleted.

25 changes: 12 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
sudo: false

notifications:
email:
on_success: never
on_failure: change

language:
- php
- node_js

php:
- 5.2
- 5.3
- 5.4
- 5.5
- 5.6
- 7.1

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=1
- WP_VERSION=trunk WP_MULTISITE=0
- WP_VERSION=trunk WP_MULTISITE=1

install:
- export DEV_LIB_PATH=dev-lib
- if [ ! -e "$DEV_LIB_PATH" ] && [ -L .travis.yml ]; then export DEV_LIB_PATH=$( dirname $( readlink .travis.yml ) ); fi
- source $DEV_LIB_PATH/travis.install.sh
- nvm install 6 && nvm use 6

script:
- source $DEV_LIB_PATH/travis.script.sh
before_script:
- composer install
- npm install

after_script:
- source $DEV_LIB_PATH/travis.after_script.sh
script:
- npm run lint
152 changes: 24 additions & 128 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,24 @@
/* jshint node:true */
module.exports = function( grunt ) {

// Project configuration
grunt.initConfig( {
browserify: {
admin: {
files: {
'js/src/media.js': 'js/src/media/manifest.js'
}
}
},
jshint: {
grunt: {
src: [ 'Gruntfile.js' ]
},
media: {
options: {
browserify: true
},
src: [ 'js/src/media/**/*.js' ]
},
field: {
src: [ 'js/src/field.js' ]
},
options: grunt.file.readJSON( '.jshintrc' )
},
concat: {
options: {
separator: '\n'
},
dist: {
src: [ 'js/src/media.js', 'js/src/field.js' ],
dest: 'js/icon-picker.js'
// Project configuration.
grunt.initConfig({
phpcs: {
'default': {
cmd: './vendor/bin/phpcs',
args: [ '--standard=./phpcs.ruleset.xml', '-p', '-s', '-v', '--extensions=php', '.' ]
}
},
uglify: {
all: {
files: {
'js/icon-picker.min.js': [ 'js/icon-picker.js' ]
'js/icon-picker.min.js': ['js/icon-picker.js']
}
}
},
cssmin: {
main: {
expand: true,
cwd: 'css/',
src: [ 'icon-picker.css' ],
src: ['icon-picker.css'],
dest: 'css/',
ext: '.min.css'
},
Expand All @@ -57,109 +30,32 @@ module.exports = function( grunt ) {
ext: '.min.css'
}
},
_watch: {
styles: {
files: [
'css/icon-picker.css'
],
tasks: [ 'cssmin' ],
options: {
debounceDelay: 500
}
},
scripts: {
files: [
'js/src/media/**/*.js',
'js/src/field.js'
],
tasks: [ 'js' ],
options: {
debounceDelay: 500,
interval: 2000
}
}
},
clean: {
main: [ 'release/<%= pkg.version %>' ]
},
copy: {

// Copy the plugin to a versioned release directory
main: {
src: [
'**',
'!dev-lib/**',
'!node_modules/**',
'!release/**',
'!tests/**',
'!.git/**',
'!.sass-cache/**',
'!Gruntfile.js',
'!package.json',
'!.gitattributes',
'!.gitignore',
'!.gitmodules',
'!readme.md'
],
dest: 'release/<%= pkg.version %>/'
}
},
compress: {
main: {
options: {
mode: 'zip',
archive: './release/icon-picker.<%= pkg.version %>.zip'
},
expand: true,
cwd: 'release/<%= pkg.version %>/',
src: [ '**/*' ],
dest: 'icon-picker/'
}
},
makepot: {
target: {
options: {
mainFile: 'icon-picker.php',
type: 'wp-plugin',
exclude: [ 'tests' ]
exclude: ['tests']
}
}
}
} );
});

// Load other tasks
grunt.loadNpmTasks( 'grunt-browserify' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
// Load tasks.
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-compress' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-wp-i18n' );

grunt.renameTask( 'watch', '_watch' );
grunt.registerTask( 'watch', function() {
if ( ! this.args.length || this.args.indexOf( 'browserify' ) > -1 ) {
grunt.config( 'browserify.options', {
browserifyOptions: {
debug: true
},
watch: true
} );

grunt.task.run( 'browserify' );
}

grunt.task.run( '_' + this.nameArgs );
} );

grunt.registerTask( 'css', [ 'cssmin' ] );
grunt.registerTask( 'js', [ 'jshint', 'browserify', 'concat', 'uglify' ] );
grunt.registerTask( 'i18n', [ 'makepot' ] );
grunt.registerTask( 'default', [ 'css', 'js' ] );
grunt.registerTask( 'build', [ 'default', 'clean', 'copy', 'compress' ] );

grunt.util.linefeed = '\n';
// Register tasks.
grunt.registerMultiTask( 'phpcs', 'Runs PHP code sniffs.', function() {
grunt.util.spawn({
cmd: this.data.cmd,
args: this.data.args,
opts: { stdio: 'inherit' }
}, this.async() );
});

grunt.registerTask( 'i18n', ['makepot']);
grunt.registerTask( 'compress', [ 'cssmin', 'uglify' ]);
grunt.registerTask( 'default', [ 'i18n', 'compress' ]);
};
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"email": "[email protected]",
"homepage": "http://kucrut.org/"
}
]
],
"require-dev": {
"wp-coding-standards/wpcs": "^0.10.0"
}
}
Loading

0 comments on commit 8bbe9df

Please sign in to comment.