Skip to content

Commit 478df9f

Browse files
authored
chore(typings): removed i18next default import typings fix
removes the meanwhile deprecated @types/i18next dependency and uses the shipped one instead fixes issue #324
1 parent c85b212 commit 478df9f

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

build/build.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const configs: Record<IBuildTargetFormat, { input: string; outputs: rollup.Outpu
5858
{ file: `dist/commonjs/${DIST_FILE_NAME}`, format: 'cjs' },
5959
{ file: `dist/amd/${DIST_FILE_NAME}`, format: 'amd', amd: { id: LIB_NAME } },
6060
{ file: `dist/native-modules/${DIST_FILE_NAME}`, format: 'esm' },
61-
{
61+
{
6262
file: `dist/umd/${DIST_FILE_NAME}`,
6363
format: 'umd',
6464
name: 'au.i18n',
@@ -168,7 +168,7 @@ if (args.dev) {
168168

169169
async function generateDts(): Promise<void> {
170170
console.log('\n==============\nGenerating dts bundle...\n==============');
171-
return new Promise<void>((resolve, reject) => {
171+
return new Promise<void>(resolve => {
172172
ChildProcess.exec(`npm run build:dts`, (err, stdout, stderr) => {
173173
if (err || stderr) {
174174
console.log('Generating dts error:');
@@ -177,26 +177,11 @@ async function generateDts(): Promise<void> {
177177
console.log('Generated dts bundle successfully');
178178
console.log(stdout);
179179
}
180-
try {
181-
fixI18nDefaultImport(path.resolve(DIST_DIR, TYPE_DIST_FILE_NAME));
182-
} catch (ex) {
183-
console.log('Failure fixing default import.');
184-
reject(ex);
185-
}
186180
resolve();
187181
});
188182
});
189183
}
190184

191-
async function fixI18nDefaultImport(typeDefFileName: string) {
192-
const importDeclaration = `import i18next from 'i18next';`;
193-
const data = fs.readFileSync(typeDefFileName, 'utf-8')
194-
.replace("import { i18next } from 'i18next';", importDeclaration);
195-
const fd = fs.openSync(typeDefFileName, 'w+');
196-
197-
fs.writeSync(fd, Buffer.from(data, 'utf8'));
198-
}
199-
200185
function copyToTargetProject(targetFormats: string[], targetProject: string) {
201186
console.log('=============\nCopying to target\n=============');
202187
targetFormats.forEach((targetFormat) => {

package-lock.json

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@
125125
"aurelia-pal": "^1.3.0",
126126
"aurelia-templating": "^1.8.2",
127127
"aurelia-templating-resources": "^1.7.1",
128-
"i18next": "^14.0.1"
128+
"i18next": "^14.1.1"
129129
},
130130
"devDependencies": {
131-
"@types/i18next": "^8.4.5",
132131
"@types/intl": "^1.2.0",
133132
"@types/jest": "^21.1.10",
134133
"@types/node": "^8.10.26",

0 commit comments

Comments
 (0)