From 2f98952cad733d62ccc83ad4c1864c797067cba4 Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Tue, 29 Aug 2023 15:08:31 +0300 Subject: [PATCH] v1.0.0 (#31) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added signMessage method to provider * throw error on missing options * Include send btc transaction function * Remove console.log * convert to amountSats * make message optional * Allow to pass a custom Bitcoin provider (#14) * Allow to pass a custom Bitcoin provider * Extract GetBitcoinProviderFunc type * Add senderAddress and allow multiple recipients (#10) * Add senderAddress and allow multiple recipients * Use Recipient in payload * Use bigint type for amountSats * Improve readability and error messages (#15) * Improve readability * Clean up error messages * Remove duplicate line * Improve error message --------- Co-authored-by: Victor Kirov * Add NPM pull request preview publish github workflow (#22) * Add NPM pull request preview publish github workflow * Add NPM pull request preview publish github workflow * fix build script * add npmrc file * add npm token * add npmrc file * change package repository to npm * update release workflow * release v0.5.0 (#23) * Improve APIs and types (BREAKING) (#16) * Remove unused type * Rename AddressPurposes enum for best practices * Extract call types into separate file * Remove unused CallMethod enum * Extract provider types into separate file * Rename directories for consistency * Rename sendBtcTransaction -> sendTransaction * Extract transactions types to separate file * Extract networks module * Improve types * Use [] instead of Array<> for consistency * Fix copy-paste oversight * Move index.ts inside src * Use import type for types * Revert sendBtcTransaction -> sendTransaction renaming * Simplify types --------- Co-authored-by: Victor Kirov * Fix bigInt serialisation Issue (#25) * serialize recipient array * Fix AddressPurposes type * Revert AddressPurpose name change * Rename const * Check recipient type * chore: npm publish with prerelease tag if prerelease option selected (#27) * chore: update release-package.yml syntax (#28) * Release v1.0.0 (#24) release v1.0.0 Co-authored-by: Tim Man --------- Co-authored-by: Ken Liao Co-authored-by: Imamah-Zafar Co-authored-by: Duska.T <55587184+DuskaT021@users.noreply.github.com> Co-authored-by: Matías Olivera Co-authored-by: Imamah-Zafar <88320460+Imamah-Zafar@users.noreply.github.com> Co-authored-by: Victor Kirov Co-authored-by: Tim Man --- .github/workflows/release-package.yml | 12 ++- .github/workflows/release-pull-request.yml | 104 +++++++++++++++++++++ .prettierrc.json | 8 +- index.ts | 4 - package.json | 6 +- src/address/index.ts | 23 ----- src/address/types.ts | 33 ------- src/addresses/index.ts | 29 ++++++ src/addresses/types.ts | 23 +++++ src/call/index.ts | 39 +++----- src/call/types.ts | 10 ++ src/index.ts | 6 ++ src/messages/index.ts | 32 +++++++ src/messages/types.ts | 10 ++ src/provider/index.ts | 20 +--- src/provider/types.ts | 18 ++++ src/transactions/index.ts | 3 + src/transactions/sendBtcTransaction.ts | 59 ++++++++++++ src/transactions/signTransaction.ts | 63 ++++--------- src/transactions/types.ts | 50 ++++++++++ src/types.ts | 22 +++++ tsconfig.json | 1 + webpack.config.js | 2 +- 23 files changed, 424 insertions(+), 153 deletions(-) create mode 100644 .github/workflows/release-pull-request.yml delete mode 100644 index.ts delete mode 100644 src/address/index.ts delete mode 100644 src/address/types.ts create mode 100644 src/addresses/index.ts create mode 100644 src/addresses/types.ts create mode 100644 src/call/types.ts create mode 100644 src/index.ts create mode 100644 src/messages/index.ts create mode 100644 src/messages/types.ts create mode 100644 src/provider/types.ts create mode 100644 src/transactions/index.ts create mode 100644 src/transactions/sendBtcTransaction.ts create mode 100644 src/transactions/types.ts create mode 100644 src/types.ts diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml index c7ac9fd..7db6e86 100644 --- a/.github/workflows/release-package.yml +++ b/.github/workflows/release-package.yml @@ -2,7 +2,7 @@ name: Release & Publish Package on: release: - types: [created] + types: [published] jobs: build: @@ -26,8 +26,14 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 16 - registry-url: https://npm.pkg.github.com/ + registry-url: https://registry.npmjs.org - run: npm ci + - run: npm run build + - run: npm publish --tag prerelease + if: github.event.release.prerelease + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - run: npm publish + if: "!github.event.release.prerelease" env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/release-pull-request.yml b/.github/workflows/release-pull-request.yml new file mode 100644 index 0000000..7f47b4d --- /dev/null +++ b/.github/workflows/release-pull-request.yml @@ -0,0 +1,104 @@ +name: Release & Publish Package + +on: + pull_request: + branches: [develop] + + workflow_dispatch: + +jobs: + fork-check: + runs-on: ubuntu-latest + outputs: + is-not-fork: ${{ steps.check.outputs.is_not_fork }} + steps: + - id: check + run: echo "::set-output name=is_not_fork::${{ github.repository == 'secretkeylabs/sats-connect' }}" + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + - run: npm ci + # TODO: enable linting once ready + # - run: npm run lint + # - run: npm test + + publish-beta: + needs: + - test + - fork-check + if: needs.fork-check.outputs.is-not-fork == 'true' + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + registry-url: https://registry.npmjs.org + + - id: git-commit + run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - run: npm ci + - run: npm run build + + - id: current-version + run: echo "version=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT + - id: tag-version + run: npm version --no-git-tag-version $CURRENT_VERSION-$SHA + env: + SHA: ${{ steps.git-commit.outputs.sha }} + CURRENT_VERSION: ${{ steps.current-version.outputs.version }} + + - id: publish + run: npm publish --tag pr + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + - id: published-version + run: echo "version=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT + - run: echo published version $VERSION + env: + VERSION: ${{ steps.published-version.outputs.version }} + + - name: Delete old bot comments + if: ${{ github.event_name == 'pull_request' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_ID: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + run: | + curl \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + https://api.github.com/repos/$REPO/issues/$PR_ID/comments \ + | jq ".[] | select(.user.login==\"github-actions[bot]\") | .id" \ + | xargs -I %q curl \ + -L \ + -X DELETE \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN"\ + https://api.github.com/repos/$REPO/issues/comments/%q + - name: Post test package PR comment + if: ${{ github.event_name == 'pull_request' }} + env: + VERSION: ${{ steps.published-version.outputs.version }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_URL: ${{ github.event.pull_request.comments_url }} + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + $GITHUB_URL \ + -d "{\"body\":\"> Test this PR with \`npm i @secretkeylabs/sats-connect@$VERSION\`\"}" \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index a70616f..35e12d9 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,11 +3,11 @@ "bracketSpacing": true, "jsxBracketSameLine": false, "jsxSingleQuote": false, + "printWidth": 100, "quoteProps": "as-needed", - "singleQuote": true, "semi": true, - "printWidth": 100, - "useTabs": false, + "singleQuote": true, "tabWidth": 2, - "trailingComma": "es5" + "trailingComma": "es5", + "useTabs": false } diff --git a/index.ts b/index.ts deleted file mode 100644 index 0809d3b..0000000 --- a/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './src/address/index'; -export * from './src/provider'; -export * from './src/call'; -export * from './src/transactions/signTransaction'; diff --git a/package.json b/package.json index c2686f0..eb0e145 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,10 @@ { "name": "sats-connect", - "version": "0.1.11", + "version": "1.0.0", "main": "dist/index.js", - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "test": "jest", "build-debug": "webpack --mode development", diff --git a/src/address/index.ts b/src/address/index.ts deleted file mode 100644 index b27ab5a..0000000 --- a/src/address/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { createUnsecuredToken, Json } from 'jsontokens'; -import { GetAddressOptions } from './types'; - -export const getAddress = async (options: GetAddressOptions) => { - const { message, network, purposes } = options.payload; - const provider = window.BitcoinProvider; - if (!provider) { - throw new Error('No Bitcoin Wallet installed'); - } - if(!purposes) { - throw new Error('Address purposes are required'); - } - try { - const request = createUnsecuredToken(options.payload as unknown as Json); - const addressResponse = await provider.connect(request); - options.onFinish?.(addressResponse); - } catch (error) { - console.error('[Connect] Error during address request', error); - options.onCancel?.(); - } -}; - -export * from './types'; diff --git a/src/address/types.ts b/src/address/types.ts deleted file mode 100644 index 6d8f29e..0000000 --- a/src/address/types.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { BitcoinNetwork } from '../provider'; - -export enum AddressPurposes { - PAYMENT = 'payment', - ORDINALS = 'ordinals', -} - -export interface Purpose { - derivation_path?: string; - purpose: AddressPurposes; -} - -export interface GetAddressPayload { - purposes: Array; - message: string; - network: BitcoinNetwork; -} - -export interface Address { - address: string; - publicKey: string; - purpose: AddressPurposes; -} - -export interface GetAddressResponse { - addresses: Array
-} - -export interface GetAddressOptions { - onFinish: (response: GetAddressResponse) => void; - onCancel: () => void; - payload: GetAddressPayload; -} diff --git a/src/addresses/index.ts b/src/addresses/index.ts new file mode 100644 index 0000000..0b3cf1f --- /dev/null +++ b/src/addresses/index.ts @@ -0,0 +1,29 @@ +import type { Json } from 'jsontokens'; +import { createUnsecuredToken } from 'jsontokens'; + +import { getDefaultProvider } from '../provider'; +import type { GetAddressOptions } from './types'; + +export const getAddress = async (options: GetAddressOptions) => { + const { getProvider = getDefaultProvider } = options; + const provider = await getProvider(); + if (!provider) { + throw new Error('No Bitcoin wallet installed'); + } + + const { purposes } = options.payload; + if (!purposes) { + throw new Error('Address purposes are required'); + } + + try { + const request = createUnsecuredToken(options.payload as unknown as Json); + const response = await provider.connect(request); + options.onFinish?.(response); + } catch (error) { + console.error('[Connect] Error during address request', error); + options.onCancel?.(); + } +}; + +export * from './types'; diff --git a/src/addresses/types.ts b/src/addresses/types.ts new file mode 100644 index 0000000..883cd05 --- /dev/null +++ b/src/addresses/types.ts @@ -0,0 +1,23 @@ +import type { RequestOptions, RequestPayload } from '../types'; + +export enum AddressPurpose { + Ordinals = 'ordinals', + Payment = 'payment', +} + +export interface GetAddressPayload extends RequestPayload { + purposes: AddressPurpose[]; + message: string; +} + +export interface Address { + address: string; + publicKey: string; + purpose: AddressPurpose; +} + +export interface GetAddressResponse { + addresses: Address[]; +} + +export type GetAddressOptions = RequestOptions; diff --git a/src/call/index.ts b/src/call/index.ts index 7eccca2..5b47664 100644 --- a/src/call/index.ts +++ b/src/call/index.ts @@ -1,38 +1,29 @@ -import { createUnsecuredToken, Json } from 'jsontokens'; -import { BitcoinNetwork } from '../provider'; +import type { Json } from 'jsontokens'; +import { createUnsecuredToken } from 'jsontokens'; -export interface CallWalletPayload { - method: string; - network: BitcoinNetwork; - params?: Array; -} - -export interface CallWalletOptions { - onFinish: (response: Record) => void; - onCancel: () => void; - payload: CallWalletPayload; -} - -export enum CallMethod { - SIGN_TRANSACTION = 'signTransaction', - GET_ADDRESS = 'getAddress', -} +import { getDefaultProvider } from '../provider'; +import type { CallWalletOptions } from './types'; export const callWalletPopup = async (options: CallWalletOptions) => { - const provider = window.BitcoinProvider; - const { method } = options.payload; + const { getProvider = getDefaultProvider } = options; + const provider = await getProvider(); if (!provider) { - throw new Error('No Bitcoin Wallet installed'); + throw new Error('No Bitcoin wallet installed'); } - if(!method) { + + const { method } = options.payload; + if (!method) { throw new Error('A wallet method is required'); } + const request = createUnsecuredToken(options.payload as unknown as Json); try { - const callResponse = await provider.call(request); - options.onFinish?.(callResponse); + const response = await provider.call(request); + options.onFinish?.(response); } catch (error) { console.error('[Connect] Error during call request', error); options.onCancel?.(); } }; + +export * from './types'; diff --git a/src/call/types.ts b/src/call/types.ts new file mode 100644 index 0000000..ba82bca --- /dev/null +++ b/src/call/types.ts @@ -0,0 +1,10 @@ +import type { RequestOptions, RequestPayload } from '../types'; + +export interface CallWalletPayload extends RequestPayload { + method: string; + params?: any[]; +} + +export type CallWalletResponse = Record; + +export type CallWalletOptions = RequestOptions; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..e402881 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,6 @@ +export * from './addresses'; +export * from './call'; +export * from './messages'; +export * from './provider'; +export * from './transactions'; +export * from './types'; diff --git a/src/messages/index.ts b/src/messages/index.ts new file mode 100644 index 0000000..433d805 --- /dev/null +++ b/src/messages/index.ts @@ -0,0 +1,32 @@ +import type { Json } from 'jsontokens'; +import { createUnsecuredToken } from 'jsontokens'; + +import { getDefaultProvider } from '../provider'; +import type { SignMessageOptions } from './types'; + +export const signMessage = async (options: SignMessageOptions) => { + const { getProvider = getDefaultProvider } = options; + const provider = await getProvider(); + if (!provider) { + throw new Error('No Bitcoin wallet installed'); + } + + const { address, message } = options.payload; + if (!address) { + throw new Error('An address is required to sign a message'); + } + if (!message) { + throw new Error('A message to be signed is required'); + } + + try { + const request = createUnsecuredToken(options.payload as unknown as Json); + const response = await provider.signMessage(request); + options.onFinish?.(response); + } catch (error) { + console.error('[Connect] Error during sign message request', error); + options.onCancel?.(); + } +}; + +export * from './types'; diff --git a/src/messages/types.ts b/src/messages/types.ts new file mode 100644 index 0000000..5c4baf2 --- /dev/null +++ b/src/messages/types.ts @@ -0,0 +1,10 @@ +import type { RequestOptions, RequestPayload } from '../types'; + +export interface SignMessagePayload extends RequestPayload { + address: string; + message: string; +} + +export type SignMessageResponse = string; + +export type SignMessageOptions = RequestOptions; diff --git a/src/provider/index.ts b/src/provider/index.ts index c482618..5640cca 100644 --- a/src/provider/index.ts +++ b/src/provider/index.ts @@ -1,19 +1,7 @@ -import { SignTransactionResponse } from '../transactions/signTransaction'; -import { GetAddressResponse } from '../address'; +import type { BitcoinProvider } from './types'; -export interface BitcoinNetwork { - type: string; - address: string; +export async function getDefaultProvider(): Promise { + return window.BitcoinProvider; } -export interface BitcoinProvider { - connect: (request: string) => Promise; - call: (request: string) => Promise>; - signTransaction: (request: string) => Promise; -} - -declare global { - interface Window { - BitcoinProvider?: BitcoinProvider; - } -} +export * from './types'; diff --git a/src/provider/types.ts b/src/provider/types.ts new file mode 100644 index 0000000..5903144 --- /dev/null +++ b/src/provider/types.ts @@ -0,0 +1,18 @@ +import type { GetAddressResponse } from '../addresses'; +import type { CallWalletResponse } from '../call'; +import type { SignMessageResponse } from '../messages'; +import type { SendBtcTransactionResponse, SignTransactionResponse } from '../transactions'; + +export interface BitcoinProvider { + call: (request: string) => Promise; + connect: (request: string) => Promise; + signMessage: (request: string) => Promise; + signTransaction: (request: string) => Promise; + sendBtcTransaction: (request: string) => Promise; +} + +declare global { + interface Window { + BitcoinProvider?: BitcoinProvider; + } +} diff --git a/src/transactions/index.ts b/src/transactions/index.ts new file mode 100644 index 0000000..8fc6c5a --- /dev/null +++ b/src/transactions/index.ts @@ -0,0 +1,3 @@ +export * from './sendBtcTransaction'; +export * from './signTransaction'; +export * from './types'; diff --git a/src/transactions/sendBtcTransaction.ts b/src/transactions/sendBtcTransaction.ts new file mode 100644 index 0000000..e4e0ad8 --- /dev/null +++ b/src/transactions/sendBtcTransaction.ts @@ -0,0 +1,59 @@ +import type { Json } from 'jsontokens'; +import { createUnsecuredToken } from 'jsontokens'; + +import { getDefaultProvider } from '../provider'; +import type { + Recipient, + SendBtcTransactionOptions, + SerializedRecipient, + SerializedSendBtcTransactionPayload, +} from './types'; + +const serializer = (recipient: Recipient[]): SerializedRecipient[] => { + return recipient.map((value) => { + const { address, amountSats } = value; + return { + address, + amountSats: amountSats.toString(), + }; + }); +}; + +export const sendBtcTransaction = async (options: SendBtcTransactionOptions) => { + const { getProvider = getDefaultProvider } = options; + const provider = await getProvider(); + if (!provider) { + throw new Error('No Bitcoin wallet installed'); + } + + const { recipients, senderAddress, network, message } = options.payload; + if (!recipients || recipients.length === 0) { + throw new Error('At least one recipient is required'); + } + if ( + recipients.some( + (item) => typeof item.address !== 'string' || typeof item.amountSats !== 'bigint' + ) + ) { + throw new Error('Incorrect recipient format'); + } + if (!senderAddress) { + throw new Error('The sender address is required'); + } + + try { + const serializedRecipients: SerializedRecipient[] = serializer(recipients); + const serializedPayload: SerializedSendBtcTransactionPayload = { + network, + senderAddress, + message, + recipients: serializedRecipients, + }; + const request = createUnsecuredToken(serializedPayload as unknown as Json); + const response = await provider.sendBtcTransaction(request); + options.onFinish?.(response); + } catch (error) { + console.error('[Connect] Error during send BTC transaction request', error); + options.onCancel?.(); + } +}; diff --git a/src/transactions/signTransaction.ts b/src/transactions/signTransaction.ts index 3606985..03066fa 100644 --- a/src/transactions/signTransaction.ts +++ b/src/transactions/signTransaction.ts @@ -1,53 +1,30 @@ -import { createUnsecuredToken, Json } from 'jsontokens'; -import { BitcoinNetwork } from '../provider'; - - -export interface InputToSign { - address: string, - signingIndexes: Array, - sigHash?: number, -} - - -export interface SignTransactionPayload { - network: BitcoinNetwork; - message: string; - psbtBase64: string; - broadcast?: boolean; - inputsToSign: InputToSign[]; -} - -export interface SignTransactionOptions { - payload: SignTransactionPayload; - onFinish: (response: any) => void; - onCancel: () => void; -} - -export interface SignTransactionResponse { - psbtBase64: string; - txId?: string; -} +import type { Json } from 'jsontokens'; +import { createUnsecuredToken } from 'jsontokens'; +import { getDefaultProvider } from '../provider'; +import type { SignTransactionOptions } from './types'; export const signTransaction = async (options: SignTransactionOptions) => { - const { psbtBase64, inputsToSign } = options.payload; - const provider = window.BitcoinProvider; + const { getProvider = getDefaultProvider } = options; + const provider = await getProvider(); if (!provider) { - throw new Error('No Bitcoin Wallet installed'); + throw new Error('No Bitcoin wallet installed'); } + + const { psbtBase64, inputsToSign } = options.payload; if (!psbtBase64) { - throw new Error('a value for psbtBase64 representing the tx hash is required'); + throw new Error('A value for psbtBase64 representing the tx hash is required'); } if (!inputsToSign) { - throw new Error('an array specifying the inputs to be signed by the wallet is required'); + throw new Error('An array specifying the inputs to be signed by the wallet is required'); } - try { - const request = createUnsecuredToken(options.payload as unknown as Json); - const addressResponse = await provider.signTransaction(request); - options.onFinish?.(addressResponse); - } catch (error) { - console.error('[Connect] Error during signPsbt request', error); - options.onCancel?.(); - } -}; + try { + const request = createUnsecuredToken(options.payload as unknown as Json); + const response = await provider.signTransaction(request); + options.onFinish?.(response); + } catch (error) { + console.error('[Connect] Error during sign transaction request', error); + options.onCancel?.(); + } +}; diff --git a/src/transactions/types.ts b/src/transactions/types.ts new file mode 100644 index 0000000..532ba6d --- /dev/null +++ b/src/transactions/types.ts @@ -0,0 +1,50 @@ +import type { RequestOptions, RequestPayload } from '../types'; + +export interface Recipient { + address: string; + amountSats: bigint; +} + +export type SerializedRecipient = Omit & { + amountSats: string; +}; + +export interface SendBtcTransactionPayload extends RequestPayload { + recipients: Recipient[]; + senderAddress: string; + message?: string; +} + +export type SerializedSendBtcTransactionPayload = Omit & { + recipients: SerializedRecipient[]; +}; + +export type SendBtcTransactionResponse = string; + +export type SendBtcTransactionOptions = RequestOptions< + SendBtcTransactionPayload, + SendBtcTransactionResponse +>; + +export interface InputToSign { + address: string; + signingIndexes: number[]; + sigHash?: number; +} + +export interface SignTransactionPayload extends RequestPayload { + message: string; + psbtBase64: string; + inputsToSign: InputToSign[]; + broadcast?: boolean; +} + +export interface SignTransactionResponse { + psbtBase64: string; + txId?: string; +} + +export type SignTransactionOptions = RequestOptions< + SignTransactionPayload, + SignTransactionResponse +>; diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..2b68fde --- /dev/null +++ b/src/types.ts @@ -0,0 +1,22 @@ +import type { BitcoinProvider } from './provider'; + +export enum BitcoinNetworkType { + Mainnet = 'Mainnet', + Testnet = 'Testnet', +} + +export interface BitcoinNetwork { + type: BitcoinNetworkType; + address?: string; +} + +export interface RequestPayload { + network: BitcoinNetwork; +} + +export interface RequestOptions { + onFinish: (response: Response) => void; + onCancel: () => void; + payload: Payload; + getProvider?: () => Promise; +} diff --git a/tsconfig.json b/tsconfig.json index 282672c..2624399 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,5 +16,6 @@ "allowUnreachableCode": false, "skipLibCheck": true }, + "include": ["./src"], "exclude": ["./tests", "./dist"] } diff --git a/webpack.config.js b/webpack.config.js index 3c32dd9..4181af9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,7 +8,7 @@ const isProduction = process.env.NODE_ENV === NODE_ENV_PRODUCTION; module.exports = { mode: isProduction ? NODE_ENV_PRODUCTION : NODE_ENV_DEVELOPMENT, - entry: ['./index.ts'], + entry: ['./src/index.ts'], output: { filename: 'index.js', library: 'sats_connect',