Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update config with year-based browsers selection #30

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
index.*
!index.ts
node_modules/
/index.d.ts
/index.js
/generate-link.d.ts
/generate-link.js
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
/index.d.ts
/index.js
/generate-link.d.ts
/generate-link.js
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Browserslist config of Gravity UI packages family

## Compatible browsers

You can check compatible browsers on [browsersl.ist](https://browsersl.ist/#q=last%202%20major%20versions%20and%20last%202%20years%20and%20fully%20supports%20es6%20and%20%3E%200.05%25%0Anot%20dead%0Anot%20op_mini%20all%0Anot%20and_qq%20%3E%200%0Anot%20and_uc%20%3E%200%0AFirefox%20ESR%0AChrome%20%3E%200%20and%20last%202%20years%20and%20%3E%200.05%25%0ASafari%20%3E%200%20and%20last%202%20years%20and%20%3E%200.05%25%0AFirefox%20%3E%200%20and%20last%202%20years%20and%20%3E%200.01%25).

## Install

```bash
Expand Down
3,547 changes: 2,307 additions & 1,240 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"lint:prettier": "prettier --check --loglevel=error './src/**/*.ts'",
"lint:typecheck": "tsc --noEmit",
"lint": "npm run lint:js && npm run lint:prettier && npm run lint:typecheck",
"clean": "rm -rf index.*",
"clean": "rm -rf index.* generate-link.*",
"build:compile": "tsc",
"build": "npm run clean && npm run build:compile",
"build:readme": "node generate-link.js",
"build": "npm run clean && npm run build:compile && npm run build:readme",
"prepublishOnly": "npm run lint && npm run build",
"test": "exit 0"
},
Expand All @@ -28,11 +29,12 @@
},
"license": "MIT",
"devDependencies": {
"@gravity-ui/eslint-config": "^2.0.0",
"@gravity-ui/prettier-config": "^1.0.1",
"@gravity-ui/eslint-config": "^3.1.1",
"@gravity-ui/prettier-config": "^1.1.0",
"@gravity-ui/tsconfig": "^1.0.0",
"eslint": "8.11.0",
"prettier": "2.6.0",
"typescript": "4.6.4"
"@types/node": "^18.19.8",
"eslint": "^8.56.0",
"prettier": "^3.2.3",
"typescript": "^5.3.3"
}
}
22 changes: 22 additions & 0 deletions src/generate-link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable no-console */
import {readFile, writeFile} from 'node:fs/promises';
import {resolve} from 'node:path';

import config from './index';

async function main() {
const readmeFilePath = resolve(__dirname, 'README.md');

const content = await readFile(readmeFilePath, 'utf8');
const updatedContent = content.replace(
/(\(https:\/\/browsersl\.ist\/#q=)[^)]+/,
`$1${encodeURIComponent(config.join('\n'))}`,
);

await writeFile(readmeFilePath, updatedContent, 'utf8');
}

main().catch((error) => {
console.error(error);
process.exit(1);
});
11 changes: 4 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
export = [
'last 2 major versions and since 2022 and > 0.05%',
'last 2 major versions and last 2 years and fully supports es6 and > 0.05%',
'not dead',
'not op_mini all',
'not and_qq > 0',
'not and_uc > 0',
'Firefox ESR',
// For support more Chromium browsers
'last 7 Chrome versions',
// For support Safari 15
'Safari >= 15.6 and > 0.1%',
//#FIXME: this is done temporarily to fix https://github.com/browserslist/browserslist-useragent/issues/80
'Firefox >= 109',
'Chrome > 0 and last 2 years and > 0.05%',
'Safari > 0 and last 2 years and > 0.05%',
'Firefox > 0 and last 2 years and > 0.01%',
];
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "@gravity-ui/tsconfig/tsconfig.json",
"compilerOptions": {
"target": "es3",
"target": "ES2022",
"declaration": true,
"outDir": "."
},
"types": ["node"],
"include": ["src/**/*"],
"exclude": ["**/node_modules/**"]
}
Loading