aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDivisionByZero <[email protected]>2023-01-29 22:33:12 +0100
committerGitHub <[email protected]>2023-01-29 21:33:12 +0000
commit52e9c1c43769d94f3f2c7be8e52504a46aa7cd74 (patch)
treea3eb1a14306f7c6817176cae366fc0fd9538276a /scripts
parent64f480d214dc0bd173b0921025c8a1ad76d12c0f (diff)
downloadfaker-52e9c1c43769d94f3f2c7be8e52504a46aa7cd74.tar.xz
faker-52e9c1c43769d94f3f2c7be8e52504a46aa7cd74.zip
refactor(system): replace mime db with common dataset (#1788)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/copyMimeTypes.ts37
1 files changed, 0 insertions, 37 deletions
diff --git a/scripts/copyMimeTypes.ts b/scripts/copyMimeTypes.ts
deleted file mode 100644
index f56acff9..00000000
--- a/scripts/copyMimeTypes.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import fs from 'node:fs';
-import path from 'node:path';
-import type { Options } from 'prettier';
-import { format } from 'prettier';
-import options from '../.prettierrc.cjs';
-
-const rootPath = path.resolve(__dirname, '..');
-const mimeDbPath = path.resolve(rootPath, 'node_modules/mime-db/db.json');
-const mimeDbLicensePath = path.resolve(
- rootPath,
- 'node_modules/mime-db/LICENSE'
-);
-const mimeTypesTsPath = path.resolve(
- rootPath,
- 'src/locales/en/system/mimeTypes.ts'
-);
-const prettierTsOptions: Options = { ...options, parser: 'typescript' };
-fs.readFile(mimeDbPath, 'utf8', (err, data) => {
- if (err) {
- throw err;
- }
-
- const license = fs.readFileSync(mimeDbLicensePath, { encoding: 'utf8' });
- const mimeTypeFileContent = `// This file is generated by scripts/copyMimeTypes.ts\n// Do not edit this file directly. Instead, update mime-db and run \`pnpm run copy:mime-types\`\n\n/*\n${license}*/\n\nexport default ${data};\n`;
-
- fs.writeFile(
- mimeTypesTsPath,
- format(mimeTypeFileContent, prettierTsOptions),
- (err) => {
- if (err) {
- throw err;
- }
-
- console.log(`Mime types copied to ${mimeTypesTsPath}`);
- }
- );
-});