Skip to content

Commit

Permalink
Add changeset support (npm publishing part 1) (#672)
Browse files Browse the repository at this point in the history
* Add changeset support (part 1)

* no emit
  • Loading branch information
grod220 authored Mar 13, 2024
1 parent ec0789b commit 4ef2ef7
Show file tree
Hide file tree
Showing 249 changed files with 2,335 additions and 573 deletions.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
58 changes: 58 additions & 0 deletions .github/workflows/packages-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Packages Release

on:
workflow_call:
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
turbo-all:
name: Compile, lint, test, & build
uses: ./.github/workflows/turbo-ci.yml

packages-release:
name: Packages Release
environment: labs-approval
runs-on: buildjet-2vcpu-ubuntu-2204
needs: turbo-all
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Access build cache
id: built
uses: buildjet/cache@v3
with:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Setup Node.js 21.x
uses: buildjet/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Disable telemetry
run: pnpm turbo telemetry disable

- name: Build packages
run: pnpm turbo build --cache-dir=.turbo

# If there are changesets, this action will create a PR on the repo to version packages
# If there are none, it will publish newer-versioned public packages to npm
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "chrome-extension",
"version": "1.0.0",
"version": "4.2.0",
"private": true,
"description": "chrome-extension",
"type": "module",
"scripts": {
Expand All @@ -21,6 +22,7 @@
"@penumbra-zone/storage": "workspace:*",
"@penumbra-zone/transport-chrome": "workspace:*",
"@penumbra-zone/transport-dom": "workspace:*",
"@penumbra-zone/types": "workspace:*",
"@penumbra-zone/ui": "workspace:*",
"@penumbra-zone/wasm": "workspace:*",
"@tanstack/react-query": "^5.25.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/approve-origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { errorFromJson } from '@connectrpc/connect/protocol-connect';
import { localExtStorage } from '@penumbra-zone/storage';
import { OriginApproval, PopupType } from './message/popup';
import { popup } from './popup';
import Map from '@penumbra-zone/polyfills/Map.groupBy';
import Map from '@penumbra-zone/polyfills/src/Map.groupBy';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

export const originAlreadyApproved = async (url: string): Promise<boolean> => {
Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/clients.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { createPromiseClient } from '@connectrpc/connect';
import { transportOptions } from '@penumbra-zone/types/registry';
import { createChannelTransport } from '@penumbra-zone/transport-dom/create';
import { createChannelTransport } from '@penumbra-zone/transport-dom/src/create';
import { CRSessionClient } from '@penumbra-zone/transport-chrome/session-client';
import { transportOptions } from '@penumbra-zone/types/src/registry';

const port = CRSessionClient.init(PRAX);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
* other content scripts could interfere or intercept connections.
*/

import { PenumbraSymbol, PenumbraProvider } from '@penumbra-zone/client/global';
import { PenumbraProvider, PenumbraSymbol } from '@penumbra-zone/client/src/global';
import {
isPraxConnectionPortMessageEvent,
isPraxRequestResponseMessageEvent,
PraxMessage,
} from './message';
import { Prax } from '../message/prax';

import '@penumbra-zone/polyfills/Promise.withResolvers';
import '@penumbra-zone/polyfills/src/Promise.withResolvers';

const requestMessage: PraxMessage<Prax.RequestConnection> = { [PRAX]: Prax.RequestConnection };

Expand Down Expand Up @@ -76,8 +76,9 @@ const praxProvider: PenumbraProvider = Object.freeze({
});

// if the global isn't present, create it.
if (!window[PenumbraSymbol])
Object.defineProperty(window, PenumbraSymbol, { value: new Object(), writable: false });
if (!window[PenumbraSymbol]) {
Object.defineProperty(window, PenumbraSymbol, { value: {}, writable: false });
}

// reveal
Object.defineProperty(window[PenumbraSymbol], PRAX_ORIGIN, {
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/impls.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ServiceImpl, createPromiseClient } from '@connectrpc/connect';
import { createPromiseClient, ServiceImpl } from '@connectrpc/connect';
import { createGrpcWebTransport } from '@connectrpc/connect-web';
import { createProxyImpl } from '@penumbra-zone/transport-dom/proxy';
import { createProxyImpl } from '@penumbra-zone/transport-dom/src/proxy';
import { rethrowImplErrors } from './utils/rethrow-impl-errors';
import { Query as IbcProxy } from '@buf/cosmos_ibc.connectrpc_es/ibc/core/client/v1/query_connect';
import { QueryService as AppService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/core/app/v1/app_connect';
Expand All @@ -23,6 +23,7 @@ import { viewImpl } from '@penumbra-zone/router/src/grpc/view-protocol-server';

import { localExtStorage } from '@penumbra-zone/storage';
import { ServiceType } from '@bufbuild/protobuf';

const grpcEndpoint = await localExtStorage.get('grpcEndpoint');

type RpcImplTuple<T extends ServiceType> = [T, Partial<ServiceImpl<T>>];
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/message/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type {
InternalRequest,
InternalResponse,
} from '@penumbra-zone/types/src/internal-msg/shared';
import type { UserChoice } from '@penumbra-zone/types/src/user-choice';
import type { Jsonified } from '@penumbra-zone/types/src/jsonified';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

export enum PopupType {
TxApproval = 'TxApproval',
Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/popup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { sessionExtStorage } from '@penumbra-zone/storage';
import { PopupMessage, PopupRequest, PopupResponse, PopupType } from './message/popup';
import { PopupPath } from './routes/popup/paths';
import type {
InternalRequest,
InternalResponse,
} from '@penumbra-zone/types/src/internal-msg/shared';
import { PopupMessage, PopupRequest, PopupResponse, PopupType } from './message/popup';
import { PopupPath } from './routes/popup/paths';

export const popup = async <M extends PopupMessage>(
req: PopupRequest<M>,
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/routes/popup/approval/origin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { originApprovalSelector } from '../../../state/origin-approval';
import { ApproveDeny } from './approve-deny';
import { LinkGradientIcon } from '../../../icons';
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';
import { DisplayOriginURL } from '../../../shared/components/display-origin-url';
import { cn } from '@penumbra-zone/ui/lib/utils';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

export const OriginApproval = () => {
const { requestOrigin, favIconUrl, title, lastRequest, setChoice, sendResponse } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { TransactionViewComponent } from '@penumbra-zone/ui';
import { useStore } from '../../../../state';
import { txApprovalSelector } from '../../../../state/tx-approval';
import { JsonViewer } from '@penumbra-zone/ui/components/ui/json-viewer';
import { Jsonified } from '@penumbra-zone/types';
import { AuthorizeRequest } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/custody/v1/custody_pb';
import { useTransactionViewSwitcher } from './use-transaction-view-switcher';
import { ViewTabs } from './view-tabs';
import { ApproveDeny } from '../approve-deny';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';
import type { Jsonified } from '@penumbra-zone/types/src/jsonified';

export const TransactionApproval = () => {
const { authorizeRequest: authReqString, setChoice, sendResponse } = useStore(txApprovalSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { LinkGradientIcon } from '../../../icons';
import { SettingsHeader } from '../../../shared';
import { OriginRecord } from '@penumbra-zone/storage';
import { DisplayOriginURL } from '../../../shared/components/display-origin-url';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';
import { useStore } from '../../../state';
import { connectedSitesSelector } from '../../../state/connected-sites';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

export const SettingsConnectedSites = () => {
const {
Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/routes/popup/settings/settings-rpc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { ShareGradientIcon } from '../../../icons';
import { SettingsHeader } from '../../../shared';
import { useStore } from '../../../state';
import { networkSelector } from '../../../state/network';
import { ServicesMessage } from '@penumbra-zone/types/src/services';
import '@penumbra-zone/polyfills/Promise.withResolvers';
import '@penumbra-zone/polyfills/src/Promise.withResolvers';
import { TrashIcon } from '@radix-ui/react-icons';
import { ServicesMessage } from '@penumbra-zone/types/src/services';

export const SettingsRPC = () => {
const { chainId: currentChainId } = useChainIdQuery();
Expand Down
8 changes: 4 additions & 4 deletions apps/extension/src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ import { Services } from '@penumbra-zone/services';
import { localExtStorage } from '@penumbra-zone/storage';

// adapter
import { ConnectRouter, PromiseClient, createContextValues } from '@connectrpc/connect';
import { ConnectRouter, createContextValues, PromiseClient } from '@connectrpc/connect';
import { CRSessionManager } from '@penumbra-zone/transport-chrome/session-manager';
import { connectChannelAdapter } from '@penumbra-zone/transport-dom/adapter';
import { transportOptions } from '@penumbra-zone/types/registry';
import { createDirectClient } from '@penumbra-zone/transport-dom/src/direct';
import { connectChannelAdapter } from '@penumbra-zone/transport-dom/src/adapter';
import { transportOptions } from '@penumbra-zone/types/src/registry';

// context
import { CustodyService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/custody/v1/custody_connect';
Expand All @@ -30,7 +31,6 @@ import {
servicesCtx,
stakingClientCtx,
} from '@penumbra-zone/router/src/ctx';
import { createDirectClient } from '@penumbra-zone/transport-dom/direct';
import { approveTransaction } from './approve-transaction';

// all rpc implementations, local and proxy
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/state/connected-sites.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExtensionStorage, LocalStorageState, OriginRecord } from '@penumbra-zone/storage';
import { AllSlices, SliceCreator } from '.';

import Map from '@penumbra-zone/polyfills/Map.groupBy';
import Map from '@penumbra-zone/polyfills/src/Map.groupBy';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

export interface ConnectedSitesSlice {
Expand Down
7 changes: 5 additions & 2 deletions apps/extension/src/state/origin-approval.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { ConnectError } from '@connectrpc/connect';
import { PopupType, OriginApproval } from '../message/popup';
import { OriginApproval, PopupType } from '../message/popup';
import { AllSlices, SliceCreator } from '.';
import { InternalRequest, InternalResponse } from '@penumbra-zone/types/src/internal-msg/shared';
import { errorToJson } from '@connectrpc/connect/protocol-connect';
import type {
InternalRequest,
InternalResponse,
} from '@penumbra-zone/types/src/internal-msg/shared';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

export interface OriginApprovalSlice {
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/state/persist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SessionStorageState,
StorageItem,
} from '@penumbra-zone/storage';
import { walletsFromJson } from '@penumbra-zone/types';
import { walletsFromJson } from '@penumbra-zone/types/src/wallet';

export type Middleware = <
T,
Expand Down
21 changes: 13 additions & 8 deletions apps/extension/src/state/tx-approval.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import { AuthorizeRequest } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/custody/v1/custody_pb';
import type { Jsonified, Stringified, TransactionClassification } from '@penumbra-zone/types';
import { AllSlices, SliceCreator } from '.';
import { InternalRequest, InternalResponse } from '@penumbra-zone/types/src/internal-msg/shared';
import { PopupType, TxApproval } from '../message/popup';
import { TransactionView } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/transaction/v1/transaction_pb';
import { viewClient } from '../clients';

import {
asPublicTransactionView,
asReceiverTransactionView,
classifyTransaction,
} from '@penumbra-zone/types';
import { ConnectError } from '@connectrpc/connect';
import { errorToJson } from '@connectrpc/connect/protocol-connect';
import type {
InternalRequest,
InternalResponse,
} from '@penumbra-zone/types/src/internal-msg/shared';
import type { Jsonified, Stringified } from '@penumbra-zone/types/src/jsonified';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';
import {
classifyTransaction,
TransactionClassification,
} from '@penumbra-zone/types/src/transaction';
import {
asPublicTransactionView,
asReceiverTransactionView,
} from '@penumbra-zone/types/src/translators';

export interface TxApprovalSlice {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/state/wallets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
mockLocalExtStorage,
mockSessionExtStorage,
} from '@penumbra-zone/storage';
import { WalletCreate } from '@penumbra-zone/types';
import type { WalletCreate } from '@penumbra-zone/types/src/wallet';

vi.stubGlobal('crypto', webcrypto);

Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/state/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
} from '@penumbra-zone/wasm';
import { Key } from '@penumbra-zone/crypto-web';
import { ExtensionStorage, LocalStorageState } from '@penumbra-zone/storage';
import { Wallet, WalletCreate } from '@penumbra-zone/types';
import { Address } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/keys/v1/keys_pb';
import { Wallet, WalletCreate } from '@penumbra-zone/types/src/wallet';

export interface WalletsSlice {
all: Wallet[];
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/wasm-build-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
TransactionPlan,
WitnessData,
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/transaction/v1/transaction_pb';
import type { ActionBuildRequest } from '@penumbra-zone/types/src/internal-msg/offscreen';
import type { JsonValue } from '@bufbuild/protobuf';
import type { ActionBuildRequest } from '@penumbra-zone/types/src/internal-msg/offscreen';

// necessary to propagate errors that occur in promises
// see: https://stackoverflow.com/questions/39992417/how-to-bubble-a-web-worker-error-in-a-promise-via-worker-onerror
Expand Down
2 changes: 1 addition & 1 deletion apps/minifront/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
env: { browser: true, es2022: true },
extends: ['custom'],
parserOptions: {
project: true,
Expand Down
6 changes: 4 additions & 2 deletions apps/minifront/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "minifront",
"version": "2.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port 5173",
Expand All @@ -16,11 +17,12 @@
"@penumbra-zone/crypto-web": "workspace:*",
"@penumbra-zone/getters": "workspace:*",
"@penumbra-zone/transport-dom": "workspace:*",
"@penumbra-zone/types": "workspace:*",
"@penumbra-zone/ui": "workspace:*",
"@radix-ui/react-icons": "^1.3.0",
"@tanstack/react-query": "^5.25.0",
"@tanstack/react-query": "^5.26.3",
"bignumber.js": "^9.1.2",
"date-fns": "^3.3.1",
"date-fns": "^3.4.0",
"immer": "^10.0.4",
"lodash": "^4.17.21",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/minifront/src/clients.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createPraxClient } from '@penumbra-zone/client/prax';
import { createPraxClient } from '@penumbra-zone/client';
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { SimulationService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/core/component/dex/v1/dex_connect';
import { CustodyService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/custody/v1/custody_connect';
Expand Down
2 changes: 1 addition & 1 deletion apps/minifront/src/components/dashboard/assets-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AddressComponent } from '@penumbra-zone/ui/components/ui/address-compon
import { BalancesByAccount, getBalancesByAccount } from '../../fetchers/balances/by-account';
import { Table, TableBody, TableCell, TableRow } from '@penumbra-zone/ui';
import { ValueViewComponent } from '@penumbra-zone/ui/components/ui/tx/view/value';
import { throwIfPraxNotConnectedTimeout } from '@penumbra-zone/client/prax';
import { throwIfPraxNotConnectedTimeout } from '@penumbra-zone/client';

export const AssetsLoader: LoaderFunction = async (): Promise<BalancesByAccount[]> => {
await throwIfPraxNotConnectedTimeout();
Expand Down
4 changes: 2 additions & 2 deletions apps/minifront/src/components/dashboard/transaction-table.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { shorten } from '@penumbra-zone/types';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@penumbra-zone/ui';
import { Link, LoaderFunction, useLoaderData } from 'react-router-dom';
import { getAllTransactions, TransactionSummary } from '../../fetchers/transactions';
import { throwIfPraxNotConnectedTimeout } from '@penumbra-zone/client/prax';
import { throwIfPraxNotConnectedTimeout } from '@penumbra-zone/client';
import { shorten } from '@penumbra-zone/types/src/string';

export const TxsLoader: LoaderFunction = async (): Promise<TransactionSummary[]> => {
await throwIfPraxNotConnectedTimeout();
Expand Down
Loading

0 comments on commit 4ef2ef7

Please sign in to comment.