Integrate Prettier in to Stylelint and ESLint
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
const { writeFile } = require('fs');
|
||||
const { resolve } = require('path');
|
||||
const imagemin = require('imagemin');
|
||||
const imageminPngquant = require('imagemin-pngquant');
|
||||
const imageminGifsicle = require('imagemin-gifsicle');
|
||||
const imageminJpegtran = require('imagemin-jpegtran');
|
||||
const { writeFile } = require("fs");
|
||||
const { resolve } = require("path");
|
||||
const imagemin = require("imagemin");
|
||||
const imageminPngquant = require("imagemin-pngquant");
|
||||
const imageminGifsicle = require("imagemin-gifsicle");
|
||||
const imageminJpegtran = require("imagemin-jpegtran");
|
||||
|
||||
imagemin(['images/*.{png,jpg,gif}'], 'theme/images', {
|
||||
imagemin(["images/*.{png,jpg,gif}"], "theme/images", {
|
||||
plugins: [
|
||||
imageminPngquant({
|
||||
quality: [0.65, 0.8],
|
||||
@@ -16,10 +16,10 @@ imagemin(['images/*.{png,jpg,gif}'], 'theme/images', {
|
||||
imageminJpegtran(),
|
||||
],
|
||||
})
|
||||
.then((files) => {
|
||||
files.forEach((file) => {
|
||||
const path = resolve(__dirname, '../', file.path);
|
||||
writeFile(path, file.data, (error) => {
|
||||
.then(files => {
|
||||
files.forEach(file => {
|
||||
const path = resolve(__dirname, "../", file.path);
|
||||
writeFile(path, file.data, error => {
|
||||
if (error) {
|
||||
process.stdout.write(`${error}\n`);
|
||||
process.exit(1);
|
||||
@@ -28,7 +28,7 @@ imagemin(['images/*.{png,jpg,gif}'], 'theme/images', {
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
process.stderr.write(`${error}\n`);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const { resolve } = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
const { upAll, stop } = require('docker-compose');
|
||||
const browsersync = require('browser-sync');
|
||||
const mysql = require('mysql');
|
||||
const { resolve } = require("path");
|
||||
const { execSync } = require("child_process");
|
||||
const { upAll, stop } = require("docker-compose");
|
||||
const browsersync = require("browser-sync");
|
||||
const mysql = require("mysql");
|
||||
|
||||
const name = 'windycoys';
|
||||
const name = "windycoys";
|
||||
|
||||
const dockerOptions = {
|
||||
cwd: resolve(__dirname),
|
||||
@@ -12,15 +12,15 @@ const dockerOptions = {
|
||||
};
|
||||
|
||||
const browserSyncOptions = {
|
||||
files: ['theme/**/*'],
|
||||
files: ["theme/**/*"],
|
||||
watchtask: true,
|
||||
open: false,
|
||||
};
|
||||
|
||||
const mysqlConfig = {
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'wordpress',
|
||||
user: "root",
|
||||
password: "password",
|
||||
database: "wordpress",
|
||||
};
|
||||
|
||||
process.env.COMPOSE_PROJECT_NAME = name;
|
||||
@@ -30,7 +30,7 @@ const getIpAddr = function getIpAddr(id) {
|
||||
return execSync(
|
||||
`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${id}`,
|
||||
)
|
||||
.toString('utf8')
|
||||
.toString("utf8")
|
||||
.trim();
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ const updateUriData = function updateUriData(wordpress, db) {
|
||||
|
||||
const query = `UPDATE wp_options SET option_value='http://${wordpress}' WHERE option_name in ('siteurl', 'home')`;
|
||||
|
||||
con.query(query, (error) => {
|
||||
con.query(query, error => {
|
||||
if (error) {
|
||||
process.stderr.write(`Error: ${error.sqlMessage}\n`);
|
||||
process.exit(1);
|
||||
@@ -56,27 +56,27 @@ const updateUriData = function updateUriData(wordpress, db) {
|
||||
const exitHandler = function exitHandler() {
|
||||
stop(dockerOptions).then(
|
||||
() => {
|
||||
process.stdout.write('\n');
|
||||
process.stdout.write("\n");
|
||||
process.exit();
|
||||
},
|
||||
(err) => {
|
||||
err => {
|
||||
process.stderr.write(`Error: ${err.message}\n`);
|
||||
process.exit(1);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
process.on('beforeExit', exitHandler.bind());
|
||||
process.on('SIGINT', exitHandler.bind());
|
||||
process.on('SIGUSR1', exitHandler.bind());
|
||||
process.on('SIGUSR2', exitHandler.bind());
|
||||
process.on('uncaughtException', exitHandler.bind());
|
||||
process.on("beforeExit", exitHandler.bind());
|
||||
process.on("SIGINT", exitHandler.bind());
|
||||
process.on("SIGUSR1", exitHandler.bind());
|
||||
process.on("SIGUSR2", exitHandler.bind());
|
||||
process.on("uncaughtException", exitHandler.bind());
|
||||
|
||||
// Start Docker containers
|
||||
upAll(dockerOptions).then(
|
||||
() => {
|
||||
process.stdout.write(
|
||||
'Docker containers launched, starting browser-sync...',
|
||||
"Docker containers launched, starting browser-sync...",
|
||||
);
|
||||
const wordpress = getIpAddr(`${name}_wordpress_1`);
|
||||
const db = getIpAddr(`${name}_db_1`);
|
||||
@@ -87,12 +87,12 @@ upAll(dockerOptions).then(
|
||||
bs.init(browserSyncOptions);
|
||||
} else {
|
||||
process.stderr.write(
|
||||
'Error: No IP address for Docker containers. Aborting.\n',
|
||||
"Error: No IP address for Docker containers. Aborting.\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
err => {
|
||||
process.strerr.write(`Error: ${err.message}\n`);
|
||||
process.exit(1);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user