Skip to content

Commit

Permalink
Merge branch 'main' into ts-core
Browse files Browse the repository at this point in the history
* main:
  Migrate to AWS-SDK V3 syntax (#4810)
  @uppy/utils: fix import in test files (#4806)
  Fix onBeforeFileAdded with Golden Retriever (#4799)
  @uppy/image-editor: respect `cropperOptions.initialAspectRatio` (#4805)
  Release: uppy@3.20.0 (#4804)
  • Loading branch information
Murderlon committed Dec 5, 2023
2 parents 521e4df + a116db5 commit ca98717
Show file tree
Hide file tree
Showing 20 changed files with 132 additions and 81 deletions.
2 changes: 1 addition & 1 deletion BUNDLE-README.md
Original file line number Diff line number Diff line change
@@ -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/v3.19.1/uppy.min.js"></script>`) or bundle it with your webapp.
this from a CDN (`<script src="https://releases.transloadit.com/uppy/v3.20.0/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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ Please add your entries in this format:

In the current stage we aim to release a new version at least every month.

## 3.20.0

Released: 2023-11-24

| Package | Version | Package | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/companion-client | 3.6.1 | @uppy/store-default | 3.1.0 |
| @uppy/locales | 3.5.0 | uppy | 3.20.0 |

- meta: uppy CDN: Export UIPlugin and BasePlugin (Artur Paikin / #4774)
- @uppy/locales: Add missing translations to de_DE (Leonhard Melzer / #4800)
- @uppy/store-default: refactor to typescript (Antoine du Hamel / #4785)
- meta: improve js2ts script (Antoine du Hamel / #4786)
- @uppy/companion-client: fix log type error (Mikael Finstad / #4766)
- @uppy/companion-client: revert breaking change (Antoine du Hamel / #4801)
- @uppy/locales: use TypeScript for source files (Antoine du Hamel / #4779)
- meta: migrate AWS SDK v2 to v3 in `bin/uploadcdn` (Trivikram Kamat / #4776)


## 3.19.1

Released: 2023-11-12
Expand Down
108 changes: 56 additions & 52 deletions README.md

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions bin/upload-to-cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
const path = require('node:path')
const { pipeline, finished } = require('node:stream/promises')
const { readFile } = require('node:fs/promises')
const { S3 } = require('@aws-sdk/client-s3');
const { S3Client, ListObjectsV2Command, PutObjectCommand } = require('@aws-sdk/client-s3');

const packlist = require('npm-packlist')
const tar = require('tar')
Expand Down Expand Up @@ -109,7 +109,7 @@ async function main (packageName, version) {
// where we force push a local build
if (version?.startsWith('-')) version = undefined // eslint-disable-line no-param-reassign

const s3 = new S3({
const s3Client = new S3Client({
credentials: {
accessKeyId: process.env.EDGLY_KEY,
secretAccessKey: process.env.EDGLY_SECRET,
Expand Down Expand Up @@ -144,11 +144,12 @@ async function main (packageName, version) {

const outputPath = path.posix.join(dirName, `v${version}`)

const { Contents: existing } = await s3.listObjects({
const { Contents: existing } = await s3Client.send(new ListObjectsV2Command({
Bucket: AWS_BUCKET,
Prefix: outputPath,
})
if (existing.length > 0) {
}))

if (existing?.length > 0) {
if (process.argv.includes('--force')) {
console.warn(`WARN Release files for ${dirName} v${version} already exist, overwriting...`)
} else {
Expand All @@ -174,16 +175,16 @@ async function main (packageName, version) {
for (const [filename, buffer] of files.entries()) {
const key = path.posix.join(outputPath, filename)
console.log(`pushing s3://${AWS_BUCKET}/${key}`)
await s3.putObject({
await s3Client.send(new PutObjectCommand({
Bucket: AWS_BUCKET,
Key: key,
ContentType: mime.lookup(filename),
Body: buffer,
})
}))
}
}

main(...process.argv.slice(2)).catch((err) => {
console.error(err.stack)
console.error(err)
process.exit(1)
})
4 changes: 2 additions & 2 deletions examples/aws-nodejs/public/drag.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<title>Uppy</title>
<link
href="https://releases.transloadit.com/uppy/v3.19.1/uppy.min.css"
href="https://releases.transloadit.com/uppy/v3.20.0/uppy.min.css"
rel="stylesheet"
/>
</head>
Expand All @@ -22,7 +22,7 @@ <h5>Uploaded files:</h5>
DragDrop,
ProgressBar,
AwsS3,
} from 'https://releases.transloadit.com/uppy/v3.19.1/uppy.min.mjs'
} from 'https://releases.transloadit.com/uppy/v3.20.0/uppy.min.mjs'

// Function for displaying uploaded files
const onUploadSuccess = (elForUploadedFiles) => (file, response) => {
Expand Down
4 changes: 2 additions & 2 deletions examples/aws-nodejs/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<title>Uppy – AWS upload example</title>
<link
href="https://releases.transloadit.com/uppy/v3.19.1/uppy.min.css"
href="https://releases.transloadit.com/uppy/v3.20.0/uppy.min.css"
rel="stylesheet"
/>
</head>
Expand All @@ -16,7 +16,7 @@ <h1>AWS upload example</h1>
Uppy,
Dashboard,
AwsS3,
} from 'https://releases.transloadit.com/uppy/v3.19.1/uppy.min.mjs'
} from 'https://releases.transloadit.com/uppy/v3.20.0/uppy.min.mjs'
/**
* This generator transforms a deep object into URL-encodable pairs
* to work with `URLSearchParams` on the client and `body-parser` on the server.
Expand Down
6 changes: 3 additions & 3 deletions examples/cdn-example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://releases.transloadit.com/uppy/v3.19.1/uppy.min.css"
href="https://releases.transloadit.com/uppy/v3.20.0/uppy.min.css"
rel="stylesheet"
/>
</head>
Expand All @@ -19,7 +19,7 @@
Dashboard,
Webcam,
Tus,
} from 'https://releases.transloadit.com/uppy/v3.19.1/uppy.min.mjs'
} from 'https://releases.transloadit.com/uppy/v3.20.0/uppy.min.mjs'

const uppy = new Uppy({ debug: true, autoProceed: false })
.use(Dashboard, { trigger: '#uppyModalOpener' })
Expand All @@ -34,7 +34,7 @@
<!-- To support older browsers, you can use the legacy bundle which adds a global `Uppy` object. -->
<script
nomodule
src="https://releases.transloadit.com/uppy/v3.19.1/uppy.legacy.min.js"
src="https://releases.transloadit.com/uppy/v3.20.0/uppy.legacy.min.js"
></script>
<script nomodule>
{
Expand Down
4 changes: 2 additions & 2 deletions examples/uppy-with-companion/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://releases.transloadit.com/uppy/v3.19.1/uppy.min.css"
href="https://releases.transloadit.com/uppy/v3.20.0/uppy.min.css"
rel="stylesheet"
/>
</head>
Expand All @@ -19,7 +19,7 @@
Instagram,
GoogleDrive,
Tus,
} from 'https://releases.transloadit.com/uppy/v3.19.1/uppy.min.mjs'
} from 'https://releases.transloadit.com/uppy/v3.20.0/uppy.min.mjs'

const uppy = new Uppy({ debug: true, autoProceed: false })
.use(Dashboard, { trigger: '#uppyModalOpener' })
Expand Down
8 changes: 8 additions & 0 deletions packages/@uppy/companion-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @uppy/companion-client

## 3.6.1

Released: 2023-11-24
Included in: Uppy v3.20.0

- @uppy/companion-client: fix log type error (Mikael Finstad / #4766)
- @uppy/companion-client: revert breaking change (Antoine du Hamel / #4801)

## 3.5.0

Released: 2023-10-20
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@uppy/companion-client",
"description": "Client library for communication with Companion. Intended for use in Uppy plugins.",
"version": "3.6.0",
"version": "3.6.1",
"license": "MIT",
"main": "lib/index.js",
"type": "module",
Expand Down
9 changes: 6 additions & 3 deletions packages/@uppy/core/src/Uppy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,10 @@ export class Uppy<M extends Meta, B extends Body> {
// users are asked to re-select these half-recovered files and then this method will be called again.
// In order to keep the progress, meta and everthing else, we keep the existing file,
// but we replace `data`, and we remove `isGhost`, because the file is no longer a ghost now
if (existingFiles[newFile.id]?.isGhost) {
const existingFileState = existingFiles[newFile.id]
const isGhost = existingFiles[newFile.id]?.isGhost
if (isGhost) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { isGhost: _, ...existingFileState } = existingFiles[newFile.id]
newFile = {
...existingFileState,
isGhost: false,
Expand All @@ -836,7 +838,8 @@ export class Uppy<M extends Meta, B extends Body> {
)
}

if (onBeforeFileAddedResult === false) {
// Pass through reselected files from Golden Retriever
if (onBeforeFileAddedResult === false && !isGhost) {
// Don’t show UI info for this error, as it should be done by the developer
throw new RestrictionError(
'Cannot add the file because onBeforeFileAdded returned false.',
Expand Down
4 changes: 2 additions & 2 deletions packages/@uppy/image-editor/src/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default class Editor extends Component {
}

renderRevert () {
const { i18n } = this.props
const { i18n, opts } = this.props

return (
<label
Expand All @@ -140,7 +140,7 @@ export default class Editor extends Component {
className="uppy-u-reset uppy-c-btn"
onClick={() => {
this.cropper.reset()
this.cropper.setAspectRatio(0)
this.cropper.setAspectRatio(opts.cropperOptions.initialAspectRatio)
this.setState({ angle90Deg: 0, angleGranular: 0 })
}}
>
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/image-editor/src/ImageEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class ImageEditor extends UIPlugin {
minCropBoxWidth: 70,
minCropBoxHeight: 70,
croppedCanvasOptions: {},
initialAspectRatio: 0,
}

const defaultActions = {
Expand Down
8 changes: 8 additions & 0 deletions packages/@uppy/locales/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @uppy/locales

## 3.5.0

Released: 2023-11-24
Included in: Uppy v3.20.0

- @uppy/locales: Add missing translations to de_DE (Leonhard Melzer / #4800)
- @uppy/locales: use TypeScript for source files (Antoine du Hamel / #4779)

## 3.4.0

Released: 2023-11-08
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/locales/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@uppy/locales",
"description": "Uppy language packs",
"version": "3.4.0",
"version": "3.5.0",
"license": "MIT",
"type": "module",
"keywords": [
Expand Down
7 changes: 7 additions & 0 deletions packages/@uppy/store-default/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @uppy/store-default

## 3.1.0

Released: 2023-11-24
Included in: Uppy v3.20.0

- @uppy/store-default: refactor to typescript (Antoine du Hamel / #4785)

## 3.0.2

Released: 2022-09-25
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/store-default/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@uppy/store-default",
"description": "The default simple object-based store for Uppy.",
"version": "3.0.5",
"version": "3.1.0",
"license": "MIT",
"main": "lib/index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/utils/src/dataURItoBlob.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import dataURItoBlob from './dataURItoBlob.ts'
import sampleImageDataURI from './sampleImageDataURI.js'
import sampleImageDataURI from './sampleImageDataURI.ts'

describe('dataURItoBlob', () => {
it('should convert a data uri to a blob', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/utils/src/dataURItoFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import dataURItoFile from './dataURItoFile.ts'
import sampleImageDataURI from './sampleImageDataURI.js'
import sampleImageDataURI from './sampleImageDataURI.ts'

describe('dataURItoFile', () => {
it('should convert a data uri to a file', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/uppy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uppy",
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
"version": "3.19.1",
"version": "3.20.0",
"license": "MIT",
"main": "index.mjs",
"module": "index.mjs",
Expand Down

0 comments on commit ca98717

Please sign in to comment.