Skip to content

Commit

Permalink
refactor!: target es2020 (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 4, 2022
1 parent 683ee34 commit 63f6361
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
10 changes: 4 additions & 6 deletions scripts/copyMimeTypes.ts
Expand Up @@ -6,7 +6,7 @@ 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(
const mimeDbLicensePath = path.resolve(
rootPath,
'node_modules/mime-db/LICENSE'
);
Expand All @@ -20,10 +20,8 @@ fs.readFile(mimeDbPath, 'utf8', (err, data) => {
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`;
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,
Expand All @@ -33,7 +31,7 @@ fs.readFile(mimeDbPath, 'utf8', (err, data) => {
throw err;
}

console.log(`Mime types copied to ${mimeTypesTsPath as string}`);
console.log(`Mime types copied to ${mimeTypesTsPath}`);
}
);
});
3 changes: 2 additions & 1 deletion tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "ES5",
"target": "ES2020",
"moduleResolution": "Node",
"rootDir": "src",
"outDir": "dist",
"declaration": true,
Expand Down
14 changes: 14 additions & 0 deletions tsconfig.lint.json
@@ -1,5 +1,19 @@
{
"compilerOptions": {
"target": "ES2020",
"moduleResolution": "Node",
"esModuleInterop": true,
"allowJs": true,
"alwaysStrict": true,
// "strictNullChecks": true,
// "strictBindCallApply": true,
"strictFunctionTypes": true,
// "strictPropertyInitialization": true,
// "noImplicitAny": true,
// "noImplicitThis": true,
"useUnknownInCatchVariables": true,
"stripInternal": true,

"rootDir": ".",
"noEmit": true
},
Expand Down

0 comments on commit 63f6361

Please sign in to comment.