eth-block-tracker
Advanced tools
Comparing version 5.0.1 to 6.1.0
import SafeEventEmitter from '@metamask/safe-event-emitter'; | ||
import { JsonRpcRequest, JsonRpcResponse } from 'json-rpc-engine'; | ||
export interface Provider extends SafeEventEmitter { | ||
sendAsync: <T, U>(req: JsonRpcRequest<T>, cb: (err: Error, response: JsonRpcResponse<U>) => void) => void; | ||
} | ||
interface BaseBlockTrackerArgs { | ||
blockResetDuration?: number; | ||
} | ||
export declare class BaseBlockTracker extends SafeEventEmitter { | ||
export declare abstract class BaseBlockTracker extends SafeEventEmitter { | ||
protected _isRunning: boolean; | ||
@@ -14,15 +10,16 @@ private _blockResetDuration; | ||
private _blockResetTimeout?; | ||
constructor(opts?: BaseBlockTrackerArgs); | ||
constructor(opts: BaseBlockTrackerArgs); | ||
destroy(): Promise<void>; | ||
isRunning(): boolean; | ||
getCurrentBlock(): string | null; | ||
getLatestBlock(): Promise<string>; | ||
removeAllListeners(eventName: string | symbol): this; | ||
removeAllListeners(eventName?: string | symbol): this; | ||
/** | ||
* To be implemented in subclass. | ||
*/ | ||
protected _start(): void; | ||
protected abstract _start(): Promise<void>; | ||
/** | ||
* To be implemented in subclass. | ||
*/ | ||
protected _end(): void; | ||
protected abstract _end(): Promise<void>; | ||
private _setupInternalEvents; | ||
@@ -29,0 +26,0 @@ private _onNewListener; |
@@ -12,3 +12,3 @@ "use strict"; | ||
class BaseBlockTracker extends safe_event_emitter_1.default { | ||
constructor(opts = {}) { | ||
constructor(opts) { | ||
super(); | ||
@@ -27,2 +27,7 @@ // config | ||
} | ||
async destroy() { | ||
this._cancelBlockResetTimeout(); | ||
await this._maybeEnd(); | ||
super.removeAllListeners(); | ||
} | ||
isRunning() { | ||
@@ -59,14 +64,2 @@ return this._isRunning; | ||
} | ||
/** | ||
* To be implemented in subclass. | ||
*/ | ||
_start() { | ||
// default behavior is noop | ||
} | ||
/** | ||
* To be implemented in subclass. | ||
*/ | ||
_end() { | ||
// default behavior is noop | ||
} | ||
_setupInternalEvents() { | ||
@@ -93,3 +86,3 @@ // first remove listeners for idempotence | ||
} | ||
_maybeStart() { | ||
async _maybeStart() { | ||
if (this._isRunning) { | ||
@@ -101,5 +94,6 @@ return; | ||
this._cancelBlockResetTimeout(); | ||
this._start(); | ||
await this._start(); | ||
this.emit('_started'); | ||
} | ||
_maybeEnd() { | ||
async _maybeEnd() { | ||
if (!this._isRunning) { | ||
@@ -110,3 +104,4 @@ return; | ||
this._setupBlockResetTimeout(); | ||
this._end(); | ||
await this._end(); | ||
this.emit('_ended'); | ||
} | ||
@@ -121,3 +116,3 @@ _getBlockTrackerEventCount() { | ||
// only update if blok number is higher | ||
if (currentBlock && (hexToInt(newBlock) <= hexToInt(currentBlock))) { | ||
if (currentBlock && hexToInt(newBlock) <= hexToInt(currentBlock)) { | ||
return; | ||
@@ -153,2 +148,9 @@ } | ||
exports.BaseBlockTracker = BaseBlockTracker; | ||
/** | ||
* Converts a number represented as a string in hexadecimal format into a native | ||
* number. | ||
* | ||
* @param hexInt - The hex string. | ||
* @returns The number. | ||
*/ | ||
function hexToInt(hexInt) { | ||
@@ -155,0 +157,0 @@ return Number.parseInt(hexInt, 16); |
@@ -1,3 +0,3 @@ | ||
export * from './BaseBlockTracker'; | ||
export * from './PollingBlockTracker'; | ||
export * from './SubscribeBlockTracker'; | ||
export * from './types'; |
@@ -13,5 +13,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./BaseBlockTracker"), exports); | ||
__exportStar(require("./PollingBlockTracker"), exports); | ||
__exportStar(require("./SubscribeBlockTracker"), exports); | ||
__exportStar(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,10 @@ | ||
import { BaseBlockTracker, Provider } from './BaseBlockTracker'; | ||
interface PollingBlockTrackerArgs { | ||
provider: Provider; | ||
pollingInterval: number; | ||
retryTimeout: number; | ||
keepEventLoopActive: boolean; | ||
setSkipCacheFlag: boolean; | ||
import { BaseBlockTracker } from './BaseBlockTracker'; | ||
import { Provider } from './types'; | ||
export interface PollingBlockTrackerOptions { | ||
provider?: Provider; | ||
pollingInterval?: number; | ||
retryTimeout?: number; | ||
keepEventLoopActive?: boolean; | ||
setSkipCacheFlag?: boolean; | ||
blockResetDuration?: number; | ||
} | ||
@@ -15,5 +17,6 @@ export declare class PollingBlockTracker extends BaseBlockTracker { | ||
private _setSkipCacheFlag; | ||
constructor(opts?: Partial<PollingBlockTrackerArgs>); | ||
constructor(opts?: PollingBlockTrackerOptions); | ||
checkForLatestBlock(): Promise<string>; | ||
protected _start(): void; | ||
protected _start(): Promise<void>; | ||
protected _end(): Promise<void>; | ||
private _synchronize; | ||
@@ -23,2 +26,1 @@ private _updateLatestBlock; | ||
} | ||
export {}; |
@@ -10,6 +10,9 @@ "use strict"; | ||
const BaseBlockTracker_1 = require("./BaseBlockTracker"); | ||
const createRandomId = json_rpc_random_id_1.default(); | ||
const logging_utils_1 = require("./logging-utils"); | ||
const log = (0, logging_utils_1.createModuleLogger)(logging_utils_1.projectLogger, 'polling-block-tracker'); | ||
const createRandomId = (0, json_rpc_random_id_1.default)(); | ||
const sec = 1000; | ||
class PollingBlockTracker extends BaseBlockTracker_1.BaseBlockTracker { | ||
constructor(opts = {}) { | ||
var _a; | ||
// parse + validate args | ||
@@ -20,3 +23,3 @@ if (!opts.provider) { | ||
super({ | ||
blockResetDuration: opts.pollingInterval, | ||
blockResetDuration: (_a = opts.blockResetDuration) !== null && _a !== void 0 ? _a : opts.pollingInterval, | ||
}); | ||
@@ -27,3 +30,4 @@ // config | ||
this._retryTimeout = opts.retryTimeout || this._pollingInterval / 10; | ||
this._keepEventLoopActive = opts.keepEventLoopActive === undefined ? true : opts.keepEventLoopActive; | ||
this._keepEventLoopActive = | ||
opts.keepEventLoopActive === undefined ? true : opts.keepEventLoopActive; | ||
this._setSkipCacheFlag = opts.setSkipCacheFlag || false; | ||
@@ -36,13 +40,19 @@ } | ||
} | ||
_start() { | ||
this._synchronize().catch((err) => this.emit('error', err)); | ||
async _start() { | ||
this._synchronize(); | ||
} | ||
async _end() { | ||
// No-op | ||
} | ||
async _synchronize() { | ||
var _a; | ||
while (this._isRunning) { | ||
try { | ||
await this._updateLatestBlock(); | ||
await timeout(this._pollingInterval, !this._keepEventLoopActive); | ||
const promise = timeout(this._pollingInterval, !this._keepEventLoopActive); | ||
this.emit('_waitingForNextIteration'); | ||
await promise; | ||
} | ||
catch (err) { | ||
const newErr = new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${err.stack}`); | ||
const newErr = new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${(_a = err.stack) !== null && _a !== void 0 ? _a : err}`); | ||
try { | ||
@@ -54,3 +64,5 @@ this.emit('error', newErr); | ||
} | ||
await timeout(this._retryTimeout, !this._keepEventLoopActive); | ||
const promise = timeout(this._retryTimeout, !this._keepEventLoopActive); | ||
this.emit('_waitingForNextIteration'); | ||
await promise; | ||
} | ||
@@ -74,5 +86,7 @@ } | ||
} | ||
const res = await pify_1.default((cb) => this._provider.sendAsync(req, cb))(); | ||
log('Making request', req); | ||
const res = await (0, pify_1.default)((cb) => this._provider.sendAsync(req, cb))(); | ||
log('Got response', res); | ||
if (res.error) { | ||
throw new Error(`PollingBlockTracker - encountered error fetching block:\n${res.error}`); | ||
throw new Error(`PollingBlockTracker - encountered error fetching block:\n${res.error.message}`); | ||
} | ||
@@ -83,2 +97,11 @@ return res.result; | ||
exports.PollingBlockTracker = PollingBlockTracker; | ||
/** | ||
* Waits for the specified amount of time. | ||
* | ||
* @param duration - The amount of time in milliseconds. | ||
* @param unref - Assuming this function is run in a Node context, governs | ||
* whether Node should wait before the `setTimeout` has completed before ending | ||
* the process (true for no, false for yes). Defaults to false. | ||
* @returns A promise that can be used to wait. | ||
*/ | ||
function timeout(duration, unref) { | ||
@@ -85,0 +108,0 @@ return new Promise((resolve) => { |
@@ -1,4 +0,5 @@ | ||
import { BaseBlockTracker, Provider } from './BaseBlockTracker'; | ||
interface SubscribeBlockTrackerArgs { | ||
provider: Provider; | ||
import { BaseBlockTracker } from './BaseBlockTracker'; | ||
import { Provider } from './types'; | ||
export interface SubscribeBlockTrackerOptions { | ||
provider?: Provider; | ||
blockResetDuration?: number; | ||
@@ -9,3 +10,3 @@ } | ||
private _subscriptionId; | ||
constructor(opts?: Partial<SubscribeBlockTrackerArgs>); | ||
constructor(opts?: SubscribeBlockTrackerOptions); | ||
checkForLatestBlock(): Promise<string>; | ||
@@ -17,2 +18,1 @@ protected _start(): Promise<void>; | ||
} | ||
export {}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const BaseBlockTracker_1 = require("./BaseBlockTracker"); | ||
const createRandomId = json_rpc_random_id_1.default(); | ||
const createRandomId = (0, json_rpc_random_id_1.default)(); | ||
class SubscribeBlockTracker extends BaseBlockTracker_1.BaseBlockTracker { | ||
@@ -29,4 +29,4 @@ constructor(opts = {}) { | ||
try { | ||
const blockNumber = await this._call('eth_blockNumber'); | ||
this._subscriptionId = await this._call('eth_subscribe', 'newHeads', {}); | ||
const blockNumber = (await this._call('eth_blockNumber')); | ||
this._subscriptionId = (await this._call('eth_subscribe', 'newHeads')); | ||
this._provider.on('data', this._handleSubData.bind(this)); | ||
@@ -54,3 +54,6 @@ this._newPotentialLatest(blockNumber); | ||
this._provider.sendAsync({ | ||
id: createRandomId(), method, params, jsonrpc: '2.0', | ||
id: createRandomId(), | ||
method, | ||
params, | ||
jsonrpc: '2.0', | ||
}, (err, res) => { | ||
@@ -68,3 +71,4 @@ if (err) { | ||
var _a; | ||
if (response.method === 'eth_subscription' && ((_a = response.params) === null || _a === void 0 ? void 0 : _a.subscription) === this._subscriptionId) { | ||
if (response.method === 'eth_subscription' && | ||
((_a = response.params) === null || _a === void 0 ? void 0 : _a.subscription) === this._subscriptionId) { | ||
this._newPotentialLatest(response.params.result.number); | ||
@@ -71,0 +75,0 @@ } |
{ | ||
"name": "eth-block-tracker", | ||
"version": "5.0.1", | ||
"version": "6.1.0", | ||
"description": "A block tracker for the Ethereum blockchain. Keeps track of the latest block.", | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/MetaMask/eth-block-tracker.git" | ||
}, | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
@@ -15,15 +16,16 @@ "types": "dist/index.d.ts", | ||
"scripts": { | ||
"lint": "eslint . --ext ts,js,json", | ||
"lint:fix": "yarn lint --fix", | ||
"build": "tsc --project .", | ||
"test": "yarn build && node test/index.js", | ||
"prepublishOnly": "yarn lint && yarn test" | ||
"build": "tsc --project tsconfig.build.json", | ||
"build:clean": "rimraf dist && yarn build", | ||
"lint": "yarn lint:eslint && yarn lint:misc --check", | ||
"lint:eslint": "eslint . --cache --ext js,ts", | ||
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", | ||
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern", | ||
"prepublishOnly": "yarn build:clean && yarn lint && yarn test", | ||
"setup": "yarn install && yarn allow-scripts", | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
}, | ||
"license": "MIT", | ||
"resolutions": { | ||
"ganache-core/**/elliptic": "^6.5.3", | ||
"ganache-core/lodash": "^4.17.19" | ||
}, | ||
"dependencies": { | ||
"@metamask/safe-event-emitter": "^2.0.0", | ||
"@metamask/utils": "^3.0.1", | ||
"json-rpc-random-id": "^1.0.1", | ||
@@ -33,27 +35,43 @@ "pify": "^3.0.0" | ||
"devDependencies": { | ||
"@metamask/eslint-config": "^5.0.0", | ||
"@types/json-rpc-random-id": "^1.0.0", | ||
"@types/pify": "^5.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.14.1", | ||
"@typescript-eslint/parser": "^4.14.1", | ||
"eslint": "^7.18.0", | ||
"@lavamoat/allow-scripts": "^2.0.2", | ||
"@metamask/auto-changelog": "^3.0.0", | ||
"@metamask/eslint-config": "^9.0.0", | ||
"@metamask/eslint-config-jest": "^9.0.0", | ||
"@metamask/eslint-config-nodejs": "^9.0.0", | ||
"@metamask/eslint-config-typescript": "^9.0.1", | ||
"@types/jest": "^27.4.1", | ||
"@types/json-rpc-random-id": "^1.0.1", | ||
"@types/node": "^17.0.23", | ||
"@types/pify": "^5.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.20.0", | ||
"@typescript-eslint/parser": "^4.20.0", | ||
"eslint": "^7.23.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-import-resolver-typescript": "^2.7.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-json": "^2.1.2", | ||
"eslint-plugin-jest": "^24.1.3", | ||
"eslint-plugin-jsdoc": "^36.1.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"ganache-core": "^2.7.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"jest": "^27.5.1", | ||
"json-rpc-engine": "^6.1.0", | ||
"tape": "^4.9.0", | ||
"typescript": "^4.1.3" | ||
"prettier": "^2.2.1", | ||
"prettier-plugin-packagejson": "^2.2.11", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^27.1.4", | ||
"ts-node": "^10.7.0", | ||
"typescript": "~4.4.0" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
"engines": { | ||
"node": ">=14.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/MetaMask/eth-block-tracker.git" | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/MetaMask/eth-block-tracker/issues" | ||
}, | ||
"homepage": "https://github.com/MetaMask/eth-block-tracker#readme" | ||
"lavamoat": { | ||
"allowScripts": { | ||
"@lavamoat/preinstall-always-fail": false | ||
} | ||
} | ||
} |
131
README.md
# eth-block-tracker | ||
This module walks the Ethereum blockchain, keeping track of the latest block. | ||
It uses a web3 provider as a data source and will continuously poll for the next block. | ||
This module walks the Ethereum blockchain, keeping track of the latest block. It uses a web3 provider as a data source and will continuously poll for the next block. | ||
## Installation | ||
`yarn add eth-block-tracker` | ||
or | ||
`npm install eth-block-tracker` | ||
## Usage | ||
```js | ||
const createInfuraProvider = require('eth-json-rpc-infura') | ||
const { PollingBlockTracker } = require('eth-block-tracker') | ||
const createInfuraProvider = require('eth-json-rpc-infura'); | ||
const { PollingBlockTracker } = require('eth-block-tracker'); | ||
const provider = createInfuraProvider({ network: 'mainnet', projectId: process.env.INFURA_PROJECT_ID }) | ||
const blockTracker = new PollingBlockTracker({ provider }) | ||
const provider = createInfuraProvider({ | ||
network: 'mainnet', | ||
projectId: process.env.INFURA_PROJECT_ID, | ||
}); | ||
const blockTracker = new PollingBlockTracker({ provider }); | ||
blockTracker.on('sync', ({ newBlock, oldBlock }) => { | ||
if (oldBlock) { | ||
console.log(`sync #${Number(oldBlock)} -> #${Number(newBlock)}`) | ||
console.log(`sync #${Number(oldBlock)} -> #${Number(newBlock)}`); | ||
} else { | ||
console.log(`first sync #${Number(newBlock)}`) | ||
console.log(`first sync #${Number(newBlock)}`); | ||
} | ||
}) | ||
}); | ||
``` | ||
## Methods | ||
## API | ||
### new PollingBlockTracker({ provider, pollingInterval, retryTimeout, keepEventLoopActive }) | ||
### Methods | ||
creates a new block tracker with `provider` as a data source and | ||
`pollingInterval` (ms) timeout between polling for the latest block. | ||
If an Error is encountered when fetching blocks, it will wait `retryTimeout` (ms) before attempting again. | ||
If `keepEventLoopActive` is false, in Node.js it will [unref the polling timeout](https://nodejs.org/api/timers.html#timers_timeout_unref), allowing the process to exit during the polling interval. defaults to `true`, meaning the process will be kept alive. | ||
#### new PollingBlockTracker({ provider, pollingInterval, retryTimeout, keepEventLoopActive }) | ||
### getCurrentBlock() | ||
Creates a new block tracker with `provider` as a data source and `pollingInterval` (ms) timeout between polling for the latest block. If an error is encountered when fetching blocks, it will wait `retryTimeout` (ms) before attempting again. If `keepEventLoopActive` is false, in Node.js it will [unref the polling timeout](https://nodejs.org/api/timers.html#timers_timeout_unref), allowing the process to exit during the polling interval. Defaults to `true`, meaning the process will be kept alive. | ||
synchronous returns the current block. may be `null`. | ||
#### getCurrentBlock() | ||
Synchronously returns the current block. May be `null`. | ||
```js | ||
console.log(blockTracker.getCurrentBlock()) | ||
console.log(blockTracker.getCurrentBlock()); | ||
``` | ||
### async getLatestBlock() | ||
#### async getLatestBlock() | ||
Asynchronously returns the latest block. | ||
if not immediately available, it will fetch one. | ||
Asynchronously returns the latest block. if not immediately available, it will fetch one. | ||
### async checkForLatestBlock() | ||
#### async checkForLatestBlock() | ||
Tells the block tracker to ask for a new block immediately, in addition to its normal polling interval. | ||
Useful if you received a hint of a new block (e.g. via `tx.blockNumber` from `getTransactionByHash`). | ||
Will resolve to the new latest block when its done polling. | ||
Tells the block tracker to ask for a new block immediately, in addition to its normal polling interval. Useful if you received a hint of a new block (e.g. via `tx.blockNumber` from `getTransactionByHash`). Will resolve to the new latest block when done polling. | ||
## Events | ||
### Events | ||
### latest | ||
#### latest | ||
The `latest` event is emitted for whenever a new latest block is detected. | ||
This may mean skipping blocks if there were two created since the last polling period. | ||
The `latest` event is emitted for whenever a new latest block is detected. This may mean skipping blocks if there were two created since the last polling period. | ||
```js | ||
blockTracker.on('latest', (newBlock) => console.log(newBlock)) | ||
blockTracker.on('latest', (newBlock) => console.log(newBlock)); | ||
``` | ||
### sync | ||
#### sync | ||
@@ -66,6 +73,8 @@ The `sync` event is emitted the same as "latest" but includes the previous block. | ||
```js | ||
blockTracker.on('sync', ({ newBlock, oldBlock }) => console.log(newBlock, oldBlock)) | ||
blockTracker.on('sync', ({ newBlock, oldBlock }) => | ||
console.log(newBlock, oldBlock), | ||
); | ||
``` | ||
### error | ||
#### error | ||
@@ -75,3 +84,57 @@ The `error` event means an error occurred while polling for the latest block. | ||
```js | ||
blockTracker.on('error', (err) => console.error(err)) | ||
blockTracker.on('error', (err) => console.error(err)); | ||
``` | ||
## Contributing | ||
### Setup | ||
- Install [Node.js](https://nodejs.org) version 14 | ||
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you. | ||
- Install [Yarn v1](https://yarnpkg.com/en/docs/install) | ||
- Run `yarn setup` to install dependencies and run any requried post-install scripts | ||
- **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state. | ||
### Testing and Linting | ||
Run `yarn test` to run the tests once. To run tests on file changes, run `yarn test:watch`. | ||
Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues. | ||
### Release & Publishing | ||
The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) and [`action-publish-release`](https://github.com/MetaMask/action-publish-release) are used to automate the release process; see those repositories for more information about how they work. | ||
1. Choose a release version. | ||
- The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See [the SemVer specification](https://semver.org/) for more information. | ||
2. If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. `1.x` for a `v1` backport release). | ||
- The major version branch should be set to the most recent release with that major version. For example, when backporting a `v1.0.2` release, you'd want to ensure there was a `1.x` branch that was set to the `v1.0.1` tag. | ||
3. Trigger the [`workflow_dispatch`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch) event [manually](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) for the `Create Release Pull Request` action to create the release PR. | ||
- For a backport release, the base branch should be the major version branch that you ensured existed in step 2. For a normal release, the base branch should be the main branch for that repository (which should be the default value). | ||
- This should trigger the [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) workflow to create the release PR. | ||
4. Update the changelog to move each change entry into the appropriate change category ([See here](https://keepachangelog.com/en/1.0.0/#types) for the full list of change categories, and the correct ordering), and edit them to be more easily understood by users of the package. | ||
- Generally any changes that don't affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.). | ||
- Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts). | ||
- Consolidate related changes into one change entry if it makes it easier to explain. | ||
- Run `yarn auto-changelog validate --rc` to check that the changelog is correctly formatted. | ||
5. Review and QA the release. | ||
- If changes are made to the base branch, the release branch will need to be updated with these changes and review/QA will need to restart again. As such, it's probably best to avoid merging other PRs into the base branch while review is underway. | ||
6. Squash & Merge the release. | ||
- This should trigger the [`action-publish-release`](https://github.com/MetaMask/action-publish-release) workflow to tag the final release commit and publish the release on GitHub. | ||
7. Publish the release on npm. | ||
- Be very careful to use a clean local environment to publish the release, and follow exactly the same steps used during CI. | ||
- Use `npm publish --dry-run` to examine the release contents to ensure the correct files are included. Compare to previous releases if necessary (e.g. using `https://unpkg.com/browse/[package name]@[package version]/`). | ||
- Once you are confident the release contents are correct, publish the release using `npm publish`. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49284
21
443
139
4
28
2
1
+ Added@metamask/utils@^3.0.1
+ Added@metamask/utils@3.6.0(transitive)
+ Added@types/debug@4.1.12(transitive)
+ Added@types/ms@0.7.34(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedsuperstruct@1.0.4(transitive)