diff --git a/package.json b/package.json index 08048ae9c..ae94e2d1c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "build:css": "yarn node ./bin/build-css.js && yarn workspace @uppy/components build:tailwind && yarn node ./bin/copy-tailwind-css.mjs", "build:js": "npm-run-all build:js:typeless build:locale-pack build:angular build:bundle", "build:js:typeless": "npm-run-all build:companion build:svelte", - "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && yarn workspace @uppy-dev/locale-pack test unused", + "build:locale-pack": "yarn workspace @uppy/locales build && yarn workspace @uppy/locales test", "build:svelte": "yarn workspace @uppy/svelte build", "check": "yarn exec biome check --write", "check:ci": "yarn exec biome ci", @@ -41,12 +41,10 @@ "size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c", "start:companion": "bash bin/companion.sh", "start:companion:with-loadbalancer": "e2e/start-companion-with-load-balancer.mjs", - "test": "npm-run-all lint test:locale-packs:unused test:unit test:companion", + "test": "npm-run-all lint test:locale-pack test:unit test:companion", "test:companion": "yarn workspace @uppy/companion test", "test:companion:watch": "yarn workspace @uppy/companion test --watch", - "test:locale-packs": "yarn locale-packs:unused && yarn locale-packs:warnings", - "test:locale-packs:unused": "yarn workspace @uppy-dev/locale-pack test unused", - "test:locale-packs:warnings": "yarn workspace @uppy-dev/locale-pack test warnings", + "test:locale-pack": "yarn workspace @uppy/locales test", "test:ts": "yarn tsc -b && yarn workspace @uppy/svelte check", "test:unit": "yarn run build && yarn test:watch --run", "test:watch": "vitest --environment jsdom --dir packages/@uppy", diff --git a/packages/@uppy/locales/package.json b/packages/@uppy/locales/package.json index de3e2627a..1403948e5 100644 --- a/packages/@uppy/locales/package.json +++ b/packages/@uppy/locales/package.json @@ -4,8 +4,11 @@ "version": "4.6.0", "license": "MIT", "type": "module", + "main": "locale-pack/index.mjs", "scripts": { - "build": "tsc --build tsconfig.build.json" + "build": "yarn node script/build-en_US.mjs && tsc --build tsconfig.build.json && yarn format", + "format": "cd ../../ && yarn check packages/@uppy/locales/src/en_US.ts", + "test": "yarn node script/test.mjs unused" }, "keywords": [ "uppy", @@ -21,7 +24,10 @@ "url": "git+https://github.com/transloadit/uppy.git" }, "dependencies": { - "@uppy/utils": "workspace:^" + "@uppy/utils": "workspace:^", + "chalk": "^5.0.0", + "dedent": "^1.0.0", + "glob": "^8.0.0" }, "devDependencies": { "typescript": "^5.8.3" diff --git a/private/locale-pack/index.mjs b/packages/@uppy/locales/script/build-en_US.mjs similarity index 87% rename from private/locale-pack/index.mjs rename to packages/@uppy/locales/script/build-en_US.mjs index 2b4ace44d..7185f1690 100644 --- a/private/locale-pack/index.mjs +++ b/packages/@uppy/locales/script/build-en_US.mjs @@ -1,4 +1,5 @@ -/* eslint-disable no-console, prefer-arrow-callback */ +// We use locale.ts in all packages. +// They need to be combined into a single file (en_US.ts). import { readFile, writeFile } from 'node:fs/promises' import path from 'node:path' @@ -6,7 +7,7 @@ import { fileURLToPath } from 'node:url' import { getLocales, sortObjectAlphabetically } from './helpers.mjs' -const root = fileURLToPath(new URL('../../', import.meta.url)) +const root = fileURLToPath(new URL('../../../../', import.meta.url)) const localesPath = path.join(root, 'packages', '@uppy', 'locales') const templatePath = path.join(localesPath, 'template.ts') @@ -44,5 +45,5 @@ await Promise.all([ 'en_US.strings = {}', `en_US.strings = ${formattedLocale}`, ), - ).then(() => console.log(`✅ Generated '${englishLocalePath}'`)), + ), ]) diff --git a/private/locale-pack/helpers.mjs b/packages/@uppy/locales/script/helpers.mjs similarity index 100% rename from private/locale-pack/helpers.mjs rename to packages/@uppy/locales/script/helpers.mjs diff --git a/private/locale-pack/test.mjs b/packages/@uppy/locales/script/test.mjs similarity index 96% rename from private/locale-pack/test.mjs rename to packages/@uppy/locales/script/test.mjs index c34b550cc..659ca868e 100644 --- a/private/locale-pack/test.mjs +++ b/packages/@uppy/locales/script/test.mjs @@ -9,7 +9,7 @@ import glob from 'glob' import { getLocales, getPaths, omit } from './helpers.mjs' -const root = fileURLToPath(new URL('../../', import.meta.url)) +const root = fileURLToPath(new URL('../../../../', import.meta.url)) const leadingLocaleName = 'en_US' const mode = process.argv[2] const pluginLocaleDependencies = { @@ -143,5 +143,3 @@ function test() { } await test() -console.log('\n') -console.log('No blocking issues found') diff --git a/private/locale-pack/package.json b/private/locale-pack/package.json deleted file mode 100644 index 1d3d21788..000000000 --- a/private/locale-pack/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "private": true, - "name": "@uppy-dev/locale-pack", - "author": "Merlijn Vos ", - "description": "Generate locale pack, types, and documentation", - "main": "index.mjs", - "scripts": { - "build": "yarn node index.mjs", - "test": "yarn node test.mjs" - }, - "dependencies": { - "chalk": "^5.0.0", - "dedent": "^1.0.0", - "glob": "^8.0.0" - } -} diff --git a/yarn.lock b/yarn.lock index 6770cfb3a..0bbb67e49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11085,16 +11085,6 @@ __metadata: languageName: unknown linkType: soft -"@uppy-dev/locale-pack@workspace:private/locale-pack": - version: 0.0.0-use.local - resolution: "@uppy-dev/locale-pack@workspace:private/locale-pack" - dependencies: - chalk: "npm:^5.0.0" - dedent: "npm:^1.0.0" - glob: "npm:^8.0.0" - languageName: unknown - linkType: soft - "@uppy-dev/release@workspace:private/release": version: 0.0.0-use.local resolution: "@uppy-dev/release@workspace:private/release" @@ -11888,6 +11878,9 @@ __metadata: resolution: "@uppy/locales@workspace:packages/@uppy/locales" dependencies: "@uppy/utils": "workspace:^" + chalk: "npm:^5.0.0" + dedent: "npm:^1.0.0" + glob: "npm:^8.0.0" typescript: "npm:^5.8.3" languageName: unknown linkType: soft