Skip to content

Commit

Permalink
Merge branch 'main' into cypress
Browse files Browse the repository at this point in the history
* main: (45 commits)
  Polished the latest update blog (#3390)
  docs: fix typo in audio.md (#3389)
  website: 2.0-2.3 post draft (#3370)
  Release: uppy@2.3.2 (#3383)
  meta: fix release script
  @uppy/core: document file.name (#3381)
  add `.npmignore` files to ignore .gitignore when packing (#3380)
  meta: add VSCode workspace settings to `.gitignore`
  Upgrade ws in companion (#3377)
  meta: use ESBuild to bundle in E2E test suite (#3375)
  meta: update linter config to parse ESM files (#3371)
  meta: move dev workspace to `private/` (#3368)
  meta: use Vite for examples/dev (#3361)
  website: remove dependency on `crypto` in @uppy/transloadit example (#3367)
  tools: enable linter on website examples (#3366)
  meta: enable linter on mjs scripts (#3364)
  Fix module field in @uppy/angular package.json (#3365)
  Release: uppy@2.3.1 (#3357)
  meta: improve release script wording and formatting
  meta: update npm deps (#3352)
  ...
  • Loading branch information
Murderlon committed Dec 27, 2021
2 parents 6494bb7 + 87c716a commit 6c612a0
Show file tree
Hide file tree
Showing 248 changed files with 13,166 additions and 28,208 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
@@ -0,0 +1,4 @@
**/node_modules
.git
website
assets
31 changes: 28 additions & 3 deletions .eslintrc.js
Expand Up @@ -118,7 +118,7 @@ module.exports = {

// jsdoc
'jsdoc/check-alignment': 'error',
'jsdoc/check-examples': 'error',
'jsdoc/check-examples': 'off', // cannot yet be supported for ESLint 8, see https://github.com/eslint/eslint/issues/14745
'jsdoc/check-param-names': ['warn'],
'jsdoc/check-syntax': ['warn'],
'jsdoc/check-tag-names': 'error',
Expand All @@ -145,13 +145,33 @@ module.exports = {
},

overrides: [
{
files: [
'*.mjs',
'private/dev/*.js',
'private/release/*.js',
'private/remark-lint-uppy/*.js',
],
parserOptions: {
sourceType: 'module',
},
},
{
files: ['./packages/@uppy/companion/**/*.js'],
rules: {
'no-restricted-syntax': 'warn',
'no-underscore-dangle': 'off',
},
},
{
files: [
'website/src/examples/*/*.es6',
],
rules: {
'import/no-extraneous-dependencies': 'off',
'no-console': 'off',
},
},
{
files: [
'*.test.js',
Expand All @@ -166,6 +186,7 @@ module.exports = {
{
files: [
'bin/**.js',
'bin/**.mjs',
'examples/**/*.js',
'packages/@uppy/companion/test/**/*.js',
'test/**/*.js',
Expand All @@ -176,6 +197,7 @@ module.exports = {
'.eslintrc.js',
'website/*.js',
'website/**/*.js',
'private/**/*.js',
],
rules: {
'no-console': 'off',
Expand All @@ -192,7 +214,7 @@ module.exports = {
],
rules: {
camelcase: ['off'],
'quote-props': ['off'],
'quote-props': ['error', 'as-needed', { 'numbers': true }],
},
},

Expand All @@ -206,11 +228,14 @@ module.exports = {
},

{
files: ['test/endtoend/*/*.js'],
files: ['test/endtoend/*/*.mjs', 'test/endtoend/*/*.ts'],
rules: {
// we mostly import @uppy stuff in these files.
'import/no-extraneous-dependencies': ['off'],
},
},
{
files: ['test/endtoend/*/*.js'],
env: {
mocha: true,
},
Expand Down
31 changes: 11 additions & 20 deletions .github/CONTRIBUTING.md
Expand Up @@ -143,26 +143,17 @@ yarn install
yarn start
```

Releases are managed by [Lerna](https://github.com/lerna/lerna). We do some cleanup and compile work around releases too. Use the npm release script:

```bash
yarn run release
```

If you have two-factor authentication enabled on your account, Lerna will ask for a one-time password. You may stumble upon a known issue with the CLI where the OTP prompt may be obscured by a publishing progress bar. If Lerna appears to freeze as it starts publishing, chances are it’s waiting for the password. Try typing in your OTP and hitting enter.

Other things to keep in mind during release:

* When adding a new package, add the following key to its package.json:
```json
"publishConfig": { "access": "public" }
```
Else, the release script will try and fail to publish a _private_ package, because the `@uppy` scope on npm does not support that.

After a release, the demos on transloadit.com should also be updated. After updating, check that some things work locally:

* the demos in the demo section work (try one that uses an import robot, and one that you need to upload to)
* the demos on the homepage work and can import from Google Drive, Instagram, Dropbox, etc.
Releases are managed by GitHub Actions, here’s an overview of the process to release a new Uppy version:

* Run `yarn release` on your local machine.
* Follow the instructions and select what packages to release.
* Before committing, check if the generated files look good.
* Push to the Transloadit repository using the command given by the tool. Do not open a PR yourself, the GitHub Actions will create one and assign you to it.
* Wait for all the GitHub Actions checks to pass. If one fails, try to figure out why. Do not go ahead without consulting the rest of the team.
* Review the PR thoroughly, and if everything looks good to you, approve the PR. Do not merge it manually!
* After the PR is automatically merged, the demos on transloadit.com should also be updated. Check that some things work locally:
* the demos in the demo section work (try one that uses an import robot, and one that you need to upload to)
* the demos on the homepage work and can import from Google Drive, Instagram, Dropbox, etc.

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:

Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/cdn.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/companion-deploy.yml
Expand Up @@ -32,8 +32,8 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
context: packages/@uppy/companion
file: packages/@uppy/companion/Dockerfile
context: .
file: Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/manual-cdn.yml
@@ -0,0 +1,34 @@
name: Manually triggered CDN upload
on:
workflow_dispatch:
inputs:
name:
description: "Package to upload"
required: true
default: "uppy"

jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache npm dependencies
id: cache-npm-libraries
uses: actions/cache@v2
with:
path: .yarn/cache/*
key: ${{ runner.os }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: corepack yarn install
- name: Build before publishing
run: corepack yarn run build
- name: Upload `${{ github.event.inputs.name }}` to CDN
run: corepack yarn run uploadcdn ${{ github.event.inputs.name }}
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
73 changes: 73 additions & 0 deletions .github/workflows/release-candidate.yml
@@ -0,0 +1,73 @@
name: Release candidate
on:
push:
branches: release

jobs:
prepare-release:
name: Prepare release candidate Pull Request
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
branch: release
- name: Rebase
run: |
git fetch origin HEAD --depth=1
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git rebase FETCH_HEAD
- name: Cache npm dependencies
id: cache-npm-libraries
uses: actions/cache@v2
with:
path: .yarn/cache/*
key: ${{ runner.os }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: corepack yarn install
- name: Bump candidate packages version
run: corepack yarn version apply --all --json | jq -s > releases.json
- name: Prepare changelog
run: corepack yarn workspace @uppy-dev/release update-changelogs releases.json | xargs git add
- name: Update contributors table
run: corepack yarn contributors:save && git add README.md
- name: Update CDN URLs
run: corepack yarn workspace @uppy-dev/release update-version-URLs | xargs git add
- name: Stage changes and remove temp files
run: |
git rm -rf .yarn/versions
git rm CHANGELOG.next.md
jq -r 'map(.cwd) | join("\n")' < releases.json | awk '{ print "git add " $0 "/package.json" }' | sh
- name: Commit
run: |
echo "Release: uppy@$(jq -r 'map(select(.ident == "uppy"))[0].newVersion' < releases.json)" > commitMessage
echo >> commitMessage
echo "This is a release candidate for the following packages:" >> commitMessage
echo >> commitMessage
jq -r 'map("- `"+.ident+"`: "+.oldVersion+" -> "+.newVersion) | join("\n") ' < releases.json >> commitMessage
git commit -n --amend --file commitMessage
- name: Open Pull Request
id: pr_opening
run: |
git push origin HEAD:release-candidate
gh api repos/${{ github.repository }}/pulls \
-F base="$(gh api /repos/${{ github.repository }} | jq -r .default_branch)" \
-F head="release-candidate" \
-F title="$(head -1 commitMessage)" \
-F body="$(git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }')" \
--jq '.number | tostring | "##[set-output name=pr_number;]"+.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Assign to the releaser
run: echo '{"assignees":[${{ toJSON(github.actor) }}]}' | gh api repos/${{ github.repository }}/issues/${{ steps.pr_opening.outputs.pr_number }}/assignees --input -
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable Release workflow
run: gh workflow enable Release --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,92 @@
name: Release
on:
pull_request_review:
types: [submitted]

jobs:
release:
name: Publish releases
if: ${{ github.event.review.state == 'approved' && github.event.sender.login == github.event.pull_request.assignee.login && github.event.pull_request.head.ref == 'release-candidate' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Cache npm dependencies
id: cache-npm-libraries
uses: actions/cache@v2
with:
path: .yarn/cache/*
key: ${{ runner.os }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: corepack yarn install
- name: Get CHANGELOG diff
run: git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }' > CHANGELOG.diff.md
- name: Copy README for `uppy` package
run: cp README.md packages/uppy/.
- name: Build before publishing
run: corepack yarn run build
- name: Login to NPM
run: corepack yarn config set npmAuthToken ${{ toJSON(secrets.NPM_TOKEN) }}
- name: Publish to NPM
run: corepack yarn workspaces foreach --no-private npm publish --access public --tolerate-republish
- name: Merge PR
id: merge
run: |
gh api -X PUT repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge \
-F merge_method="squash" \
-F commit_message="$(cat CHANGELOG.diff.md)" \
--jq 'if .merged then "##[set-output name=sha;]"+.sha else error("not merged") end'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create tags
run: |
git --no-pager diff --name-only HEAD^ | awk '$0 ~ /^packages\/.+\/package\.json$/ { print "jq -r '"'"'\"gh api /repos/{owner}/{repo}/git/refs -f ref=\\\"refs/tags/\"+.name+\"@\"+.version+\"\\\" -f sha=${{ steps.merge.outputs.sha }}\"'"'"' < " $0 }' > createTags.sh
cat createTags.sh
sh createTags.sh | sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Uppy version number
id: uppyVersion
run: jq -r '"##[set-output name=version;]"+.version' < packages/uppy/package.json
- name: Create GitHub release
run: gh release create uppy@${{ steps.uppyVersion.outputs.version }} -t "Uppy ${{ steps.uppyVersion.outputs.version }}" -F CHANGELOG.diff.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload `uppy` to CDN
run: corepack yarn run uploadcdn uppy
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
- name: Upload `@uppy/robodog` to CDN if it was released
run: git diff --exit-code --quiet HEAD^ -- packages/@uppy/robodog/package.json || corepack yarn run uploadcdn @uppy/robodog
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
- name: Upload `@uppy/locales` to CDN if it was released
run: git diff --exit-code --quiet HEAD^ -- packages/@uppy/locales/package.json ||corepack yarn run uploadcdn @uppy/locales
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
- name: Remove release-candidate branch
run: gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release-candidate || echo "Already deleted"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove release branch
run: gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Disable Release workflow
run: gh workflow disable Release --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: In case of failure
if: ${{ failure() }}
run: gh pr comment ${{ github.event.pull_request.number }} --body "Release job failed, please take action."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -4,9 +4,11 @@ npm-debug.log
npm-debug.log*
nohup.out
node_modules
.angular
.cache
.parcel-cache
.eslintcache
.vscode/settings.json
.yarn/cache
.yarn/install-state.gz
yarn-error.log
Expand Down

0 comments on commit 6c612a0

Please sign in to comment.