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

fix studio cli fails when rc file comes from general cli #286

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tableland/studio-cli",
"version": "0.2.0",
"version": "0.2.1",
"description": "Tableland command line tools",
"repository": "https://github.com/tablelandnetwork/studio/cli",
"publishConfig": {
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ const explorer = cosmiconfigSync(moduleName, {
"package.json", // For the ts/js devs in the house
],
});
const config = explorer.search();

const conf = explorer.search();
// The aliases config is used by @tableland/cli but not here. We want to allow
// people to use the same rc config for both, so we have to remove it here.
// @ts-expect-error the config type doesn't expect aliases
const { aliases: _, ...config } = conf.config;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the functional change.
We remove the aliases field from the config since it can't be used, and yargs crashes if it is present in the config Object.


// If a dotenv file (or exported env vars) are provided, these override any config values
dotenv.config();
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/custom-types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Schema as SDKSchema } from "@tableland/sdk";
import { customType } from "drizzle-orm/sqlite-core";
import { unescapeSchema } from "../helpers";
import { unescapeSchema } from "../helpers.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Testing this feature requires the use of npm link. When linking local builds you must include the file types, so I added them where needed.


export type Schema = SDKSchema;

Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod";
import { helpers } from "@tableland/sdk";
import { slugify } from "@tableland/studio-store";
import { restrictedTeamSlugs, restrictedDefSlugs } from "./restricted-slugs";
import { restrictedTeamSlugs, restrictedDefSlugs } from "./restricted-slugs.js";

export const teamNameSchema = z
.string()
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/validators/defs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod";
import { type Schema } from "@tableland/studio-store";
import { defNameSchema } from "../common";
import { defNameSchema } from "../common.js";

const defDescriptionSchema = z.string().trim().min(1).max(1024);

Expand Down
Loading