Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build process #714

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions grunt/configs/coffee.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
/* jshint node:true */
module.exports = function( grunt ) {
module.exports = function () {
'use strict';

var config = {};

// Compile CoffeeScript
config.coffee = {
compile: {
options: {
sourceMap: true
},
files: [
{
expand: true,
cwd: '<%= dirs.general.js %>/admin/',
dest: '<%= dirs.general.js %>/admin/',
src: '*.coffee',
ext: '.min.js'
}
]
return {
coffee: {
compile: {
options: {
sourceMap: true
},
files: [
{
expand: true,
cwd: '<%= dirs.general.js %>/admin/',
dest: '<%= dirs.general.js %>/admin/',
src: '*.coffee',
ext: '.min.js'
}
]
}
}
};

return config;
};
42 changes: 20 additions & 22 deletions grunt/configs/potomo.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
/* jshint node:true */
module.exports = function( grunt ) {
'use strict';
module.exports = function () {
'use strict';

var config = {};

// The potomo task compiles PO files to MO files
config.potomo = {
framework: {
options: {
poDel: false,
},
files: [{
expand: true,
cwd: '<%= dirs.lang %>',
src: ['*.po'],
dest: '<%= dirs.lang %>',
ext: '.mo',
nonull: true
}]
}
};

return config;
// The potomo task compiles PO files to MO files
return {
potomo: {
framework: {
options: {
poDel: false,
},
files: [{
expand: true,
cwd: '<%= dirs.lang %>',
src: ['*.po'],
dest: '<%= dirs.lang %>',
ext: '.mo',
nonull: true
}]
}
}
};
};
64 changes: 31 additions & 33 deletions grunt/configs/sass.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
/* jshint node:true */
module.exports = function( grunt ) {
module.exports = function () {
'use strict';

var config = {};

// Compile all .scss files.
config.sass = {
compile: {
options: {
style: 'compressed',
sourcemap: true
},
files: [
{
expand: true,
cwd: '<%= dirs.general.css %>/admin/',
dest: '<%= dirs.general.css %>/admin/',
src: ['*.scss', '!_*.scss'],
ext: '.min.css'
},
{
expand: true,
cwd: '<%= dirs.gateway.css %>/admin/',
dest: '<%= dirs.gateway.css %>/admin/',
src: ['*.scss', '!_*.scss'],
ext: '.min.css'
return {
sass: {
compile: {
options: {
'style': 'compressed',
'source-map': true
},
{
expand: true,
cwd: '<%= dirs.gateway.css %>/frontend/',
dest: '<%= dirs.gateway.css %>/frontend/',
src: ['*.scss', '!_*.scss'],
ext: '.min.css'
}
]
files: [
{
expand: true,
cwd: '<%= dirs.general.css %>/admin/',
dest: '<%= dirs.general.css %>/admin/',
src: ['*.scss', '!_*.scss'],
ext: '.min.css'
},
{
expand: true,
cwd: '<%= dirs.gateway.css %>/admin/',
dest: '<%= dirs.gateway.css %>/admin/',
src: ['*.scss', '!_*.scss'],
ext: '.min.css'
},
{
expand: true,
cwd: '<%= dirs.gateway.css %>/frontend/',
dest: '<%= dirs.gateway.css %>/frontend/',
src: ['*.scss', '!_*.scss'],
ext: '.min.css'
}
]
}
}
};

return config;
};
33 changes: 22 additions & 11 deletions grunt/configs/shell.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
/* jshint node:true */
module.exports = function( grunt ) {
module.exports = function () {
'use strict';

var config = {};
let headers = {
"Report-Msgid-Bugs-To": "https://github.com/godaddy-wordpress/wc-plugin-framework/issues",
"Last-Translator": "[email protected]",
"Language-Team": "[email protected]",
"Project-Id-Version": "SkyVerge WooCommerce Plugin Framework"
};

config.shell = {
options: {
execOptions: {
maxBuffer: 1000 * 1000 * 1000,
return {
shell: {
options: {
execOptions: {
maxBuffer: 1000 * 1000 * 1000,
},
},
},
makepot: {
command: 'wp i18n make-pot ./woocommerce ./woocommerce/i18n/languages/woocommerce-plugin-framework.pot --domain=woocommerce-plugin-framework --package-name=\'SkyVerge WooCommerce Plugin Framework\''
makepot: {
command: [
'wp i18n make-pot . ./woocommerce/i18n/languages/woocommerce-plugin-framework.pot',
'--include="woocommerce"',
'--domain="woocommerce-plugin-framework"',
`--headers='${JSON.stringify(headers)}'`,
'--file-comment="Copyright (c) GoDaddy Operating Company, LLC. All Rights Reserved."'
].join(' ')
}
}
};

return config;
};
37 changes: 18 additions & 19 deletions grunt/tasks/parsepo.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
/* jshint node:true */
module.exports = function( grunt ) {
'use strict';
module.exports = async function (grunt) {
'use strict';

var fs = require('fs'),
gp = require('gettext-parser'),
util = grunt.option( 'util' );
const fs = await import('fs'),
gp = await import('gettext-parser');

// Parse and adjust PO headers.
grunt.registerTask( 'parsepo', 'Custom parse PO task.', function () {
// Parse and adjust PO headers.
grunt.registerTask('parsepo', 'Custom parse PO task.', function () {

var files = grunt.file.expand( grunt.config( 'dirs.lang' ) + '/*.po' );
let files = grunt.file.expand(grunt.config('dirs.lang') + '/*.po');

if ( ! files.length ) {
return;
}
if (!files.length) {
return;
}

files.forEach( function (file) {
files.forEach(function (file) {

var input = fs.readFileSync( file ),
po = gp.po.parse( input );
let input = fs.readFileSync(file),
po = gp.po.parse(input);

// Set PO file headers to reflect the current version number.
po.headers['project-id-version'] = grunt.config( 'pkg.title' ) + ' ' + grunt.config( 'pkg.version' );
// Set PO file headers to reflect the current version number.
po.headers['project-id-version'] = grunt.config('pkg.title') + ' ' + grunt.config('pkg.version');

fs.writeFileSync( file, gp.po.compile( po ) );
} );
fs.writeFileSync(file, gp.po.compile(po));
});

} );
});

};
8 changes: 4 additions & 4 deletions woocommerce/i18n/languages/woocommerce-plugin-framework.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) GoDaddy Operating Company, LLC. All Rights Reserved.
msgid ""
msgstr ""
"Project-Id-Version: SkyVerge WooCommerce Plugin Framework 1.0.0 TODO: plugin version\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-plugin-framework\n"
"Project-Id-Version: SkyVerge WooCommerce Plugin Framework\n"
"Report-Msgid-Bugs-To: https://github.com/godaddy-wordpress/wc-plugin-framework/issues\n"
"Last-Translator: [email protected]\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language-Team: [email protected]\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-09-02T12:48:01+00:00\n"
"POT-Creation-Date: 2024-09-04T23:18:22+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.11.0\n"
"X-Domain: woocommerce-plugin-framework\n"
Expand Down
Loading