Skip to content

Commit

Permalink
fix(npm): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Jul 2, 2023
1 parent 1e58419 commit 201e63f
Show file tree
Hide file tree
Showing 8 changed files with 617 additions and 502 deletions.
29 changes: 29 additions & 0 deletions .syncpackrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// @ts-check

/** @type {import("syncpack").RcFile} */
const config = {
versionGroups: [
{
dependencies: ['@types/node'],
packages: ['**'],
pinVersion: '18.16.19',
},
{
dependencies: ['chalk'],
packages: ['**'],
pinVersion: '4.1.2',
},
{
dependencies: ['globby'],
packages: ['**'],
pinVersion: '11.1.0',
},
{
dependencies: ['pretty-bytes'],
packages: ['**'],
pinVersion: '5.6.0',
},
],
};

module.exports = config;
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,21 @@
"Tom Chen (@tomchentw)"
],
"dependencies": {
"chalk": "4.1.1",
"commander": "8.3.0",
"execa": "5.1.1",
"expect-more": "1.2.0",
"globby": "11.0.4",
"chalk": "4.1.2",
"commander": "11.0.0",
"expect-more": "1.3.0",
"globby": "11.1.0",
"pretty-bytes": "5.6.0"
},
"devDependencies": {
"@types/execa": "2.0.0",
"@types/node": "16.11.7",
"@typescript-eslint/eslint-plugin": "5.3.1",
"@typescript-eslint/parser": "5.3.1",
"eslint": "8.2.0",
"organize-imports-cli": "0.8.0",
"@types/node": "18.16.19",
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.60.1",
"eslint": "8.44.0",
"organize-imports-cli": "0.10.0",
"pkg": "5.8.1",
"prettier": "2.4.1",
"rimraf": "3.0.2",
"prettier": "2.8.8",
"syncpack": "10.6.1",
"typescript": "5.1.6"
},
"engines": {
Expand Down Expand Up @@ -78,7 +76,7 @@
"license": "MIT",
"repository": "JamieMason/ImageOptim-CLI",
"resolutions": {
"globby": "<12"
"globby": "11.1.0"
},
"scripts": {
"build": "npm run build:ts && npm run build:bin",
Expand All @@ -89,8 +87,8 @@
"format:prettier": "prettier --write './src/**/*.ts'",
"lint": "eslint --ext .ts .",
"lint:fix": "npm run format && npm run lint -- --fix",
"postbuild": "rimraf dist/*.js",
"prebuild": "rimraf dist ./test/dist",
"postbuild": "rm -rf dist/*.js",
"prebuild": "rm -rf dist ./test/dist",
"prepack": "npm run build"
}
}
6 changes: 6 additions & 0 deletions src/exec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { exec as execProcess } from 'child_process';
import { promisify } from 'util';

const execProm = promisify(execProcess);

export const exec = (program: string, args: string[]) => execProm(`${program} ${args.join(' ')}`);
6 changes: 3 additions & 3 deletions src/fs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import execa from 'execa';
import { access, constants, copyFile, stat as fsStat, Stats } from 'fs';
import { dirname } from 'path';
import { exec } from './exec';
import { verbose } from './log';

async function mkdirP(src: string): Promise<void> {
verbose(`mkdir -p ${src}`);
await execa('mkdir', ['-p', src]);
await exec('mkdir', ['-p', src]);
}

export function copy(src: string, target: string): Promise<void> {
Expand All @@ -26,7 +26,7 @@ export function pathExists(src: string): Promise<boolean> {

export async function remove(src: string): Promise<void> {
verbose(`rm -rf ${src}`);
await execa('rm', ['-rf', src]);
await exec('rm', ['-rf', src]);
}

export function stat(src: string): Promise<Stats> {
Expand Down
7 changes: 2 additions & 5 deletions src/osascript.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import execa from 'execa';
import { exec } from './exec';

export const osascript = (filePath: string, ...args: string[]): Promise<string> =>
execa('osascript', [filePath, ...args]).then(({ stdout }) => stdout);

export const osascriptSync = (filePath: string, ...args: string[]): string =>
execa.sync('osascript', [filePath, ...args]).stdout;
exec('osascript', [filePath, ...args]).then(({ stdout }) => stdout);
6 changes: 3 additions & 3 deletions src/pngquant.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import execa from 'execa';
import { IOptions } from '.';
import { isWalkable } from 'expect-more';
import { IOptions } from '.';
import { PNGQUANT_BIN_PATH } from './constants';
import { exec } from './exec';

export const pngquant = async (pngFilePaths: string[], options: IOptions): Promise<void> => {
try {
await execa(PNGQUANT_BIN_PATH, [
await exec(PNGQUANT_BIN_PATH, [
'--ext=.png',
'--force',
'--skip-if-larger',
Expand Down
4 changes: 2 additions & 2 deletions src/run-imageoptim.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import execa from 'execa';
import { pathExists } from './fs';
import { AppRunner } from '.';
import { IMAGEOPTIM, IMAGEOPTIM_BIN_PATH, IMAGEOPTIM_URL } from './constants';
import { info, panic, verbose } from './log';
import { exec } from './exec';

export const runImageOptim: AppRunner = async (options) => {
info(`Running ${IMAGEOPTIM.name}...`);
if (!(await pathExists(IMAGEOPTIM_BIN_PATH))) {
return panic(`ImageOptim.app is not installed (${IMAGEOPTIM_URL})`, options);
}
await execa(IMAGEOPTIM_BIN_PATH, [options.tmpDir]);
await exec(`${IMAGEOPTIM_BIN_PATH}`, [options.tmpDir]);
verbose(`${IMAGEOPTIM.name} has finished`);
};

0 comments on commit 201e63f

Please sign in to comment.