sokcuri / TweetDeckPlayer

Web-App Application for Useful and Better Tweet Life
Other
66 stars 21 forks source link

distribution file size #52

Closed TintypeMolly closed 7 years ago

TintypeMolly commented 7 years ago

Maybe we can exclude unnecessary dev-dependencies from build to shrink the sizes of dists.

npm prune --production might do the job, but we still need electron-packager.

And electron is on devDependencies right now,

but I think it should be moved to dependencies.

Basic Build Procedure Idea

Assumptions

  1. The /build directory is not used to place distribution files anymore. It will be used as a temporary storage for intermediate files during the build.
  2. /dist will be used to place distribution files. This directory should be ignored.
  3. Project root's node_modules have both dependencies and devDependencies installed.

    Procedures

  4. copy the whole project into /build directory except the node_modules directory
  5. npm install --production inside the build directory
  6. Now /build's node_modules have only dependencies not devDependencies.
  7. Pack /build using the project root's environment which electron-packager installed.
  8. ...
  9. PROFIT!!

    Possible Improvements

  10. If we can specify arch and platform by passing arguments like electron-packager binary, it would be nice.
  11. For now, the build script builds all presets simultaneously and the builder doesn't have choice.
  12. It doesn't generate proper error messages.
sokcuri commented 7 years ago

찾아보니 NPM 3.0 마일스톤으로 Dependencies와 devDependencies 폴더를 다르게 지정하는 기능이 이슈에 올라와 있습니다. (https://github.com/npm/npm/issues/9674)

현재는 빌드시에 둘을 구분할 수 있는 방법이 딱히 없는 바, 위에 제시된 대로 build 폴더 안에 프로젝트를 복사하고 npm install하는 방법이 제일 좋은것 같습니다.

타 프로젝트들을 보면 build:win32 build:darwin과 같이 어떤 것을 빌드할 것인지 넘길 수 있는데 이걸 추가하면 될것같구요.

TintypeMolly commented 7 years ago

I'm working on this