Skip to content

Commit

Permalink
Merge branch 'provider-user-sessions' into webdav-provider-poc
Browse files Browse the repository at this point in the history
# Conflicts:
#	private/dev/Dashboard.js
#	yarn.lock
  • Loading branch information
mifi committed Oct 2, 2023
2 parents 59262c1 + b33f5b1 commit 47c4025
Show file tree
Hide file tree
Showing 294 changed files with 5,114 additions and 3,532 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.git
website
assets
private
e2e
.env
11 changes: 10 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ COMPANION_UNSPLASH_SECRET=***
COMPANION_ONEDRIVE_KEY=***
COMPANION_ONEDRIVE_SECRET=****

# To test dynamic Oauth against local companion (which is pointless but allows us to test it without Transloadit's servers), enable these:
#COMPANION_GOOGLE_KEYS_ENDPOINT=http://localhost:3020/drive/test-dynamic-oauth-credentials?secret=development
#COMPANION_TEST_DYNAMIC_OAUTH_CREDENTIALS=true
#COMPANION_TEST_DYNAMIC_OAUTH_CREDENTIALS_SECRET=development


# Development environment
# =======================

Expand All @@ -69,10 +75,13 @@ VITE_UPLOADER=tus

VITE_COMPANION_URL=http://localhost:3020
# See also Transloadit.COMPANION_PATTERN
VITE_COMPANION_ALLOWED_HOSTS="/\.transloadit\.com\$/"
VITE_COMPANION_ALLOWED_HOSTS="\.transloadit\.com$"
VITE_TUS_ENDPOINT=https://tusd.tusdemo.net/files/
VITE_XHR_ENDPOINT=https://xhr-server.herokuapp.com/upload

# If you want to test dynamic Oauth
# VITE_COMPANION_GOOGLE_DRIVE_KEYS_PARAMS_CREDENTIALS_NAME=companion-google-drive

VITE_TRANSLOADIT_KEY=***
VITE_TRANSLOADIT_TEMPLATE=***
VITE_TRANSLOADIT_SERVICE_URL=https://api2.transloadit.com
Expand Down
19 changes: 16 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const svgPresentationAttributes = [

module.exports = {
root: true,
extends: ['transloadit'],
extends: ['transloadit', 'prettier'],
env: {
es6: true,
jest: true,
Expand Down Expand Up @@ -63,7 +63,6 @@ module.exports = {
// rules we want to enforce
'array-callback-return': 'error',
'func-names': 'error',
'implicit-arrow-linebreak': 'error',
'import/no-dynamic-require': 'error',
'import/no-extraneous-dependencies': 'error',
'max-len': 'error',
Expand Down Expand Up @@ -142,6 +141,7 @@ module.exports = {
{
files: [
'*.jsx',
'*.tsx',
'packages/@uppy/react-native/**/*.js',
],
parser: 'espree',
Expand Down Expand Up @@ -359,6 +359,7 @@ module.exports = {
'test/**/*.ts',
'*.test.js',
'*.test-d.ts',
'*.test-d.tsx',
'postcss.config.js',
'.eslintrc.js',
'private/**/*.js',
Expand Down Expand Up @@ -475,11 +476,23 @@ module.exports = {
},
},
{
files: ['**/react/*.md/*.js', '**/react.md/*.js', '**/react-*.md/*.js'],
files: ['**/react/*.md/*.js', '**/react.md/*.js', '**/react-*.md/*.js', '**/react/**/*.test-d.tsx'],
settings: {
react: { pragma: 'React' },
},
},
{
files: ['**/react/**/*.test-d.tsx'],
rules: {
'import/extensions': 'off',
'import/no-useless-path-segments': 'off',
'no-alert': 'off',
'no-inner-declarations': 'off',
'no-lone-blocks': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
},
},
{
files: ['e2e/**/*.ts'],
extends: ['plugin:cypress/recommended'],
Expand Down
172 changes: 108 additions & 64 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Uppy development
## Contributing to Uppy

Fork the repository into your own account first. See the [GitHub Help](https://help.github.com/articles/fork-a-repo/) article for instructions.

Expand All @@ -9,66 +9,46 @@ git clone https://github.com/transloadit/uppy.git
cd uppy
```

We are using [Corepack][] to manage version of [Yarn][]. Corepack comes pre-installed with Node.js >=16.x, or can be installed through `npm`. You can run `corepack enable` to install a `yarn` executable in your `$PATH`, or prefix all yarn commands with `corepack yarn`.
We are using [Corepack][] to manage versions of [Yarn][].
Corepack comes pre-installed with Node.js >=16.x, or can be installed through `npm`:

```sh
corepack -v || npm i -g corepack
yarn -v || corepack enable
yarn install || corepack yarn install
corepack enable
```

[Corepack]: https://nodejs.org/api/corepack.html

[Yarn]: https://yarnpkg.com/

Our website’s examples section is also our playground, please read the [Local Previews](#Local-previews) section to get up and running.

### Requiring files

* If we are `require()`ing a file from the same subpackage, we can freely use relative imports as long as the required file is under the `src` directory (for example to import `@uppy/dashboard/src/utils/hi.js` from `@uppy/dashboard/src/index.js`, use `require('./utils/hi.js')`).
* But if we want to `require()` some file from another subpackage - we should use global @uppy requires, and they should always be in the form of `@uppy/:packageName/(lib instead of src)/(same path).js`

## Tests

### Unit tests
## Development

Unit tests are using Jest and can be run with:
First of all, install Uppy dependencies:

```bash
yarn run test:unit
yarn install
```

### End-to-End tests

We use [Cypress](https://www.cypress.io/) for our e2e test suite. Be sure to checkout “[Writing your first test](https://docs.cypress.io/guides/getting-started/writing-your-first-test#Add-a-test-file)” and the “[Introduction to Cypress](https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Cypress-Can-Be-Simple-Sometimes)”. You should also be aware of the “[Best Practices](https://docs.cypress.io/guides/references/best-practices)”.

To get started make sure you have your `.env` set up. Copy the contents of `.env.example` to a file named `.env` and add the values relevant for the test(s) you are trying to run.

To start the testing suite run:

yarn e2e

This will run Cypress in watch-mode, and it will pick up and rebuild any changes to JS files. If you need to change other files (like CSS for example), you need to run the respective `yarn build:*` scripts.

Alternatively the following command is the same as the above, except it doesn’t run `build` first:

yarn e2e:skip-build
### Basic

To generate the boilerplate for a new test run:
To run a basic development version of Uppy, run:

yarn e2e:generate
```bash
yarn dev
```

## Development
and go to http://localhost:5174 (or whatever link the yarn command outputted).
As you edit Uppy code, the browser will live reload the changes.

### Companion

To start the Companion server along with Uppy, run:
If you’d like to work on features that the basic development version of Uppy doesn’t support, such as Uppy integrations with Instagram/Google Drive/Facebook etc., you need to set up your `.env` file (copy the contents of `.env.example` and adjust them based on what you need to work on), and run:

```bash
yarn run dev:with-companion
```

or if you only want to run Companion
Or, if you only want to run the Companion server:

```bash
yarn run start:companion
Expand Down Expand Up @@ -138,28 +118,50 @@ Tester invites -> Accept

Now you should be able to test the Instagram integration.

## Zoom

See above Instagram instructions for setting up a tunnel, but replace `instagram` with `zoom` in the URL. Note that **you also have to add the OAuth redirect URL to `OAuth allow list`** in the Zoom Oauth app settings or it will not work.
### Requiring files

Add the following scopes: `recording:read`, `user:read`, `user_info:read`
* If we are `require()`ing a file from the same subpackage, we can freely use relative imports as long as the required file is under the `src` directory (for example to import `@uppy/dashboard/src/utils/hi.js` from `@uppy/dashboard/src/index.js`, use `require('./utils/hi.js')`).
* But if we want to `require()` some file from another subpackage - we should use global @uppy requires, and they should always be in the form of `@uppy/:packageName/(lib instead of src)/(same path).js`

To test recording a meeting, you need to sign up for a Zoom Pro trial (can be cancelled later), for example using their iOS app.
## Tests

## Releases
### Unit tests

Before doing a release, check that the examples on the website work:
Unit tests are using Jest and can be run with:

```bash
yarn start
open http://localhost:4000/examples/dashboard
yarn test:unit
```

Also check the other examples:
### End-to-End tests

```bash
yarn workspace <example-name> start
```
We use [Cypress](https://www.cypress.io/) for our e2e test suite. Be sure to checkout “[Writing your first test](https://docs.cypress.io/guides/getting-started/writing-your-first-test#Add-a-test-file)” and the “[Introduction to Cypress](https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Cypress-Can-Be-Simple-Sometimes)”. You should also be aware of the “[Best Practices](https://docs.cypress.io/guides/references/best-practices)”.

To get started make sure you have your `.env` set up. Copy the contents of `.env.example` to a file named `.env` and add the values relevant for the test(s) you are trying to run.

To start the testing suite run:

yarn e2e

This will run Cypress in watch-mode, and it will pick up and rebuild any changes to JS files. If you need to change other files (like CSS for example), you need to run the respective `yarn build:*` scripts.

Alternatively the following command is the same as the above, except it doesn’t run `build` first:

yarn e2e:skip-build

To generate the boilerplate for a new test run:

yarn e2e:generate

## Zoom

See above Instagram instructions for setting up a tunnel, but replace `instagram` with `zoom` in the URL. Note that **you also have to add the OAuth redirect URL to `OAuth allow list`** in the Zoom Oauth app settings or it will not work.

Add the following scopes: `recording:read`, `user:read`, `user_info:read`

To test recording a meeting, you need to sign up for a Zoom Pro trial (can be cancelled later), for example using their iOS app.

## Releases

Releases are managed by GitHub Actions, here’s an overview of the process to release a new Uppy version:

Expand All @@ -176,30 +178,72 @@ Releases are managed by GitHub Actions, here’s an overview of the process to r

If you don’t have access to the transloadit.com source code ping @arturi or @goto-bus-stop and we’ll pick it up. :sparkles:

## Website development
### Releasing hotfix patch

We keep the [uppy.io](http://uppy.io) website in `./website` to keep docs and code in sync as we are still iterating at high velocity.
#### Companion hotfix

The site is built with [Hexo](http://hexo.io/), and Travis automatically deploys this onto GitHub Pages (it overwrites the `gh-pages` branch with Hexo’s build at every change to `main`). The content is written in Markdown and located in `./website/src`. Feel free to fork & hack!
First checkout the tag of the version you want to patch:

Even though bundled in this repo, the website is regarded as a separate project. As such, it has its own `package.json` and we aim to keep the surface where the two projects interface as small as possible. `./website/update.js` is called during website builds to inject the Uppy knowledge into the site.
```bash
git checkout @uppy/[email protected]
```

### Local previews
Now create a branch for your hotfix:

1. `yarn install`
2. `yarn start`
3. Go to http://localhost:4000. Your changes in `/website` and `/packages/@uppy` will be watched, your browser will refresh as files change.
```bash
git checkout -b x.y.z-hotfix
```

Then, to work on, for instance, the XHRUpload example, you would edit the following files:
Run yarn to make sure all packages are consistent:

```bash
${EDITOR} packages/@uppy/core/src/index.js \
packages/@uppy/core/src/Plugin.js \
packages/@uppy/xhr-upload/src/index.js \
website/src/examples/xhrupload/app.es6
corepack yarn
```

And open <http://localhost:4000/examples/xhrupload/> in your web browser.
Now navigate to the Companion workspace:

```bash
cd packages/@uppy/companion
```

**Now cherry pick your desired commits**.

Next edit `CHANGELOG.md` and then commit it:

```bash
git add CHANGELOG.md
git commit -m 'Update changelog'
```

Now let’s create the version & tag:

```bash
mkdir -p .git && npm version --workspaces-update=false --tag-version-prefix='@uppy/companion@' patch
```

Run a “dry-run” first:

```bash
corepack yarn pack
```

If the earlier command succeeded, let’s publish!

```bash
corepack yarn npm publish --access public --tag=none
```

Now we can push our branch and tags.

```bash
git push && git push --tags
```

#### Hotfix other packages

For other Uppy packages, the process should be like Companion,
but hasn’t been documented yet. Make sure to remember to run `yarn` as well as building the package first, then you can release it.
If you do release any other packages, please update this doc.

## CSS guidelines

Expand Down Expand Up @@ -378,7 +422,7 @@ order: 0
category: "Other Integrations"
```

This data is used to generate Uppy’s website. Refer to [the section about running the website locally](#website-previews) if you’d like to see how the docs look on the website.
This data is used to generate Uppy’s website.

Any change of the documentation that involves a security best practice must substantiated with an external reference. See [#3565](https://github.com/transloadit/uppy/issues/3565).

Expand Down
13 changes: 10 additions & 3 deletions .github/ISSUE_TEMPLATE/1-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ body:
attributes:
label: Initial checklist
options:
- label: I understand this is a bug report and questions should be posted in the [Community Forum](https://community.transloadit.com/)
- label:
I understand this is a bug report and questions should be posted in
the [Community Forum](https://community.transloadit.com/)
required: true
- label: I searched [issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue) and couldn’t find anything (or linked relevant results below)
- label:
I searched
[issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue)
and couldn’t find anything (or linked relevant results below)
required: true
- type: input
id: runnable-example
Expand All @@ -28,7 +33,9 @@ body:
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: How did this happen? Please provide a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).
description:
How did this happen? Please provide a [minimal, reproducible
example](https://stackoverflow.com/help/minimal-reproducible-example).
validations:
required: true
- type: textarea
Expand Down
13 changes: 10 additions & 3 deletions .github/ISSUE_TEMPLATE/2-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ body:
attributes:
label: Initial checklist
options:
- label: I understand this is a feature request and questions should be posted in the [Community Forum](https://community.transloadit.com/)
- label:
I understand this is a feature request and questions should be
posted in the [Community Forum](https://community.transloadit.com/)
required: true
- label: I searched [issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue) and couldn’t find anything (or linked relevant results below)
- label:
I searched
[issues](https://github.com/transloadit/uppy/issues?q=is%3Aissue)
and couldn’t find anything (or linked relevant results below)
required: true
- type: textarea
id: problem
Expand All @@ -29,6 +34,8 @@ body:
id: alternatives
attributes:
label: Alternatives
description: What are the alternative solutions? Can this be solved in a different way?
description:
What are the alternative solutions? Can this be solved in a different
way?
validations:
required: true
Loading

0 comments on commit 47c4025

Please sign in to comment.