Skip to content

Commit

Permalink
fix: wip build to use esmodules instead
Browse files Browse the repository at this point in the history
  • Loading branch information
zcstarr committed Dec 10, 2024
1 parent 60a573c commit 2ea552c
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ coverage
*.tgz
LLMLOG.md
.turbo
.turbo/
**/*/.turbo
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "jest.config.js",
"scripts": {
"build": "turbo run build",
"build:package": "turbo run build:package",
"build:package": "turbo run build:package --filter=@open-rpc/logs-react^... --filter=@open-rpc/inspector^...",
"test": "turbo run test",
"lint": "turbo run lint",
"watch": "turbo run build test --watch",
Expand Down
9 changes: 9 additions & 0 deletions packages/docs-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
"name": "@open-rpc/docs-react",
"version": "0.0.0-development",
"description": "",
"type": "module",
"main": "build/index.js",
"module": "build/index.js",
"types": "build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.js"
}
},
"scripts": {
"lint": "eslint 'src/**/*.{ts,tsx}'",
"build": "tsc --project tsconfig.json && cp src/ContentDescriptor/ContentDescriptor.css build/ContentDescriptor/",
Expand Down
30 changes: 29 additions & 1 deletion packages/inspector/.turbo/turbo-build$colon$package.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@

> @open-rpc/[email protected] build:package /Users/shanejonas/code/openrpc/tools/packages/inspector
> @open-rpc/[email protected] build:package /Users/zcstarr/src/open-rpc/tools/packages/inspector
> tsc --project tsconfig.json

src/containers/Inspector.tsx:41:43 - error TS2307: Cannot find module '@open-rpc/logs-react' or its corresponding type declarations.

41 import JSONRPCLogger, { JSONRPCLog } from "@open-rpc/logs-react";
   ~~~~~~~~~~~~~~~~~~~~~~

src/hooks/useTabs.ts:3:28 - error TS2307: Cannot find module '@open-rpc/logs-react' or its corresponding type declarations.

3 import { JSONRPCLog } from "@open-rpc/logs-react";
   ~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors Files
1 src/containers/Inspector.tsx:41
1 src/hooks/useTabs.ts:3
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @open-rpc/[email protected] build:package: `tsc --project tsconfig.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @open-rpc/[email protected] build:package script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zcstarr/.npm/_logs/2024-12-05T04_11_45_527Z-debug.log

18 changes: 13 additions & 5 deletions packages/inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
"name": "@open-rpc/inspector",
"version": "0.0.0-development",
"description": "",
"main": "package/index.js",
"main": "build/index.js",
"module": "build/index.js",
"types": "build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.js"
}
},
"files": [
"package/"
"build/"
],
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +22,8 @@
"build": "rescripts build",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"test": "jest",
"build:package": "tsc --project tsconfig.json",
"clean": "rm -rf package build coverage",
"build:package": "tsc --build tsconfig.json",
"clean": "rm -rf build coverage",
"format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,md}'"
},
"author": "",
Expand Down Expand Up @@ -49,7 +57,7 @@
"@material-ui/lab": "4.0.0-alpha.47",
"@monaco-editor/react": "^4.0.0",
"@open-rpc/client-js": "^1.6.3",
"@open-rpc/logs-react": "*",
"@open-rpc/logs-react": "workspace:*",
"@open-rpc/meta-schema": "^1.14.9",
"@open-rpc/schema-utils-js": "^1.14.3",
"@rehooks/window-size": "^1.0.2",
Expand Down
7 changes: 5 additions & 2 deletions packages/inspector/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./package",
"outDir": "./build",
"rootDir": "./src"
},
"include": ["src"]
"include": ["src"],
"references": [
{ "path": "../logs-react" }
]
}
7 changes: 2 additions & 5 deletions packages/logs-react/.turbo/turbo-build$colon$package.log
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

> @open-rpc/[email protected] build:package /Users/shanejonas/code/openrpc/tools/packages/logs-react
> tsc --project tsconfig.json && mv package/exports.d.ts package/index.d.ts && mv package/exports.js package/index.js && find src/components -mindepth 1 -maxdepth 1 -type d -exec sh -c 'for f in {}/*.css; do cp "$f" "package/components/$(basename {})"; done' {} \;
> @open-rpc/[email protected] build:package /Users/zcstarr/src/open-rpc/tools/packages/logs-react
> tsc --build tsconfig.json && cp -r src/**/*.css build/

cp: src/components/logsReact/*.css: No such file or directory
cp: src/components/alert/*.css: No such file or directory
cp: src/components/logChips/*.css: No such file or directory
16 changes: 12 additions & 4 deletions packages/logs-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@
"name": "@open-rpc/logs-react",
"version": "0.0.0-development",
"description": "",
"main": "package/index.js",
"main": "build/index.js",
"module": "build/index.js",
"types": "build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.js"
}
},
"homepage": "https://open-rpc.github.io/logs-react/",
"files": [
"package/"
"build/"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"start": "vite",
"build": "vite build",
"build:package": "tsc --project tsconfig.json && mv package/exports.d.ts package/index.d.ts && mv package/exports.js package/index.js && find src/components -mindepth 1 -maxdepth 1 -type d -exec sh -c 'for f in {}/*.css; do cp \"$f\" \"package/components/$(basename {})\"; done' {} \\;",
"build:package": "tsc --build tsconfig.json && cp -r src/**/*.css build/",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"test": "jest",
"clean": "rm -rf package build coverage",
"clean": "rm -rf build coverage",
"format": "prettier --write 'src/**/*.{ts,tsx,js,jsx,json,md}'"
},
"author": "",
Expand Down
5 changes: 3 additions & 2 deletions packages/logs-react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./package",
"rootDir": "./src"
"outDir": "./build",
"rootDir": "./src",
"composite": true
},
"include": ["src"]
}
12 changes: 11 additions & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@material-ui/core": "4.9.8",
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "4.0.0-alpha.47",
"@open-rpc/docs-react": "*",
"@open-rpc/docs-react": "workspace:*",
"@open-rpc/examples": "^1.3.3",
"@open-rpc/inspector": "*",
"@open-rpc/meta-schema": "^1.14.9",
Expand Down Expand Up @@ -70,5 +70,15 @@
},
"engines": {
"node": ">=18.20.5"
},
"type": "module",
"main": "build/index.js",
"module": "build/index.js",
"types": "build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.js"
}
}
}
3 changes: 3 additions & 0 deletions packages/playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"isolatedModules": true,
"noEmit": true
},
"references": [
{ "path": "../logs-react" }
],
"include": [
"src"
]
Expand Down
3 changes: 3 additions & 0 deletions packages/playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default defineConfig({
react(),
monacoEditorPlugin({})
],
resolve: {
preserveSymlinks: true
},
build: {
outDir: 'dist',
sourcemap: true
Expand Down
24 changes: 15 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["dom", "es2015", "es2016", "es2017"],
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"esModuleInterop": true,
"jsx": "react",
"declaration": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
"composite": true,
"baseUrl": ".",
"paths": {
"@open-rpc/*": ["packages/*/src"]
}
},
"exclude": ["node_modules", "build", "dist", "package"]
"references": [
{ "path": "packages/logs-react" },
{ "path": "packages/inspector" },
{ "path": "packages/docs-react" },
{ "path": "packages/playground" }
]
}

0 comments on commit 2ea552c

Please sign in to comment.