Command Line Interface (CLI) app example using TypeScript. Produces a self-contained bundle file which can be installed and execute via command line.
- Unit tests with Jest.
- TypeScript adds additional syntax to JavaScript to support a tighter integration with your editor. Catch errors early in your editor.
- TypeScript understands JavaScript and uses type inference to give you great tooling without additional code.
WC is an extensible Rust-based platform for the next generation of fast developer tools. It's used by tools like Next.js, Parcel, and Deno, as well as companies like Vercel, ByteDance, Tencent, Shopify, and more.
- Fast
- SWC is 20x faster than Babel on a single thread and 70x faster on four cores.
A toolkit to automate & enhance your workflow
- Flexible
- Using code over configuration, utilize all of JavaScript to create your gulpfile—where tasks can be written using your own code or chained single purpose plugins.
- Composable
- Write individual, focused tasks and compose them into larger operations, providing you with speed and accuracy while reducing repetition.
- Efficient
- By using gulp streams, you can apply many transformations to your files while in memory before anything is written to the disk—significantly speeding up your build process.
Find and fix problems in your JavaScript code
Leverage gulp and the flexibility of JavaScript to automate slow, repetitive workflows and compose them into efficient build pipelines.
- Find Problems
- ESLint statically analyzes your code to quickly find problems. ESLint is built into most text editors and you can run ESLint as part of your continuous integration pipeline.
- Fix Automatically
- Many problems ESLint finds can be automatically fixed. ESLint fixes are syntax-aware so you won't experience errors introduced by traditional find-and-replace algorithms.
Jest is a delightful JavaScript Testing Framework with a focus on simplicity..
- Zero Config
- Jest aims to work out of the box, config free, on most JavaScript projects.
- Isolated
- Tests are parallelized by running them in their own processes to maximize performance.
- Snapshots
- Make tests which keep track of large objects with ease. Snapshots live either alongside your tests, or embedded inline.
- Great API
- From it to expect - Jest has the entire toolkit in one place. Well documented, well maintained, well good.
Static module bundler for modern JavaScript applications.
- Self Contained Bundles
We recommend yarn to manage project packages. Although you can use npm install to add packages, pick either yarn or npm to install/manage packages, and use only that command.
Why choose one?
yarn creates yarn.lock at the project root, while npm creates package-lock.json. These files separately and independently track specific package versions manages specific package versions. If both files exist, package versions in the project will be inconsistent.
Yarn resolutions allow per-package version overrides. All dependencies use the specified package version.
The resolutions section includes several packages flagged by Github as security vulnerabilities.
TypeScript logger with small footprint & configurable transports.
gulpfile.ts@toreda/build-tools@toreda/strong-types
Parse command-line arguments.
Packages used only during development should be placed indevDependencies.
Install packages with the --dev flag with yarn or the --save-dev flag with NPM to install a package directly into devDependencies.
With yarn:
yarn install @toreda/types --devWith NPM
npm install @toreda/types --save-devCore package for the SWC (Speedy Web Compiler). The super-fast TypeScript & JavaScript compiler written in Rust. Significantly
gulpfile.ts- All
.spec.tstest files where babel was previously used.
SWC Plugin enabling Jest to use SWC to transform files instead of Babel.
- Anytime
yarn testis run. - Used as
transforminjest.config.js. - All
.spec.tstest files where babel was previously used.
JavaScript & TypeScript linter which flags inconsistent formatting and styles.
gulpfile.ts- Running command
yarn lintoryarn eslint
Turns off all rules that are unnecessary or might conflict with [Prettier].
gulpfile.ts- Running command
yarn lintoryarn eslint
Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
gulpfile.ts- Running command
yarn lintoryarn eslint
Speeds up TypeScript type checking and ESLint linting (by moving each to a separate process)
gulpfile.tswebpack.config.ts
Streaming task-based build system.
gulpfile.ts- Running command
yarn buildoryarn gulp
Build scripts and Gulp pipelines for TypeScript project. Capable of building NPM packages, libraries, and command line apps. Acts as a Gulp wrapper, providing a single consistent build pipeline used by @toreda NPM projects.
Note: While this package can make your life easier it's not required for this package, but it's used in the default setup.
gulpfile.ts
Toreda's TypeScript ESLint configuration and ruleset for ESLint.
While standard for Toreda TypeScript projects, you can define any ruleset you'd like.
Change Toreda Ruleset
Edit .eslintrc.js and remove extends, or change the extends value to change the ESLint ruleset used.
extends: ['@toreda/eslint-config'],Override Individual Rules
Add Individual rules to rules: {...} in .eslintrc.js to change the behavior of that rule only. The rule value set overrides both the default value and the Toreda value for that rule.
package.json
Ruleset config to enforce Toreda's organization-wide formatting standard. Any prettier ruleset can be used in your project and this is not required for your own projects.
If you removed also remove this key from package.json:
"prettier": "@toreda/prettier-config",package.json
Basic and common type definitions used in @toreda projects.
@toreda/build-tools
Type definitions for Gulp.
gulpfile.ts
Type definitions for Node functions.
- Helpful types on import in any project
.tsfile.
Type definitions for webpack. Package version generally always match the webpack package version to eliminate bugs and API discrepancies.
webpack.config.ts
Type definitions for the webpack-node-externals webpack plugin. Provides typescript type hints for plugin configuration types.
webpack.config.ts
Adds type support for yargs function calls.
If you encounter build errors after installing @types/yargs it likely means code somewhere in the project did not respect yargs types.
Each package export without type definitions becomes an implicit any type. This behavior mimics vanilla JavaScript and effectively disables type checking (this is bad).
src/cli.ts
Type definitions for webpack.
webpack.config.ts
Adds support for defining external packages to use during build that are not included in bundle. Extremely useful when deploying bundles to platforms with libraries available. For example, AWS Lambda functions require aws-sdk during build and development, but the Lambda run-time environment makes aws-sdk to all Lambda functions. Using webpack-node-externals makes it easy to rely on aws-sdk during the build without adding redundant and unused code to the final bundle.
Excluding run-time packages is different than excluding devDependencies which may only used during build & bundling.
webpack.config.ts
Intuitive testing framework with integrated code coverage and report formatting.
Why include this package?
Jest is included in the project's package.json as a devDependency, rather than relying on the jest command being available for a couple important reasons.
Using Jest from package.json has a few benefits:
- Package guaranteed available. No guessing whether it's installed or what version is installed.
- The project controls the jest version.
- TypeScript often requires additional types or packages to work with popular NPM packages. Jest + TypeScript currently needs
ts-nodeand@types/jest(among others). Keeping package versions & package updates synchronized is tough task without surprise updates breaking testing.
- All
.spec.tstest files in./tests.
Intuitive testing framework with integrated code coverage and report formatting.
Why include this package?
Processes jest execution results and sends to a SonarQube instance. Target SonarQube server details set in sonar-project.properties
- All
.spec.tstest files in./tests.
Uglify replacement focused on better speed and better performance.
- All
.spec.tsfiles intests/
Run node scripts directly from the command line without transpiling.
TypeScript package support with tsconfig.json.
- Running
yarn build - Running
webpack. - Using
ts-loader
Lifecycle methods are like checkpoints that execute logic at each step in the client's lifecycle flow.
Init
The async init methods are called in the following order:
MIT © Toreda, Inc.
Copyright © 2019 - 2025 Toreda, Inc. All Rights Reserved.
Visit Toreda's official company website at www.toreda.com
