-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2 with TypeScript, tsup
, and pnpm
workspace
#185
Conversation
New Prism Language file generation script for v2
Refactored Highlight component to use modern React patterns.
I don't think the dependencies in building things that are then used in later builds is 100% there right now. Here's from a fresh branch where I've cleaned out all previous built files: $ git clean -f -x && pnpm build
Removing packages/prism-react-renderer/src/prism-langs.ts
> prism-react-renderer-monorepo@ build /Users/rye/scm/fmd/prism-react-renderer
> pnpm --sequential --filter generate-prism-languages --filter prism-react-renderer --filter demo build
Scope: 3 of 4 workspace projects
packages/generate-prism-languages build$ ts-node ./index.ts
│ Formidable Prism React Renderer
│ Generated TypeScript output at: /Users/rye/scm/fmd/prism-react-renderer/packages/prism-react-renderer/src/prism-langs.ts
│ Included language definitions in the following order: regex, clike, javascript, actionscript, coffeescript, javadoclike, css, css-extras, yaml, markup, markdown, graphql, sql, js-templat
└─ Done in 999ms
packages/prism-react-renderer build$ patch-package && tsup
│ patch-package 6.5.1
│ Applying patches...
│ prismjs@1.26.0 ✔
│ CLI Building entry: src/index.ts
│ CLI Using tsconfig: tsconfig.json
│ CLI tsup v6.7.0
│ CLI Using tsup config: /Users/rye/scm/fmd/prism-react-renderer/packages/prism-react-renderer/tsup.config.ts
│ CLI Target: es6
│ CLI Cleaning output folder
│ CJS Build start
│ ESM Build start
│ ✘ [ERROR] Could not resolve "./prism-langs"
│ src/index.ts:1:22:
│ 1 │ import { Prism } from "./prism-langs"
│ ╵ ~~~~~~~~~~~~~~~
│ ✘ [ERROR] Could not resolve "./prism-langs"
│ src/index.ts:1:22:
│ 1 │ import { Prism } from "./prism-langs"
│ ╵ ~~~~~~~~~~~~~~~
│ CJS Build failed
│ Error: Build failed with 1 error:
│ src/index.ts:1:22: ERROR: Could not resolve "./prism-langs"
│ at failureErrorWithLog (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:1636:15)
│ at /Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:1048:25
│ at runOnEndCallbacks (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:1471:45)
│ at buildResponseToResult (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:1046:7)
│ at /Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:1075:16
│ at responseCallbacks.<computed> (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:697:9)
│ at handleIncomingPacket (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:752:9)
│ at Socket.readFromStdout (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/esbuild@0.17.16/node_modules/esbuild/lib/main.js:673:7)
│ at Socket.emit (node:events:527:28)
│ at addChunk (node:internal/streams/readable:315:12)
│ ESM Build failed
│ DTS Build start
│ src/index.ts(1,23): error TS2307: Cannot find module './prism-langs' or its corresponding type declarations.
│ DTS Build error
│ RollupError: Failed to compile. Check the logs above.
│ at error (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:274:30)
│ at Object.error (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:24694:20)
│ at Object.error (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:23888:42)
│ at generateDtsFromTs (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/tsup@6.7.0_pyqfhkbboucpxgvrs7ocxwodkm/node_modules/tsup/dist/rollup.js:7498:22)
│ at /Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/tsup@6.7.0_pyqfhkbboucpxgvrs7ocxwodkm/node_modules/tsup/dist/rollup.js:7505:59
│ at _nullishCoalesce (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/tsup@6.7.0_pyqfhkbboucpxgvrs7ocxwodkm/node_modules/tsup/dist/rollup.js:1:198)
│ at Object.transform (/Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/tsup@6.7.0_pyqfhkbboucpxgvrs7ocxwodkm/node_modules/tsup/dist/rollup.js:7505:18)
│ at /Users/rye/scm/fmd/prism-react-renderer/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/shared/rollup.js:24893:40
└─ Failed in 1.1s
/Users/rye/scm/fmd/prism-react-renderer/packages/prism-react-renderer:
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL prism-react-renderer@1.3.5 build: `patch-package && tsup`
Exit status 1
ELIFECYCLE Command failed with exit code 1. |
Add GitHub Actions + Changesets
Bump to Prism 1.29, update README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you didn't try to sneak anything in here, all previous PRs looked 👍 so I'm assuming this is 👍 . (I pulled down locally, ran the build and spun up the demo, all seemed to run without a hitch.)
Migration to new codebase from the following PR set:
#186
#187
#188
#189