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

JSDelta Cookbook #51

Open
wolfgang42 opened this issue Mar 19, 2022 · 2 comments
Open

JSDelta Cookbook #51

wolfgang42 opened this issue Mar 19, 2022 · 2 comments

Comments

@wolfgang42
Copy link

I don’t use JSDelta very often, so when I do have need for it I generally have to puzzle out how to get it do do what I want again. I'm therefore opening this issue to serve as a collection of recipes for using JSDelta in different situations.

@wolfgang42
Copy link
Author

Produce a minimal test case from a Node.js project

predicate.sh:

#!/bin/bash

cd $(dirname $1) # enter directory containing project
yarn install || exit 1 # Install dependencies, or abort with irrelevant error

yarn run some-command # The actual command under test

rm -rf node_modules/ # Delete dependencies (otherwise jsdelta tries to minimize them, too)

and to run it:

# Copy git repo, but strip git data so jsdelta doesn't spend time on it
git clone . /tmp/jsdelta-start
rm -rf /tmp/jsdelta-start/.git
# Run the minimization (note: I don't understand what the `package.json` arg does but this seems to work fine regardless)
# --msg works regardless of whether output is on stdout or stderr
yarn run jsdelta --cmd predicate.sh --msg 'error message goes here' --dir /tmp/jsdelta-start/ package.json

@esbena
Copy link
Collaborator

esbena commented Mar 21, 2022

Feel free to open a PR with this content in a Cookbook section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants