-
-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated mime-db to 1.52.0 (#808)
- Loading branch information
Showing
5 changed files
with
2,189 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 mimeDbLicencePath = 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 licence = fs.readFileSync(mimeDbLicencePath, { 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${ | ||
licence as string | ||
}*/\n\nexport default ${data as string};\n`; | ||
|
||
fs.writeFile( | ||
mimeTypesTsPath, | ||
format(mimeTypeFileContent, prettierTsOptions), | ||
(err) => { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
console.log(`Mime types copied to ${mimeTypesTsPath as string}`); | ||
} | ||
); | ||
}); |
Oops, something went wrong.