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: assets building commands for windows platform. #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion bin/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ const runThemeCleanup = () => {
'.git',
'.github',
'bin',
'languages',
];

deleteDirs.forEach((dir) => {
Expand Down
30 changes: 30 additions & 0 deletions bin/phpcbf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { spawn } = require('cross-spawn');

// Get the command-line arguments excluding the first two (node and script.js)
const args = process.argv.slice(2);

// Define the main command you want to run.
const command = './vendor/bin/phpcbf';

// Combine the command and arguments.
const fullCommand = [command, ...args];

// Spawn the process.
const child = spawn(fullCommand[0], fullCommand.slice(1));

// Handle process events.
child.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});

child.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});

child.on('error', (error) => {
console.error(`Error: ${error.message}`);
});

child.on('close', (code) => {
console.log(`Child process exited with code ${code}`);
});
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"license": "MIT",
"private": true,
"scripts": {
"prod": "NODE_ENV=production webpack --progress && npm run pot",
"prod": "cross-env NODE_ENV=production webpack --progress && npm run pot",
"dev": "webpack --watch --progress",
"clean": "rm -rf assets/build/*",
"init": "./bin/init.js && npm run pot",
"init": "node ./bin/init.js && npm run pot",
"lint:css": "stylelint assets/src/sass/**/*.scss --syntax scss",
"lint:js:fix": "eslint assets/src/js/ --fix",
"lint:js": "eslint assets/src/js/",
"lint:php": "./vendor/bin/phpcs",
"lint:php:fix": "./bin/phpcbf.sh",
"lint:php": "php ./vendor/bin/phpcs",
"lint:php:fix": "node ./bin/phpcbf.js",
"lint:staged": "lint-staged",
"pot": "wp-pot --src './**/*.php' --dest-file './languages/blank-theme.pot' --domain 'blank-theme' --package 'Blank Theme' ",
"precommit": "npm-run-all lint:* pot",
Expand All @@ -24,12 +25,14 @@
"webfontloader": "^1.6.28"
},
"devDependencies": {
"cross-spawn": "^7.0.3",
"@wordpress/babel-preset-default": "^6.2.0",
"@wordpress/browserslist-config": "^4.0.1",
"@wordpress/dependency-extraction-webpack-plugin": "^3.1.4",
"@wordpress/eslint-plugin": "^9.0.6",
"@wordpress/stylelint-config": "^19.0.5",
"babel-loader": "^8.2.2",
"cross-env": "^7.0.3",
"css-loader": "^5.2.6",
"eslint": "^7.27.0",
"eslint-webpack-plugin": "^2.5.4",
Expand Down
Loading