Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

chore: add prettier check in linting step #1764

Merged
merged 3 commits into from
Sep 20, 2022
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
6 changes: 4 additions & 2 deletions lib/fabricator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ const script = `
process.stdin.resume();
`;

const children: Record<string, ChildProcessByStdio<Writable, Readable, null>> =
{};
const children: Record<
string,
ChildProcessByStdio<Writable, Readable, null>
> = {};

export function fabricate(
bakes: string[],
Expand Down
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ export async function exec(argv2: string[]) {

const { bytecode } = argv;

const nativeBuild = argv['native-build']
const nativeBuild = argv['native-build'];

for (const target of targets) {
target.forceBuild = forceBuild;
Expand Down Expand Up @@ -678,7 +678,7 @@ export async function exec(argv2: string[]) {
target: target as Target,
symLinks,
doCompress,
nativeBuild
nativeBuild,
});

if (target.platform !== 'win' && target.output) {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@
"clean": "rimraf lib-es5",
"build": "npm run clean && tsc",
"start": "tsc --watch",
"lint": "eslint lib prelude test",
"lint:fix": "npm run lint -- --fix",
"lint": "npm run lint:style && npm run lint:code",
"lint:style": "prettier -c \"{lib,prelude,test}/**/*.{ts,js}\"",
"lint:code": "eslint lib prelude test",
"fix": "npm run lint:style -- -w && npm run lint:code -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run lint",
"test": "npm run build && node test/test.js node14 no-npm && node test/test.js node12 no-npm && node test/test.js node10 no-npm && node test/test.js host only-npm"
Expand Down
6 changes: 2 additions & 4 deletions test/test-46-input-package-json-outputdir/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ const input = '.';
const newcomers = [
'out/palookaville-linux',
'out/palookaville-macos',
'out/palookaville-win.exe'
'out/palookaville-win.exe',
];

const before = utils.filesBefore(newcomers);

utils.pkg.sync([
input
], { stdio: 'inherit' });
utils.pkg.sync([input], { stdio: 'inherit' });

utils.filesAfter(before, newcomers);
utils.vacuum.sync('out');
121 changes: 10 additions & 111 deletions test/test-50-signature/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,117 +22,16 @@ let spoiler = fs.readFileSync(output);
spoiler = Buffer.concat([
spoiler,
Buffer.from([
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0xfe,
0x01,
0x12,
0x23,
0x34,
0x45,
0x56,
0x67,
0x78,
0x89,
0x9a,
0xab,
0xbc,
0xcd,
0xde,
0xef,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34,
0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34,
0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef,
]),
]);
fs.writeFileSync(output, spoiler);
Expand Down
21 changes: 11 additions & 10 deletions test/test-79-npm/node-notifier/node-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ var notifier = require('node-notifier');
var utils = require('node-notifier/lib/utils.js');
var whichArgument;

utils.command = utils.fileCommandJson = utils.immediateFileCommand = function (
filename
) {
var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux
var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename);
if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) {
console.log('ok');
}
process.exit();
};
utils.command =
utils.fileCommandJson =
utils.immediateFileCommand =
function (filename) {
var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux
var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename);
if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) {
console.log('ok');
}
process.exit();
};

var which = require('which');
which.sync = function (filename) {
Expand Down
15 changes: 10 additions & 5 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@ module.exports.shouldSkipPnpm = function () {
const REQUIRED_MINOR_VERSION = 19;

const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
const MINOR_VERSION = parseInt(process.version.match(/v[0-9]+\.([0-9]+)/)[1], 10);

const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION
const isDisallowedMinor = MAJOR_VERSION === REQUIRED_MAJOR_VERSION && MINOR_VERSION < REQUIRED_MINOR_VERSION;
const MINOR_VERSION = parseInt(
process.version.match(/v[0-9]+\.([0-9]+)/)[1],
10
);

const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION;
const isDisallowedMinor =
MAJOR_VERSION === REQUIRED_MAJOR_VERSION &&
MINOR_VERSION < REQUIRED_MINOR_VERSION;
if (isDisallowedMajor || isDisallowedMinor) {
const need = `${REQUIRED_MAJOR_VERSION}.${REQUIRED_MINOR_VERSION}`;
const got = `${MAJOR_VERSION}.${MINOR_VERSION}`;
Expand All @@ -183,4 +188,4 @@ module.exports.shouldSkipPnpm = function () {
}

return false;
}
};