Skip to content

Commit f49923f

Browse files
committed
Merge branch 'master' into reorg-src
2 parents f8ce24a + ad6f080 commit f49923f

File tree

13 files changed

+228
-84
lines changed

13 files changed

+228
-84
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ node_modules
33
build/*
44
!build/README.md
55

6+
dist/*
7+
!dist/README.md
8+
69
npm-debug.log

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yolos!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Plotly, Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1-
# plotly.js
1+
# [plotly.js](https://plot.ly/javascript/getting-started/)
22

3-
The premier high-level javascript graphing library
3+
[![npm version](https://img.shields.io/npm/v/plotly.svg)](https://www.npmjs.com/package/plotly)
4+
5+
To get started, check out <https://plot.ly/javascript/getting-started/>!
6+
7+
## Table of contents
8+
9+
* [Quick start](#quick-start)
10+
* [Bugs and feature requests](#bugs-and-feature-requests)
11+
* [Documentation](#documentation)
12+
* [Contributing](#contributing)
13+
* [Community](#community)
14+
* [Clients for R, Python, and MATLAB](#clients-for-r-python-and-matlab)
15+
* [Creators](#creators)
16+
* [Copyright and license](#copyright-and-license)
17+
18+
19+
## Quick start
20+
21+
Several quick start options are available:
22+
23+
* [Download the latest release](https://github.com/plotly/plotly.js/releases/v1.0.0/plotly.js.zip).
24+
* Clone the repo: `git clone https://github.com/plotly/plotly.js.git`.
25+
* Install with [npm](https://www.npmjs.com): `npm install plotly`.
26+
* Use the plotly.js CDN hosted by Fastly:
27+
28+
```html
29+
<!-- Latest compiled and minified plotly.js JavaScript -->
30+
<script type="text/javascript" src="https://cdn.plot.ly/plotly-latest.min.js">
31+
```
32+
33+
Read the [Getting started page](https://plot.ly/javascript/getting-started/) for examples.
34+
35+
## Bugs and feature requests
36+
37+
Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/plotly/plotly.js/issues/new).
38+
39+
## Documentation
40+
41+
Plotly.js documentation, in the repo documentation, is built with [Jekyll](http://jekyllrb.com) and publicly hosted on GitHub Pages at <https://plot.ly/javascript/getting-started/>. The docs may also be run locally.
42+
43+
You can also suggest new documentation examples by submitting a [Codepen](http://codepen.io/tag/plotly/) on community.plot.ly (tagged [`plotly-js`](community.plot.ly/c/plotly-js).
44+
45+
## Contributing
46+
47+
Please read through our [contributing guidelines](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
48+
49+
## Community
50+
51+
Get updates on plotly.js's development and chat with the project maintainers and community members.
52+
53+
* Follow [@plotlygraphs on Twitter](https://twitter.com/plotlygraphs).
54+
* Implementation help may be found at Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)) or community.plot.ly (tagged [`plotly-js`](http://community.plot.ly/c/plotly-js).
55+
* Developers should use the keyword `plotly` on packages which modify or add to the functionality of plotly.js when distributing through [npm](https://www.npmjs.com/browse/keyword/plotly) or similar delivery mechanisms for maximum discoverability.
56+
* Direct developer email support can be purchased through a [Plotly Pro](https://plot.ly/products/cloud/) plan.
57+
58+
## Versioning
59+
60+
For transparency into our release cycle and in striving to maintain backward compatibility, plotly.js is maintained under [the Semantic Versioning guidelines](http://semver.org/).
61+
62+
See [the Releases section of our GitHub project](https://github.com/plotly/plotly.js/releases) for changelogs for each release version of plotly.js.
63+
64+
## Clients for R, Python, and MATLAB
65+
66+
Open-source clients to the plotly.js APIs are available at these links:
67+
68+
| | GitHub repo | Getting started |
69+
|---|--------|---------|
70+
|**R / RStudio**| [ropensci/plotly](https://github.com/ropensci/plotly) | [plot.ly/r/getting-started](https://plot.ly/r/getting-started) |
71+
|**Python / Pandas / IPython notebook**| [plotly/plotly.py](https://github.com/plotly/plotly.py) | [plot.ly/python/getting-started](https://plot.ly/python/getting-started) |
72+
|**MATLAB**| [plotly/matlab-api](https://github.com/plotly/matlab-api) | [plot.ly/matlab/getting-started](https://plot.ly/matlab/getting-started) |
73+
|**node.js**| [plotly/plotly-nodejs](https://github.com/plotly/plotly-nodejs) | [plot.ly/nodejs/getting-started/](https://plot.ly/nodejs/getting-started/) |
74+
|**Julia**| [plotly/Plotly.jl](https://github.com/plotly/Plotly.jl) | [plot.ly/julia/getting-started/](https://plot.ly/julia/getting-started/) |
75+
76+
plotly.js charts can also be created and saved online for free at [plot.ly/plot](https://plot.ly/plot).
77+
78+
## Creators
79+
80+
| | Github | Twitter |
81+
|---|--------|---------|
82+
|**Alex C. Johnson**| [@alexcjohnson](https://github.com/alexcjohnson) | |
83+
|**Étienne Tétreault-Pinard**| [@etpinard](https://github.com/etpinard) | [@etpinard](https://twitter.com/etpinard) |
84+
|**Mikola Lysenko**| [@mikolalysenko](https://github.com/mikolalysenko) | [@MikolaLysenko](https://twitter.com/MikolaLysenko) |
85+
|**Ben Postlethwaite**| [@bpostlethwaite](https://github.com/bpostlethwaite) | |
86+
|**Chris Parmer**| [@chriddyp](https://github.com/chriddyp) | |
87+
88+
## Copyright and license
89+
90+
Code and documentation copyright 2015 Plotly, Inc.
91+
Code released under [the MIT license](https://github.com/plotly/plotly.js/blob/master/LICENSE).
92+
Docs released under [Creative Commons](https://github.com/plotly/documentation/blob/source/LICENSE).

devtools/test_dashboard/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var browserify = require('browserify');
66
var ecstatic = require('ecstatic');
77
var _open = require('open');
88

9-
var makeWatchifiedBundle = require('../../tasks/watch_plotly');
9+
var makeWatchifiedBundle = require('../../tasks/util/make_watchified_bundle');
1010
var shortcutPaths = require('../../tasks/util/shortcut_paths');
1111
var constants = require('../../tasks/util/constants');
1212

tasks/bench.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

tasks/bundle.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var browserify = require('browserify');
44
var UglifyJS = require('uglify-js');
55

66
var compressAttributes = require('./util/compress_attributes');
7+
var appendVersion = require('./util/append_version');
78
var constants = require('./util/constants');
89

910
/*
@@ -24,7 +25,10 @@ try {
2425
fs.statSync(constants.pathToFontSVGBuild).isFile();
2526
}
2627
catch(e) {
27-
throw new Error('Please run `npm run preprocess` first');
28+
throw new Error([
29+
'build/ is missing a or more files',
30+
'Please run `npm run preprocess` first'
31+
].join('\n'));
2832
}
2933

3034

@@ -41,30 +45,43 @@ browserify(constants.pathToPlotlySrc, {
4145
if(!DEV) {
4246
fs.writeFile(
4347
constants.pathToPlotlyDistMin,
44-
UglifyJS.minify(buf.toString(), constants.uglifyOptions).code
48+
UglifyJS.minify(buf.toString(), constants.uglifyOptions).code,
49+
function() {
50+
appendVersion(
51+
constants.pathToPlotlyDistMin, {object: 'Plotly'}
52+
);
53+
}
4554
);
4655
}
4756
})
48-
.pipe(fs.createWriteStream(constants.pathToPlotlyDist));
57+
.pipe(fs.createWriteStream(constants.pathToPlotlyDist))
58+
.on('finish', function() {
59+
appendVersion(constants.pathToPlotlyDist, {object: 'Plotly', DEV: DEV});
60+
});
4961

5062

5163
// Browserify the geo assets
5264
browserify(constants.pathToPlotlyGeoAssetsSrc, {
5365
standalone: 'PlotlyGeoAssets'
5466
})
55-
.bundle(function(err, buf) {
67+
.bundle(function(err) {
5668
if(err) throw err;
5769
})
58-
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist));
59-
70+
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist))
71+
.on('finish', function() {
72+
appendVersion(constants.pathToPlotlyGeoAssetsDist, {object: 'PlotlyGeoAssets'});
73+
});
6074

6175

6276
// Browserify the plotly.js with meta
6377
browserify(constants.pathToPlotlySrc, {
6478
debug: DEV,
6579
standalone: 'Plotly'
6680
})
67-
.bundle(function(err, buf) {
81+
.bundle(function(err) {
6882
if(err) throw err;
6983
})
70-
.pipe(fs.createWriteStream(constants.pathToPlotlyDistWithMeta));
84+
.pipe(fs.createWriteStream(constants.pathToPlotlyDistWithMeta))
85+
.on('finish', function() {
86+
appendVersion(constants.pathToPlotlyDistWithMeta, {object: 'Plotly', DEV: DEV});
87+
});

tasks/citest.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

tasks/postpublish.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

tasks/test.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

tasks/util/append_version.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var fs = require('fs');
2+
3+
var pkg = require('../../package.json');
4+
5+
/**
6+
* Append package version to bundle
7+
*
8+
* @param {string} path path to bundle
9+
* @param {object} opts
10+
* - object {string} the standalone object in the bundle
11+
* - DEV {boolean} is this a DEV build?
12+
*/
13+
module.exports = function appendVersion(path, opts) {
14+
var txt = [
15+
opts.object,
16+
'.version=', '\'',
17+
pkg.version, opts.DEV ? '-dev' : '',
18+
'\'', ';'
19+
].join('');
20+
21+
fs.appendFile(path, txt, function(err) {
22+
if(err) throw err;
23+
}) ;
24+
};

tasks/util/make_watchified_bundle.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
var fs = require('fs');
2+
3+
var browserify = require('browserify');
4+
var watchify = require('watchify');
5+
6+
var compressAttributes = require('./compress_attributes');
7+
var appendVersion = require('./append_version');
8+
var formatBundleMsg = require('./format_bundle_msg');
9+
var constants = require('./constants');
10+
11+
/**
12+
* Make a plotly.js browserify bundle function watched by watchify.
13+
*
14+
* @param {function} onFirstBundleCallback executed when first bundle is completed
15+
*
16+
*/
17+
module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
18+
var b = browserify(constants.pathToPlotlySrc, {
19+
debug: true,
20+
standalone: 'Plotly',
21+
transform: [compressAttributes],
22+
cache: {},
23+
packageCache: {},
24+
plugin: [watchify]
25+
});
26+
27+
var firstBundle = true;
28+
29+
if(firstBundle) {
30+
console.log([
31+
'***',
32+
'Building the first bundle, this should take ~10 seconds',
33+
'***\n'
34+
].join(' '));
35+
}
36+
37+
b.on('update', bundle);
38+
formatBundleMsg(b, 'plotly.js');
39+
40+
function bundle() {
41+
b.bundle(function(err) {
42+
if(err) console.error(JSON.stringify(String(err)));
43+
44+
if(firstBundle) {
45+
onFirstBundleCallback();
46+
firstBundle = false;
47+
}
48+
})
49+
.pipe(
50+
fs.createWriteStream(constants.pathToPlotlyDist)
51+
)
52+
.on('finish', function() {
53+
appendVersion(constants.pathToPlotlyDist, {object: 'Plotly', DEV: true});
54+
});
55+
}
56+
57+
return bundle;
58+
};

tasks/watch_plotly.js

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,5 @@
1-
var fs = require('fs');
1+
var makeWatchifiedBundle = require('./util/make_watchified_bundle');
22

3-
var browserify = require('browserify');
4-
var watchify = require('watchify');
5-
6-
var compressAttributes = require('./util/compress_attributes');
7-
var formatBundleMsg = require('./util/format_bundle_msg');
8-
var constants = require('./util/constants');
9-
10-
/**
11-
* Make a browserify bundle function watched by watchify.
12-
*
13-
* @param {function} onFirstBundleCallback executed when first bundle is completed
14-
*
15-
*/
16-
function makeWatchifiedBundle(onFirstBundleCallback) {
17-
var b = browserify(constants.pathToPlotlySrc, {
18-
debug: true,
19-
standalone: 'Plotly',
20-
transform: [compressAttributes],
21-
cache: {},
22-
packageCache: {},
23-
plugin: [watchify]
24-
});
25-
26-
var firstBundle = true;
27-
28-
if(firstBundle) {
29-
console.log([
30-
'***',
31-
'Building the first bundle, this should take ~10 seconds',
32-
'***\n'
33-
].join(' '));
34-
}
35-
36-
b.on('update', bundle);
37-
formatBundleMsg(b, 'plotly.js');
38-
39-
function bundle() {
40-
b.bundle(function(err) {
41-
if(err) console.error(JSON.stringify(String(err)));
42-
43-
if(firstBundle) {
44-
onFirstBundleCallback();
45-
firstBundle = false;
46-
}
47-
})
48-
.pipe(
49-
fs.createWriteStream(constants.pathToPlotlyDist)
50-
);
51-
}
52-
53-
return bundle;
54-
}
55-
56-
// call watchifiedBundle if ran in CLI
57-
if(process.argv[1] === __filename) {
58-
var watchifiedBundle = makeWatchifiedBundle(function() {});
59-
watchifiedBundle();
60-
}
61-
62-
// export if required in
63-
module.exports = makeWatchifiedBundle;
3+
// make watchified bundle and run it!
4+
var watchifiedBundle = makeWatchifiedBundle(function() {});
5+
watchifiedBundle();

0 commit comments

Comments
 (0)