Collection of bash scripts for building js/ts with different builders/transpilers/minifiers, for use in the browser or in specific web platforms.
All scripts assume a project structure with source files in ./src
and built files in ./dist
.
Script to build typescript files in ./src
using Parcel bundler. Each file in the top level inside ./src
will be treated independently and will be built individually. This allows having separate files for each page that you need to use in Optimizely and work with modules and such.
If a project-javascript.js
file is present, the script copies it to the ./dist
folder with the bundled files. This file remains untouched.
Typescript files are compiled to JS and then bundled by Parcel. It should respect any configs in tsconfig.json
, but it will not add polyfills if your es6 code requires them.
Like typescript-parcel-optimizely, but with JS.
Transpiles files in ./src
using Babel and appends & prepends:
- An auto-executable function wrapper.
- A cheap-ass ES6-only browser validator, by checking if
window.Promise
exists (This should be optional by arguments, it is in the to-do list) - A
window.$FILENAME = $FILENAME
statement. It adds a property with the file name to window. This assumes that your code will have a global variable with the same name as the filename.
The script also uses Uglify.js to minify the transpiled files.