Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
171 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
build/ | ||
coverage/ | ||
node_modules/ | ||
npm/ | ||
npm-debug.log | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,39 @@ | ||
const globals = { | ||
'apollo-client': 'apollo', | ||
'rxjs/Observable': 'Rx', | ||
'rxjs/Observer': 'Rx', | ||
'rxjs/Subscription': 'Rx', | ||
'rxjs/Subscriber': 'Rx', | ||
'rxjs/Operator': 'Rx', | ||
|
||
'rxjs/symbol/observable': 'Rx.Symbol', | ||
|
||
'rxjs/scheduler/AsyncScheduler': 'Rx.Scheduler.async', | ||
|
||
'rxjs/observable/combineLatest': 'Rx.Observable', | ||
|
||
'rxjs/operator/observeOn': 'Rx.Observable.prototype', | ||
'rxjs/operator/switchMap': 'Rx.Observable.prototype' | ||
} | ||
|
||
export default { | ||
entry: 'build/src/index.js', | ||
dest: 'build/bundles/apollo-rxjs.umd.js', | ||
format: 'umd', | ||
sourceMap: true, | ||
exports: 'named', | ||
moduleName: 'apollo.rxjs', | ||
globals: { | ||
'apollo-client': 'apollo', | ||
'rxjs/Observable': 'Rx', | ||
'rxjs/Observer': 'Rx', | ||
'rxjs/Subscription': 'Rx', | ||
'rxjs/Subscriber': 'Rx', | ||
'rxjs/Operator': 'Rx', | ||
|
||
'rxjs/symbol/observable': 'Rx.Symbol', | ||
|
||
'rxjs/scheduler/AsyncScheduler': 'Rx.Scheduler.async', | ||
globals, | ||
onwarn | ||
} | ||
|
||
'rxjs/observable/combineLatest': 'Rx.Observable', | ||
function onwarn(message) { | ||
const suppressed = [ | ||
'UNRESOLVED_IMPORT', | ||
'THIS_IS_UNDEFINED' | ||
]; | ||
|
||
'rxjs/operator/observeOn': 'Rx.Observable.prototype', | ||
'rxjs/operator/switchMap': 'Rx.Observable.prototype' | ||
if (!suppressed.find(code => message.code === code)) { | ||
return console.warn(message.message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh -e | ||
|
||
|
||
# When we publish to npm, the published files are available in the root | ||
# directory, which allows for a clean include or require of sub-modules. | ||
# | ||
# var language = require('apollo-client-rxjs/rxify'); | ||
# | ||
|
||
# Clear the built output | ||
rm -rf ./build | ||
|
||
# Compile new files | ||
npm run build | ||
|
||
# Make sure the ./npm directory is empty | ||
rm -rf ./npm | ||
mkdir ./npm | ||
|
||
# Copy all files from ./lib/src to /npm | ||
cd ./build/src && cp -r ./ ../../npm/ | ||
# Copy also the umd bundle with the source map file | ||
cd ../bundles | ||
cp apollo-rxjs.umd.js ../../npm/ && cp apollo-rxjs.umd.js.map ../../npm/ | ||
|
||
# Back to the root directory | ||
cd ../../ | ||
|
||
# Ensure a vanilla package.json before deploying so other tools do not interpret | ||
# The built output as requiring any further transformation. | ||
node -e "var package = require('./package.json'); \ | ||
delete package.scripts; \ | ||
delete package.devDependencies; \ | ||
package.main = 'apollo-rxjs.umd.js'; \ | ||
package.module = 'index.js'; \ | ||
package.typings = 'index.d.ts'; \ | ||
var fs = require('fs'); \ | ||
fs.writeFileSync('./npm/package.json', JSON.stringify(package, null, 2)); \ | ||
" | ||
|
||
|
||
# Copy few more files to ./npm | ||
cp README.md npm/ | ||
|
||
echo 'deploying to npm...' | ||
cd npm && npm publish && git push --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.