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

add project setup && build + deploy and release tasks #1

Merged
merged 5 commits into from Jan 30, 2017

Conversation

soenkekluth
Copy link
Contributor

@soenkekluth soenkekluth commented Jan 29, 2017

i added a complete setup and package.json to organize the project better. the scripts enable to build the code for publishing to npm as es2015 and commonjs modules. also a browser compatible version is build.

take a look at the scripts in package.json
you can build the project - release a version to npm and deploy the demo to github pages automatically

just call npm i or yarn install and then (yarn / npm) run build

@soenkekluth soenkekluth mentioned this pull request Jan 29, 2017
@micku7zu
Copy link
Owner

Ok, I tested the pull request and it's not exactly what I was looking for.

Maybe i'm still old on how all this things works, I adopted es2015 classes, functions and everything else but not used es6 module and commonjs.

I don't have any problem that all this things comes as something extra but not changing the way library already works. I want to be able to include the js file at the end of the body and everything should work in mostly all browsers.

I run "npm i" and "npm run build" and the files were generated but I couldn't:
<script src="../lib/vanilla-tilt.js"></script>
and I saw that the auto loading was commented.

What I want to ask is that if we can achieve all this es6 module and commonjs but without changing the way it already works?

Thanks for your work

@micku7zu
Copy link
Owner

I wrote the code using es2015 features that are not working on old browsers and my ideal output of all this build / npm would be something like this:

When I run npm build i want to generate 4 files:

  • vanilla-tilt.js - which should be the original library (es2015 features) that can be included using <script> in the end of the and just works, without anything else
  • vanilla-tilt.min.js - the exact same thing as the one above but minimized
  • vanilla-tilt.babel.js - like the first one, but the code should be transformed using babel in JS that works on old browsers too
  • vanilla-tilt.babel.min.js - like the one above but the code minimized.

They can be a es6 module or common js module if they work exactly the same as specified and module if anyone wants.

Can this be achieved?

@soenkekluth
Copy link
Contributor Author

soenkekluth commented Jan 29, 2017

@micku7zu of course. the lib folder is supposed to be published to npm - not to use in a script tag but installed with npm install vanilla-tilt. then you can require it as a module und use it in your web project.
the dist folder will be committed to github and contains the files you can use in a script tag of your html. i will commit the changes to build the raw code wrapped in a self executing function like the original source.

@micku7zu
Copy link
Owner

Ok, thanks!

I will wait to see the outcome 😃

@soenkekluth
Copy link
Contributor Author

soenkekluth commented Jan 29, 2017

@micku7zu just committed. as i see there are 2 conflicts in the main file. i will check..

ps before bundling you need to run npm i again. dependencies have changed

@soenkekluth
Copy link
Contributor Author

there you go :)

@micku7zu
Copy link
Owner

micku7zu commented Jan 29, 2017

I tested it in a hurry and it seems that it is ok. I still have some more questions:

  1. Can we minify the dist/ files?
  2. Can we move all the files related to the build process in a folder build/ ? Of course, not package.json or any other file that is needed in the root directory 😄

I still need to see what yarn.lock, .editorconfig and .gitattributes do...

Thanks again for your work. It's late here and I will have a closer look tomorrow 😄

@micku7zu micku7zu merged commit e25e393 into micku7zu:master Jan 30, 2017
@micku7zu
Copy link
Owner

So, I saw that minify works and dist/ is exactly as I wanted. Thanks

I read about yarn.lock, .editorconfig and .gitattributes, they are all ok.

I merged the changes with small adjustments:

  • Changed the version writed in vanilla-tilt.js to match package.json
  • Changed the description from package.json
  • Auto indent code from build.js

Thanks again, great work!

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

Successfully merging this pull request may close these issues.

None yet

2 participants