1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/development
Elliot Winkler 53006d4cf0
Add TypeScript to the build system (#13489)
This commit modifies the build system so that TypeScript files can be
transpiled into ES5 just like JavaScript files.

Note that this commit does NOT change the build system to run TypeScript
files through the TypeScript compiler. In other words, no files will be
type-checked at the build stage, as we expect type-checking to be
handled elsewhere (live, via your editor integration with `tsserver`,
and before a PR is merged, via `yarn lint`). Rather, we merely instruct
Babel to strip TypeScript-specific syntax from any files that have it,
as if those files had been written using JavaScript syntax alone.

Why take this approach? Because it prevents the build process from being
negatively impacted with respect to performance (as TypeScript takes a
significant amount of time to run).

It's worth noting the downside of this approach: because we aren't
running files through TypeScript, but relying on Babel's [TypeScript
transform][1] to identify TypeScript syntax, this transform has to keep
up with any syntax changes that TypeScript adds in the future. In fact
there are a few syntactical forms that Babel already does not recognize.
These forms are rare or are deprecated by TypeScript, so I don't
consider them to be a blocker, but it's worth noting just in case it
comes up later. Also, any settings we place in `tsconfig.json` will be
completely ignored by Babel. Again, this isn't a blocker because there
are some analogs for the most important settings reflected in the
options we can pass to the transform. These and other caveats are
detailed in the [documentation for the transform][2].

[1]: https://babeljs.io/docs/en/babel-plugin-transform-typescript
[2]: https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats
2022-03-28 16:33:40 -06:00
..
build Add TypeScript to the build system (#13489) 2022-03-28 16:33:40 -06:00
highlights Add JSDoc ESLint rules (#12112) 2022-01-07 12:27:33 -03:30
lib Derive version suffix from build type and version (#13895) 2022-03-10 12:31:50 -03:30
states Support for GridPlus Lattice1 hardware wallet (#12053) 2021-11-08 11:18:41 -03:30
announcer.js
chromereload.js
create-static-server.js
empty.js
generate-lavamoat-policies.sh Fix LavaMoat background policy generation (#12844) 2021-11-26 16:38:23 -03:30
generate-migration.sh
gource-viz.sh
jest.config.js Update Jest coverage reporters (#12845) 2021-12-01 15:16:34 -03:30
metamaskbot-build-announce.js Automate the Flask release process (#13898) 2022-03-15 08:54:37 -02:30
missing-locale-strings.js
mock-3box.js
mock-segment.js Remove unused SEGMENT_LEGACY_WRITE_KEY (#12429) 2021-10-22 10:34:37 -02:30
README.md
run-ganache.sh Adding support for EIP-1559 in E2E tests (#13282) 2022-01-19 04:38:41 +05:30
sentry-publish.js Automate the Flask release process (#13898) 2022-03-15 08:54:37 -02:30
sentry-upload-artifacts.sh Automate the Flask release process (#13898) 2022-03-15 08:54:37 -02:30
shellcheck.sh
show-deps-install-scripts.js
source-map-explorer.sh
sourcemap-validator.js
static-server.js
stream-flat-map.js
verify-locale-strings.js Fix manifest i18n substitutions for Beta and Flask (#12717) 2021-11-16 08:43:21 -08:00

Development

Several files which are needed for developing on MetaMask.

Usually each file or directory contains information about its scope / usage.