Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor locale scripts & generate types and docs #3276

Merged
merged 23 commits into from Nov 10, 2021
Merged

Refactor locale scripts & generate types and docs #3276

merged 23 commits into from Nov 10, 2021

Conversation

Murderlon
Copy link
Member

@Murderlon Murderlon commented Oct 20, 2021

Closes #3232

Summary

  • Create locale.js for every plugin instead of this.defaultLocale in the class
  • Complete refactor of locale scripts
    • No dynamic plugin class imports with hacks to mimic the environment in order to get the defaultLocale.
    • Separate tests and build in separate files
    • Add two modes for test file, unused (fails hard) and warnings
  • Generate docs
    • Use remark to cleanly mutate the file
    • Rename some doc files to match the plugin name (such as statusbar --> status-bar)
    • Comments in locale.js are kept and are present in the docs as well.
  • Generate types

Open

  • Optional: do tree traversal on JS ASTs instead of hacky regex matching to find unused references of locale keys

* main:
  Update "AWS S3" to rename master branch to main (#3266)
  2.2.1
  Release
  Try removing version altogether
  Progress object is nested (#3262)
  @uppy/status-bar: fix `calculateProcessingProgress` is not a function (#3261)
  Add retext to markdown linter (#3024)
* main:
  Disable drop state for non-files (#2449)
  meta: use Yarn v3 instead of npm (#3237)
  examples: Update to Parcel 2 (#3275)
  ci: test Companion with Node.js 16.x (#3273)
  e2e tests: Move transloadit2 test into transloadit, remove the former (#3271)
  Release
  ci: fix tranloadit2 e2e tests (#3270)
  Add unique class to discard button (#3269)
@aduh95
Copy link
Member

aduh95 commented Oct 26, 2021

  • Optional: make bin a yarn workspace and install all the packages needed there instead of main package.json

I suggest to create a new folder such as private/generate-locales. I don't think we should keep it in bin/ if it doesn't make sense anymore.

* main:
  meta: upgrade ESLint to v8.0.0 (#3251)
  @uppy/unsplash@2.0.2
  Update `lerna.json`
  Fix `@uppy/unsplash` upload (#3272)
@Murderlon
Copy link
Member Author

Update

  • I can't believe this led me astray but I thought we needed AST parsing to match comments to strings for documentation generation, but after I moved the files out of the plugin classes and into separate files, I could simply load that file as a string and place it inside a markdown code block. So that's done now.
  • Eslint was used to fix linter issues but it significantly slowed down the process. Instead I'm ignoring the comma dangle rule in the locale files, which was the only thing it was fixing.
  • I moved the scripts into private/locale-pack as it doesn't belong in bin/

@Murderlon Murderlon marked this pull request as ready for review October 28, 2021 12:02
@goto-bus-stop

This comment has been minimized.

website/src/docs/aws-s3.md Show resolved Hide resolved
website/src/docs/status-bar.md Outdated Show resolved Hide resolved
@Murderlon

This comment has been minimized.

@goto-bus-stop

This comment has been minimized.

Copy link
Contributor

@goto-bus-stop goto-bus-stop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this in general though, nice work :)

And very good to notice that the AST stuff is not needed anymore with the separate files 😇

website/src/docs/aws-s3.md Outdated Show resolved Hide resolved
@Murderlon

This comment has been minimized.

packages/@uppy/locales/src/en_US.js Outdated Show resolved Hide resolved
private/locale-pack/helpers.mjs Outdated Show resolved Hide resolved
private/locale-pack/index.mjs Outdated Show resolved Hide resolved
private/locale-pack/index.mjs Show resolved Hide resolved
private/locale-pack/test.mjs Outdated Show resolved Hide resolved
private/locale-pack/test.mjs Show resolved Hide resolved
private/locale-pack/test.mjs Show resolved Hide resolved
website/src/docs/box.md Outdated Show resolved Hide resolved
@Murderlon
Copy link
Member Author

Fixed all the markdown escaping issues and incorrectly deleted sections. Only thing I haven't changed is using top level await, as I don't mind the main().then() pattern, but it's just stylistic.

* main:
  Create docs for `@uppy/screen-capture` (#3282)
  Fix bug introduced in #3159
  rename master to main
  Rewrite Companion providers to use streams to allow simultaneous upload/download without saving to disk (#3159)
  chore: Add `FileRemoveReason` type (#3283)
  ci: test with Node.js 17.x (#3274)
  meta: use `workspace:^` in peerDependencies (#3278)
  meta: use `workspace:^` instead of `workspace:*` (#3278)
  meta: upgrade Yarn to 3.1.0 (#3278)
  meta: add `update-yarn` script (#3278)
@Murderlon Murderlon requested a review from aduh95 November 9, 2021 12:19
* 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)
@Murderlon Murderlon merged commit 00094af into main Nov 10, 2021
@Murderlon Murderlon deleted the locale-docs branch November 10, 2021 10:43
Murderlon added a commit that referenced this pull request Nov 11, 2021
* main:
  Refactor locale scripts & generate types and docs (#3276)
  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
Murderlon added a commit that referenced this pull request Nov 11, 2021
* main: (30 commits)
  Refactor locale scripts & generate types and docs (#3276)
  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)
  ...
@github-actions github-actions bot mentioned this pull request Dec 7, 2021
github-actions bot added a commit that referenced this pull request Dec 7, 2021
| Package                   | Version | Package                   | Version |
| ------------------------- | ------- | ------------------------- | ------- |
| @uppy/angular             |   0.2.6 | @uppy/locales             |   2.0.4 |
| @uppy/audio               |   0.2.0 | @uppy/onedrive            |   2.0.5 |
| @uppy/aws-s3              |   2.0.6 | @uppy/provider-views      |   2.0.6 |
| @uppy/aws-s3-multipart    |   2.2.0 | @uppy/react               |   2.1.2 |
| @uppy/box                 |   1.0.5 | @uppy/screen-capture      |   2.0.5 |
| @uppy/companion           |   3.1.2 | @uppy/status-bar          |   2.1.2 |
| @uppy/companion-client    |   2.0.4 | @uppy/store-default       |   2.0.3 |
| @uppy/core                |   2.1.3 | @uppy/thumbnail-generator |   2.0.6 |
| @uppy/dashboard           |   2.1.2 | @uppy/transloadit         |   2.0.5 |
| @uppy/drag-drop           |   2.0.5 | @uppy/tus                 |   2.1.2 |
| @uppy/dropbox             |   2.0.5 | @uppy/url                 |   2.0.5 |
| @uppy/facebook            |   2.0.5 | @uppy/utils               |   4.0.4 |
| @uppy/file-input          |   2.0.5 | @uppy/webcam              |   2.0.5 |
| @uppy/golden-retriever    |   2.0.6 | @uppy/xhr-upload          |   2.0.6 |
| @uppy/google-drive        |   2.0.5 | @uppy/zoom                |   1.0.5 |
| @uppy/image-editor        |   1.1.0 | @uppy/robodog             |   2.1.4 |
| @uppy/informer            |   2.0.5 | uppy                      |   2.3.0 |
| @uppy/instagram           |   2.0.5 |                           |         |

- meta: add release automations (Antoine du Hamel / #3304)
- @uppy/dashboard: Save meta fields when opening the image editor (Merlijn Vos / #3339)
- @uppy/aws-s3-multipart: Drop `lockedCandidatesForBatch` and mark chunks as busy when preparing (Yegor Yarko / #3342)
- @uppy/webcam: fix broken links in `webcam.md` (Antoine du Hamel / #3346)
- @uppy/audio: new @uppy/audio plugin for recording with microphone (Artur Paikin / #2976)
- build: force use of `@babel/plugin-proposal-optional-chaining` (Antoine du Hamel / #3335)
- @uppy/companion: fix deploy Yarn version (Antoine du Hamel / #3327)
- @uppy/companion: upgrade aws-sdk (Mikael Finstad / #3334)
- @uppy/core: disable loose transpilation for legacy bundle (Antoine du Hamel / #3329)
- @uppy/angular: examples: update `angular-example` to Angular v13 (Antoine du Hamel / #3325)
- meta: Update BACKLOG.md (Artur Paikin, Merlijn Vos)
- meta: Add disableLocalFiles to options summary (Steve Barker / #3323)
- meta: Create SECURITY.md (Ziding Zhang / #3052)
- @uppy/image-editor: Pass croppedCanvasOptions to getCroppedCanvas (Mohamed Boudra / #3320)
- meta: finish `master`->`main` job (Mikael Finstad / #3315)
- website: update documents that were out of date (Antoine du Hamel / #3317)
- @uppy/status-bar: Status bar error state improvements (Merlijn Vos / #3299)
- doc: Fix typo in `docs/drag-drop.md` (Ash Allen / #3319)
- website: Update /support and docs about Transloadit-hosted Companion (Artur Paikin / #3243)
- @uppy/aws-s3,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive,@uppy/image-editor,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/screen-capture,@uppy/status-bar,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/url,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: Refactor locale scripts & generate types and docs (Merlijn Vos / #3276)
- @uppy/companion: Remove references of incorrect `options` argument for `companion.socket` (Mikael Finstad / #3307)
- @uppy/companion: Upgrade linting to 2.0.0-0 (Kevin van Zonneveld / #3280)
vymao pushed a commit to vymao/uppy that referenced this pull request Mar 29, 2022
* main: (30 commits)
  Refactor locale scripts & generate types and docs (transloadit#3276)
  Remove references of incorrect `options` argument for `companion.socket` (transloadit#3307)
  Upgrade linting to 2.0.0-0 (transloadit#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 (transloadit#3079)
  Convert sets to arrays prior to using spread operator to enable transpilation to ES5 (transloadit#3297)
  Add showRecordingLength to webcam types (transloadit#3303)
  Required meta fields UI (transloadit#3285)
  Update BACKLOG.md
  Release uppy@2.2.2
  @uppy/provider-views@2.0.5
  fix: @uppy/utils - `getFileType()` always returns a string (transloadit#3294)
  Remove yarn file
  @uppy/companion: fix Dockerfiles (transloadit#3291)
  @uppy/companion: use Node.js 16.x for Dockerfile (transloadit#3289)
  if an item is checked, it can’t be disabled (transloadit#3288)
  ...
HeavenFox pushed a commit to docsend/uppy that referenced this pull request Jun 27, 2023
| Package                   | Version | Package                   | Version |
| ------------------------- | ------- | ------------------------- | ------- |
| @uppy/angular             |   0.2.6 | @uppy/locales             |   2.0.4 |
| @uppy/audio               |   0.2.0 | @uppy/onedrive            |   2.0.5 |
| @uppy/aws-s3              |   2.0.6 | @uppy/provider-views      |   2.0.6 |
| @uppy/aws-s3-multipart    |   2.2.0 | @uppy/react               |   2.1.2 |
| @uppy/box                 |   1.0.5 | @uppy/screen-capture      |   2.0.5 |
| @uppy/companion           |   3.1.2 | @uppy/status-bar          |   2.1.2 |
| @uppy/companion-client    |   2.0.4 | @uppy/store-default       |   2.0.3 |
| @uppy/core                |   2.1.3 | @uppy/thumbnail-generator |   2.0.6 |
| @uppy/dashboard           |   2.1.2 | @uppy/transloadit         |   2.0.5 |
| @uppy/drag-drop           |   2.0.5 | @uppy/tus                 |   2.1.2 |
| @uppy/dropbox             |   2.0.5 | @uppy/url                 |   2.0.5 |
| @uppy/facebook            |   2.0.5 | @uppy/utils               |   4.0.4 |
| @uppy/file-input          |   2.0.5 | @uppy/webcam              |   2.0.5 |
| @uppy/golden-retriever    |   2.0.6 | @uppy/xhr-upload          |   2.0.6 |
| @uppy/google-drive        |   2.0.5 | @uppy/zoom                |   1.0.5 |
| @uppy/image-editor        |   1.1.0 | @uppy/robodog             |   2.1.4 |
| @uppy/informer            |   2.0.5 | uppy                      |   2.3.0 |
| @uppy/instagram           |   2.0.5 |                           |         |

- meta: add release automations (Antoine du Hamel / transloadit#3304)
- @uppy/dashboard: Save meta fields when opening the image editor (Merlijn Vos / transloadit#3339)
- @uppy/aws-s3-multipart: Drop `lockedCandidatesForBatch` and mark chunks as busy when preparing (Yegor Yarko / transloadit#3342)
- @uppy/webcam: fix broken links in `webcam.md` (Antoine du Hamel / transloadit#3346)
- @uppy/audio: new @uppy/audio plugin for recording with microphone (Artur Paikin / transloadit#2976)
- build: force use of `@babel/plugin-proposal-optional-chaining` (Antoine du Hamel / transloadit#3335)
- @uppy/companion: fix deploy Yarn version (Antoine du Hamel / transloadit#3327)
- @uppy/companion: upgrade aws-sdk (Mikael Finstad / transloadit#3334)
- @uppy/core: disable loose transpilation for legacy bundle (Antoine du Hamel / transloadit#3329)
- @uppy/angular: examples: update `angular-example` to Angular v13 (Antoine du Hamel / transloadit#3325)
- meta: Update BACKLOG.md (Artur Paikin, Merlijn Vos)
- meta: Add disableLocalFiles to options summary (Steve Barker / transloadit#3323)
- meta: Create SECURITY.md (Ziding Zhang / transloadit#3052)
- @uppy/image-editor: Pass croppedCanvasOptions to getCroppedCanvas (Mohamed Boudra / transloadit#3320)
- meta: finish `master`->`main` job (Mikael Finstad / transloadit#3315)
- website: update documents that were out of date (Antoine du Hamel / transloadit#3317)
- @uppy/status-bar: Status bar error state improvements (Merlijn Vos / transloadit#3299)
- doc: Fix typo in `docs/drag-drop.md` (Ash Allen / transloadit#3319)
- website: Update /support and docs about Transloadit-hosted Companion (Artur Paikin / transloadit#3243)
- @uppy/aws-s3,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive,@uppy/image-editor,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/screen-capture,@uppy/status-bar,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/url,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: Refactor locale scripts & generate types and docs (Merlijn Vos / transloadit#3276)
- @uppy/companion: Remove references of incorrect `options` argument for `companion.socket` (Mikael Finstad / transloadit#3307)
- @uppy/companion: Upgrade linting to 2.0.0-0 (Kevin van Zonneveld / transloadit#3280)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard locale documentation is out of date
3 participants