From ac07bcf0cbf8454ef9d1ef303afde0eb019eb019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 14 Jun 2018 15:07:45 +0200 Subject: [PATCH] Move `ProviderView` to `@uppy/provider-views`. Steps taken: ```bash cp -R package-template packages/@uppy/provider-views vim packages/@uppy/provider-views/{README.md,package.json} vim src/plugins/{Dropbox,GoogleDrive,Instagram}/index.js # Update require()s vim src/index.js # Update require() ``` --- packages/@uppy/provider-views/LICENSE | 21 +++++++++ packages/@uppy/provider-views/README.md | 45 +++++++++++++++++++ packages/@uppy/provider-views/package.json | 28 ++++++++++++ .../@uppy/provider-views/src}/AuthView.js | 0 .../@uppy/provider-views/src}/Breadcrumbs.js | 0 .../@uppy/provider-views/src}/Browser.js | 0 .../@uppy/provider-views/src}/Filter.js | 0 .../provider-views/src}/FooterActions.js | 0 .../@uppy/provider-views/src}/Item.js | 0 .../@uppy/provider-views/src}/ItemList.js | 0 .../@uppy/provider-views/src}/Loader.js | 0 .../@uppy/provider-views/src}/index.js | 0 .../@uppy/provider-views/types/index.d.ts | 0 src/index.js | 4 +- src/plugins/Dropbox/index.js | 4 +- src/plugins/GoogleDrive/index.js | 4 +- src/plugins/Instagram/index.js | 4 +- 17 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 packages/@uppy/provider-views/LICENSE create mode 100644 packages/@uppy/provider-views/README.md create mode 100644 packages/@uppy/provider-views/package.json rename {src/views/ProviderView => packages/@uppy/provider-views/src}/AuthView.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/Breadcrumbs.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/Browser.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/Filter.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/FooterActions.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/Item.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/ItemList.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/Loader.js (100%) rename {src/views/ProviderView => packages/@uppy/provider-views/src}/index.js (100%) create mode 100644 packages/@uppy/provider-views/types/index.d.ts diff --git a/packages/@uppy/provider-views/LICENSE b/packages/@uppy/provider-views/LICENSE new file mode 100644 index 000000000..c23747330 --- /dev/null +++ b/packages/@uppy/provider-views/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Transloadit + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@uppy/provider-views/README.md b/packages/@uppy/provider-views/README.md new file mode 100644 index 000000000..d94a28c50 --- /dev/null +++ b/packages/@uppy/provider-views/README.md @@ -0,0 +1,45 @@ +# @uppy/provider-views + +Uppy logo: a superman puppy in a pink suit + + +Build Status + +View library for Uppy remote provider plugins. + +Uppy is being developed by the folks at [Transloadit](https://transloadit.com), a versatile file encoding service. + +## Example + +```js +const Plugin = require('@uppy/core/lib/plugin') +const ProviderViews = require('@uppy/provider-views') + +class GoogleDrive extends Plugin { + constructor () { /* snip */ } + install () { + this.view = new ProviderViews(this) + // snip + } + + render (state) { + return this.view.render(state) + } +} +``` + +## Installation + +> Unless you are creating a custom provider plugin, you do not need to install this. + +```bash +$ npm install @uppy/provider-views --save +``` + +## Documentation + +Documentation for this plugin can be found on the [Uppy website](https://uppy.io/docs/DOC_PAGE_HERE). + +## License + +[The MIT License](./LICENSE). diff --git a/packages/@uppy/provider-views/package.json b/packages/@uppy/provider-views/package.json new file mode 100644 index 000000000..166b34f7b --- /dev/null +++ b/packages/@uppy/provider-views/package.json @@ -0,0 +1,28 @@ +{ + "name": "@uppy/provider-views", + "description": "View library for Uppy remote provider plugins.", + "version": "0.25.5", + "license": "MIT", + "main": "lib/index.js", + "jsnext:main": "src/index.js", + "types": "types/index.d.ts", + "keywords": [ + "file uploader", + "plugin name and other keywords", + "uppy", + "uppy-plugin" + ], + "homepage": "https://uppy.io", + "bugs": { + "url": "https://github.com/transloadit/uppy/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/transloadit/uppy.git" + }, + "dependencies": { + "@uppy/utils": "^0.25.5", + "classnames": "^2.2.6", + "preact": "^8.2.9" + } +} diff --git a/src/views/ProviderView/AuthView.js b/packages/@uppy/provider-views/src/AuthView.js similarity index 100% rename from src/views/ProviderView/AuthView.js rename to packages/@uppy/provider-views/src/AuthView.js diff --git a/src/views/ProviderView/Breadcrumbs.js b/packages/@uppy/provider-views/src/Breadcrumbs.js similarity index 100% rename from src/views/ProviderView/Breadcrumbs.js rename to packages/@uppy/provider-views/src/Breadcrumbs.js diff --git a/src/views/ProviderView/Browser.js b/packages/@uppy/provider-views/src/Browser.js similarity index 100% rename from src/views/ProviderView/Browser.js rename to packages/@uppy/provider-views/src/Browser.js diff --git a/src/views/ProviderView/Filter.js b/packages/@uppy/provider-views/src/Filter.js similarity index 100% rename from src/views/ProviderView/Filter.js rename to packages/@uppy/provider-views/src/Filter.js diff --git a/src/views/ProviderView/FooterActions.js b/packages/@uppy/provider-views/src/FooterActions.js similarity index 100% rename from src/views/ProviderView/FooterActions.js rename to packages/@uppy/provider-views/src/FooterActions.js diff --git a/src/views/ProviderView/Item.js b/packages/@uppy/provider-views/src/Item.js similarity index 100% rename from src/views/ProviderView/Item.js rename to packages/@uppy/provider-views/src/Item.js diff --git a/src/views/ProviderView/ItemList.js b/packages/@uppy/provider-views/src/ItemList.js similarity index 100% rename from src/views/ProviderView/ItemList.js rename to packages/@uppy/provider-views/src/ItemList.js diff --git a/src/views/ProviderView/Loader.js b/packages/@uppy/provider-views/src/Loader.js similarity index 100% rename from src/views/ProviderView/Loader.js rename to packages/@uppy/provider-views/src/Loader.js diff --git a/src/views/ProviderView/index.js b/packages/@uppy/provider-views/src/index.js similarity index 100% rename from src/views/ProviderView/index.js rename to packages/@uppy/provider-views/src/index.js diff --git a/packages/@uppy/provider-views/types/index.d.ts b/packages/@uppy/provider-views/types/index.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/index.js b/src/index.js index 9254f5718..07cebb6d7 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ const Core = require('@uppy/core') const server = require('@uppy/server-utils') // Reusable views -const views = require('./views') +const ProviderView = require('@uppy/provider-views') // Parent const Plugin = require('@uppy/core/lib/Plugin') @@ -38,7 +38,7 @@ const ReduxDevTools = require('./plugins/ReduxDevTools') module.exports = { Core, - views, + views: { ProviderView }, server, Plugin, StatusBar, diff --git a/src/plugins/Dropbox/index.js b/src/plugins/Dropbox/index.js index 5a62ea076..961b31c6b 100644 --- a/src/plugins/Dropbox/index.js +++ b/src/plugins/Dropbox/index.js @@ -1,6 +1,6 @@ const Plugin = require('@uppy/core/lib/Plugin') const { Provider } = require('@uppy/server-utils') -const { ProviderView } = require('../../views') +const ProviderViews = require('@uppy/provider-views') const icons = require('./icons') const { h } = require('preact') @@ -39,7 +39,7 @@ module.exports = class Dropbox extends Plugin { } install () { - this.view = new ProviderView(this) + this.view = new ProviderViews(this) // Set default state for Dropbox this.setPluginState({ authenticated: false, diff --git a/src/plugins/GoogleDrive/index.js b/src/plugins/GoogleDrive/index.js index 41fdb6627..a985cfe3c 100644 --- a/src/plugins/GoogleDrive/index.js +++ b/src/plugins/GoogleDrive/index.js @@ -1,6 +1,6 @@ const Plugin = require('@uppy/core/lib/Plugin') const { Provider } = require('@uppy/server-utils') -const { ProviderView } = require('../../views') +const ProviderViews = require('@uppy/provider-views') const { h } = require('preact') module.exports = class GoogleDrive extends Plugin { @@ -34,7 +34,7 @@ module.exports = class GoogleDrive extends Plugin { } install () { - this.view = new ProviderView(this) + this.view = new ProviderViews(this) // Set default state for Google Drive this.setPluginState({ authenticated: false, diff --git a/src/plugins/Instagram/index.js b/src/plugins/Instagram/index.js index 11689a079..826a2d5e7 100644 --- a/src/plugins/Instagram/index.js +++ b/src/plugins/Instagram/index.js @@ -1,6 +1,6 @@ const Plugin = require('@uppy/core/lib/Plugin') const { Provider } = require('@uppy/server-utils') -const { ProviderView } = require('../../views') +const ProviderViews = require('@uppy/provider-views') const { h } = require('preact') module.exports = class Instagram extends Plugin { @@ -37,7 +37,7 @@ module.exports = class Instagram extends Plugin { } install () { - this.view = new ProviderView(this, { + this.view = new ProviderViews(this, { viewType: 'grid', showTitles: false, showFilter: false,