Skip to content

Commit

Permalink
Merge branch 'dashboard-i18n' into weblate/translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Adammatthiesen authored Nov 15, 2024
2 parents 29ccf8a + 5542979 commit 09ef1b2
Show file tree
Hide file tree
Showing 5 changed files with 309 additions and 27 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/translation-changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,10 @@ jobs:
run: pnpm ci:install
shell: bash

- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const write = require('@changesets/write')
const execa = require('execa')
const summary = `Translations Updated (PR #${context.payload.pull_request.number})`
const opts = { reject: false }
const { stdout } = await execa('grep', [summary, '-r', '.changeset'], opts)
if (stdout) {
console.log('Changeset already exists')
return
}
const releases = [
{ name: "@studiocms/core", type: "patch" }
]
const cwd = process.cwd()
const changesetId = await write.default({ summary, releases }, cwd)
console.log(`Changeset created: ${changesetId}`)
- name: Create Translation Changesets
run: pnpm translations:changesets
env:
CI_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"update:web": "pnpm --filter web up --latest",
"update:docs": "pnpm --filter docs up --latest",
"web:dev": "pnpm --filter web dev",
"docs:dev": "pnpm --filter docs dev"
"docs:dev": "pnpm --filter docs dev",
"translations:changeset": "tsm --require=./scripts/filter-warnings.cjs ./scripts/translation-changeset.ts"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
Expand All @@ -37,6 +38,7 @@
"@changesets/changelog-github": "^0.5.0",
"@changesets/write": "0.3.2",
"execa": "9.5.1",
"typescript": "catalog:"
"typescript": "catalog:",
"tsm": "2.3.0"
}
}
240 changes: 240 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions scripts/filter-warnings.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* When using custom loaders like `tsm` to add TypeScript & module support to scripts,
* Node.js outputs a known set of warnings, which distract from the actual script output.
*
* By adding `--require=./scripts/lib/filter-warnings.cjs` to the `node` or `tsm` args,
* this script filters those known warnings (but not any others) from the output.
*/

// Remove Node's built-in `warning` listener which outputs all warnings to stderr
process.removeAllListeners('warning');

// Add our own version that skips known warnings
process.on('warning', (warning) => {
const { name, message } = warning;
if (
name === 'ExperimentalWarning' &&
(message.indexOf('--experimental-loader') > -1 || message.indexOf('Custom ESM Loaders') > -1)
)
return;
if (name === 'DeprecationWarning' && message.indexOf('Obsolete loader hook') > -1) return;

console.warn(warning);
});
Loading

0 comments on commit 09ef1b2

Please sign in to comment.