Skip to content

Commit

Permalink
Feature: Font Awesome 5 + GraphQL API integration (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
MickeyKay authored Mar 3, 2021
1 parent 3d2cf3f commit 9d6dd40
Show file tree
Hide file tree
Showing 14 changed files with 1,316 additions and 1,694 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ matrix:
include:
- php: 7.4
env: WP_VERSION=latest
- php: 7.3
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=trunk
- php: 5.6
env: WP_VERSION=4.9
- php: 7.4
env: WP_TRAVISCI=phpcs

Expand Down
306 changes: 155 additions & 151 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,161 +3,165 @@

module.exports = function( grunt ) {

// Grab package as variable for later use/
var pkg = grunt.file.readJSON( 'package.json' );
// Grab package as variable for later use/
var pkg = grunt.file.readJSON( 'package.json' );

// Load all tasks.
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
// Load all tasks.
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});

// Project configuration
grunt.initConfig( {
pkg: pkg,
devUpdate: {
main: {
options: {
updateType: 'prompt',
packages: {
devDependencies: true
},
}
}
},
prompt: {
version: {
options: {
questions: [
{
config: 'newVersion',
type: 'input',
message: 'What specific version would you like?',
default: '<%= pkg.version %>'
},
{
config: 'updateStable',
type: 'confirm',
message: 'Bump stable version?',
default: false
}
]
}
}
},
replace: {
package: {
src: ['package.json'],
overwrite: true,
replacements: [
{
"version": "1.0.0",
from: /("version":\s*).*,\n/g,
to: '$1"<%= newVersion %>",\n'
}
]
},
readme: {
src: ['readme.txt'],
overwrite: true,
replacements: [
{
from: /(Stable tag:\s*)(.*)(\n)/g,
to: function(matchedText, index, fullText, regexMatches) {
return grunt.config('updateStable') ? regexMatches[0] + grunt.config('newVersion') + regexMatches[2]: matchedText;
}
}
]
},
php: {
src: ['better-font-awesome.php'],
overwrite: true,
replacements: [
{
from: /(\*\s*Version:\s*).*\n/g,
to: '$1<%= newVersion %>\n'
}
]
}
},
makepot: {
target: {
options: {
domainPath: '/languages/', // Where to save the POT file.
potFilename: 'better-font-awesome.pot', // Name of the POT file.
type: 'wp-plugin' // Type of project (wp-plugin or wp-theme).
}
}
},
wp_readme_to_markdown: {
readme: {
files: {
'readme.md': 'readme.txt'
},
options: {
post_convert: function(text) {
var prefix = [
'[![Build Status](https://travis-ci.org/MickeyKay/better-font-awesome.svg?branch=master)](https://travis-ci.org/MickeyKay/better-font-awesome)',
'[![Downloads](https://img.shields.io/wordpress/plugin/dt/better-font-awesome.svg)](https://wordpress.org/plugins/better-font-awesome/)',
'[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)'
].join(' ');
// Project configuration
grunt.initConfig( {
pkg: pkg,
devUpdate: {
main: {
options: {
updateType: 'prompt',
packages: {
devDependencies: true
},
}
}
},
prompt: {
version: {
options: {
questions: [
{
config: 'newVersion',
type: 'input',
message: 'What specific version would you like?',
default: '<%= pkg.version %>'
},
{
config: 'updateStable',
type: 'confirm',
message: 'Bump stable version?',
default: false
}
]
}
}
},
replace: {
package: {
src: ['package.json'],
overwrite: true,
replacements: [
{
"version": "1.0.0",
from: /("version":\s*).*,\n/g,
to: '$1"<%= newVersion %>",\n'
}
]
},
readme: {
src: ['readme.txt'],
overwrite: true,
replacements: [
{
from: /(Stable tag:\s*)(.*)(\n)/g,
to: function(matchedText, index, fullText, regexMatches) {
return grunt.config('updateStable') ? regexMatches[0] + grunt.config('newVersion') + regexMatches[2]: matchedText;
}
}
]
},
php: {
src: ['better-font-awesome.php'],
overwrite: true,
replacements: [
{
from: /(\*\s*Version:\s*).*\n/g,
to: '$1<%= newVersion %>\n'
},
{
from: /(const VERSION = ').*(';)/g,
to: '$1<%= newVersion %>$2'
}
]
}
},
makepot: {
target: {
options: {
domainPath: '/languages/', // Where to save the POT file.
potFilename: 'better-font-awesome.pot', // Name of the POT file.
type: 'wp-plugin' // Type of project (wp-plugin or wp-theme).
}
}
},
wp_readme_to_markdown: {
readme: {
files: {
'readme.md': 'readme.txt'
},
options: {
post_convert: function(text) {
var prefix = [
'[![Build Status](https://travis-ci.com/MickeyKay/better-font-awesome.svg?branch=master)](https://travis-ci.com/MickeyKay/better-font-awesome)',
'[![Downloads](https://img.shields.io/wordpress/plugin/dt/better-font-awesome.svg)](https://wordpress.org/plugins/better-font-awesome/)',
'[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)'
].join(' ');

return [prefix,text].join('\n\n');
}
}
},
},
copy: {
composerDeps: {
src: [
'vendor/mickey-kay/**'
],
dest: 'svn/trunk/'
},
svnAssets: {
cwd: 'assets/',
src: ['**'],
dest: 'svn/assets/',
expand: true,
},
svnTrunk: {
src: [
'**',
'!node_modules/**',
'!vendor/**',
'!svn/**',
'!.git/**',
'!.gitignore',
'!.gitmodules',
'!.sass-cache/**',
'!bin/**',
'!tests/**',
'!css/src/**',
'!js/src/**',
'!img/src/**',
'!assets/**',
'!design/**',
'!Gruntfile.js',
'!package.json',
'!composer*',
],
dest: 'svn/trunk/',
},
svnTags: {
cwd: 'svn/trunk/',
src: ['**'],
dest: 'svn/tags/<%= newVersion %>/',
expand: true,
}
}
} );
return [prefix,text].join('\n\n');
}
}
},
},
copy: {
composerDeps: {
src: [
'vendor/mickey-kay/**'
],
dest: 'svn/trunk/'
},
svnAssets: {
cwd: 'assets/',
src: ['**'],
dest: 'svn/assets/',
expand: true,
},
svnTrunk: {
src: [
'**',
'!node_modules/**',
'!vendor/**',
'!svn/**',
'!.git/**',
'!.gitignore',
'!.gitmodules',
'!.sass-cache/**',
'!bin/**',
'!tests/**',
'!css/src/**',
'!js/src/**',
'!img/src/**',
'!assets/**',
'!design/**',
'!Gruntfile.js',
'!package.json',
'!composer*',
],
dest: 'svn/trunk/',
},
svnTags: {
cwd: 'svn/trunk/',
src: ['**'],
dest: 'svn/tags/<%= newVersion %>/',
expand: true,
}
}
} );

grunt.registerTask( 'build', [
'prompt',
'replace',
'makepot',
'wp_readme_to_markdown',
'copy'
] );
grunt.registerTask( 'build', [
'prompt',
'replace',
'makepot',
'wp_readme_to_markdown',
'copy'
] );

grunt.registerTask( 'default', 'build' );
grunt.registerTask( 'default', 'build' );

grunt.util.linefeed = '\n';
grunt.util.linefeed = '\n';
};
Loading

0 comments on commit 9d6dd40

Please sign in to comment.