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

Exclude a directory while packaging #927

Closed
akashnimare opened this issue Nov 21, 2016 · 5 comments · May be fixed by qcif/data-curator#563
Closed

Exclude a directory while packaging #927

akashnimare opened this issue Nov 21, 2016 · 5 comments · May be fixed by qcif/data-curator#563

Comments

@akashnimare
Copy link
Contributor

  • Version:
    8.7.0
  • Target:
    OSX

I'm using electron-builder to package my app. While building installers I want to exclude a directory (which is junk and have no real use) which resides in my app/node_modules/@paulcbetts/cld/deps/cld . As of now I manually delete it and then run npm run dist to package. Is there any way I can exclude it while building?

@develar any help would be highly appreciated since that folder is taking ~120MB of my app size 😭

@develar
Copy link
Member

develar commented Nov 21, 2016

Please try to use files to exclude.

Probably !node_modules/@paulcbetts/cld/deps/cld${/*}

@akashnimare
Copy link
Contributor Author

@develar yeah I tried files option in my development package.json like this -

"files": [
      "!node_modules/@paulcbetts/cld/deps/cld${/*}"
    ]

but it didn't work -

npm run dist

> zulip@0.5.1 dist /Users/akka/dev/zulipwork/zulip-electron
> build

Rebuilding native production dependencies for arch x64
Packaging for darwin x64 using electron 1.4.7 to dist/mac
Error: Application entry file "main/index.js" in the "/Users/akka/dev/zulipwork/zulip-electron/dist/mac/Zulip.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.
    at error (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/asarUtil.ts:429:12)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/asarUtil.ts:454:11
    at next (native)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
    at processImmediate [as _immediateCallback] (timers.js:529:5)
From previous event:
    at checkFileInArchive (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/asarUtil.js:104:22)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/platformPackager.ts:393:13
    at next (native)
From previous event:
    at MacPackager.checkFileInPackage (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/platformPackager.js:451:11)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/platformPackager.ts:435:16
From previous event:
    at MacPackager.sanityCheckPackage (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/platformPackager.js:466:11)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/platformPackager.ts:278:16
    at next (native)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
    at processImmediate [as _immediateCallback] (timers.js:529:5)
From previous event:
    at MacPackager.doPack (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/platformPackager.js:326:11)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/macPackager.ts:79:28
    at next (native)
From previous event:
    at MacPackager.pack (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/macPackager.js:163:11)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/packager.ts:132:22
From previous event:
    at Packager.doBuild (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/packager.js:256:11)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/packager.ts:100:38
    at next (native)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
    at processImmediate [as _immediateCallback] (timers.js:529:5)
From previous event:
    at Packager.build (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/packager.js:208:11)
    at /Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/src/builder.ts:240:40
    at next (native)
From previous event:
    at build (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/builder.js:89:21)
    at Object.<anonymous> (/Users/akka/dev/zulipwork/zulip-electron/node_modules/electron-builder/out/build-cli.js:62:41)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (bootstrap_node.js:352:7)
    at startup (bootstrap_node.js:144:9)
    at bootstrap_node.js:467:3

npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/akka/.nvm/versions/node/v6.3.1/bin/node" "/Users/akka/.nvm/versions/node/v6.3.1/bin/npm" "run" "dist"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! zulip@0.5.1 dist: `build`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the zulip@0.5.1 dist script 'build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the zulip package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs zulip
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls zulip
npm ERR! There is likely additional logging output above.

Am I doing something wrong here? Here is my app structure - zulip-electron

@develar
Copy link
Member

develar commented Nov 21, 2016

As stated in the docs:

Remember that default pattern / is not added to your custom, so, you have to add it explicitly — e.g. ["*/", "!ignoreMe${/}"].

@akashnimare
Copy link
Contributor Author

@develar you're awesome. Thank you so much ❤️ . To make it work correctly I had to use it like this -

"files": [
     "**/*",
      "!node_modules/@paulcbetts/cld/deps/cld${/*}"
    ]

@develar
Copy link
Member

develar commented Nov 21, 2016

Reopened — not user friendly. If only ignored patterns are specified — obviously all not ignored files must be copied.

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

Successfully merging a pull request may close this issue.

2 participants