From 3c01b42cf80c09d100743655ab0b1c91af1254af Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@ya.ru> Date: Wed, 13 Sep 2023 13:08:07 +0300 Subject: [PATCH] wip --- esbuild/build.js | 14 ++++++++------ package.json | 2 +- src/config/i18n.ts | 5 ++++- tsconfig.cjs.json | 2 +- tsconfig.esm.json | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/esbuild/build.js b/esbuild/build.js index 209c7461..1bfd80be 100755 --- a/esbuild/build.js +++ b/esbuild/build.js @@ -7,17 +7,16 @@ const {resolve} = require('node:path'); const postcss = require('postcss'); const postcssPresetEnv = require('postcss-preset-env'); -const tsconfigJson = require('../tsconfig.json'); - const {FileWatcher} = require('./FileWatcher'); const {SparsedBuild} = require('./SparsedBuild'); const {useFromSourcePlugin} = require('./use-from-source-plugin'); -const { - compilerOptions: {target}, -} = tsconfigJson; - async function build({path, format}) { + const tsconfig = require(`../tsconfig${format ? '.' + format : ''}.json`); + const { + compilerOptions: {target}, + } = tsconfig; + const watcher = new FileWatcher(process.argv.indexOf('--watch') > -1); const sparsed = new SparsedBuild( async (entry) => { @@ -30,6 +29,9 @@ async function build({path, format}) { outbase: './src', outdir: `./build${format ? '/' + format : ''}`, format: format, + loader: { + '.json': 'text', + }, plugins: [ useFromSourcePlugin(/\.svg$/), sparsed.plugin, diff --git a/package.json b/package.json index b6ab91db..009f3a2c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "React components for drawing Diplodoc documentation", "author": "YFM Team ", "license": "MIT", - "version": "3.0.0-alpha-4", + "version": "3.0.0-alpha-5", "repository": { "type": "git", "url": "git@github.com:yandex-cloud/docs-components.git" diff --git a/src/config/i18n.ts b/src/config/i18n.ts index 04ebc0b6..9146ee6f 100644 --- a/src/config/i18n.ts +++ b/src/config/i18n.ts @@ -18,7 +18,10 @@ let initializePromise: Promise | null = null; export const configureI18N = ({lang, loc}: I18NConfig) => { if (initializePromise === null) { lang = lang || Lang.En; - loc = loc || {ru, en}; + loc = loc || { + ru: JSON.parse(ru as unknown as string), + en: JSON.parse(en as unknown as string), + }; initializePromise = i18n.use(initReactI18next).init({ lng: lang, diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json index 365e3e7d..a8379931 100644 --- a/tsconfig.cjs.json +++ b/tsconfig.cjs.json @@ -3,7 +3,7 @@ "compilerOptions": { "module": "CommonJS", "target": "ES2017", - "outDir": "build/cjs", + "outDir": "build/cjs" }, "include": ["src/**/*.ts", "src/**/*.tsx"] } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 7100d0a9..84e6e1a8 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -3,7 +3,7 @@ "compilerOptions": { "module": "ESNext", "target": "ES2017", - "outDir": "build/esm", + "outDir": "build/esm" }, "include": ["src/**/*.ts", "src/**/*.tsx"] }