-
Notifications
You must be signed in to change notification settings - Fork 33
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(synapse-constants): Refactor with rollup for package build and export [SLT-160] #3175
Changes from 1 commit
7712349
eff8683
45f487b
af5c0e1
03de23e
3dd19a9
1f6cc54
bd68bbc
20b0e4f
6f42be2
a5503a5
1297139
b7b7bb2
f132586
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
extends: '../../.eslintrc.js', | ||
overrides: [ | ||
{ | ||
files: ['**/*.ts'], | ||
rules: { | ||
'guard-for-in': 'off', | ||
'prefer-arrow/prefer-arrow-functions': 'off', | ||
}, | ||
}, | ||
], | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import typescript from 'rollup-plugin-typescript2' | ||
import { nodeResolve } from '@rollup/plugin-node-resolve' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import json from '@rollup/plugin-json' | ||
import terser from '@rollup/plugin-terser' | ||
import url from '@rollup/plugin-url' | ||
import { codecovRollupPlugin } from '@codecov/rollup-plugin' | ||
|
||
export default { | ||
input: 'src/index.ts', // Entry point for your constants/utilities | ||
output: [ | ||
{ | ||
file: 'dist/bundle.cjs.js', | ||
format: 'cjs', // CommonJS output | ||
sourcemap: true, | ||
}, | ||
{ | ||
file: 'dist/bundle.esm.js', | ||
format: 'esm', // ES Module output | ||
sourcemap: true, | ||
}, | ||
], | ||
plugins: [ | ||
nodeResolve({ | ||
preferBuiltins: true, | ||
}), | ||
commonjs(), | ||
json(), | ||
typescript({ | ||
tsconfig: './tsconfig.json', | ||
declaration: true, | ||
declarationDir: 'dist', | ||
}), | ||
terser(), | ||
url({ | ||
include: ['**/*.svg', '**/*.png', '**/*.jpg'], | ||
limit: 0, | ||
emitFiles: false, | ||
}), | ||
codecovRollupPlugin({ | ||
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, | ||
bundleName: 'synapse-constants', | ||
uploadToken: process.env.CODECOV_TOKEN, | ||
uploadOverrides: { | ||
sha: process.env.GH_COMMIT_SHA, | ||
}, | ||
}), | ||
], | ||
external: ['lodash', 'ethers'], | ||
abtestingalpha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
abtestingalpha marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ export const findChainIdsWithPausedToken = (routeSymbol: string) => { | |
PAUSED_TOKENS_BY_CHAIN, | ||
(result, tokens, chainId) => { | ||
if (_.includes(tokens, routeSymbol)) { | ||
result.push(chainId) | ||
result.push(chainId as never) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reconsider the use of The change from This change might be attempting to bypass a TypeScript compilation error, but it's not addressing the root cause of any potential type mismatch. Instead, consider the following alternatives:
|
||
} | ||
return result | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from './constants/tokens/index' | ||
export * as CHAINS from './constants/chains/index' | ||
export * from './constants/types/index' | ||
// export * from './constants/assets/chains/index' | ||
// export * from './constants/assets/explorer/index' | ||
// export * from './constants/assets/icons/index' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"allowJs": true, | ||
"rootDir": "./", | ||
"module": "ESNext", | ||
"target": "ES2019", | ||
"module": "CommonJS", | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"outDir": "dist", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"declaration": false, | ||
"jsx": "react", | ||
"skipLibCheck": true | ||
"resolveJsonModule": true | ||
}, | ||
"include": [ | ||
"./constants/**/*", | ||
"./custom.d.ts", | ||
"./index.ts", | ||
"./index.d.ts" | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"**/*.spec.ts" | ||
] | ||
} | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM: Plugin configuration is comprehensive and well-structured.
The plugin setup covers all necessary aspects of the build process:
The TypeScript plugin is correctly configured with the appropriate tsconfig and declaration settings, which is crucial for maintaining type information.
Consider extracting the Codecov configuration into a separate object for improved readability:
This change would make the configuration more modular and easier to maintain.