thaliproject / postcardapp

A sample app to demonstrate how to build Thali applications
MIT License
22 stars 5 forks source link

Trim 'node_modules' #95

Closed deadlyfingers closed 8 years ago

deadlyfingers commented 8 years ago

Add gulp build script to trim 'node_modules' of unnecessary files.

deadlyfingers commented 8 years ago

Done a first pass at this with > 50 MB savings by removing:

    node_modules+'**/test/*',
    node_modules+'**/tests/*',
    node_modules+'**/examples/*',
    node_modules+'**/*.gif',
    node_modules+'**/*.jpg',
    node_modules+'**/*.png',
    node_modules+'**/*.md',
    node_modules+'**/*.css',
    node_modules+'**/*.html'

Results:

141.5 MB => 86.7 MB
16,161 => 12,290 items
deadlyfingers commented 8 years ago

Second pass including:

    node_modules+'**/component.json',
    node_modules+'**/bower.json',
    node_modules+'**/pouchdb/docs/**/*',

Results

=> 85.7 MB
=> 11,811 items
deadlyfingers commented 8 years ago

As we are deleting files that we reckon to be unnecessary we would need to test everything still works... So until we are confident it works 100% it can be run using gulp:

gulp build
gulp trim:node_modules
cordova build

If something breaks then use gulp to reset the build:

gulp clean