diff --git a/package-lock.json b/package-lock.json index 026d9012..2ff4c141 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,10 +15,13 @@ "@aws-sdk/client-cloudfront": "^3.651.1", "@aws-sdk/client-s3": "^3.651.1", "@playwright/browser-chromium": "^1.47.1", + "@types/diff": "^5.2.2", "@types/jest": "^29.5.13", "@types/mustache": "^4.2.5", "@types/nib": "^1.1.2", "@types/node": "^18.16.12", + "@types/recursive-readdir": "^2.2.4", + "@types/semver": "^7.5.8", "@types/stylus": "^0.48.43", "@typescript-eslint/eslint-plugin": "^8.6.0", "@typescript-eslint/parser": "^8.6.0", @@ -4340,6 +4343,12 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/diff": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.2.tgz", + "integrity": "sha512-qVqLpd49rmJA2nZzLVsmfS/aiiBpfVE95dHhPVwG0NmSBAt+riPxnj53wq2oBq5m4Q2RF1IWFEUpnZTgrQZfEQ==", + "dev": true + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -4433,6 +4442,21 @@ "integrity": "sha512-tIRrjbY9C277MOfP8M3zjMIhtMlUJ6YVqkGgLjz+74jVsdf4/UjC6Hku4+1N0BS0qyC0JAS6tJLUk9H6JUKviQ==", "dev": true }, + "node_modules/@types/recursive-readdir": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@types/recursive-readdir/-/recursive-readdir-2.2.4.tgz", + "integrity": "sha512-84REEGT3lcgopvpkmGApzmU5UEG0valme5rQS/KGiguTkJ70/Au8UYZTyrzoZnY9svuX9351+1uvrRPzWDD/uw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", diff --git a/package.json b/package.json index bb8d3533..c8ccb6ac 100644 --- a/package.json +++ b/package.json @@ -43,10 +43,13 @@ "@aws-sdk/client-cloudfront": "^3.651.1", "@aws-sdk/client-s3": "^3.651.1", "@playwright/browser-chromium": "^1.47.1", + "@types/diff": "^5.2.2", "@types/jest": "^29.5.13", "@types/mustache": "^4.2.5", "@types/nib": "^1.1.2", "@types/node": "^18.16.12", + "@types/recursive-readdir": "^2.2.4", + "@types/semver": "^7.5.8", "@types/stylus": "^0.48.43", "@typescript-eslint/eslint-plugin": "^8.6.0", "@typescript-eslint/parser": "^8.6.0", diff --git a/publish-npm.mjs b/publish-npm.mjs index f4406708..68114311 100644 --- a/publish-npm.mjs +++ b/publish-npm.mjs @@ -238,16 +238,18 @@ const printDiffPackage = (diffObj) => async function publish() { console.clear(); - if (DRY_RUN) console.info('Dry run! 🌵'); - - const gitInd = ora(`Git: Checking working tree`).start(); - if (await run('git', ['status', '--porcelain'])) { - gitInd.fail( - 'Git: Working tree dirty. Please resolve any changes before publishing.' - ); - return; + if (DRY_RUN) { + console.info('Dry run! 🌵'); + } else { + const gitInd = ora(`Git: Checking working tree`).start(); + if (await run('git', ['status', '--porcelain'])) { + gitInd.fail( + 'Git: Working tree dirty. Please resolve any changes before publishing.' + ); + return; + } + gitInd.succeed(`Git: Working tree clean`); } - gitInd.succeed(`Git: Working tree clean`); const commithash = execSync('git rev-parse --short HEAD', { encoding: 'utf8' @@ -301,6 +303,9 @@ async function publish() { (memo, diff) => { if (diff) { memo.changeCount++; + if (diff.includes('Binary files differ')) { + return memo; + } const [ { hunks: [hunk]