Skip to content

Commit

Permalink
Merge pull request #279 from gilbsgilbs/update-deps
Browse files Browse the repository at this point in the history
V1
  • Loading branch information
gilbsgilbs authored Dec 7, 2024
2 parents 6ad571b + 4f3832e commit 882d70b
Show file tree
Hide file tree
Showing 54 changed files with 3,535 additions and 3,334 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

50 changes: 0 additions & 50 deletions .eslintrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: CI
on: [push, pull_request]

env:
MAIN_NODE_VERSION: "16"
MAIN_NODE_VERSION: "22"

jobs:
static-checks:
Expand All @@ -26,7 +26,7 @@ jobs:
name: Run tests
strategy:
matrix:
node: ["18", "20", "21"]
node: ["18", "20", "22", "23"]
steps:
- uses: actions/checkout@v4
- name: Setup node
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ informed that you're working on it.
- `exporters/`: contains code related to exporting extracted translations to files.
- `commons.ts`: Types and exceptions definitions for extractors.
- `index.ts`: Entrypoint for exporters. Calls and uses the proper extractor implementation
(only JSONv3 and JSONv4 at the moment).
(only JSONv4).
- `json.ts`: [JSONv4](https://www.i18next.com/misc/json-format#i18next-json-v4) extractor
implementation.
- `comments.ts` parses the comment hints.
Expand Down
42 changes: 21 additions & 21 deletions docs/generateDocs.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
/* eslint-disable @typescript-eslint/no-require-imports */
const path = require("path");

const fs = require('fs-extra');
const yaml = require('js-yaml');
const nunjucks = require('nunjucks');
/* eslint-enable @typescript-eslint/no-var-requires */
const fs = require("fs-extra");
const yaml = require("js-yaml");
const nunjucks = require("nunjucks");
/* eslint-enable @typescript-eslint/no-require-imports */

const OUTPUT_PATH = './_build';
const TEMPLATES_PATH = './templates';
const ASSETS_PATH = './assets';
const OUTPUT_PATH = "./_build";
const TEMPLATES_PATH = "./templates";
const ASSETS_PATH = "./assets";

// Remove and recreate output directory
fs.removeSync(OUTPUT_PATH);
try {
fs.mkdirSync(OUTPUT_PATH);
} catch (err) {
if (err.code !== 'EEXIST') {
if (err.code !== "EEXIST") {
throw err;
}
}
fs.copySync(ASSETS_PATH, OUTPUT_PATH);

const env = new nunjucks.Environment(new nunjucks.FileSystemLoader('.'), {
const env = new nunjucks.Environment(new nunjucks.FileSystemLoader("."), {
autoescape: false,
});
env.addGlobal('includeFile', (src, ctx) => {
env.addGlobal("includeFile", (src, ctx) => {
return env.renderString(
fs
.readFileSync(src, 'utf-8')
.readFileSync(src, "utf-8")
// Substitute documentation links
.replace(
/\(\s*https:\/\/i18next-extract\.netlify\.com\/(?:#\/)?([^)]+)\s*\)/gm,
'($1)',
"($1)",
)
.replace(/\(\s*(?:\.\/|\/)?docs\/assets\/([^)]+)\s*\)/gm, '($1)'),
.replace(/\(\s*(?:\.\/|\/)?docs\/assets\/([^)]+)\s*\)/gm, "($1)"),
ctx,
);
});

const templatePaths = fs
.readdirSync(TEMPLATES_PATH)
.filter((s) => s.endsWith('.md') || s.endsWith('.html'));
.filter((s) => s.endsWith(".md") || s.endsWith(".html"));

for (const templatePath of templatePaths) {
console.log(`Rendering ${templatePath}.`);
Expand All @@ -49,17 +49,17 @@ for (const templatePath of templatePaths) {

let ctx = {};
try {
ctx = yaml.load(fs.readFileSync(filePath + '.yml'));
ctx = yaml.load(fs.readFileSync(filePath + ".yml"));
} catch (err) {
if (err.code !== 'ENOENT') {
if (err.code !== "ENOENT") {
throw err;
}
}

const tpl =
'<!-- THIS FILE WAS GENERATED FROM A TEMPLATE. DO NOT EDIT IT MANUALLY. -->\n' +
'<!-- Read CONTRIBUTING.md for more information. -->\n\n' +
fs.readFileSync(filePath, 'utf-8');
"<!-- THIS FILE WAS GENERATED FROM A TEMPLATE. DO NOT EDIT IT MANUALLY. -->\n" +
"<!-- Read CONTRIBUTING.md for more information. -->\n\n" +
fs.readFileSync(filePath, "utf-8");
fs.writeFileSync(
path.join(OUTPUT_PATH, templatePath),
env.renderString(tpl, ctx),
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"nodemon": "^3.0.1",
"nunjucks": "^3.2.4"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.5.3+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90"
}
17 changes: 3 additions & 14 deletions docs/templates/configuration.md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ configOptions:
https://react.i18next.com/latest/trans-component#additional-options-on-i-18-next-init).
defaultValue: "['br', 'strong', 'i', 'p']"
- name: compatibilityJSON
type: '"v3" | "v4"'
type: '"v4"|null'
description: |
Compatibility mode of the output JSON file. This option only changes the way plurals are exported.
See [JSONv* format documentation](https://www.i18next.com/misc/json-format#i18next-json-v4) and [why this option exists](https://www.i18next.com/misc/migration-guide#json-format-v4-pluralization).
defaultValue: '"v3"'
Compatibility mode of the output JSON file. As i18next has dropped support for JSONv3, this option is a no-op in practice.
defaultValue: 'null'
- name: i18nextInstanceNames
type: "string[]"
description: |
Expand Down Expand Up @@ -333,15 +331,6 @@ configOptions:
type: "number"
description: Number of indentation space to use in extracted JSON files.
defaultValue: "2"
- name: enableExperimentalIcu
type: "boolean"
description: |
Enable experimental support for [ICU message syntax](
http://userguide.icu-project.org/formatparse/messages). Only plurals and JSONv4 are supported for now.
☠️ *This feature is incomplete and might change or move into an third-party module in the
future. Stay tuned.* ☠️
defaultValue: "false"
- name: excludes
type: "string[]"
description: |
Expand Down
Loading

0 comments on commit 882d70b

Please sign in to comment.