Skip to content

Commit

Permalink
Made dedupe optin. Made exclude work by default
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu committed Apr 3, 2024
1 parent 3b0bfe7 commit 77254e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@appthreat/caxa",
"version": "0.0.3",
"version": "0.0.4",
"description": "Package Node.js applications into executable binaries",
"author": "Team AppThreat <cloud@appthreat.com>",
"homepage": "https://github.com/appthreat/caxa",
Expand Down Expand Up @@ -38,7 +38,7 @@
"@types/archiver": "^6.0.2",
"@types/dedent": "^0.7.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.12.2",
"@types/node": "^20.12.3",
"cross-env": "^7.0.3",
"prettier": "^3.2.5",
"shx": "^0.3.4",
Expand Down
11 changes: 7 additions & 4 deletions source/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ export default async function caxa({
force = true,
exclude = defaultExcludes,
filter = (() => {
if (!exclude.length) {
exclude = defaultExcludes;
}
const pathsToExclude = globbySync(exclude, {
expandDirectories: false,
onlyFiles: false,
}).map((pathToExclude: string) => path.normalize(pathToExclude));
return (pathToCopy: string) =>
!pathsToExclude.includes(path.normalize(pathToCopy));
})(),
dedupe = true,
dedupe = false,
prepareCommand,
prepare = async (buildDirectory: string) => {
if (prepareCommand === undefined) return;
Expand Down Expand Up @@ -232,8 +235,8 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
`[Advanced] Paths to exclude from the build. The paths are passed to https://github.com/sindresorhus/globby and paths that match will be excluded. [Super-Advanced, Please don’t use] If you wish to emulate ‘--include’, you may use ‘--exclude "*" ".*" "!path-to-include" ...’. The problem with ‘--include’ is that if you change your project structure but forget to change the caxa invocation, then things will subtly fail only in the packaged version.`,
)
.option(
"-D, --no-dedupe",
"[Advanced] Don’t run ‘npm dedupe --production’ on the build directory.",
"--dedupe",
"[Advanced] Run ‘npm dedupe --production’ on the build directory.",
)
.option(
"-p, --prepare-command <command>",
Expand Down Expand Up @@ -290,7 +293,7 @@ if (url.fileURLToPath(import.meta.url) === (await fs.realpath(process.argv[1])))
input,
output,
force,
exclude = [],
exclude,
dedupe,
prepareCommand,
includeNode,
Expand Down

0 comments on commit 77254e6

Please sign in to comment.