question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Making exclude emulate include

See original GitHub issue

For some projects it would be much easier to have an include option rather than exclude. Bigger projects tend to have a lot of files not required at runtime (see dungeon-revealer/dungeon-revealer#1115). This makes it infeasible to explicitly list every pattern to exclude. Here are my attempts to get the exclude option to emulate the include option at maxb2/caxa-exclude-example. N.B. some of these use GNU/Linux tools and aren’t necessarily portable to other OSes.

No excludes

npx caxa -i . -o hello-no-exclude -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/app.js"

Archive contents:

app.js
.git/
node_modules/
package.json
package-lock.json
README.md

Hardcode the excludes

npx caxa -i . -o hello-exclude-names --exclude README.md .git -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/app.js"

app.js 
node_modules/
package.json
package-lock.json

Trying to emulate “include”

npx caxa -i . -o hello-exclude-glob --exclude * '!app.js' '!node_modules' '!package*' -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/app.js"

app.js
.git/
node_modules/
package.json
package-lock.json

Bash globbing doesn’t include hidden files!

$ echo *
app.js node_modules package.json package-lock.json README.md

Explicitly exclude hidden files

npx caxa -i . -o hello-exclude-glob-dot --exclude * '\.*' '!app.js' '!node_modules' '!package*' -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/app.js"

app.js
node_modules/
package.json
package-lock.json

Use find to list the excludes.

EXCLUDE=$(find . -maxdepth 1 -not -path '.' -not -name 'node_modules' -not -name 'app.js' -not -name 'package*' -exec echo {} + | sed -e 's|\./||g') && npx caxa -i . -o hello-exclude-glob-find --exclude $EXCLUDE -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/app.js"

app.js
node_modules/
package.json
package-lock.json

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
leafaccommented, Jun 14, 2021

👍 I like the idea of having --include and --exclude being mutually exclusive. Let’s have it for caxa@2.1.0.

0reactions
leafaccommented, Jun 25, 2021

The implementation ended up not being as straightforward as I expected, so I decided to just document how to emulate --include with --exclude. Let’s say that it’s designed after .gitignore 😃 It’s out as part of caxa@2.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to remove emulator from tool window android studio
go to File -> Setting -> tools -> Emulator and uncheck the checkbox ... Apply at right bottom & delete your emulator &...
Read more >
Adding Exclusions to Rules
To add exclusions to a specific rule: ... In the Capabilities & Exclusions pane, click Edit Exclusions. The Edit Exclusions Center window appears....
Read more >
Emulator support - Playnite
Excluding files and folders from import completely. Scanner configurations allow to specify list of files and folders to be completely ignored during emulation...
Read more >
Introducing EmuDeck: Steam Deck Emulation ... - YouTube
Introducing EmuDeck: Steam Deck Emulation Configuration Tool! ... You can have your whole retro library up and running within SteamOS in 20 ...
Read more >
Using Big Data to Emulate a Target Trial When a Randomized ...
First, suppose that we are interested in a target trial in which all potential participants are required to have a baseline mammography and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found