Skip to content

Commit 3df98a0

Browse files
authored
chore: remove legacy locale folder (#2263)
1 parent 5f947cb commit 3df98a0

5 files changed

Lines changed: 3 additions & 44 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ versions.json
8080
/docs/api/typedoc.json
8181
/docs/public/api-diff-index.json
8282
/lib
83-
/locale
8483

8584
# Faker
8685
TAGS

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@
5353
},
5454
"files": [
5555
"CHANGELOG.md",
56-
"dist",
57-
"locale"
56+
"dist"
5857
],
5958
"scripts": {
60-
"clean": "rimraf coverage .eslintcache dist docs/.vitepress/dist pnpm-lock.yaml node_modules",
59+
"clean": "rimraf coverage .eslintcache dist docs/.vitepress/dist locale pnpm-lock.yaml node_modules",
6160
"build:clean": "rimraf dist",
6261
"build:code": "tsx ./scripts/bundle.ts",
6362
"build:types": "tsc --project tsconfig.build.json",

scripts/bundle.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
import { buildSync } from 'esbuild';
22
import { globSync } from 'glob';
3-
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
43
import { allLocales } from '../src';
54

65
console.log('Building dist for node (cjs)...');
76

8-
// Generate entry-points for cjs compatibility
9-
const localeDir = 'locale';
107
const target = ['ES2019', 'node14.17'];
118

12-
if (existsSync(localeDir)) {
13-
rmSync(localeDir, { recursive: true, force: true });
14-
}
15-
16-
mkdirSync(localeDir);
17-
for (const locale of Object.keys(allLocales)) {
18-
writeFileSync(
19-
`${localeDir}/${locale}.js`,
20-
`module.exports = require('../dist/cjs/locale/${locale}');\n`,
21-
{ encoding: 'utf8' }
22-
);
23-
}
24-
259
buildSync({
2610
entryPoints: globSync('./src/**/*.ts'),
2711
// We can use the following entry points when esbuild supports cjs+splitting

test/locale-imports.spec.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,4 @@ describe.each(Object.keys(allLocales))('locale imports', (locale) => {
6262
}
6363
}
6464
});
65-
66-
describe('Internal tests to cover `src/locale/*.ts`', () => {
67-
it(`should be possible to directly require('../locale/${locale}')`, () => {
68-
// eslint-disable-next-line @typescript-eslint/no-var-requires
69-
const { faker } = require(`../locale/${locale}`);
70-
71-
expect(faker).toBeDefined();
72-
expect(faker.string.alpha()).toBeTypeOf('string');
73-
expect(faker.definitions.metadata.title).toBe(
74-
allLocales[locale].metadata.title
75-
);
76-
});
77-
78-
it(`should be possible to directly import('../src/locale/${locale}')`, async () => {
79-
const { faker } = await import(`../src/locale/${locale}`);
80-
81-
expect(faker).toBeDefined();
82-
expect(faker.string.alpha()).toBeTypeOf('string');
83-
expect(faker.definitions.metadata.title).toBe(
84-
allLocales[locale].metadata.title
85-
);
86-
});
87-
});
8865
});

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
"allowSyntheticDefaultImports": true,
1818
"resolveJsonModule": true
1919
},
20-
"exclude": ["node_modules", "dist", "locale"]
20+
"exclude": ["node_modules", "dist"]
2121
}

0 commit comments

Comments
 (0)