Skip to content

Commit

Permalink
Merge branch 'main' into locale-docs
Browse files Browse the repository at this point in the history
* main:
  Remove references of incorrect `options` argument for `companion.socket` (#3307)
  Upgrade linting to 2.0.0-0 (#3280)
  Release uppy@2.1.2, @uppy/robodog@2.1.3
  @uppy/core@2.1.2
  meta: update version references in docs
  Release @uppy/robodog@2.1.2
  @uppy/unsplash@2.0.3
  @uppy/aws-s3: use `Promise.allSettled` insead of custom utils (#3079)
  Convert sets to arrays prior to using spread operator to enable transpilation to ES5 (#3297)
  Add showRecordingLength to webcam types (#3303)
  Required meta fields UI (#3285)
  Update BACKLOG.md
  Release uppy@2.2.2
  @uppy/provider-views@2.0.5
  fix: @uppy/utils - `getFileType()` always returns a string (#3294)
  Remove yarn file
  @uppy/companion: fix Dockerfiles (#3291)
  @uppy/companion: use Node.js 16.x for Dockerfile (#3289)
  if an item is checked, it can’t be disabled (#3288)
  • Loading branch information
Murderlon committed Nov 10, 2021
2 parents de8c74b + 3fdc55b commit 725a277
Show file tree
Hide file tree
Showing 112 changed files with 383 additions and 285 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -19,3 +19,4 @@ website/src/_posts/2021-03-*.md
website/src/_posts/2021-04-*.md
website/src/_posts/2021-05-*.md
website/src/_posts/2021-06-*.md
website/src/docs/react-dashboard.md
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -43,7 +43,6 @@ module.exports = {
rules: {
// transloadit rules we are actually ok with in the uppy repo
'import/extensions': 'off',
'no-await-in-loop': 'off',
'object-shorthand': ['error', 'always'],
'strict': 'off',
'key-spacing': 'off',
Expand Down Expand Up @@ -79,6 +78,7 @@ module.exports = {
'global-require': ['warn'],
'import/no-unresolved': ['warn'],
'import/order': ['warn'],
'max-classes-per-file': ['warn'],
'no-mixed-operators': ['warn'],
'no-param-reassign': ['warn'],
'no-redeclare': ['warn'],
Expand Down
24 changes: 2 additions & 22 deletions BACKLOG.md
Expand Up @@ -5,32 +5,12 @@
These are ideas that are planned for specific versions or act as a backlog without a clear date.
PRs are welcome! Please do open an issue to discuss first if it's a big feature, priorities may have changed after something was added here.

## `2.0.0`

- [x] Drop IE10 (officially), drop IE11 polyfills? (@aduh95)
- [x] *: upgrade to Preact X (@murderlon)
- [x] chore: hunt down most `@TODO`s and either fix, or remove, or move to github issues/changelog backlog (@murderlon)
- [x] core: consider removing Preact from `Plugin` (maybe have a `(ui)Plugin extends BasePlugin`?) as pointed out on Reddit https://www.reddit.com/r/javascript/comments/bhkx5k/uppy_10_your_best_friend_in_file_uploading/ (@murderlon)
- [x] core: force the `new` keyword when instantiating Uppy — now we support both `new Uppy()` and `Uppy()` which is harder to maintain and might lead to confusion (@arturi)
- [ ] core: maybe we remove `file.name` and only keep `file.meta.name`; we can change the file.name here actually because it's just a plain object. we can't change the file.data.name where data is a File instance from an input or something. For XHRUpload, where we put the File instance in a FormData object and it uses the unchangeable .name property (@arturi)
- [x] core: pass full file object to `onBeforeFileAdded`. Maybe also check restrictions before calling the callbacks: https://github.com/transloadit/uppy/pull/1594 (@arturi)
- [x] core/dashboard: replace `poweredBy` and `exceedsSize` locale keys by word order aware versions, see PR #2077 (@goto-bus-stop)
- [x] dashboard: set default `trigger: null`, see https://github.com/transloadit/uppy/pull/2144#issuecomment-600581690 (@arturi)
- [x] form: make the `multipleResults` option `true` by default (@arturi)
- [x] locales: Remove the old es_GL name alias for gl_ES. Keep gl_ES only (@arturi)
- [x] providers: remove `serverHeaders` https://github.com/transloadit/uppy/pull/1861 (@mifi)
- [x] transloadit: remove `UPPY_SERVER` constant (@mifi)
- [x] tus: set the `limit` option to a sensible default, like 5 (10?) (@arturi)
- [x] xhr: set the `limit` option to a sensible default, like 5 (10?) (@arturi)
- [x] xhr: change default name depending on whether `bundle` is set `files[]` (`true`) vs `file` (default) (#782) (@aduh95)
- [x] providers: allow changing provider name title through locale https://github.com/transloadit/uppy/issues/2279 (@goto-bus-stop)
- [x] tus: remove `autoRetry` option (throw error at runtime if it is explicitly given) (@aduh95)
- [x] dashboard: showing links to files should be turned off by default (it's great for devs, they can opt-in, but for end-user UI it's weird and can even lead to problems) (@arturi)

## `3.0.0`

- [ ] Switch to ES Modules (ESM)
- [ ] @uppy/image-editor: Remove silly hack to work around non-ESM.
- [ ] Consider updating the name of @uppy/aws-s3 and @uppy/aws-s3-multipart to reflect it also supports Google Cloud Storage, Wasabi, and other cloud providers.
- [ ] Consider fixing all locale files to follow the bcp-47 standard (nl_NL --> nl-NL)

## `4.0.0`

Expand Down
2 changes: 1 addition & 1 deletion BUNDLE-README.md
@@ -1,7 +1,7 @@
# Uppy

Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can use
this from a CDN (`<script src="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.js"></script>`) or bundle it with your webapp.
this from a CDN (`<script src="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.js"></script>`) or bundle it with your webapp.

Note that the recommended way to use Uppy is to install it with yarn/npm and use a
bundler like Webpack so that you can create a smaller custom build with only the
Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -69,18 +69,18 @@ $ npm install @uppy/core @uppy/dashboard @uppy/tus

We recommend installing from npm and then using a module bundler such as [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/).

Add CSS [uppy.min.css](https://releases.transloadit.com/uppy/v2.2.1/uppy.min.css), either to your HTML page’s `<head>` or include in JS, if your bundler of choice supports it — transforms and plugins are available for Browserify and Webpack.
Add CSS [uppy.min.css](https://releases.transloadit.com/uppy/v2.2.3/uppy.min.css), either to your HTML page’s `<head>` or include in JS, if your bundler of choice supports it — transforms and plugins are available for Browserify and Webpack.

Alternatively, you can also use a pre-built bundle from Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object.

> ⚠️ The bundle consists of most Uppy plugins, so this method is not recommended for production, as your users will have to download all plugins when you are likely using only a few.
```html
<!-- 1. Add CSS to `<head>` -->
<link href="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.css" rel="stylesheet">
<link href="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.css" rel="stylesheet">

<!-- 2. Add JS before the closing `</body>` -->
<script src="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.js"></script>
<script src="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.js"></script>

<!-- 3. Initialize -->
<div class="UppyDragDrop"></div>
Expand Down Expand Up @@ -190,7 +190,7 @@ If you’re using Uppy from CDN, those polyfills are already included in the leg
bundle, so no need to include anything additionally:
```html
<script src="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.js"></script>
<script src="https://releases.transloadit.com/uppy/v2.2.3/uppy.legacy.min.js"></script>
```
## FAQ
Expand Down
8 changes: 0 additions & 8 deletions bin/after-version-bump.js
Expand Up @@ -13,7 +13,6 @@
// NOTE this _amends_ the previous commit, which should
// already be a "Release" commit generated by bin/release.

const lastCommitMessage = require('last-commit-message')
const { spawn } = require('child_process')
const { readFile, writeFile } = require('fs/promises')
const once = require('events.once')
Expand Down Expand Up @@ -43,7 +42,6 @@ async function updateVersions (files, packageName) {
console.log('replacing', replacements, 'in', files.length, 'files')

for (const f of files) {
// eslint-disable-next-line no-await-in-loop
await replaceInFile(f, replacements)
}
}
Expand Down Expand Up @@ -78,12 +76,6 @@ async function main () {
process.exit(0)
}

const message = await lastCommitMessage()
if (message.trim() !== 'Release') {
console.error(`Last commit is not a release commit, but '${message}'`)
process.exit(1)
}

const files = await globby([
'README.md',
'BUNDLE-README.md',
Expand Down
14 changes: 7 additions & 7 deletions bin/build-bundle.js
Expand Up @@ -96,17 +96,17 @@ const methods = [
buildBundle(
'./packages/uppy/index.js',
'./packages/uppy/dist/uppy.js',
{ standalone: 'Uppy' }
{ standalone: 'Uppy' },
).then(minifyBundle),
buildBundle(
'./packages/uppy/bundle.js',
'./packages/uppy/dist/uppy.legacy.js',
{ standalone: 'Uppy (with polyfills)' }
{ standalone: 'Uppy (with polyfills)' },
).then(transpileDownForIE),
buildBundle(
'./packages/@uppy/robodog/bundle.js',
'./packages/@uppy/robodog/dist/robodog.js',
{ standalone: 'Robodog' }
{ standalone: 'Robodog' },
).then(minifyBundle),
]

Expand All @@ -118,17 +118,17 @@ glob.sync(localePackagePath).forEach((localePath) => {
buildBundle(
`./packages/@uppy/locales/src/${localeName}.js`,
`./packages/@uppy/locales/dist/${localeName}.min.js`,
{ minify: true }
)
{ minify: true },
),
)
})

// Add BUNDLE-README.MD
methods.push(
fs.promises.copyFile(
`${__dirname}/../BUNDLE-README.md`,
`./packages/uppy/dist/README.md`
)
`./packages/uppy/dist/README.md`,
),
)

Promise.all(methods).then(() => {
Expand Down
6 changes: 2 additions & 4 deletions bin/build-css.js
Expand Up @@ -23,7 +23,6 @@ function handleErr (err) {
async function compileCSS () {
const files = await glob('packages/{,@uppy/}*/src/style.scss')

/* eslint-disable no-await-in-loop */
for (const file of files) {
const importedFiles = new Set()
const scssResult = await renderScss({
Expand Down Expand Up @@ -78,7 +77,7 @@ async function compileCSS () {
await writeFile(outfile, postcssResult.css)
console.info(
chalk.green('✓ Built Uppy CSS:'),
chalk.magenta(path.relative(cwd, outfile))
chalk.magenta(path.relative(cwd, outfile)),
)

const minifiedResult = await postcss([
Expand All @@ -90,10 +89,9 @@ async function compileCSS () {
await writeFile(outfile.replace(/\.css$/, '.min.css'), minifiedResult.css)
console.info(
chalk.green('✓ Minified Bundle CSS:'),
chalk.magenta(path.relative(cwd, outfile).replace(/\.css$/, '.min.css'))
chalk.magenta(path.relative(cwd, outfile).replace(/\.css$/, '.min.css')),
)
}
/* eslint-enable no-await-in-loop */
}

compileCSS().then(() => {
Expand Down
4 changes: 2 additions & 2 deletions bin/build-lib.js
Expand Up @@ -34,7 +34,7 @@ async function buildLib () {
const metaMtime = Math.max(...metaMtimes)

const files = await glob(SOURCE)
/* eslint-disable no-await-in-loop, no-continue */
/* eslint-disable no-continue */
for (const file of files) {
if (IGNORE.test(file)) {
continue
Expand All @@ -60,7 +60,7 @@ async function buildLib () {
])
console.log(chalk.green('Compiled lib:'), chalk.magenta(libFile))
}
/* eslint-enable no-await-in-loop, no-continue */
/* eslint-enable no-continue */
}

console.log('Using Babel version:', require('@babel/core/package.json').version)
Expand Down
2 changes: 1 addition & 1 deletion bin/upload-to-cdn.js
Expand Up @@ -85,7 +85,7 @@ async function getLocalDistFiles (packagePath) {
files.map(async (f) => [
f,
await readFile(path.join(packagePath, 'dist', f)),
])
]),
)

return new Map(entries)
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-companion/server.js
Expand Up @@ -52,4 +52,4 @@ const server = app.listen(3020, () => {
console.log('listening on port 3020')
})

companion.socket(server, options)
companion.socket(server)
4 changes: 2 additions & 2 deletions examples/cdn-example/index.html
Expand Up @@ -4,11 +4,11 @@
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.css" rel="stylesheet">
<link href="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.css" rel="stylesheet">
</head>
<body>
<button id="uppyModalOpener">Open Modal</button>
<script src="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.js"></script>
<script src="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.js"></script>
<script>
const uppy = new Uppy.Core({debug: true, autoProceed: false})
.use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
Expand Down
2 changes: 1 addition & 1 deletion examples/redux/main.js
Expand Up @@ -25,7 +25,7 @@ const reducer = combineReducers({

let enhancer = applyMiddleware(
uppyReduxStore.middleware(),
logger
logger,
)
if (typeof __REDUX_DEVTOOLS_EXTENSION__ !== 'undefined') {
// eslint-disable-next-line no-undef
Expand Down
2 changes: 1 addition & 1 deletion examples/transloadit-textarea/index.html
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://releases.transloadit.com/uppy/robodog/v2.0.0-alpha.0/robodog.css">
<link rel="stylesheet" href="https://releases.transloadit.com/uppy/robodog/v2.1.3/robodog.css">
<style>
body {
font-family: Roboto, Open Sans;
Expand Down
8 changes: 4 additions & 4 deletions examples/transloadit-textarea/main.js
Expand Up @@ -26,7 +26,7 @@ class MarkdownTextarea {
this.uploadLine.classList.add('mdtxt-upload')

this.uploadLine.appendChild(
document.createTextNode('Upload an attachment')
document.createTextNode('Upload an attachment'),
)
}

Expand Down Expand Up @@ -111,7 +111,7 @@ class MarkdownTextarea {
// Was cancelled
if (result == null) return
this.insertAttachments(
this.matchFilesAndThumbs(result.results)
this.matchFilesAndThumbs(result.results),
)
}).catch((err) => {
console.error(err)
Expand All @@ -130,7 +130,7 @@ class MarkdownTextarea {
// Was cancelled
if (result == null) return
this.insertAttachments(
this.matchFilesAndThumbs(result.results)
this.matchFilesAndThumbs(result.results),
)
}).catch((err) => {
console.error(err)
Expand All @@ -140,7 +140,7 @@ class MarkdownTextarea {
}

const textarea = new MarkdownTextarea(
document.querySelector('#new textarea')
document.querySelector('#new textarea'),
)
textarea.install()

Expand Down
4 changes: 2 additions & 2 deletions examples/uppy-with-companion/client/index.html
Expand Up @@ -4,11 +4,11 @@
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.css" rel="stylesheet">
<link href="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.css" rel="stylesheet">
</head>
<body>
<button id="uppyModalOpener">Open Modal</button>
<script src="https://releases.transloadit.com/uppy/v2.2.1/uppy.min.js"></script>
<script src="https://releases.transloadit.com/uppy/v2.2.3/uppy.min.js"></script>
<script>
const uppy = new Uppy.Core({debug: true, autoProceed: false})
.use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
Expand Down
2 changes: 1 addition & 1 deletion examples/uppy-with-companion/server/index.js
Expand Up @@ -66,7 +66,7 @@ app.use((err, req, res) => {
res.status(err.status || 500).json({ message: err.message, error: err })
})

companion.socket(app.listen(3020), uppyOptions)
companion.socket(app.listen(3020))

console.log('Welcome to Companion!')
console.log(`Listening on http://0.0.0.0:${3020}`)
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -68,17 +68,18 @@
"deep-freeze": "^0.0.1",
"disc": "^1.3.3",
"eslint": "^8.0.0",
"eslint-config-transloadit": "^1.2.0",
"eslint-config-transloadit": "^2.0.0",
"eslint-plugin-compat": "^3.8.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^25.0.0",
"eslint-plugin-jsdoc": "^36.0.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-markdown": "^2.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-import": "^0.0.1",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"events.once": "^2.0.2",
"exorcist": "^2.0.0",
"fakefile": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/aws-s3-multipart/src/MultipartUploader.js
Expand Up @@ -254,7 +254,7 @@ class MultipartUploader {

if (typeof result?.presignedUrls !== 'object') {
throw new TypeError(
'AwsS3/Multipart: Got incorrect result from `prepareUploadParts()`, expected an object `{ presignedUrls }`.'
'AwsS3/Multipart: Got incorrect result from `prepareUploadParts()`, expected an object `{ presignedUrls }`.',
)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/aws-s3-multipart/src/index.js
Expand Up @@ -294,7 +294,7 @@ module.exports = class AwsS3Multipart extends BasePlugin {
protocol: 's3-multipart',
size: file.data.size,
metadata: file.meta,
}
},
).then((res) => {
this.uppy.setFileState(file.id, { serverToken: res.token })
file = this.uppy.getFile(file.id)
Expand Down
8 changes: 4 additions & 4 deletions packages/@uppy/aws-s3-multipart/src/index.test.js
Expand Up @@ -28,7 +28,7 @@ describe('AwsS3Multipart', () => {
const opts = {}

expect(() => awsS3Multipart.opts.createMultipartUpload(file)).toThrow(
err
err,
)
expect(() => awsS3Multipart.opts.listParts(file, opts)).toThrow(err)
expect(() => awsS3Multipart.opts.completeMultipartUpload(file, opts)).toThrow(err)
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('AwsS3Multipart', () => {

it('Calls the prepareUploadParts function totalChunks / limit times', async () => {
const scope = nock(
'https://bucket.s3.us-east-2.amazonaws.com'
'https://bucket.s3.us-east-2.amazonaws.com',
).defaultReplyHeaders({
'access-control-allow-method': 'PUT',
'access-control-allow-origin': '*',
Expand Down Expand Up @@ -103,15 +103,15 @@ describe('AwsS3Multipart', () => {
await core.upload()

expect(
awsS3Multipart.opts.prepareUploadParts.mock.calls.length
awsS3Multipart.opts.prepareUploadParts.mock.calls.length,
).toEqual(1)

scope.done()
})

it('Calls prepareUploadParts with a Math.ceil(limit / 2) minimum, instead of one at a time for the remaining chunks after the first limit batch', async () => {
const scope = nock(
'https://bucket.s3.us-east-2.amazonaws.com'
'https://bucket.s3.us-east-2.amazonaws.com',
).defaultReplyHeaders({
'access-control-allow-method': 'PUT',
'access-control-allow-origin': '*',
Expand Down

0 comments on commit 725a277

Please sign in to comment.