c2pa-js icon indicating copy to clipboard operation
c2pa-js copied to clipboard

Doc for developing (or debugging) c2pa-js

Open jingzhaoou opened this issue 3 years ago • 4 comments

I am interested in building things from scratch to get better understanding how things work together. For example, with the examples/react-ts-vite example, I hope to point to my local c2ps module by changing a few lines in package.json to look like the following

"dependencies": {
"@contentauth/react": "file:../../packages/react",
"c2pa": "file:../../packages/c2pa",
"c2pa-wc": "file:../../packages/c2pa-wc",
} ```
When running {**}yarn install{*}, it still forced me to install the official modules. Wonder if someone can give me some brief instructions how to do development with {*}c2pa-js{**}. Highly appreciated.

jingzhaoou avatar Jul 10 '22 04:07 jingzhaoou

I just tried yarn link and still no luck.

I first ran yarn link under c2pa-js/packages/c2pa. Then I ran yarn link c2pa under c2pa-js/examples/react-ts-vite. The c2pa folder under c2pa-js/examples/react-ts-vite/node_modules becomes a symbolic link. However, when I ran yarn dev, I got the following errors:

5:00:37 AM [vite] Internal server error: Failed to resolve entry for package "c2pa". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "c2pa". The package may have incorrect main/module/exports specified in its package.json.
  Plugin: vite:import-analysis
  File: /home/jou2019/workspace/c2pa-js/examples/react-ts-vite/src/main.tsx
      at packageEntryFailure (/home/jou2019/workspace/c2pa-js/examples/react-ts-vite/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:40970:11)

jingzhaoou avatar Jul 10 '22 05:07 jingzhaoou

@jingzhaoou Thanks for bringing this up - we will be working on adding documentation for this. In order to get you moving forward, can you see if this works? (We recently switched from yarn/lerna to PNPM so some of the documentation may not be up to date).

  1. Run pnpm link --global in c2pa-js/packages/c2pa
  2. Clone our examples repo by running git clone [email protected]:contentauth/c2pa-js-examples.git (our current examples folder gets processed during the publishing step - will update the docs here as this can be confusing)
  3. Run the following in examples/minimal-ts-vite (to make sure it worked) - pnpm link --global c2pa
  4. Run the example with npm run dev

@emensch may also be able to chime in tomorrow with a better way of accomplishing this.

dkozma avatar Jul 12 '22 15:07 dkozma

@adobe export issue to Jira project CAI

crandmck avatar Jan 23 '23 19:01 crandmck

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/CAI-3385 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jan 23 '23 19:01 github-jira-sync-bot