build: update dependencies (#1540)

* build: update dependencies

* build: update audit dependencies

* chore: remove bootstrap

* chore: update eslint config

* build: fix lint

* build: update esbuild loader

---------

Co-authored-by: janniks <janniks@users.noreply.github.com>
This commit is contained in:
janniks
2023-09-04 18:06:55 +02:00
committed by GitHub
parent 761923d688
commit c13748238c
47 changed files with 6053 additions and 7624 deletions

View File

@@ -28,6 +28,7 @@ module.exports = {
'@typescript-eslint/no-unsafe-call': ['off'],
'@typescript-eslint/no-unsafe-return': ['off'],
'@typescript-eslint/no-unsafe-member-access': ['off'],
'@typescript-eslint/no-unsafe-enum-comparison': ['off'],
'@typescript-eslint/no-non-null-assertion': ['off'],
'import/no-extraneous-dependencies': ['error'],

View File

@@ -35,7 +35,6 @@ jobs:
- run: npm install -g npm@latest
- run: npm ci
- run: npm run bootstrap
- run: git config --local user.email 'action@github.com'
- run: git config --local user.name 'GitHub Action'

View File

@@ -31,7 +31,6 @@ jobs:
- run: npm install -g npm@latest
- run: npm ci
- run: npm run bootstrap
- run: npm run build
- run: git config --local user.email 'action@github.com'

View File

@@ -2,7 +2,7 @@ name: pull-request
on:
pull_request:
paths-ignore:
- "**.md"
- '**.md'
workflow_dispatch:
@@ -41,7 +41,6 @@ jobs:
cache: npm
- run: npm install -g npm@latest
- run: npm ci
- run: npm run bootstrap
- id: git-commit
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
- run: echo $SHA

View File

@@ -22,15 +22,12 @@ jobs:
- run: npm install -g npm@latest
- run: npm ci
- name: Bootstrap lerna
run: npm run bootstrap
- name: Check bootstrap
- name: Check package.json
run: |
if [[ -n $(git status -s) ]]; then
git status
echo "Error: file tree is not clean; Likely needs bootstraping"
echo "Run `npm run bootstrap` and commit to resolve"
echo "Error: file tree is not clean; Likely needs npm install"
echo "Run `npm install` and commit to resolve"
exit 1
fi

View File

@@ -37,7 +37,6 @@ jobs:
- run: npm install -g npm@latest
- run: npm ci
- run: npm run bootstrap
# workaround for changesets/action to allow not using changesets
# todo: add `force` option on fork to allow removing this workaround

View File

@@ -43,9 +43,9 @@ To migrate your app from blockstack.js to Stacks.js follow the steps in the resp
If you encounter a bug or have a feature request, we encourage you to follow the steps below:
1. **Search for existing issues:** Before submitting a new issue, please search [existing and closed issues](../../issues) to check if a similar problem or feature request has already been reported.
1. **Open a new issue:** If it hasn't been addressed, please [open a new issue](../../issues/new/choose). Choose the appropriate issue template and provide as much detail as possible, including steps to reproduce the bug or a clear description of the requested feature.
1. **Evaluation SLA:** Our team reads and evaluates all the issues and pull requests. We are avaliable Monday to Friday and we make a best effort to respond within 7 business days.
1. **Search for existing issues:** Before submitting a new issue, please search [existing and closed issues](../../issues) to check if a similar problem or feature request has already been reported.
1. **Open a new issue:** If it hasn't been addressed, please [open a new issue](../../issues/new/choose). Choose the appropriate issue template and provide as much detail as possible, including steps to reproduce the bug or a clear description of the requested feature.
1. **Evaluation SLA:** Our team reads and evaluates all the issues and pull requests. We are avaliable Monday to Friday and we make a best effort to respond within 7 business days.
Please **do not** use the issue tracker for personal support requests or to ask for the status of a transaction. You'll find help at the [#support Discord channel](https://discord.gg/SK3DxdsP).
@@ -64,17 +64,17 @@ To setup the development environment for this repository, follow these steps:
> NodeJS & npm are required (v18.x.x is currently recommended)
1. Clone this package.
2. Run `npm install` to install dependencies
3. Run `npm run bootstrap` to [bootstrap](https://github.com/lerna/lerna/tree/main/commands/bootstrap) project
4. Run `npm run build` to build packages
5. Run `npm run test` to run tests
1. Run `npm install` to install dependencies
1. Run `npm run build` to build packages
1. Run `npm run test` to run tests
> Some tests may contain logging of errors and warnings.
> This should not be confused with failing tests.
> Make sure the last lines of `npm run test` show `lerna success - @stacks/...` for every package.
### Code of Conduct
Please read our [Code of conduct](../../../.github/blob/main/CODE_OF_CONDUCT.md) since we expect project participants to adhere to it.
Please read our [Code of conduct](../../../.github/blob/main/CODE_OF_CONDUCT.md) since we expect project participants to adhere to it.
## Community

View File

@@ -43,9 +43,8 @@ module.exports = {
{
loader: 'esbuild-loader',
options: {
loader: 'tsx',
target: 'es2017',
tsconfigRaw: require(path.resolve(process.cwd(), 'tsconfig.build.json')),
tsconfig: 'tsconfig.build.json',
},
},
],

View File

@@ -5,17 +5,5 @@
"access": "public"
},
"changelogPreset": "conventionalcommits",
"packages": [
"packages/*"
],
"command": {
"bootstrap": {
"forceLocal": true,
"hoist": true,
"npmClientArgs": [
"--ci"
]
}
},
"useWorkspaces": true
"packages": ["packages/*"]
}

13303
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,10 +7,9 @@
"license": "MIT",
"prettier": "@stacks/prettier-config",
"scripts": {
"bootstrap": "lerna bootstrap",
"build": "lerna run build",
"build:docs": "rimraf docs && typedoc --tsconfig tsconfig.typedoc.json",
"ci:version": "npx lerna version --conventional-commits --no-push --no-git-tag-version --yes && npx lerna bootstrap",
"build:docs": "rimraf docs && typedoc",
"ci:version": "npx lerna version --conventional-commits --no-push --no-git-tag-version --yes",
"clean": "lerna clean",
"lerna": "lerna",
"lint": "npm run lint:eslint && npm run lint:prettier",
@@ -26,46 +25,46 @@
"prepare": "husky install .github/.husky"
},
"devDependencies": {
"@changesets/cli": "^2.23.0",
"@commitlint/cli": "^17.4.0",
"@commitlint/config-conventional": "^17.4.0",
"@janniks/typedoc-theme-stacks": "^1.2.3",
"@stacks/eslint-config": "^1.2.0",
"@changesets/cli": "^2.26.2",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@stacks/eslint-config": "^2.0.0",
"@stacks/prettier-config": "^0.0.10",
"@types/bs58check": "^2.1.0",
"@types/jest": "^28.1.1",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"assert": "^2.0.0",
"conventional-changelog-conventionalcommits": "^5.0.0",
"esbuild": "^0.14.23",
"esbuild-loader": "^2.18.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"conventional-changelog-conventionalcommits": "^6.1.0",
"esbuild": "^0.19.0",
"esbuild-loader": "^4.0.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-node": "^11.1.0",
"husky": "^8.0.3",
"inspectpack": "^4.7.1",
"jest": "^28.1.3",
"jest": "^29.6.2",
"jest-fetch-mock": "^3.0.3",
"jest-module-name-mapper": "^0.1.5",
"lerna": "^5.5.2",
"madge": "^5.0.1",
"lerna": "^7.1.5",
"madge": "^6.1.0",
"path-browserify": "^1.0.1",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"prettier": "^3.0.1",
"rimraf": "^5.0.1",
"stream-http": "^3.2.0",
"ts-jest": "^28.0.8",
"typedoc": "^0.23.20",
"typedoc-plugin-replace-text": "^2.1.0",
"typescript": "^4.9.5",
"webpack": "^5.36.1",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.10.0"
"ts-jest": "^29.1.1",
"typedoc": "^0.24.8",
"typedoc-plugin-replace-text": "^3.1.0",
"typescript": "^5.1.6",
"webpack": "^5.88.2",
"webpack-bundle-analyzer": "^4.9.0",
"webpack-cli": "^5.1.4"
},
"overrides": {
"blockstack": {
"ajv": "6.12.6"
"ajv": "6.12.6",
"tough-cookie": "4.1.3"
},
"json5": "2.2.3",
"nth-check": "2.0.1",

View File

@@ -58,8 +58,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -15,11 +15,14 @@ function getQueryStringParams(query: string): Record<string, string> {
}
// Trim a starting `?` character if exists
const trimmed = /^[?#]/.test(query) ? query.slice(1) : query;
return trimmed.split('&').reduce((params, param) => {
const [key, value] = param.split('=');
params[key] = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : '';
return params;
}, {} as Record<string, string>);
return trimmed.split('&').reduce(
(params, param) => {
const [key, value] = param.split('=');
params[key] = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : '';
return params;
},
{} as Record<string, string>
);
}
/**

View File

@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
// todo: fix eslint rule, rename UserSession?
import { AppConfig } from './appConfig';
import { SessionOptions } from './sessionData';
import { InstanceDataStore, LocalStorageStore, SessionDataStore } from './sessionStore';

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -52,8 +52,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/stacks.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -106,6 +106,5 @@
"bin": {
"stacks": "./bin.js",
"stx": "./bin.js"
},
"gitHead": "77b4d6d531b74996e4b7a0cbd1cf5b8358a690ce"
}
}

View File

@@ -29,7 +29,6 @@ export class CLITransactionSigner implements TransactionSigner {
}
signTransaction(_txIn: bitcoinjs.TransactionBuilder, _signingIndex: number): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-empty-function
return Promise.resolve().then(() => {});
}

View File

@@ -7,6 +7,7 @@ export function encryptBackupPhrase(plaintextBuffer: string, password: string):
}
export function decryptBackupPhrase(
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
dataBuffer: string | Buffer,
password: string
): Promise<string> {

View File

@@ -213,7 +213,6 @@ export class CLINetworkAdapter {
receiveFeesPeriod = this.receiveFeesPeriod!;
}
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
if (namespaceInfo.reveal_block + receiveFeesPeriod > blockHeight) {
address = namespaceInfo.address;
}

View File

@@ -47,8 +47,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -210,7 +210,7 @@ export class NoSessionDataError extends BlockstackError {
export interface GaiaHubErrorResponse {
status: number;
statusText: string;
body?: string | any;
body?: any; // todo: should this be string?
}
export interface HubErrorDetails {

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -66,8 +66,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -51,8 +51,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -17,8 +17,8 @@ export type StacksNetworkName = (typeof StacksNetworks)[number];
* @related {@link StacksMainnet}, {@link StacksTestnet}, {@link StacksDevnet}, {@link StacksMocknet}
*/
export class StacksNetwork {
version = TransactionVersion.Mainnet;
chainId = ChainID.Mainnet;
version: TransactionVersion = TransactionVersion.Mainnet;
chainId: ChainID = ChainID.Mainnet;
bnsLookupUrl = 'https://stacks-node-api.mainnet.stacks.co';
broadcastEndpoint = '/v2/transactions';
transferFeeEstimateEndpoint = '/v2/fees/transfer';

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -56,8 +56,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -29,7 +29,7 @@
"bs58": "^5.0.0"
},
"devDependencies": {
"@stacks/blockchain-api-client": "^6.2.1",
"@stacks/blockchain-api-client": "^7.3.0",
"jest-fetch-mock": "^3.0.3",
"process": "^0.11.10",
"rimraf": "^3.0.2",
@@ -55,8 +55,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -335,7 +335,10 @@ export interface StackAggregationIncreaseOptions {
}
export class StackingClient {
constructor(public address: string, public network: StacksNetwork) {}
constructor(
public address: string,
public network: StacksNetwork
) {}
/**
* Get stacks node info

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -54,8 +54,5 @@
},
"bugs": {
"url": "https://github.com/blockstack/blockstack.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -248,7 +248,7 @@ export async function getBucketUrl(
async function getGaiaErrorResponse(response: Response): Promise<GaiaHubErrorResponse> {
let responseMsg = '';
let responseJson: any | undefined;
let responseJson: any;
try {
responseMsg = await response.text();
try {

View File

@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*",
"tests/**/*"
]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -61,8 +61,5 @@
},
"bugs": {
"url": "https://github.com/hirosystems/stacks.js/issues"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}
}

View File

@@ -93,7 +93,12 @@ export function createSingleSigSpendingCondition(
fee: IntegerType
): SingleSigSpendingCondition {
// address version arg doesn't matter for signer hash generation
const signer = addressFromPublicKeys(0, hashMode, 1, [createStacksPublicKey(pubKey)]).hash160;
const signer = addressFromPublicKeys(
0 as any, // only used for hash, so version doesn't matter
hashMode,
1,
[createStacksPublicKey(pubKey)]
).hash160;
const keyEncoding = isCompressed(createStacksPublicKey(pubKey))
? PubKeyEncoding.Compressed
: PubKeyEncoding.Uncompressed;
@@ -118,7 +123,12 @@ export function createMultiSigSpendingCondition(
const stacksPublicKeys = pubKeys.map(createStacksPublicKey);
// address version arg doesn't matter for signer hash generation
const signer = addressFromPublicKeys(0, hashMode, numSigs, stacksPublicKeys).hash160;
const signer = addressFromPublicKeys(
0 as any, // only used for hash, so version doesn't matter
hashMode,
numSigs,
stacksPublicKeys
).hash160;
return {
hashMode,
@@ -417,7 +427,12 @@ function verifySingleSig(
);
// address version arg doesn't matter for signer hash generation
const addrBytes = addressFromPublicKeys(0, condition.hashMode, 1, [pubKey]).hash160;
const addrBytes = addressFromPublicKeys(
0 as any, // only used for hash, so version doesn't matter
condition.hashMode,
1,
[pubKey]
).hash160;
if (addrBytes !== condition.signer)
throw new VerificationError(
@@ -473,7 +488,7 @@ function verifyMultiSig(
throw new VerificationError('Uncompressed keys are not allowed in this hash mode');
const addrBytes = addressFromPublicKeys(
0,
0 as any, // only used for hash, so version doesn't matter
condition.hashMode,
condition.signaturesRequired,
publicKeys

View File

@@ -1,6 +1,5 @@
import { asciiToBytes, hexToBytes, utf8ToBytes } from '@stacks/common';
import {
BufferCV,
boolCV,
bufferCV,
contractPrincipalCV,

View File

@@ -45,6 +45,7 @@ type NftString = `${ContractIdString}::${string}`;
* Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6').willSendEq(10000).ustx();
* ```
*/
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
export function principal(principal: AddressString | ContractIdString) {
if (isContractIdString(principal)) {
// `principal` is a ContractIdString here
@@ -59,7 +60,10 @@ export function principal(principal: AddressString | ContractIdString) {
* Not meant to be used directly. Start from `Pc.principal(…)` instead.
*/
class PartialPcWithPrincipal {
constructor(private address: string, private contractName?: string) {}
constructor(
private address: string,
private contractName?: string
) {}
// todo: split FT and STX into separate methods? e.g. `willSendSTXEq` and `willSendFtEq`
@@ -310,6 +314,7 @@ function parseNft(nftAssetName: NftString) {
}
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
function isContractIdString(value: AddressString | ContractIdString): value is ContractIdString {
return value.includes('.');
}

View File

@@ -205,7 +205,12 @@ test('Public keys to address hash', () => {
else hashMode = AddressHashMode.SerializeP2WSH;
}
const address = addressFromPublicKeys(0, hashMode, fixture.numRequired, fixture.keys);
const address = addressFromPublicKeys(
0 as any, // only used for hash, so version doesn't matter
hashMode,
fixture.numRequired,
fixture.keys
);
expect(address.hash160).toBe(fixture.result);
}
});

View File

@@ -3,5 +3,8 @@
"compilerOptions": {
"target": "ES2020"
},
"include": ["src/**/*", "tests/**/*"]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -66,8 +66,5 @@
"files": [
"dist",
"src"
],
"typedoc": {
"entryPoint": "./src/index.ts"
}
]
}

View File

@@ -1,4 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*"]
"include": ["src/**/*", "tests/**/*"],
"typedocOptions": {
"entryPoints": ["src/index.ts"]
}
}

View File

@@ -17,8 +17,42 @@
"@stacks/wallet-sdk": ["packages/wallet-sdk/src"]
}
},
"exclude": [
"**/node_modules",
"**/dist",
]
"exclude": ["**/node_modules", "**/dist"],
"typedocOptions": {
"name": "Stacks.js",
"entryPointStrategy": "packages",
"entryPoints": [
// "packages/*", without packages/cli
"packages/auth",
"packages/encryption",
"packages/network",
"packages/stacking",
"packages/transactions",
"packages/bns",
"packages/common",
"packages/keychain",
"packages/profile",
"packages/storage",
"packages/wallet-sdk"
],
"json": "docs/docs.json",
"out": "docs",
"excludePrivate": true,
"excludeProtected": true,
"categoryOrder": ["*", "Other"],
"gaID": "GTM-M8P6G7Z",
"plugin": ["typedoc-plugin-replace-text"],
"replaceText": {
"replacements": [
{
"pattern": "https://github.com/hirosystems/stacks.js/tree/main/packages/wallet-sdk",
"replace": "/modules/_stacks_wallet_sdk"
},
{
"pattern": "https://github.com/hirosystems/stacks.js/tree/main/packages/",
"replace": "/modules/_stacks_"
}
]
}
}
}

View File

@@ -1,44 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2020",
"module": "ES6"
},
"typedocOptions": {
"name": "Stacks.js",
"entryPointStrategy": "packages",
"entryPoints": [
// "packages/*", without packages/cli
"packages/auth",
"packages/encryption",
"packages/network",
"packages/stacking",
"packages/transactions",
"packages/bns",
"packages/common",
"packages/keychain",
"packages/profile",
"packages/storage",
"packages/wallet-sdk"
],
"json": "docs/docs.json",
"out": "docs",
"excludePrivate": true,
"excludeProtected": true,
"categoryOrder": ["*", "Other"],
"gaID": "GTM-M8P6G7Z",
"theme": "stacks",
"replaceText": {
"replacements": [
{
"pattern": "https://github.com/hirosystems/stacks.js/tree/main/packages/wallet-sdk",
"replace": "/modules/_stacks_wallet_sdk"
},
{
"pattern": "https://github.com/hirosystems/stacks.js/tree/main/packages/",
"replace": "/modules/_stacks_"
}
]
}
}
}