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(publish): Handle binary diff #252

Merged
merged 1 commit into from
Sep 17, 2024
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
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 14 additions & 9 deletions publish-npm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -301,6 +303,9 @@ async function publish() {
(memo, diff) => {
if (diff) {
memo.changeCount++;
if (diff.includes('Binary files differ')) {
return memo;
}
const [
{
hunks: [hunk]
Expand Down