diff --git a/README.md b/README.md index 9d7b09ef6..a6f16040f 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,28 @@ -# Environment-aware Components +# Adaptive Loading An exploration into loading and rendering the most suitable version of a component based on signals exposed to the web (network, CPU, memory etc). +## Source & Components + +This repo contains several different pieces for the Adaptive Loading project: React Hooks, patterns for adaptive loading with different Web Platform signals and full applications. + +### Adaptive Loading patterns + +* [Network-aware loading](https://github.com/GoogleChromeLabs/network-aware-components/tree/master/cra-network-aware-loading) with create-react-app ([demo](https://adaptive-loading.web.app/cra-network-aware-loading/)) +* [Network-aware only-if-cached loading](https://github.com/GoogleChromeLabs/network-aware-components/tree/master/cra-network-aware-only-if-cached-loading) with create-react-app ([demo](https://adaptive-loading.web.app/cra-network-aware-only-if-cached-loading/)) +* [Network-aware code-splitting](https://github.com/GoogleChromeLabs/network-aware-components/tree/master/cra-network-aware-code-splitting) with create-react-app ([demo](https://adaptive-loading.web.app/cra-network-aware-code-splitting/)) +* [Network-aware data-fetching](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-network-aware-data-fetching) with create-react-app ([demo](https://adaptive-loading.web.app/cra-network-aware-data-fetching/)) +* [Battery considerate loading](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-battery-considerate-loading) with create-react-app ([demo](https://adaptive-loading.web.app/cra-battery-considerate-loading/)) +* [Memory considerate loading](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-memory-considerate-loading) with create-react-app ([demo](https://adaptive-loading.web.app/cra-memory-considerate-loading/)) +* [Memory considerate loading (SketchFab version)](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-memory-considerate-loading-sketchfab) with create-react-app ([demo](https://adaptive-loading.web.app/cra-memory-considerate-loading-sketchfab/)) +* [Device-class aware loading](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-device-class-aware-loading) ([demo](https://adaptive-loading.web.app/cra-device-class-aware-loading/)) +* [UA-aware code-splitting](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-ua-aware-code-splitting) with create-react-app ([demo](https://adaptive-loading.web.app/cra-ua-aware-code-splitting/)) + +### Full applications + +* [React Movie - network-aware components](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/react-movie-network-aware-loading) ([demo](https://adaptive-loading.web.app/react-movie-network-aware-loading/)) +* [React Shrine - network-aware code-splitting](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/react-shrine-network-aware-code-splitting) ([demo](https://adaptive-loading.web.app/react-shrine-network-aware-code-splitting/)) + ## Deployment Create Firebase Project by logging in to [console.firebase.google.com](https://console.firebase.google.com) and replace the default value in `/.firebaserc` and `/functions/.firebaserc` with the created Project ID. Or simply copy the default value from `/.firebaserc` or `/functions/.firebaserc` and paste as the Project ID when creating the Firebase Project. @@ -21,22 +42,6 @@ npm run build npm run deploy ``` -## Demos - -### Simpler -* [Network-aware loading](https://github.com/GoogleChromeLabs/network-aware-components/tree/master/cra-network-aware-component) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-network-aware-component/)) -* [Network-aware code-splitting](https://github.com/GoogleChromeLabs/network-aware-components/tree/master/cra-network-aware-code-splitting) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-network-aware-code-splitting/)) -* [Network-aware data-fetching](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-network-aware-data-fetching) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-network-aware-data-fetching/)) -* [Battery considerate loading](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-battery-considerate-loading) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-battery-considerate-loading/)) -* [Memory considerate loading](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-memory-considerate-loading) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-memory-considerate-loading/)) -* [Memory considerate loading (SketchFab version)](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-memory-considerate-loading-sketchfab) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-memory-considerate-loading-sketchfab/)) -* [Device-class aware loading](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-device-class-aware-loading) ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-device-class-aware-loading/)) -* [UA-aware code-splitting](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/cra-ua-aware-code-splitting) with create-react-app ([demo](https://us-central1-adaptive-loading.cloudfunctions.net/app/cra-ua-aware-code-splitting/)) - -### Advanced -* [React Movie - network-aware components](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/react-movie-network-aware-loading) -* [React Shrine - network-aware code-splitting](https://github.com/GoogleChromeLabs/environment-aware-components/tree/master/react-shrine-network-aware-code-splitting) - ## Team This project is brought to you by [Addy Osmani](https://github.com/addyosmani) and [Anton Karlovskiy](https://github.com/anton-karlovskiy). diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 64a68ed2e..ed63e1706 --- a/build.sh +++ b/build.sh @@ -8,6 +8,7 @@ craMemoryConsiderateLoading="cra-memory-considerate-loading" craMemoryConsiderateLoadingSketchfab="cra-memory-considerate-loading-sketchfab" craNetworkAwareCodeSplitting="cra-network-aware-code-splitting" craNetworkAwareComponent="cra-network-aware-loading" +craNetworkAwareOnlyIfCachedComponent="cra-network-aware-only-if-cached-loading" craNetworkAwareDataFetching="cra-network-aware-data-fetching" craUaAwareCodeSplitting="cra-ua-aware-code-splitting" reactMovieNetworkAwareComponents="react-movie-network-aware-loading" @@ -64,6 +65,14 @@ mkdir -p "${multipleBuildsPath}${craNetworkAwareComponent}" cp -r $individualBuildAllFiles "${multipleBuildsPath}${craNetworkAwareComponent}" cd .. +cd $craNetworkAwareOnlyIfCachedComponent +rm -rf node_modules build +npm install +npm run build +mkdir -p "${multipleBuildsPath}${craNetworkAwareOnlyIfCachedComponent}" +cp -r $individualBuildAllFiles "${multipleBuildsPath}${craNetworkAwareOnlyIfCachedComponent}" +cd .. + cd $craNetworkAwareDataFetching rm -rf node_modules build npm install diff --git a/cra-network-aware-only-if-cached-loading/package-lock.json b/cra-network-aware-only-if-cached-loading/package-lock.json index b838cb575..2d32e3fc6 100644 --- a/cra-network-aware-only-if-cached-loading/package-lock.json +++ b/cra-network-aware-only-if-cached-loading/package-lock.json @@ -1,5 +1,5 @@ { - "name": "cra-network-aware-loading", + "name": "cra-network-aware-force-cache-loading", "version": "0.1.0", "lockfileVersion": 1, "requires": true, @@ -2782,8 +2782,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -2801,13 +2800,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2820,18 +2817,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -2934,8 +2928,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -2945,7 +2938,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2958,20 +2950,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -2988,7 +2977,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3061,8 +3049,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -3072,7 +3059,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -3148,8 +3134,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -3179,7 +3164,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3197,7 +3181,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3236,13 +3219,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } }, @@ -6639,8 +6620,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -6658,13 +6638,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6677,18 +6655,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6791,8 +6766,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6802,7 +6776,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6815,20 +6788,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6845,7 +6815,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6918,8 +6887,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -6929,7 +6897,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7005,8 +6972,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -7036,7 +7002,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7054,7 +7019,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7093,13 +7057,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } }