Skip to content
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

[editor][wip] Packaging AIConfigEditor Component with Vite #830

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rholinshead
Copy link
Contributor

@rholinshead rholinshead commented Jan 9, 2024

[editor][wip] Packaging AIConfigEditor Component with Vite

[editor][wip] Packaging AIConfigEditor Component with Vite

This PR separates our current editor implementation into a root package containing the LocalEditor and a library package containing the AIConfigEditor and its associated code. When we want to publish the @lastmileai/aiconfig-editor package, just cd into the aiconfig-editor dir and run yarn && yarn build before running npm publish. yarn build will compile the react code to commonjs and esm format files & source maps (separated by specific folders) and the appropriate type declarations. This will allow the package to be used in most js projects.

We can't land this as-is because it essentially breaks the dev x, preventing HMR from working. The next couple diffs should fix that.

For now, we can still use this for publishing the package, with the following steps:

Steps to Publish @lastmileai/aiconfig-editor

  1. Rebase onto main. Fix merge conflicts and any other merge scenarios, especially:
  • Handling core editor files that were added or moved (e.g. utils, components) — make sure they are properly moved to the right place under aiconfig-editor dir instead of being top-level alongside LocalEditor
  • Handling package.json changes — this one is a huge pain to deal with. Make sure the change is in the correct package.json (i.e. if package added for editor core, should be in aiconfig-editor package.json). This might require a bit of finagling to be able to yarn and yarn build both packages afterwards. Last time this happened (due to bump of aiconfig package version), I had to hard-code the aiconfig-editor to the latest version number in the top-level package.json for yarn to work there, then yarn and yarn build in aiconfig-editor, then point top-level package back to local aiconfig-editor and then yarn again

If all files are good, the following order should work:

  1. In /client, run yarn
  2. In client/aiconfig-editor, run yarn && yarn build
  3. In /client, run rm -rf node_modules && yarn && yarn build
  4. Make sure there are no errors in LocalEditor or AIConfigEditor. Then, test the local editor in dev and prod mode to make sure they are still good.
  5. If all is good, go back to client/aiconfig-editor and bump the package version number and then yarn build
  6. Finally, can run npm publish from client/aiconfig-editor

@rholinshead rholinshead changed the title [editor][wip] Packaging AIConfigEditor Component [editor][wip] Packaging AIConfigEditor Component with Vite Jan 18, 2024
# [editor][wip] Packaging AIConfigEditor Component with Vite

This PR separates our current editor implementation into a root package containing the LocalEditor and a library package containing the AIConfigEditor and its associated code. When we want to publish the `@lastmileai/aiconfig-editor` package, just cd into the `aiconfig-editor` dir and run `yarn && yarn build` before running `npm publish`. `yarn build` will compile the react code to commonjs and esm format files & source maps (separated by specific folders) and the appropriate type declarations. This will allow the package to be used in most js projects.

We can't land this as-is because it essentially breaks the dev x, preventing HMR from working. The next couple diffs should fix that.

For now, we can still use this for publishing the package, with the following steps:

# Steps to Publish @lastmileai/aiconfig-editor

1. Rebase onto main. Fix merge conflicts and any other merge scenarios, especially:
- Handling core editor files that were added or moved (e.g. utils, components) — make sure they are properly moved to the right place under `aiconfig-editor` dir instead of being top-level alongside `LocalEditor`
- Handling `package.json` changes — this one is a huge pain to deal with. Make sure the change is in the correct `package.json` (i.e. if package added for editor core, should be in `aiconfig-editor package.json`). This might require a bit of finagling to be able to `yarn` and `yarn build` both packages afterwards. Last time this happened (due to bump of aiconfig package version), I had to hard-code the aiconfig-editor to the latest version number in the top-level `package.json` for `yarn` to work there, then `yarn` and `yarn build` in `aiconfig-editor`, then point top-level package back to local `aiconfig-editor` and then `yarn` again

If all files are good, the following order should work:

2. In `/client`, run `yarn`
3. In `client/aiconfig-editor`, run `yarn && yarn build`
4. In `/client`, run `rm -rf node_modules && yarn && yarn build`
5. Make sure there are no errors in `LocalEditor` or `AIConfigEditor`. Then, test the local editor in dev and prod mode to make sure they are still good.
6. If all is good, go back to `client/aiconfig-editor` and bump the package version number and then `yarn build`
7. Finally, can run `npm publish` from `client/aiconfig-editor`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant