This PR solves #14 - it adds a build script that compiles all src/ files to .js or .css and put them into dist/ directory. Then the users of eagle.js does not need to prepare extra dependencies for build that eagle.js depends on. The build script is at build/build.js. We can execute it with npm run build or automatically execute before publishing to npm.
Sorry for the long description 😅 . I tried to keep simple to describe this patch but I need such the number of sentences finally.
Build script
The build script does the following things:
Compile all .scss files in src/themes/ and output into dist/themes/ directory.
Copy all src/themes/assets/ int dist/themes/assets/
I've move all images in themes/ into themes/assets/ for convenience. 🙂
Compile/bundle all .js and .vue files into dist/eagle.js. Also generate dist/eagle.css that has style block contents in all .vue files.
Using rollup for bundle because it generates smallest code among all bundlers, AFAIK.
Extra things that this PR includes
In package.json
Move vue from dependencies to peerDependencies
Because if eagle.js include vue as a dependency, it restricts the users what version of vue they can use. peerDependencies just notifies the users that eagle.js requires vue, so they can select the version they want to use.
Clean up dependencies that does not used by eagle.js
Add files field to only publish dist/ and src/ directories to npm.
Rename theme files to let Sass compiler aware which file should be distributed. And move all images into themes/assets
I don't confident so much about themes. If anything is going wrong, please let me know.
Modify a few styles in .vue files to scope because rollup-plugin-vue does not support scoped css yet. It will be supported since v2.4.
Possible effects of this change
Moving vue from dependencies to peerDependencies is technically a breaking change because npm no longer install vue automatically if the users only specify eagle.js in their dependencies. But I think its effect is smaller.
import Eagle from 'eagle.js' no longer load component styles since they are separated to dist/eagle.css. The users need to import eagle.js/dist/eagle.css explicitly.
Themes are now in dist/ directory and the users should import them but things in src/ still also works.
Thanks so much for this. For the record, I may not have the time to review this before long so I am blindly trusting you. I'll update the npm repo in a few days.
This PR solves #14 - it adds a build script that compiles all
src/
files to.js
or.css
and put them intodist/
directory. Then the users of eagle.js does not need to prepare extra dependencies for build that eagle.js depends on. The build script is atbuild/build.js
. We can execute it withnpm run build
or automatically execute before publishing to npm.Sorry for the long description 😅 . I tried to keep simple to describe this patch but I need such the number of sentences finally.
Build script
The build script does the following things:
.scss
files insrc/themes/
and output intodist/themes/
directory.src/themes/assets/
intdist/themes/assets/
themes/
intothemes/assets/
for convenience. 🙂.js
and.vue
files intodist/eagle.js
. Also generatedist/eagle.css
that has style block contents in all.vue
files.Extra things that this PR includes
vue
fromdependencies
topeerDependencies
peerDependencies
just notifies the users that eagle.js requires vue, so they can select the version they want to use.dist/
andsrc/
directories to npm.themes/assets
.vue
files to scope because rollup-plugin-vue does not support scoped css yet. It will be supported since v2.4.Possible effects of this change
vue
fromdependencies
topeerDependencies
is technically a breaking change because npm no longer install vue automatically if the users only specify eagle.js in their dependencies. But I think its effect is smaller.import Eagle from 'eagle.js'
no longer load component styles since they are separated todist/eagle.css
. The users need to importeagle.js/dist/eagle.css
explicitly.dist/
directory and the users should import them but things insrc/
still also works.