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

Prep work for splitting clis #1086

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ericanderson
Copy link
Member

@ericanderson ericanderson commented Jan 10, 2025

The ultimate goal is to move a bunch of packages to osdk-ts-clis, specifically:

  • @osdk/create-app
  • @osdk/create-app.*
  • @osdk/create-widget
  • @osdk/create-widget.*
  • @osdk/cli
  • @osdk/cli.common
  • @osdk/example-generator

NOTE: Intent is to keep cli.cmd.typescript in this repo still.

This meant:

  • No longer relying on the version of create-app being the exact same as the client. (We now need to hard code the STABLE_PACKAGE_CLIENT_VERSION.
  • Making @osdk/cli.cmd.typscript not private. (We need to be able to depend on it from the other repo)
  • Making @osdk/cli.common not private. (Its going to move to the other repo but we need to be able to depend on it)
  • Fixing a file name issue so babel does the right thing (handleGenerate.mts -> handleGenerate.ts)

Additional changes in here:

  • I noticed that tsup was doing some duplicative work related to having shims: true and thought this would not be needed any more as we don't need to have __dirname in our code since everything is a module now.
  • However in order to be sure that the output did not have any __dirname entries, I had to fix a few places in the code that weren't using the import.meta.url method, and I renamed all the times we do const __dirname = path.dirname(fileURLToPath(import.meta.url)); to a different name so I could validate in the output there wasn't any uses of __dirname.

"@osdk/generator": "workspace:~",
"@osdk/cli.common": "workspace:*",
"@osdk/generator": "workspace:*",
"@osdk/generator-utils": "workspace:*",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these we don't want surprises so we are locking exactly in.

@@ -47,6 +55,14 @@ beforeEach(() => {
describe.each(TEMPLATES)("template $id", (template) => {
const supportedVersions = Object.keys(template.files);
describe.each(supportedVersions)("For SDK version %s", (sdkVersion) => {
beforeAll(() => {
vi.stubEnv("STABLE_PACKAGE_CLIENT_VERSION", "2.1.0-beta.20");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't run babel or anything for tests

@@ -18,6 +18,7 @@ import { findUp } from "find-up";
import { readFile } from "fs/promises";
import * as path from "node:path";

process.env.STABLE_PACKAGE_CLIENT_VERSION = "~2.0.11";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After we move this to the other repo, we can put a devDependency on @osdk/client in the packages that need this and can just read from there instead of doing the hard coding.

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.

1 participant