mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-25 00:19:32 +08:00
296 lines
4.7 KiB
JavaScript
296 lines
4.7 KiB
JavaScript
/**
|
|
* Pojo Makefile
|
|
*/
|
|
'use strict';
|
|
|
|
module.exports = function( grunt ) {
|
|
|
|
require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );
|
|
|
|
// Project configuration.
|
|
grunt.initConfig( {
|
|
pkg: grunt.file.readJSON( 'package.json' ),
|
|
|
|
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
|
|
'<%= grunt.template.today("dd-mm-yyyy") %> */',
|
|
|
|
checktextdomain: {
|
|
standard: {
|
|
options:{
|
|
text_domain: 'pojo-accessibility',
|
|
correct_domain: true,
|
|
keywords: [
|
|
// WordPress keywords
|
|
'__:1,2d',
|
|
'_e:1,2d',
|
|
'_x:1,2c,3d',
|
|
'esc_html__:1,2d',
|
|
'esc_html_e:1,2d',
|
|
'esc_html_x:1,2c,3d',
|
|
'esc_attr__:1,2d',
|
|
'esc_attr_e:1,2d',
|
|
'esc_attr_x:1,2c,3d',
|
|
'_ex:1,2c,3d',
|
|
'_n:1,2,4d',
|
|
'_nx:1,2,4c,5d',
|
|
'_n_noop:1,2,3d',
|
|
'_nx_noop:1,2,3c,4d'
|
|
]
|
|
},
|
|
files: [ {
|
|
src: [
|
|
'**/*.php',
|
|
'!node_modules/**',
|
|
'!build/**',
|
|
'!tests/**',
|
|
'!vendor/**',
|
|
'!*~'
|
|
],
|
|
expand: true
|
|
} ]
|
|
}
|
|
},
|
|
|
|
usebanner: {
|
|
dist: {
|
|
options: {
|
|
banner: '<%= banner %>'
|
|
},
|
|
files: {
|
|
src: [
|
|
'assets/js/app.min.js',
|
|
'assets/css/style.css',
|
|
'assets/css/style.min.css'
|
|
]
|
|
}
|
|
}
|
|
},
|
|
|
|
jshint: {
|
|
options: {
|
|
jshintrc: '.jshintrc'
|
|
},
|
|
all: [
|
|
'Gruntfile.js',
|
|
'assets/js/skip-link-focus-fix.js',
|
|
'assets/js/app.dev.js'
|
|
]
|
|
},
|
|
|
|
uglify: {
|
|
options: {},
|
|
dist: {
|
|
files: {
|
|
'assets/js/app.min.js': [
|
|
'assets/js/skip-link-focus-fix.js',
|
|
'assets/js/app.dev.js'
|
|
]
|
|
}
|
|
}
|
|
},
|
|
|
|
less: {
|
|
dist: {
|
|
options: {
|
|
//cleancss: true
|
|
},
|
|
files: {
|
|
'assets/css/style.css': 'assets/less/style.less'
|
|
}
|
|
},
|
|
|
|
mincss: {
|
|
options: {
|
|
compress: true
|
|
},
|
|
files: {
|
|
'assets/css/style.min.css': 'assets/less/style.less'
|
|
}
|
|
}
|
|
},
|
|
|
|
watch: {
|
|
js: {
|
|
files: [
|
|
'**/*.js',
|
|
'!**/*.min.js'
|
|
],
|
|
tasks: [
|
|
'scripts'
|
|
],
|
|
options: {}
|
|
},
|
|
|
|
less: {
|
|
|
|
files: [
|
|
'**/*.less'
|
|
],
|
|
tasks: [
|
|
'styles'
|
|
],
|
|
options: {}
|
|
}
|
|
},
|
|
|
|
bumpup: {
|
|
options: {
|
|
updateProps: {
|
|
pkg: 'package.json'
|
|
}
|
|
},
|
|
file: 'package.json'
|
|
},
|
|
|
|
replace: {
|
|
plugin_main: {
|
|
src: [ 'pojo-accessibility.php' ],
|
|
overwrite: true,
|
|
replacements: [
|
|
{
|
|
from: /Version: \d{1,1}\.\d{1,2}\.\d{1,2}/g,
|
|
to: 'Version: <%= pkg.version %>'
|
|
}
|
|
]
|
|
},
|
|
|
|
readme: {
|
|
src: [ 'readme.txt' ],
|
|
overwrite: true,
|
|
replacements: [
|
|
{
|
|
from: /Stable tag: \d{1,1}\.\d{1,2}\.\d{1,2}/g,
|
|
to: 'Stable tag: <%= pkg.version %>'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
|
|
shell: {
|
|
git_add_all : {
|
|
command: [
|
|
'git add --all',
|
|
'git commit -m "Bump to <%= pkg.version %>"'
|
|
].join( '&&' )
|
|
}
|
|
},
|
|
|
|
release: {
|
|
options: {
|
|
bump: false,
|
|
npm: false,
|
|
commit: false,
|
|
tagName: 'v<%= version %>',
|
|
commitMessage: 'released v<%= version %>',
|
|
tagMessage: 'Tagged as v<%= version %>'
|
|
}
|
|
},
|
|
|
|
wp_readme_to_markdown: {
|
|
github: {
|
|
options: {
|
|
screenshot_url: 'assets/{screenshot}.png',
|
|
wordpressPluginSlug: 'pojo-accessibility',
|
|
travisUrlRepo: 'https://travis-ci.org/pojome/one-click-accessibility',
|
|
gruntDependencyStatusUrl: 'https://david-dm.org/pojome/pojo-accessibility'
|
|
},
|
|
files: {
|
|
'README.md': 'readme.txt'
|
|
}
|
|
}
|
|
},
|
|
|
|
copy: {
|
|
main: {
|
|
src: [
|
|
'**',
|
|
'!node_modules/**',
|
|
'!build/**',
|
|
'!bin/**',
|
|
'!.git/**',
|
|
'!tests/**',
|
|
'!.travis.yml',
|
|
'!.jshintrc',
|
|
'!README.md',
|
|
'!phpunit.xml',
|
|
'!vendor/**',
|
|
'!Gruntfile.js',
|
|
'!package.json',
|
|
'!npm-debug.log',
|
|
'!composer.json',
|
|
'!composer.lock',
|
|
'!assets/less/**',
|
|
'!wp-assets/**',
|
|
'!.gitignore',
|
|
'!.gitmodules',
|
|
'!*~'
|
|
],
|
|
expand: true,
|
|
dest: 'build/'
|
|
}
|
|
},
|
|
|
|
clean: {
|
|
//Clean up build folder
|
|
main: [
|
|
'build'
|
|
]
|
|
},
|
|
|
|
wp_deploy: {
|
|
deploy:{
|
|
options: {
|
|
plugin_slug: '<%= pkg.slug %>',
|
|
svn_user: 'KingYes',
|
|
build_dir: 'build/',
|
|
assets_dir: 'wp-assets/'
|
|
}
|
|
}
|
|
},
|
|
|
|
phpunit: {
|
|
classes: {
|
|
dir: ''
|
|
},
|
|
options: {
|
|
bin: 'phpunit',
|
|
bootstrap: 'tests/bootstrap.php',
|
|
colors: true
|
|
}
|
|
}
|
|
|
|
} );
|
|
|
|
// Default task(s).
|
|
grunt.registerTask( 'default', [
|
|
'checktextdomain',
|
|
'scripts',
|
|
'styles',
|
|
'usebanner',
|
|
'wp_readme_to_markdown',
|
|
//'phpunit'
|
|
] );
|
|
|
|
grunt.registerTask( 'build', [
|
|
'default',
|
|
'clean',
|
|
'copy'
|
|
] );
|
|
|
|
grunt.registerTask( 'scripts', [
|
|
'jshint',
|
|
'uglify'
|
|
] );
|
|
|
|
grunt.registerTask( 'styles', [
|
|
'less'
|
|
] );
|
|
|
|
grunt.registerTask( 'publish', [
|
|
'default',
|
|
'bumpup',
|
|
'replace',
|
|
'shell:git_add_all',
|
|
'release'
|
|
] );
|
|
};
|