1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Commit Graph

31 Commits

Author SHA1 Message Date
Peter Bengtsson
bb67c2a6f5 move 'bottleneck' to optional dependencies (#24829) 2022-01-31 18:30:38 +00:00
Ryosuke Nakayama
e1a64337d3 Fix render translation test (#24235) 2022-01-12 13:26:58 +00:00
Peter Bengtsson
7f6f20a73f run prettier on all code in CI (#23482)
* run prettier on all code in CI

* rename

* test .tsx too

* ignore more

* prettier the stragglers

* minimal permission
2021-12-08 16:11:52 +00:00
Marcelo Jacobus
55a5805e47 Also check data directory for mismatching liquid tags (#23433) 2021-12-08 02:33:04 +00:00
Marcelo Jacobus
4d82765849 Hide list of files inside a details tag (#23407)
That way the PR looks shorter, even though it has the same information
as before
2021-12-06 14:55:00 +00:00
Marcelo Jacobus
840de67988 Flatten array before joining (#23222)
Fix PR report body created for this issue: https://github.com/github/docs-engineering/issues/1278
2021-11-30 17:49:41 +00:00
Marcelo Jacobus
7b7d78e126 Properly reset files with broken liquid tags (#23151)
* Fix: Properly reset files with broken liquid tags

* Add a comment clarifying why we reset translations the way we do
2021-11-30 13:06:20 +00:00
Marcelo Jacobus
9eadcaf683 Only output error message when file exists (#23155)
Close https://github.com/github/docs-engineering/issues/1276
2021-11-30 12:46:05 +00:00
Marcelo Jacobus
18a54dd34b Display all files reset in a translation batch (#23152)
* Output every file reset

* Add --dry-run and --reason options to reset-translated-file.js

* Output reason when reset-translated-file.js script is called
2021-11-30 12:38:22 +00:00
Marcelo Jacobus
855034fec3 Report files reset during the translation batch (#23159)
* Add script to report reset files

* Has the workflow report the reset files

* Fix script name

* Filter report by language

* Update .github/workflows/create-translation-batch-pr.yml

* Use build in array methods
2021-11-30 12:31:08 +00:00
Marcelo Jacobus
6275cd1071 Add script to spot differences in liquid tags (#22962)
* Add script to spot differences in liquid tags

It compares source and translation

Usage example:

```bash
script/i18n/liquid-diff.js {files} --language=es
```
2021-11-25 08:56:20 +00:00
Marcelo Jacobus
2de66f3c81 Fix script/i18n/lint-translation-files.js (#23016)
* Fix error

* Attempt to fix that error

* Remove debugging code

* fix: Update path of lint-translation script

* fix: Update conditional guard clause

The conditional compared an array to a string using strict equality, so
it was never going to be true. This change makes sure we return early
when there are no changes.

* fix: Exit early when there are no files to lint

* refactor: Filter files to reset in plain javascript

As opposed to doing it in bash.

* Update tests/linting/lint-files.js

Co-authored-by: Francis <15894826+francisfuzz@users.noreply.github.com>

* Update tests/linting/lint-files.js

Co-authored-by: Francis <15894826+francisfuzz@users.noreply.github.com>

* Update script/i18n/lint-translation-files.js

Co-authored-by: Francis <15894826+francisfuzz@users.noreply.github.com>

Co-authored-by: Francis <15894826+francisfuzz@users.noreply.github.com>
2021-11-23 16:11:34 -08:00
Francis
9c4ef4dcc0 Add a new test that checks every YAML document can be parsed (#23053)
* fix: update lint-translation script to point to the correct test

This change reflects its new home in `test/linting/lint-files.js` as committed in f0d17c300d on April 28, 2021.

* test: check release notes can be parsed a single YAML document

* test: check yaml content parsability

* test: check parsability for all YAML content

* refactor: move annotations to lint yaml content suite

* fix: revert file contents

* fix: remove local test script

* refactor: lowercase yaml file type

* fix: remove null assignment to stay consistent with other variables

* refactor: update reference name to caught error

* fix: remove the royal we from annotation

* refactor: update annotation for improved readability

* fix: add missing preposition
2021-11-23 18:46:04 +00:00
Francis
8f4140fa9f fix: update permissions and command execution for linting translation files (#22922)
* fix: make script for linting translations executable

* fix: execute the command directly

* feat: surface any errors if lint check fails

* fix: do not return early if lint check errors

Co-authored-by: Octomerger Bot <63058869+Octomerger@users.noreply.github.com>
2021-11-18 21:36:33 +00:00
Francis
5bb2c7acb2 [Localization] Refactor script for linting translation files to require check type (#22653)
* feat: stub two reset scripts

* refactor: split lint script into two separate files

* fix: revert back to original lint script

* refactor: use commander interface for linting translation files

* Skip reset attempt when violation list is empty

So that "execSync(`cat ${log}...`)" in line 64 is never executed. When
there are no errors, the log file is not created, and unless it had been
previously created by another process, the script will error out.

Co-authored-by: Marcelo Jacobus <marcelo.jacobus@gmail.com>
2021-11-17 03:09:07 +00:00
Francis
2422a22293 Reset known and unique broken translation files sequentially (#22709)
* fix: de-duplicate and filter non-existent broken files

* fix: sequentially reset known broken translation files

When a known broken translation is reset, a Git operation performs the
underlying reset. If more than one Git operation is running at a time,
Git will throw an error:

> Another git process seems to be running in this repository [...]

This change ensures that we reset each broken translation file
sequentially to not run into this error.

* Skip reset of a file that does not exist

Co-authored-by: Marcelo Jacobus <marcelo.jacobus@gmail.com>
2021-11-15 16:24:23 +00:00
Rachael Sewell
1c196cdd42 test frontmatter properties too (#22642) 2021-11-05 20:05:55 +00:00
Rachael Sewell
8c7deebadc add script to remove stale translation files (#22555) 2021-11-05 01:00:54 +00:00
Rachael Sewell
c5df94c88b Crowdin broken liquid test (#22559) 2021-11-04 14:27:22 -07:00
Marcelo Jacobus
ed9e3d79cb Add test and script to ensure 1:1 parity of liquid tags between source and translation (#22472)
Co-authored-by: Peter Bengtsson <peterbe@github.com>
2021-11-04 10:59:17 -03:00
Chris
bb20db6ed9 Update reset-known-broken-translation-files to ignore checked files sources from GitHub issue (#22576) 2021-11-03 19:32:07 +00:00
Rachael Sewell
95d02d7eef group translations scripts together (#22232) 2021-11-03 10:28:32 -07:00
Kevin Heis
b29e37318a Remove import x statements (#20594)
* Clear out most import x

* Update rimraf use

* Move up readme blocks in scripts
2021-07-29 20:28:30 +00:00
Kevin Heis
8a56437c93 Pretty format (#20352)
* Update prettier flow to include JS

* Run prettier

* ...run prettier
2021-07-14 14:35:01 -07:00
Kevin Heis
42e785b0a8 Migrate CommonJS to ESM (#20301)
* First run of script

* Get the app running --- ish

* Get NextJS working

* Remove `node:`

* Get more tests passing in unit directory

* Update FailBot test to use nock

* Update test.yml

* Update Dockerfile

* tests/content fixes

* Update page.js

* Update build-changelog.js

* updating tests/routing

* Update orphan-tests.js

* updating tests/rendering

* Update .eslintrc.js

* Update .eslintrc.js

* Install jest/globals

* "linting" tests

* staging update to server.mjs

* Change '.github/allowed-actions.js' to a ESM export

* Lint

* Fixes for the main package.json

* Move Jest to be last in the npm test command so we can pass args

* Just use 'npm run lint' in the npm test command

* update algolia label script

* update openapi script

* update require on openapi

* Update enterprise-algolia-label.js

* forgot JSON.parse

* Update lunr-search-index.js

* Always explicitly include process.cwd() for JSON file reads pathed from project root

* update graphql/update-files.js script

* Update other npm scripts using jest to pass ESM NODE_OPTIONS

* Update check-for-enterprise-issues-by-label.js for ESM

* Update create-enterprise-issue.js for ESM

* Import jest global for browser tests

* Convert 'script/deploy' to ESM

Co-authored-by: Grace Park <gracepark@github.com>
Co-authored-by: James M. Greene <jamesmgreene@github.com>
2021-07-14 13:49:18 -07:00
James M. Greene
542a459c06 Move script-only dependencies to devDependencies (#19542)
* Move lib/search/sync.js to script/search/sync.js

* Move mdast-util-from-markdown to devDeps

* Move lib/redirects/add-redirect-to-frontmatter.js to script/helpers/

* Move mkdirp to devDeps

* Move linkinator to devDeps

* Move rimraf to devDeps

* Fix script/search/sync.js require paths

* Move lib/search/build-records.js to script/search/

* Move lib/search/find-indexable-pages to script/search/

* Fix require paths for build-records

* Fix require paths for find-indexable-pages

* Move lib/search/algolia-get-remote-index-names.js to script/search/

* Movbe lib/search/algolia-search-index.js to script/search/

* Move lib/search/lunr-search-index.js to script/search/

* Move lib/search/lunr-get-index-names.js to script/search/

* Fix Lunr search index paths

* Move lib/search/validate-records.js to script/search/

* Move is-url to devDeps

* Move lib/search/algolia-client.js to script/search/

* Move lib/search/parse-page-sections-into-records.js to script/search/

* Move lib/search/rank.js to script/search/

* Fix path to cached-index-names.json file

* Normalize require for fs.promises
2021-05-25 20:44:19 +00:00
Kevin Heis
9ba7e6bc34 Update homogenize-frontmatter script to not stop on errors and concurrency yes (#19480)
* Update homogenize-frontmatter script to not stop on errors and concurrency yes

* Update homogenize-frontmatter.js

* Speed up by avoiding exists check

Node docs: Using fs.exists() to check for the existence of a file before calling fs.open(), fs.readFile() or fs.writeFile() is not recommended. Doing so introduces a race condition, since other processes may change the file's state between the two calls. Instead, user code should open/read/write the file directly and handle the error raised if the file does not exist.

* Update homogenize-frontmatter.js

Co-authored-by: Zeke Sikelianos <zeke@github.com>
2021-05-24 16:27:50 +00:00
Rachael Sewell
ad20a5e23c crowdin frontmatter cleanup workflow (#19329) 2021-05-14 00:10:28 +00:00
James M. Greene
a68d285228 Crowdin remediation process tweaks (#19252) 2021-05-13 20:38:43 +00:00
Zeke Sikelianos
918bd8a54f update frontmatter homogenisation to sweep all translated files (#19117)
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
Co-authored-by: James M. Greene <417751+JamesMGreene@users.noreply.github.com>
2021-05-03 23:26:18 +00:00
Zeke Sikelianos
2c3b74bb6c create script to homogenise localised frontmatter (#19014)
Co-authored-by: James M. Greene <JamesMGreene@github.com>
2021-04-29 18:50:09 +00:00