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

chore: optimizing the build toolchain #1788

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# docs: https://github.com/browserslist/browserslist
# see https://browsersl.ist/#q=defaults

defaults
partially supports es6-module
iOS >= 10
ChromeAndroid >= 49
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

23 changes: 0 additions & 23 deletions .eslintrc

This file was deleted.

129 changes: 129 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// see docs: https://eslint.org/docs/user-guide/configuring

module.exports = {
ignorePatterns: [
'node_modules',
//
'.commitlintrc.cjs',
'.eslintrc.cjs',
'.lintstagedrc.mjs',
'babel.config.mjs',
'rollup.config.mjs',
'vite.config.mjs',
//
'packages/g-devtool',
'packages/g-webgpu-compiler',
'packages/site',
//
'build',
'coverage',
'esm',
'lib',
'dist',
'rust',
'__tests__',
'scripts',
'types',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'airbnb',
'airbnb/hooks',
'airbnb-typescript',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
plugins: ['eslint-plugin-tsdoc', 'jest'],
root: true,
env: {
node: true,
browser: true,
'jest/globals': true,
},
rules: {
'import/no-cycle': 'warn',
'import/no-duplicates': 'warn',
'class-methods-use-this': 'warn',
'no-plusplus': [
'warn',
{
allowForLoopAfterthoughts: true,
},
],
'no-restricted-globals': 'warn',
'no-continue': 'warn',
'no-multi-assign': 'warn',
'no-cond-assign': 'warn',
'no-return-assign': 'warn',
'no-new': 'warn',
'new-cap': 'warn',
'default-case': 'warn',
'consistent-return': 'warn',
'prefer-regex-literals': 'warn',
'guard-for-in': 'warn',
'no-underscore-dangle': 'off',
'no-fallthrough': 'off',
'no-empty': 'off',
'no-param-reassign': 'off',
'no-redeclare': 'off',
'no-useless-escape': 'off',
'no-case-declarations': 'off',
'no-constant-condition': 'off',
'import/prefer-default-export': 'off',
'prefer-destructuring': 'off',
'no-restricted-syntax': 'off',
'no-bitwise': 'off',
//
'@typescript-eslint/naming-convention': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-misused-promises': [
'warn',
{
checksConditionals: false,
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ args: 'none', ignoreRestSiblings: true },
],
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-base-to-string': 'warn',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: false },
],
'@typescript-eslint/no-redeclare': ['error'],
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/return-await': 'warn',
'@typescript-eslint/default-param-last': 'warn',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-invalid-this': 'off',
// not found
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/ban-types': 'off',
//
'tsdoc/syntax': 'warn',
},
globals: { G: true, window: true, document: true, module: true },
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jspm_packages/

# TypeScript v1 declaration files
typings/
types/

# Optional npm cache directory
.npm
Expand Down
9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

10 changes: 10 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# see docs: https://prettier.io/docs/en/configuration.html

semi: true
singleQuote: true
trailingComma: 'all'
bracketSpacing: true
arrowParens: 'always'
printWidth: 80
proseWrap: 'never'
endOfLine: 'auto'
37 changes: 37 additions & 0 deletions babel.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// See https://babeljs.io/docs/en/configuration

export default {
assumptions: {
privateFieldsAsProperties: true,
setPublicClassFields: true,
},
presets: [
[
'@babel/preset-env',
{
// Exclude transforms that make all code slower
exclude: ['transform-typeof-symbol'],
},
],
'@babel/preset-typescript',
'@babel/preset-react',
],
plugins: [
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
},
],
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
[
'@babel/plugin-transform-runtime',
{
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
// explicitly resolving to match the provided helper functions.
// https://github.com/babel/babel/issues/10261
version: '7.25.6',
},
],
],
};
35 changes: 24 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
"scripts": {
"dev": "vite",
"demo": "http-server -c-1 -o ./demo/",
"build": "pnpm -r --sequential --if-present run build",
"build:types": "pnpm --recursive --sequential --if-present run build:types",
"build": "pnpm --recursive --sequential --if-present run build",
"bundle-viz": "cross-env BUNDLE_VIS=1 PACKAGE=g npm run build",
"contributor": "git-contributor",
"cov": "jest --config jest.config.js --coverage",
"doc": "dumi dev",
"eslint": "eslint --ext .ts,.js ./packages --quiet",
"eslint-fix": "eslint --fix --ext .ts,.js ./packages",
"eslint": "eslint ./packages --config=.eslintrc.cjs --ext=.ts,.js --quiet --cache --cache-location=node_modules/.cache/.eslintcache",
"eslint-fix": "eslint ./packages --config=.eslintrc.cjs --fix --ext=.ts,.js",
"limit-size": "limit-size",
"lint": "npm run eslint",
"lint-staged": "lint-staged",
Expand Down Expand Up @@ -47,27 +48,40 @@
},
"devDependencies": {
"@antv/util": "^3.3.5",
"@babel/core": "^7.25.2",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@changesets/cli": "^2.26.2",
"@commitlint/cli": "^8.3.6",
"@commitlint/config-angular": "^9.1.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^6.0.1",
"@rollup/plugin-strip": "^3.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.10",
"@types/node": "^16.18.64",
"@types/pixelmatch": "^5.2.6",
"@types/pngjs": "^6.0.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"case-police": "^0.5.14",
"cross-env": "^6.0.3",
"cross-env": "^7.0.3",
"d3": "^7.8.5",
"d3-force-3d": "^3.0.3",
"eslint": "^7.32.0",
"eslint-plugin-jest": "24.3.6",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-tsdoc": "~0.2.17",
"fs-extra": "^11.2.0",
"get-pixels": "3.3.3",
"git-contributor": "~1.0.11",
Expand All @@ -89,12 +103,11 @@
"playwright": "latest",
"pngjs": "^6.0.0",
"portfinder": "^1.0.32",
"prettier": "^2.8.8",
"prettier": "3.2.5",
"rimraf": "^4.4.1",
"rollup": "^3.29.4",
"rollup-plugin-filesize": "^10.0.0",
"rollup-plugin-glslify": "^1.2.1",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-visualizer": "^5.9.2",
"simplex-noise": "^3.0.0",
"sinon": "^11.1.2",
Expand Down
9 changes: 6 additions & 3 deletions packages/g-camera-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,32 @@
"author": "https://github.com/orgs/antvis/people",
"sideEffects": true,
"exports": {
"types": "./dist/index.d.ts",
"types": "./types/index.d.ts",
"import": "./dist/index.esm.js",
"default": "./dist/index.js"
},
"main": "dist/index.js",
"unpkg": "dist/index.umd.min.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"types": "types/index.d.ts",
"files": [
"package.json",
"dist",
"types",
"LICENSE",
"README.md"
],
"scripts": {
"build": "npm run clean && rollup -c",
"build:types": "tsc --emitDeclarationOnly --noCheck",
"build": "npm run clean && npm run build:types && rollup -c",
"clean": "rimraf dist",
"sync": "tnpm sync",
"watch": "rollup -c -w"
},
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/util": "^3.3.5",
"@babel/runtime": "^7.25.6",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/g-camera-api/src/AdvancedCamera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ export class AdvancedCamera extends Camera {
const dist =
vec3.dist(interFocalPoint, destFocalPoint) +
vec3.dist(interPosition, destPosition);
if (dist <= epsilon && destZoom == undefined && destRoll == undefined) {
if (
dist <= epsilon &&
destZoom === undefined &&
destRoll === undefined
) {
return end();
}

Expand Down
Loading
Loading