Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn install --immutable --immutable-cache --check-cache
run: pnpm install --frozen-lockfile

- name: Format
run: yarn format
run: pnpm format

# See https://autofix.ci/
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
12 changes: 8 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn install --immutable --immutable-cache --check-cache
run: pnpm install --frozen-lockfile

- name: Build
run: yarn build
run: pnpm build

- name: Lint
run: yarn lint
run: pnpm lint
14 changes: 9 additions & 5 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ jobs:
- name: Checkout Repository 🛎️
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

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

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

- name: Build Project
run: yarn build
run: pnpm build

- name: Test @cosmwasm/ts-codegen
run: cd packages/ts-codegen && yarn test
run: pnpm --filter @cosmwasm/ts-codegen test

- name: Test @cosmwasm/ts-codegen-ast
run: cd ./packages/ast && yarn test
run: pnpm --filter @cosmwasm/ts-codegen-ast test
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,13 @@ export_schema_with_title(
### Initial setup

```
yarn
yarn bootstrap
pnpm install
```

### Building

```
yarn build
pnpm build
```

### Tests
Expand All @@ -632,7 +631,7 @@ Then `cd` into a package and run the tests

```
cd ./packages/ast
yarn test:watch
pnpm test:watch
```

### Working with ASTs
Expand Down
2 changes: 1 addition & 1 deletion docs/developing/ast.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface InstantiateMsg {
### 2 run AST generator

```
yarn test:ast
pnpm test:ast
```

### 3 look at the JSON produced
Expand Down
7 changes: 3 additions & 4 deletions docs/developing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
## Initial setup

```
yarn
yarn bootstrap
pnpm install
```

## Building

```
yarn build
pnpm build
```

## Tests
Expand All @@ -19,7 +18,7 @@ Then `cd` into a package and run the tests

```
cd ./packages/wasm-ast-types
yarn test:watch
pnpm test:watch
```

## Working with ASTs
Expand Down
7 changes: 3 additions & 4 deletions docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,13 @@ export_schema_with_title(
### Initial setup

```
yarn
yarn bootstrap
pnpm install
```

### Building

```
yarn build
pnpm build
```

### Tests
Expand All @@ -670,7 +669,7 @@ Then `cd` into a package and run the tests

```
cd ./packages/wasm-ast-types
yarn test:watch
pnpm test:watch
```

### Working with ASTs
Expand Down
6 changes: 3 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"lerna": "6",
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"conventionalCommits": true,
"npmClient": "yarn",
"npmClient": "pnpm",
"npmClientArgs": [
"--no-lockfile"
"--frozen-lockfile"
],
"packages": [
"packages/*"
Expand Down
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
},
"private": true,
"scripts": {
"clean": "lerna run clean",
"build": "lerna run build --stream",
"test": "lerna run test --stream",
"lint": "lerna run lint --parallel",
"format": "lerna run format --parallel",
"symlink": "symlink-workspace --logLevel error",
"postinstall": "yarn symlink"
"clean": "pnpm -r run clean",
"build": "pnpm -r run build",
"test": "pnpm -r run test",
"lint": "pnpm -r run lint",
"format": "pnpm -r run format",
"deps": "pnpm up -r -i -L"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.30.0",
"@types/jest": "^29.5.11",
"@types/jest-in-case": "^1.0.2",
"@types/mkdirp": "1.0.2",
Expand All @@ -30,22 +31,18 @@
"globals": "^16.2.0",
"jest": "^29.6.2",
"jest-in-case": "^1.0.2",
"lerna": "^6",
"lerna": "^8.2.4",
"mkdirp": "1.0.2",
"prettier": "^3.6.0",
"rimraf": "4.4.1",
"strip-ansi": "^6",
"symlink-workspace": "^1.9.0",
"ts-jest": "^29.1.1",
"tsx": "^4.20.3",
"typescript": "^5.1.6"
},
"workspaces": [
"packages/*"
],
"repository": {
"type": "git",
"url": "https://github.com/hyperweb-io/ts-codegen"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion packages/ast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface InstantiateMsg {
### 2 run AST generator

```
yarn test:ast
pnpm test:ast
```

### 3 look at the JSON produced
Expand Down
11 changes: 8 additions & 3 deletions packages/ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"scripts": {
"copy": "copyfiles -f LICENSE-Apache LICENSE-MIT README.md package.json dist",
"clean": "rimraf dist/**",
"prepare": "npm run build",
"prepublishOnly": "npm run build",
"codegen": "tsx ./scripts/build.ts",
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && npm run copy",
"lint": "eslint . --fix",
"format": "prettier --write --log-level warn \"./**/*.ts\"",
"test": "jest",
Expand All @@ -36,10 +36,15 @@
},
"dependencies": {
"@babel/types": "7.24.0",
"@cosmwasm/ts-codegen-types": "^1.5.0",
"@cosmwasm/ts-codegen-types": "workspace:*",
"ast-stringify": "0.2.1",
"case": "1.6.3",
"deepmerge": "4.2.2",
"minimatch": "^10.0.3"
},
"devDependencies": {
"@babel/generator": "^7.29.8",
"@types/babel__generator": "^7.6.8",
"glob": "^10"
}
}
14 changes: 5 additions & 9 deletions packages/ast/src/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export interface IContext {
registeredUtils?: UtilMapping,
filepath?: string
): (
| t.ImportNamespaceSpecifier
| t.ImportDeclaration
| t.ImportDefaultSpecifier
t.ImportNamespaceSpecifier | t.ImportDeclaration | t.ImportDefaultSpecifier
)[];
}

Expand Down Expand Up @@ -131,9 +129,9 @@ export class BuilderContext {
* only mergeDefaultOpt needs to implementing for combine options and default options.
* @param TOpt option type
*/
export abstract class RenderContextBase<TOpt = RenderOptions>
implements IRenderContext<TOpt>
{
export abstract class RenderContextBase<
TOpt = RenderOptions,
> implements IRenderContext<TOpt> {
builderContext: BuilderContext;
contract: ContractInfo;
utils: Record<string, boolean> = {};
Expand Down Expand Up @@ -185,9 +183,7 @@ export abstract class RenderContextBase<TOpt = RenderOptions>
registeredUtils?: UtilMapping,
filepath?: string
): (
| t.ImportNamespaceSpecifier
| t.ImportDeclaration
| t.ImportDefaultSpecifier
t.ImportNamespaceSpecifier | t.ImportDeclaration | t.ImportDefaultSpecifier
)[] {
return getImportStatements(
convertUtilsToImportList(this, Object.keys(this.utils), registeredUtils),
Expand Down
4 changes: 1 addition & 3 deletions packages/ast/src/context/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ export const getImportStatements = (
list: ImportObj[],
filepath?: string
): (
| t.ImportNamespaceSpecifier
| t.ImportDeclaration
| t.ImportDefaultSpecifier
t.ImportNamespaceSpecifier | t.ImportDeclaration | t.ImportDefaultSpecifier
)[] => {
// swap helpers with helpers file...
const modifiedImports = list.map((imp) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ast/test-utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import generate from '@babel/generator';
import { RenderOptions } from '@cosmwasm/ts-codegen-ast/types';
import {
ExecuteMsg,
IDLObject,
Expand All @@ -11,6 +10,7 @@ import { globSync as glob } from 'glob';
import { join } from 'path';

import { RenderContext } from '../src/context';
import { RenderOptions } from '../src/types';

export const expectCode = (ast: any): void => {
expect(generate(ast).code).toMatchSnapshot();
Expand Down
7 changes: 3 additions & 4 deletions packages/ts-codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,13 @@ export_schema_with_title(
### Initial setup

```
yarn
yarn bootstrap
pnpm install
```

### Building

```
yarn build
pnpm build
```

### Tests
Expand All @@ -632,7 +631,7 @@ Then `cd` into a package and run the tests

```
cd ./packages/ast
yarn test:watch
pnpm test:watch
```

### Working with ASTs
Expand Down
14 changes: 10 additions & 4 deletions packages/ts-codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"scripts": {
"copy": "copyfiles -f LICENSE-Apache LICENSE-MIT README.md package.json dist",
"clean": "rimraf dist/**",
"prepare": "npm run build",
"prepublishOnly": "npm run build",
"cmds": "tsx ./scripts/cmds.ts",
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && npm run copy",
"lint": "eslint . --fix",
"format": "prettier --write --log-level warn \"./**/*.ts\"",
"test": "jest",
Expand All @@ -38,13 +38,14 @@
},
"dependencies": {
"@babel/generator": "7.24.4",
"@babel/parser": "^7.24.0",
"@babel/traverse": "7.24.1",
"@babel/types": "7.24.0",
"@chain-registry/types": "^0.17.1",
"@chain-registry/utils": "^1.51.71",
"@chain-registry/v2": "^1.71.229",
"@cosmwasm/ts-codegen-ast": "^1.10.0",
"@cosmwasm/ts-codegen-types": "^1.5.0",
"@cosmwasm/ts-codegen-ast": "workspace:*",
"@cosmwasm/ts-codegen-types": "workspace:*",
"@interchainjs/amino": "1.17.1",
"@interchainjs/cosmos": "1.17.1",
"@interchainjs/types": "1.17.1",
Expand All @@ -66,6 +67,11 @@
"rimraf": "3.0.2",
"shelljs": "0.8.5"
},
"devDependencies": {
"@types/babel__generator": "^7.6.8",
"@types/babel__traverse": "^7.20.6",
"@types/minimist": "^1.2.5"
},
"keywords": [
"cosmwasm",
"interchain",
Expand Down
Loading
Loading