Skip to content

Commit d29853f

Browse files
Merge pull request #92 from microsoftgraph/Multiple-Output-JS
Create two different output js files on with vendor polyfills and one without
2 parents 2983bd5 + 0abd896 commit d29853f

File tree

9 files changed

+25
-7
lines changed

9 files changed

+25
-7
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ The Microsoft Graph JavaScript client library is a lightweight wrapper around th
1818

1919
### Browser
2020

21-
Include [lib/graph-js-sdk-web.js](https://github.com/microsoftgraph/msgraph-sdk-javascript/raw/master/lib/graph-js-sdk-web.js) in your page.
21+
The library comes with two varieties of options, you can pick one based on your use case
22+
23+
1. If your application has polyfills for **Fetch-API** and **ES6-Promise**, then can just include [lib/graph-js-sdk-core.js](https://github.com/microsoftgraph/msgraph-sdk-javascript/raw/master/lib/graph-js-sdk-core.js) in your page.
24+
```html
25+
<script type="text/javascript" src="graph-js-sdk-core.js"></script>
26+
```
27+
28+
2. If your application does not have polyfills for **Fetch-API** and **ES6-Promise**, then you have to include [lib/graph-js-sdk-web.js](https://github.com/microsoftgraph/msgraph-sdk-javascript/raw/master/lib/graph-js-sdk-web.js) in your page.
2229
```html
2330
<script type="text/javascript" src="graph-js-sdk-web.js"></script>
2431
```

core-browserify.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var browserify = require('browserify');
2+
var b = browserify();
3+
b.add('./browser-wrapper.js');
4+
b.external("es6-promise");
5+
b.external("isomorphic-fetch");
6+
b.bundle().pipe(process.stdout);

lib/graph-js-sdk-core.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/graph-js-sdk-web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/GraphRequest.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/ResponseHandler.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
"uglify-js": "^3.4.5"
1919
},
2020
"scripts": {
21-
"build": "tsc && node node-browserify.js > lib/graph-js-sdk-web.js && uglifyjs ./lib/graph-js-sdk-web.js --output ./lib/graph-js-sdk-web.js",
21+
"compile": "tsc",
22+
"rollup-core": "node core-browserify.js > lib/graph-js-sdk-core.js && uglifyjs lib/graph-js-sdk-core.js --output lib/graph-js-sdk-core.js",
23+
"rollup-with-vendor": "node node-browserify.js > lib/graph-js-sdk-web.js && uglifyjs ./lib/graph-js-sdk-web.js --output ./lib/graph-js-sdk-web.js",
24+
"build-core": "npm run compile && npm run rollup-core",
25+
"build-with-vendor": "npm run compile && npm run rollup-with-vendor",
26+
"build": "npm run compile && npm run rollup-core && npm run rollup-with-vendor",
2227
"test": "mocha lib/spec/core",
2328
"test:types": "tsc --p spec/types && mocha spec/types"
2429
},

src/GraphRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Promise } from 'es6-promise'
22
import 'isomorphic-fetch';
33

4-
import { Options, URLComponents, GraphError, oDataQueryNames, GraphRequestCallback, PACKAGE_VERSION, DefaultRequestHeaders } from "./common"
4+
import { Options, URLComponents, oDataQueryNames, GraphRequestCallback, PACKAGE_VERSION, DefaultRequestHeaders } from "./common"
55
import { ResponseHandler } from "./ResponseHandler"
66
import { RequestMethod } from './RequestMethod';
77
import { ResponseType } from "./ResponseType";

src/ResponseHandler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {GraphRequest} from "./GraphRequest"
21
import {GraphRequestCallback, GraphError} from "./common"
32

43
export class ResponseHandler {

0 commit comments

Comments
 (0)