From a8f49841c4595c42763b8e624c0f863bd87c0ef3 Mon Sep 17 00:00:00 2001 From: ernest-nowacki Date: Thu, 9 Oct 2025 12:48:03 +0200 Subject: [PATCH 1/2] Make .d.ts files from sdk/types included in the build output --- packages/cre-sdk-examples/package.json | 52 +++---- packages/cre-sdk/package.json | 156 ++++++++++---------- packages/cre-sdk/scripts/src/build-types.ts | 29 ++-- 3 files changed, 124 insertions(+), 113 deletions(-) diff --git a/packages/cre-sdk-examples/package.json b/packages/cre-sdk-examples/package.json index 4f98ab7..4688662 100644 --- a/packages/cre-sdk-examples/package.json +++ b/packages/cre-sdk-examples/package.json @@ -1,28 +1,28 @@ { - "name": "@chainlink/cre-sdk-examples", - "private": true, - "version": "0.0.6-alpha", - "type": "module", - "author": "Ernest Nowacki", - "license": "BUSL-1.1", - "description": "Demo app with example workflows utilizing CRE TypeScript SDK. It presents usage of CRE SDK and allows SDK developers to test workflows.", - "scripts": { - "check": "biome check --write ${BIOME_PATHS:-.}", - "format": "biome format --write ${BIOME_PATHS:-.}", - "full-checks": "bun typecheck && bun check", - "lint": "biome lint --write", - "typecheck": "tsc" - }, - "dependencies": { - "@bufbuild/protobuf": "2.6.3", - "@chainlink/cre-sdk": "workspace:*", - "viem": "2.34.0", - "zod": "3.25.76" - }, - "devDependencies": { - "@types/bun": "1.2.21" - }, - "engines": { - "bun": ">=1.2.21" - } + "name": "@chainlink/cre-sdk-examples", + "private": true, + "version": "0.0.7-alpha", + "type": "module", + "author": "Ernest Nowacki", + "license": "BUSL-1.1", + "description": "Demo app with example workflows utilizing CRE TypeScript SDK. It presents usage of CRE SDK and allows SDK developers to test workflows.", + "scripts": { + "check": "biome check --write ${BIOME_PATHS:-.}", + "format": "biome format --write ${BIOME_PATHS:-.}", + "full-checks": "bun typecheck && bun check", + "lint": "biome lint --write", + "typecheck": "tsc" + }, + "dependencies": { + "@bufbuild/protobuf": "2.6.3", + "@chainlink/cre-sdk": "workspace:*", + "viem": "2.34.0", + "zod": "3.25.76" + }, + "devDependencies": { + "@types/bun": "1.2.21" + }, + "engines": { + "bun": ">=1.2.21" + } } diff --git a/packages/cre-sdk/package.json b/packages/cre-sdk/package.json index 781a37d..5000500 100644 --- a/packages/cre-sdk/package.json +++ b/packages/cre-sdk/package.json @@ -1,80 +1,80 @@ { - "name": "@chainlink/cre-sdk", - "version": "0.0.6-alpha", - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js" - }, - "./restricted-apis": { - "types": "./dist/restricted-apis.d.ts" - }, - "./pb": { - "types": "./dist/pb.d.ts", - "import": "./dist/pb.js" - } - }, - "bin": { - "cre-compile": "bin/cre-compile.ts" - }, - "files": [ - "bin/", - "scripts/", - "dist/", - "package.json", - "README.md", - "LICENSE.md" - ], - "scripts": { - "build": "bun run clean && bun run compile:build && bun run build:types && bun run fix-imports", - "build:types": "bun run scripts/run.ts build-types", - "check": "biome check --write ${BIOME_PATHS:-.}", - "clean": "rm -rf dist", - "compile:all-standard-tests": "bun scripts/run.ts compile-all-standard-tests", - "compile:build": "tsc -p tsconfig.build.json", - "compile:cre-setup": "bun scripts/run.ts cre-setup", - "compile:js-to-wasm": "bun scripts/run.ts compile-to-wasm", - "compile:ts-to-js": "bun scripts/run.ts compile-to-js", - "compile:workflow": "bun scripts/run.ts compile-workflow", - "fix-imports": "bun scripts/run.ts fix-imports", - "format": "biome format --write ${BIOME_PATHS:-.}", - "full-checks": "bun generate:sdk && bun build && bun typecheck && bun check && bun test && bun test:standard", - "generate:chain-selectors": "bun scripts/run.ts generate-chain-selectors && BIOME_PATHS=\"src/generated\" bun check", - "generate:proto": "bunx @bufbuild/buf generate && BIOME_PATHS=\"src/generated\" bun check", - "generate:sdk": "bun generate:proto && bun generate:chain-selectors && bun scripts/run generate-sdks && BIOME_PATHS=\"src/generated src/generated-sdk\" bun check", - "lint": "biome lint --write", - "prepublishOnly": "bun typecheck && bun check && bun test && bun test:standard", - "test": "bun test", - "test:standard": "./scripts/run-standard-tests.sh", - "typecheck": "tsc" - }, - "dependencies": { - "@bufbuild/protobuf": "2.6.3", - "@bufbuild/protoc-gen-es": "2.6.3", - "@chainlink/cre-sdk-javy-plugin": "workspace:*", - "@standard-schema/spec": "1.0.0", - "viem": "2.34.0", - "zod": "3.25.76" - }, - "devDependencies": { - "@biomejs/biome": "2.2.4", - "@bufbuild/buf": "1.56.0", - "@types/bun": "1.2.21", - "chain-selectors": "https://github.com/smartcontractkit/chain-selectors.git#8b963095ae797a3024c8e55822cced7bf618176f", - "fast-glob": "3.3.3", - "ts-proto": "2.7.5", - "typescript": "5.9.2", - "yaml": "2.8.1" - }, - "publishConfig": { - "access": "public" - }, - "author": "SmartContract Chainlink Limited SEZC", - "license": "BUSL-1.1", - "engines": { - "bun": ">=1.2.21" - } + "name": "@chainlink/cre-sdk", + "version": "0.0.7-alpha", + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + }, + "./restricted-apis": { + "types": "./dist/sdk/types/restricted-apis.d.ts" + }, + "./pb": { + "types": "./dist/pb.d.ts", + "import": "./dist/pb.js" + } + }, + "bin": { + "cre-compile": "bin/cre-compile.ts" + }, + "files": [ + "bin/", + "scripts/", + "dist/", + "package.json", + "README.md", + "LICENSE.md" + ], + "scripts": { + "build": "bun run clean && bun run compile:build && bun run build:types && bun run fix-imports", + "build:types": "bun run scripts/run.ts build-types", + "check": "biome check --write ${BIOME_PATHS:-.}", + "clean": "rm -rf dist", + "compile:all-standard-tests": "bun scripts/run.ts compile-all-standard-tests", + "compile:build": "tsc -p tsconfig.build.json", + "compile:cre-setup": "bun scripts/run.ts cre-setup", + "compile:js-to-wasm": "bun scripts/run.ts compile-to-wasm", + "compile:ts-to-js": "bun scripts/run.ts compile-to-js", + "compile:workflow": "bun scripts/run.ts compile-workflow", + "fix-imports": "bun scripts/run.ts fix-imports", + "format": "biome format --write ${BIOME_PATHS:-.}", + "full-checks": "bun generate:sdk && bun build && bun typecheck && bun check && bun test && bun test:standard", + "generate:chain-selectors": "bun scripts/run.ts generate-chain-selectors && BIOME_PATHS=\"src/generated\" bun check", + "generate:proto": "bunx @bufbuild/buf generate && BIOME_PATHS=\"src/generated\" bun check", + "generate:sdk": "bun generate:proto && bun generate:chain-selectors && bun scripts/run generate-sdks && BIOME_PATHS=\"src/generated src/generated-sdk\" bun check", + "lint": "biome lint --write", + "prepublishOnly": "bun typecheck && bun check && bun test && bun test:standard", + "test": "bun test", + "test:standard": "./scripts/run-standard-tests.sh", + "typecheck": "tsc" + }, + "dependencies": { + "@bufbuild/protobuf": "2.6.3", + "@bufbuild/protoc-gen-es": "2.6.3", + "@chainlink/cre-sdk-javy-plugin": "workspace:*", + "@standard-schema/spec": "1.0.0", + "viem": "2.34.0", + "zod": "3.25.76" + }, + "devDependencies": { + "@biomejs/biome": "2.2.4", + "@bufbuild/buf": "1.56.0", + "@types/bun": "1.2.21", + "chain-selectors": "https://github.com/smartcontractkit/chain-selectors.git#8b963095ae797a3024c8e55822cced7bf618176f", + "fast-glob": "3.3.3", + "ts-proto": "2.7.5", + "typescript": "5.9.2", + "yaml": "2.8.1" + }, + "publishConfig": { + "access": "public" + }, + "author": "SmartContract Chainlink Limited SEZC", + "license": "BUSL-1.1", + "engines": { + "bun": ">=1.2.21" + } } diff --git a/packages/cre-sdk/scripts/src/build-types.ts b/packages/cre-sdk/scripts/src/build-types.ts index 6df0bb7..4172cef 100644 --- a/packages/cre-sdk/scripts/src/build-types.ts +++ b/packages/cre-sdk/scripts/src/build-types.ts @@ -1,22 +1,33 @@ import { glob } from 'fast-glob' import { copyFile, mkdir } from 'fs/promises' -import { dirname, join, relative } from 'path' +import { join } from 'path' const buildTypes = async () => { - console.log('🔧 Including restricted-apis type in built files...') + console.log('🔧 Copying type definition files to dist...') // Define paths relative to the scripts directory const packageRoot = join(import.meta.dir, '../..') - const sourceFile = join(packageRoot, 'src/sdk/types/restricted-apis.d.ts') - const destFile = join(packageRoot, 'dist/restricted-apis.d.ts') + const sourceDir = join(packageRoot, 'src/sdk/types') + const destDir = join(packageRoot, 'dist/sdk/types') - // Ensure the dist directory exists - await mkdir(dirname(destFile), { recursive: true }) + // Ensure the destination directory exists + await mkdir(destDir, { recursive: true }) - // Copy the file - await copyFile(sourceFile, destFile) + // Find all .d.ts files in the source directory + const typeFiles = await glob('*.d.ts', { + cwd: sourceDir, + absolute: false, + }) - console.log('✅ Included restricted-apis type in the build.') + // Copy each file + for (const file of typeFiles) { + const sourceFile = join(sourceDir, file) + const destFile = join(destDir, file) + await copyFile(sourceFile, destFile) + console.log(` ✓ Copied ${file}`) + } + + console.log(`✅ Copied ${typeFiles.length} type definition file(s) to dist/sdk/types`) } export const main = buildTypes From 7ea62122ee6baeb3dd4ca9af1c101744450b6eab Mon Sep 17 00:00:00 2001 From: ernest-nowacki Date: Thu, 9 Oct 2025 12:49:18 +0200 Subject: [PATCH 2/2] Restore proper formatting --- packages/cre-sdk-examples/package.json | 52 ++++----- packages/cre-sdk/package.json | 156 ++++++++++++------------- 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/packages/cre-sdk-examples/package.json b/packages/cre-sdk-examples/package.json index 4688662..961d5c7 100644 --- a/packages/cre-sdk-examples/package.json +++ b/packages/cre-sdk-examples/package.json @@ -1,28 +1,28 @@ { - "name": "@chainlink/cre-sdk-examples", - "private": true, - "version": "0.0.7-alpha", - "type": "module", - "author": "Ernest Nowacki", - "license": "BUSL-1.1", - "description": "Demo app with example workflows utilizing CRE TypeScript SDK. It presents usage of CRE SDK and allows SDK developers to test workflows.", - "scripts": { - "check": "biome check --write ${BIOME_PATHS:-.}", - "format": "biome format --write ${BIOME_PATHS:-.}", - "full-checks": "bun typecheck && bun check", - "lint": "biome lint --write", - "typecheck": "tsc" - }, - "dependencies": { - "@bufbuild/protobuf": "2.6.3", - "@chainlink/cre-sdk": "workspace:*", - "viem": "2.34.0", - "zod": "3.25.76" - }, - "devDependencies": { - "@types/bun": "1.2.21" - }, - "engines": { - "bun": ">=1.2.21" - } + "name": "@chainlink/cre-sdk-examples", + "private": true, + "version": "0.0.7-alpha", + "type": "module", + "author": "Ernest Nowacki", + "license": "BUSL-1.1", + "description": "Demo app with example workflows utilizing CRE TypeScript SDK. It presents usage of CRE SDK and allows SDK developers to test workflows.", + "scripts": { + "check": "biome check --write ${BIOME_PATHS:-.}", + "format": "biome format --write ${BIOME_PATHS:-.}", + "full-checks": "bun typecheck && bun check", + "lint": "biome lint --write", + "typecheck": "tsc" + }, + "dependencies": { + "@bufbuild/protobuf": "2.6.3", + "@chainlink/cre-sdk": "workspace:*", + "viem": "2.34.0", + "zod": "3.25.76" + }, + "devDependencies": { + "@types/bun": "1.2.21" + }, + "engines": { + "bun": ">=1.2.21" + } } diff --git a/packages/cre-sdk/package.json b/packages/cre-sdk/package.json index 5000500..5b99a06 100644 --- a/packages/cre-sdk/package.json +++ b/packages/cre-sdk/package.json @@ -1,80 +1,80 @@ { - "name": "@chainlink/cre-sdk", - "version": "0.0.7-alpha", - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js" - }, - "./restricted-apis": { - "types": "./dist/sdk/types/restricted-apis.d.ts" - }, - "./pb": { - "types": "./dist/pb.d.ts", - "import": "./dist/pb.js" - } - }, - "bin": { - "cre-compile": "bin/cre-compile.ts" - }, - "files": [ - "bin/", - "scripts/", - "dist/", - "package.json", - "README.md", - "LICENSE.md" - ], - "scripts": { - "build": "bun run clean && bun run compile:build && bun run build:types && bun run fix-imports", - "build:types": "bun run scripts/run.ts build-types", - "check": "biome check --write ${BIOME_PATHS:-.}", - "clean": "rm -rf dist", - "compile:all-standard-tests": "bun scripts/run.ts compile-all-standard-tests", - "compile:build": "tsc -p tsconfig.build.json", - "compile:cre-setup": "bun scripts/run.ts cre-setup", - "compile:js-to-wasm": "bun scripts/run.ts compile-to-wasm", - "compile:ts-to-js": "bun scripts/run.ts compile-to-js", - "compile:workflow": "bun scripts/run.ts compile-workflow", - "fix-imports": "bun scripts/run.ts fix-imports", - "format": "biome format --write ${BIOME_PATHS:-.}", - "full-checks": "bun generate:sdk && bun build && bun typecheck && bun check && bun test && bun test:standard", - "generate:chain-selectors": "bun scripts/run.ts generate-chain-selectors && BIOME_PATHS=\"src/generated\" bun check", - "generate:proto": "bunx @bufbuild/buf generate && BIOME_PATHS=\"src/generated\" bun check", - "generate:sdk": "bun generate:proto && bun generate:chain-selectors && bun scripts/run generate-sdks && BIOME_PATHS=\"src/generated src/generated-sdk\" bun check", - "lint": "biome lint --write", - "prepublishOnly": "bun typecheck && bun check && bun test && bun test:standard", - "test": "bun test", - "test:standard": "./scripts/run-standard-tests.sh", - "typecheck": "tsc" - }, - "dependencies": { - "@bufbuild/protobuf": "2.6.3", - "@bufbuild/protoc-gen-es": "2.6.3", - "@chainlink/cre-sdk-javy-plugin": "workspace:*", - "@standard-schema/spec": "1.0.0", - "viem": "2.34.0", - "zod": "3.25.76" - }, - "devDependencies": { - "@biomejs/biome": "2.2.4", - "@bufbuild/buf": "1.56.0", - "@types/bun": "1.2.21", - "chain-selectors": "https://github.com/smartcontractkit/chain-selectors.git#8b963095ae797a3024c8e55822cced7bf618176f", - "fast-glob": "3.3.3", - "ts-proto": "2.7.5", - "typescript": "5.9.2", - "yaml": "2.8.1" - }, - "publishConfig": { - "access": "public" - }, - "author": "SmartContract Chainlink Limited SEZC", - "license": "BUSL-1.1", - "engines": { - "bun": ">=1.2.21" - } + "name": "@chainlink/cre-sdk", + "version": "0.0.7-alpha", + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + }, + "./restricted-apis": { + "types": "./dist/sdk/types/restricted-apis.d.ts" + }, + "./pb": { + "types": "./dist/pb.d.ts", + "import": "./dist/pb.js" + } + }, + "bin": { + "cre-compile": "bin/cre-compile.ts" + }, + "files": [ + "bin/", + "scripts/", + "dist/", + "package.json", + "README.md", + "LICENSE.md" + ], + "scripts": { + "build": "bun run clean && bun run compile:build && bun run build:types && bun run fix-imports", + "build:types": "bun run scripts/run.ts build-types", + "check": "biome check --write ${BIOME_PATHS:-.}", + "clean": "rm -rf dist", + "compile:all-standard-tests": "bun scripts/run.ts compile-all-standard-tests", + "compile:build": "tsc -p tsconfig.build.json", + "compile:cre-setup": "bun scripts/run.ts cre-setup", + "compile:js-to-wasm": "bun scripts/run.ts compile-to-wasm", + "compile:ts-to-js": "bun scripts/run.ts compile-to-js", + "compile:workflow": "bun scripts/run.ts compile-workflow", + "fix-imports": "bun scripts/run.ts fix-imports", + "format": "biome format --write ${BIOME_PATHS:-.}", + "full-checks": "bun generate:sdk && bun build && bun typecheck && bun check && bun test && bun test:standard", + "generate:chain-selectors": "bun scripts/run.ts generate-chain-selectors && BIOME_PATHS=\"src/generated\" bun check", + "generate:proto": "bunx @bufbuild/buf generate && BIOME_PATHS=\"src/generated\" bun check", + "generate:sdk": "bun generate:proto && bun generate:chain-selectors && bun scripts/run generate-sdks && BIOME_PATHS=\"src/generated src/generated-sdk\" bun check", + "lint": "biome lint --write", + "prepublishOnly": "bun typecheck && bun check && bun test && bun test:standard", + "test": "bun test", + "test:standard": "./scripts/run-standard-tests.sh", + "typecheck": "tsc" + }, + "dependencies": { + "@bufbuild/protobuf": "2.6.3", + "@bufbuild/protoc-gen-es": "2.6.3", + "@chainlink/cre-sdk-javy-plugin": "workspace:*", + "@standard-schema/spec": "1.0.0", + "viem": "2.34.0", + "zod": "3.25.76" + }, + "devDependencies": { + "@biomejs/biome": "2.2.4", + "@bufbuild/buf": "1.56.0", + "@types/bun": "1.2.21", + "chain-selectors": "https://github.com/smartcontractkit/chain-selectors.git#8b963095ae797a3024c8e55822cced7bf618176f", + "fast-glob": "3.3.3", + "ts-proto": "2.7.5", + "typescript": "5.9.2", + "yaml": "2.8.1" + }, + "publishConfig": { + "access": "public" + }, + "author": "SmartContract Chainlink Limited SEZC", + "license": "BUSL-1.1", + "engines": { + "bun": ">=1.2.21" + } }