The following npm scripts are made
available to you in the project root. You can run each of them with
npm run <script-name>.
If you want to limit the scope of a script to a particular package, add the
--scope option to the command (e.g.,
npm run clean -- --scope=@aave/math-utils). See run options.
You can also run Lerna commands in this
project. It is recommended that you use
npx to run these commands (i.e.,
npx lerna <command>).
Supports run options.
Clean coverage results in ./coverage and runs npm run clean for each
package.
Supports run options.
Runs ESLint for each package.
Supports run options.
Runs the TypeScript compiler for each package without emitting any files. This is used in a pre-push hook for a faster alternative than a full build, so you probably won't want to run it directly.
Supports run options.
Runs the TypeScript compiler for each package.
Runs Jest in watch mode, which attempts to run only on changed files.
This command doesn't support --scope, but you can narrow the test run by
adding filename (path) filters in as many ...args that follow (e.g.,
npm test core/src).
Runs Jest in coverage mode,
dumping coverage results in ./coverage and showing a text summary in the
console output.
Feel free to add more
coverage reporters
to the list. The Jest configuration can be found in the root package.json.
Runs Commitizen commit wizard, ensuring that your commit messages conform to Conventional Commits.
Use the git commit command directly
with the
-n, --no-verify option
to bypasses the pre-commit and commit-msg hooks.
When we setup a new package you just need to create a new folder in packages
and do npm init and tsc --init. In the tsconfig paste:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist/esm",
"rootDir": "src"
}
}In the package.json copy these scripts and replace YOUR_PACKAGE_NAME with your
package name
"scripts": {
"clean": "cd ../.. && npx rimraf packages/YOUR_PACKAGE_NAME/dist packages/math-utils/*.log*",
"lint": "cd ../.. && eslint packages/YOUR_PACKAGE_NAME/src/**/*.ts",
"check-types": "yarn build -- --noEmit",
"prebuild": "yarn clean",
"build": "cd ../.. && tsc -p packages/YOUR_PACKAGE_NAME/tsconfig.json && tsc -p packages/YOUR_PACKAGE_NAME/tsconfig.json --module commonjs --outDir ./packages/YOUR_PACKAGE_NAME/dist/cjs",
"test": "cd ../.. && yarn test packages/YOUR_PACKAGE_NAME",
"cover": "cd ../.. && yarn cover packages/YOUR_PACKAGE_NAME",
"commit": "cd ../.. && yarn commit",
"prepublishOnly": "yarn build"
},also in the package.json paste these in:
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",That's it. Now start writing your logic. You must write your typescript code in
the src folder in your package.