Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Sep 13, 2023
1 parent 6fef4b7 commit 3c01b42
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
14 changes: 8 additions & 6 deletions esbuild/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "React components for drawing Diplodoc documentation",
"author": "YFM Team <[email protected]>",
"license": "MIT",
"version": "3.0.0-alpha-4",
"version": "3.0.0-alpha-5",
"repository": {
"type": "git",
"url": "[email protected]:yandex-cloud/docs-components.git"
Expand Down
5 changes: 4 additions & 1 deletion src/config/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ let initializePromise: Promise<TFunction> | 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,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"module": "CommonJS",
"target": "ES2017",
"outDir": "build/cjs",
"outDir": "build/cjs"
},
"include": ["src/**/*.ts", "src/**/*.tsx"]
}
2 changes: 1 addition & 1 deletion tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"module": "ESNext",
"target": "ES2017",
"outDir": "build/esm",
"outDir": "build/esm"
},
"include": ["src/**/*.ts", "src/**/*.tsx"]
}

0 comments on commit 3c01b42

Please sign in to comment.