Remove redundant grunt items

This commit is contained in:
roykho 2021-11-29 09:44:45 -08:00
parent 11c2028bd5
commit 3d7ec4cd59
No known key found for this signature in database
GPG Key ID: 7B36C0EA25795714
3 changed files with 7 additions and 253 deletions

View File

@ -1,231 +0,0 @@
module.exports = function( grunt ) {
'use strict';
var sass = require( 'node-sass' );
grunt.initConfig({
// Setting folder templates.
dirs: {
css: 'assets/css',
fonts: 'assets/fonts',
images: 'assets/images',
js: 'assets/js',
php: 'includes'
},
// JavaScript linting with ESLint.
eslint: {
src: [
'<%= dirs.js %>/admin/*.js',
'!<%= dirs.js %>/admin/*.min.js',
'<%= dirs.js %>/frontend/*.js',
'!<%= dirs.js %>/frontend/*.min.js'
]
},
// Sass linting with Stylelint.
stylelint: {
options: {
configFile: '.stylelintrc'
},
all: [
'<%= dirs.css %>/*.scss',
'!<%= dirs.css %>/select2.scss'
]
},
// Minify .js files.
uglify: {
options: {
ie8: true,
parse: {
strict: false
},
output: {
comments : /@license|@preserve|^!/
}
},
js_assets: {
files: [{
expand: true,
cwd: '<%= dirs.js %>/',
src: [
'**/*.js',
'!**/*.min.js'
],
extDot: 'last',
dest: '<%= dirs.js %>',
ext: '.min.js'
}]
}
},
// Compile all .scss files.
sass: {
compile: {
options: {
implementation: sass,
sourceMap: 'none'
},
files: [{
expand: true,
cwd: '<%= dirs.css %>/',
src: ['*.scss'],
dest: '<%= dirs.css %>/',
ext: '.css'
}]
}
},
// Generate RTL .css files.
rtlcss: {
woocommerce: {
expand: true,
cwd: '<%= dirs.css %>',
src: [
'*.css',
'!select2.css',
'!*-rtl.css'
],
dest: '<%= dirs.css %>/',
ext: '-rtl.css'
}
},
// Minify all .css files.
cssmin: {
minify: {
files: [
{
expand: true,
cwd: '<%= dirs.css %>/',
src: ['*.css'],
dest: '<%= dirs.css %>/',
ext: '.css'
},
{
expand: true,
cwd: '<%= dirs.css %>/photoswipe/',
src: ['*.css', '!*.min.css'],
dest: '<%= dirs.css %>/photoswipe/',
ext: '.min.css'
},
{
expand: true,
cwd: '<%= dirs.css %>/photoswipe/default-skin/',
src: ['*.css', '!*.min.css'],
dest: '<%= dirs.css %>/photoswipe/default-skin/',
ext: '.min.css'
}
]
}
},
// Concatenate select2.css onto the admin.css files.
concat: {
admin: {
files: {
'<%= dirs.css %>/admin.css' : ['<%= dirs.css %>/select2.css', '<%= dirs.css %>/admin.css'],
'<%= dirs.css %>/admin-rtl.css' : ['<%= dirs.css %>/select2.css', '<%= dirs.css %>/admin-rtl.css']
}
}
},
// Watch changes for assets.
watch: {
css: {
files: ['<%= dirs.css %>/*.scss'],
tasks: ['sass', 'rtlcss', 'postcss', 'cssmin', 'concat']
},
js: {
files: [
'GruntFile.js',
'<%= dirs.js %>/**/*.js',
'!<%= dirs.js %>/**/*.min.js'
],
tasks: ['eslint','newer:uglify']
}
},
// PHP Code Sniffer.
phpcs: {
options: {
bin: 'vendor/bin/phpcs'
},
dist: {
src: [
'**/*.php', // Include all php files.
'!includes/api/legacy/**',
'!includes/libraries/**',
'!node_modules/**',
'!tests/cli/**',
'!tmp/**',
'!vendor/**'
]
}
},
// Autoprefixer.
postcss: {
options: {
processors: [
require( 'autoprefixer' )
]
},
dist: {
src: [
'<%= dirs.css %>/*.css'
]
}
}
});
// Load NPM tasks to be used here.
grunt.loadNpmTasks( 'grunt-sass' );
grunt.loadNpmTasks( 'grunt-phpcs' );
grunt.loadNpmTasks( 'grunt-rtlcss' );
grunt.loadNpmTasks( 'grunt-postcss' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'gruntify-eslint' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-newer' );
// Register tasks.
grunt.registerTask( 'default', [
'js',
'css'
]);
grunt.registerTask( 'js', [
'eslint',
'uglify:js_assets'
]);
grunt.registerTask( 'css', [
'sass',
'rtlcss',
'postcss',
'cssmin',
'concat'
]);
grunt.registerTask( 'assets', [
'js',
'css'
]);
grunt.registerTask( 'e2e-build', [
'uglify:js_assets',
'css'
]);
// Only an alias to 'default' task.
grunt.registerTask( 'dev', [
'default'
]);
};

View File

@ -8,17 +8,14 @@
"url": "https://github.com/woocommerce/woocommerce.git"
},
"license": "GPL-3.0+",
"main": "Gruntfile.js",
"config": {
"wp_org_slug": "woocommerce"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "./bin/build-zip.sh",
"build:core": "grunt && pnpm run makepot",
"build-watch": "grunt watch",
"build:core": "pnpm nx build woocommerce-legacy-assets && pnpm run makepot",
"build:zip": "pnpm run build",
"build:assets": "grunt assets",
"lint:js": "eslint assets/js --ext=js",
"docker:down": "pnpx wc-e2e docker:down",
"docker:ssh": "pnpx wc-e2e docker:ssh",
@ -62,20 +59,6 @@
"eslint-config-wpcalypso": "5.0.0",
"eslint-plugin-jest": "23.20.0",
"github-contributors-list": "https://github.com/woocommerce/github-contributors-list/tarball/master",
"grunt": "1.3.0",
"grunt-contrib-clean": "2.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "3.0.0",
"grunt-contrib-uglify": "4.0.1",
"grunt-contrib-watch": "1.1.0",
"grunt-newer": "^1.3.0",
"grunt-phpcs": "0.4.0",
"grunt-postcss": "0.9.0",
"grunt-rtlcss": "2.0.2",
"grunt-sass": "3.1.0",
"grunt-stylelint": "0.16.0",
"gruntify-eslint": "5.0.0",
"husky": "4.3.0",
"istanbul": "1.0.0-alpha.2",
"jest": "^25.1.0",

View File

@ -44,15 +44,17 @@
}
},
"build-watch": {
"executor": "@nrwl/workspace:run-script",
"executor": "@nrwl/workspace:run-commands",
"options": {
"script": "build-watch"
"command": "grunt watch",
"cwd": "plugins/woocommerce"
}
},
"build-assets": {
"executor": "@nrwl/workspace:run-script",
"executor": "@nrwl/workspace:run-commands",
"options": {
"script": "build:assets"
"command": "pnpm nx build woocommerce-legacy-assets",
"cwd": "plugins/woocommerce"
}
},
"lint-js": {