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: Productionize JavaScript and NPM #392

Draft
wants to merge 10 commits into
base: operation-solar-storm
Choose a base branch
from

Conversation

roninjin10
Copy link

@roninjin10 roninjin10 commented Oct 12, 2024

Adds npm publishing and generally updates the javascripts to be more robust

.gitattributes

Ignore some generated files in future github diffs

publish.yml

Runs basic checks like linters before publishing. By default it does a dry-run which means it tests that npm publishing will work but doesn't actually publish. To publish you must trigger a publish via a workflow action.

release.yml

Must have been a bad rebase because this

helios-ts/biome.json

Configures the biome linter to lint and format the ts package. I tried to configure it as much as the code was already formatted as possible.

helios-ts/docs

Generated docs that can be genrated via npm run docs

helios-ts/package.json

Updated package.json in many ways to robustly be ready to publish to npm

  • Added private: false and sideEffect: true as best practices
  • Added keywords and description
  • Added repostory info
  • Fixed license
  • Added contributors
  • Updated the module type to be module

Note: type: module means instead of using commonjs require() and module.exports you must use modern esm syntax now import foo from 'foo.js' and export default

  • Updated exports main modules and types to properly specify an npm package
  • Added seperate typescript types builds that will support source maps and are universally compatible
  • Added typedoc to generate docs
  • Added biome to lint and format
  • Added npm publish commands
  • Added a lint:package command that will lint the package to verify it is properly formatted to publish to npm and have universal compatibility with all node.js and typescript versions/setups
  • Added files property to only publish the files we need published and ignore files we don't need published
  • Added typecheck command that will run typechecker without building anything
  • Moved ethers to a dev dependency since the npm package doesn't need to install it

helios-ts/tsconfig.json

  • Made strict: true to better catch bugs
  • Added skipLibCheck because without this running npx tsc --noemit would break
  • Added emitDeclarationOnly because we are using webpack to build not tsc so tsc only builds types
  • Made the moduleResolution and module NodeNext as is currently a best practice

Note: node next requires us to add .js file extension to our files

  • Made target ES2020, a target that supports the private property syntax we are using

helios-ts/typedoc.json

Copy pasted a typedoc.json file in for the docs generation

helios-ts/webpack.config.js

Updated the webpack config to generate both esm and cjs for universal compatibility

  • Added jsdoc types so the typescript typechecker in your editor will give you autocomplete and diagnostics
  • Installed webpack-merge
  • created a base config shared by the 2 configs
  • Changed ts-loader to only transpile. This makes webpack way faster and works better since we use tsc to generate types now. This improves compatability and also allows tsc to generate source maps
  • the esm and commonjs configs extend the main config with more specific configuration

ncitron and others added 7 commits October 11, 2024 16:03
* generic execution client

* feat: generic consensus

* wip

* crate refactor

* fmt

* cleanup redundant modules

* clean up reexports

* clean up ethereum lib exports

* fix rpc socket handling

* fix tests

* ci

* remove unused clone

* fix transaction builder

* remove stub directories
* add lc server

* add client

* add builder

* add config

* add server cli

* fix rpc socket defaults

* change rpc defaults

* better block safety
* feat: wasm support for all networks

* cleanup
* wip

* feat: add execution block backfill

* handle finalized blocks

* cleanup

* fix timing in wasm

* remove web_sys from core

* typo

* rebase fixes
update webpack config

copy everything over

format and fix everything

workflow

finish
"format:check": "biome format .",
"lint": "biome check . --write --unsafe",
"lint:check": "biome check . --verbose",
"lint:package": "bunx publint --strict && attw --pack --ignore-rules cjs-resolves-to-esm",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lint:package": "bunx publint --strict && attw --pack --ignore-rules cjs-resolves-to-esm",
"lint:package": "npx bunx publint --strict && attw --pack --ignore-rules cjs-resolves-to-esm",

Copy pasta this should be npx since this repo isn’t using bun

@ncitron ncitron force-pushed the operation-solar-storm branch from ee12436 to 1d1b50b Compare October 23, 2024 23:03
@roninjin10 roninjin10 marked this pull request as draft November 22, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants