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

Cleanup npm package #995

Merged
merged 3 commits into from
Feb 16, 2017
Merged

Cleanup npm package #995

merged 3 commits into from
Feb 16, 2017

Conversation

thijstriemstra
Copy link
Contributor

@thijstriemstra thijstriemstra commented Feb 14, 2017

The current (1.3.2) npm package contains a lot of unnecessary files for an NPM user:

$ ls -l node_modules/wavesurfer.js/
total 60
-rw-rw-r--  1 thijs thijs  343 feb  7 12:19 bower.json
-rw-rw-r--  1 thijs thijs 1923 feb  7 12:23 CHANGES.md
-rw-rw-r--  1 thijs thijs   18 feb 14  2016 CNAME
drwxrwxr-x  4 thijs thijs 4096 feb  8 22:38 coverage
drwxrwxr-x  3 thijs thijs 4096 feb  8 22:38 dist
drwxrwxr-x 20 thijs thijs 4096 feb  8 22:38 example
-rw-rw-r--  1 thijs thijs 5481 jan 19 16:43 Gruntfile.js
-rw-rw-r--  1 thijs thijs 1302 jan 19 16:43 karma.conf.js
-rw-rw-r--  1 thijs thijs 2801 feb  8 22:38 package.json
drwxrwxr-x  2 thijs thijs 4096 feb  8 22:38 plugin
-rw-rw-r--  1 thijs thijs 4411 jan 19 16:43 README.md
drwxrwxr-x  3 thijs thijs 4096 feb  8 22:38 spec
drwxrwxr-x  2 thijs thijs 4096 feb  8 22:38 src

Only dist is really needed. This PR excludes everything that npm doesn't include already by default, and includes the required dist and optional src and plugins directories for compatibility with people currently using npm. I suggest we stop doing that after the next branch and only distribute the dist dir.

npm pack is a useful command to display what will go into the NPM package. With this PR:

$ npm pack
wavesurfer.js-1.3.2.tgz

$ tar -tf wavesurfer.js-1.3.2.tgz 
package/package.json
package/README.md
package/CHANGES.md
package/dist/wavesurfer.js
package/dist/wavesurfer.min.js
package/dist/plugin/wavesurfer.cursor.js
package/dist/plugin/wavesurfer.elan.min.js
package/dist/plugin/wavesurfer.microphone.js
package/dist/plugin/wavesurfer.microphone.min.js
package/dist/plugin/wavesurfer.minimap.js
package/dist/plugin/wavesurfer.elan.js
package/dist/plugin/wavesurfer.regions.js
package/dist/plugin/wavesurfer.regions.min.js
package/dist/plugin/wavesurfer.spectrogram.js
package/dist/plugin/wavesurfer.spectrogram.min.js
package/dist/plugin/wavesurfer.timeline.js
package/dist/plugin/wavesurfer.cursor.min.js
package/dist/plugin/wavesurfer.timeline.min.js
package/dist/plugin/wavesurfer.minimap.min.js
package/dist/wavesurfer.min.js.map
package/plugin/wavesurfer.cursor.js
package/plugin/wavesurfer.elan.js
package/plugin/wavesurfer.microphone.js
package/plugin/wavesurfer.minimap.js
package/plugin/wavesurfer.regions.js
package/plugin/wavesurfer.spectrogram.js
package/plugin/wavesurfer.timeline.js
package/src/drawer.canvas.js
package/src/drawer.js
package/src/drawer.multicanvas.js
package/src/html-init.js
package/src/mediaelement.js
package/src/peakcache.js
package/src/util.js
package/src/wavesurfer.js
package/src/webaudio.js

@thijstriemstra
Copy link
Contributor Author

thijstriemstra commented Feb 14, 2017

@katspaugh With this PR it now randomly includes the non-minified and minified plugins though, I guess we only want the minified plugins, or do we want both versions of each plugin?

Update: now minified plugins in dist only, identical to content of https://github.com/katspaugh/wavesurfer.js/tree/master/dist/plugin

package/package.json
package/README.md
package/CHANGES.md
package/dist/wavesurfer.js
package/dist/wavesurfer.min.js
package/dist/plugin/wavesurfer.cursor.min.js
package/dist/plugin/wavesurfer.elan.min.js
package/dist/plugin/wavesurfer.microphone.min.js
package/dist/plugin/wavesurfer.minimap.min.js
package/dist/plugin/wavesurfer.regions.min.js
package/dist/plugin/wavesurfer.spectrogram.min.js
package/dist/plugin/wavesurfer.timeline.min.js
package/dist/wavesurfer.min.js.map
package/src/drawer.canvas.js
package/src/drawer.js
package/src/drawer.multicanvas.js
package/src/html-init.js
package/src/mediaelement.js
package/src/peakcache.js
package/src/util.js
package/src/wavesurfer.js
package/src/webaudio.js
package/plugin/wavesurfer.cursor.js
package/plugin/wavesurfer.elan.js
package/plugin/wavesurfer.microphone.js
package/plugin/wavesurfer.minimap.js
package/plugin/wavesurfer.regions.js
package/plugin/wavesurfer.spectrogram.js
package/plugin/wavesurfer.timeline.js

@mspae
Copy link
Contributor

mspae commented Feb 14, 2017

Awesome. I think bower.json is missing though.

@thijstriemstra
Copy link
Contributor Author

Npm stripped out bower.json; not needed there.

@mspae
Copy link
Contributor

mspae commented Feb 14, 2017

Aah. Of course :)

@thijstriemstra
Copy link
Contributor Author

@mspae can you add a github review so I can merge it (it's blocked until at least one approved review).

@mspae
Copy link
Contributor

mspae commented Feb 16, 2017

my bad. I can't review from my phone for some reason. 📵

@mspae mspae merged commit 04a8448 into katspaugh:master Feb 16, 2017
mspae pushed a commit to mspae/wavesurfer.js that referenced this pull request Mar 5, 2017
* ignore eclipse project files

* exclude everything except dist, plugin and src directories in npm package

* only include minified plugins in npm package
mspae added a commit that referenced this pull request Mar 8, 2017
* added contributing info (#1006)

* Readded global audio context singleton, functionally equal to PR #1021

* Cleanup npm package (#995)

* ignore eclipse project files

* exclude everything except dist, plugin and src directories in npm package

* only include minified plugins in npm package

* updated .npmignore to exclude everything except dist and src directories and subdirectories

* Add support for forceDecode (#1009)

* Add support for forceDecode

Adds the `forceDecode` option to force client side decoding of the audio after download regardless if pre-decoded peaks are passed to the `.load/2` method. This is primarily for use with `.zoom/1` to enable high fidelity rendering on zoom. Without local decoding, the zoom on pre-decoded peaks is very low fidelity.

* Update conditional brackets for failing test

* nullify this.arraybuffer when destroying to prevent memory leak

* removed <<<< HEAD

* return array when using getImage() (#1027)

* return array when using getImage()

* return one canvas image data if not multiple canvases

* Update drawer.multicanvas.js

* updated getImage()

* add comments fir getImage()

* updated comments

* updated getImage to es6 syntax and applied jsdoc formatting

* create new labels feature for spectrogram plugin (#984)

* create new labels feature for spectrogram plugin

- create labels parameter (true|false)
- create labels element and canvas
- create labels frequency method loadLabels();
- update createWrapper() method and apply labels feature parameter.

* create new labels feature for spectrogram plugin

create new labels feature for spectrogram plugin

- create labels parameter (true|false)
- create labels element and canvas
- create labels frequency method loadLabels();
- update createWrapper() method and apply labels feature parameter.

* remove extra spaces

* removed one more extra white space :)

* update css formatting

* remove extra space

* remove extra space

* Updated spectrogram labels to es6

* add getFilters method (#982)

* add getFilters method

* add getFilters() method

add 'Filters must be set with setFilters method first' note.

* return empty array if no filters are set

* change to `return this.backend.filters || [];`

* add debounce to resize/orientationchange event for minimap plugin (#987)

* add debounce to resize event
* add orientationchange event

* getVolume method (#978)

* getVolume method

returns the current gainNode volume.

* added getVolume method

* added getVolume method

* updated getVolume to es6 syntax

* avoid error when calling pause before play (#977)

This prevents a `Failed to execute 'stop' on 'AudioBufferSourceNode'` when stop() is called before play().

* fix getDuration() return value when using MediaElement (#941)

* fix getDuration() return value for MediaElement

change getDuration function in mediaelement.js to return the correct duration length same as WebAudio.

from
        var duration = this.media.duration; // incorrect duration value returned
        console.log preview:
        https://cloud.githubusercontent.com/assets/5193884/22399178/6d26c1fe-e565-11e6-9b13-e6107641666a.png
to
        var duration = this.buffer.duration; // correct duration value returned same as WebAudio
        console.log preview:
        https://cloud.githubusercontent.com/assets/5193884/22393549/7b130096-e4d6-11e6-83ff-4ebb78b9e42f.png

* Update mediaelement.js

* add wavesurfer.getPlaybackRate() (#939)

add getPlaybackRate method and return playback rate.
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.

2 participants