Skip to content

Commit

Permalink
Rename @edgedb/create to @gel/create (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
diksipav committed Jan 23, 2025
1 parent 250c6c6 commit ed081d7
Show file tree
Hide file tree
Showing 60 changed files with 184 additions and 189 deletions.
2 changes: 1 addition & 1 deletion packages/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@gel/ai",
"description": "Helper library for the Gel AI extension",
"version": "0.1.0-alpha.2",
"author": "Gel <info@gel.com>",
"author": "Gel <info@geldata.com>",
"type": "module",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@gel/auth-core",
"description": "Core helper library for the Gel Auth extension",
"version": "0.2.1",
"author": "Gel <info@gel.com>",
"author": "Gel <info@geldata.com>",
"repository": {
"type": "git",
"url": "https://github.com/geldata/gel-js.git",
Expand Down
6 changes: 3 additions & 3 deletions packages/auth-core/test/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ beforeAll(async () => {
ext::auth::AuthConfig::token_time_to_live := <duration>'24 hours';
configure current database set
ext::auth::SMTPConfig::sender := 'noreply@example.gel.com';
ext::auth::SMTPConfig::sender := 'noreply@example.geldata.com';
configure current database
insert ext::auth::EmailPasswordProviderConfig {};
Expand All @@ -39,7 +39,7 @@ test("test password signup/signin flow", async () => {
const auth = await Auth.create(client);

const signupResponse = await auth.signupWithEmailPassword(
"test@example.gel.com",
"test@example.geldata.com",
"supersecretpassword",
`${auth.baseUrl}/auth/emailpassword/verify`,
);
Expand All @@ -49,7 +49,7 @@ test("test password signup/signin flow", async () => {

await expect(
auth.signinWithEmailPassword(
"test@example.gel.com",
"test@example.geldata.com",
"supersecretpassword",
),
).rejects.toThrow("Email verification is required");
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Helper library to integrate the Gel Auth extension with Express",
"version": "0.2.2",
"type": "module",
"author": "Gel <info@gel.com>",
"author": "Gel <info@geldata.com>",
"repository": {
"type": "git",
"url": "https://github.com/geldata/gel-js.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-express/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This library provides a few affordances for adding Gel Auth to your existing Exp

## Configuring the `ExpressAuth` class

After [configuring the Gel Auth extension](https://www.gel.com/docs/guides/auth/index), you can set up the various auth routes with our route builders.
After [configuring the Gel Auth extension](https://www.geldata.com/docs/guides/auth/index), you can set up the various auth routes with our route builders.

Start by instantiating an `ExpressAuth` object by passing it a configured Gel client and some options:

Expand Down
2 changes: 1 addition & 1 deletion packages/auth-remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@gel/auth-remix",
"description": "Helper library to integrate the Gel Auth extension with Remix",
"version": "0.2.2",
"author": "Gel <info@gel.com>",
"author": "Gel <info@geldata.com>",
"type": "module",
"repository": {
"type": "git",
Expand Down
18 changes: 9 additions & 9 deletions packages/create/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# `@edgedb/create`: Project scaffolding for EdgeDB-backed applications
# `@gel/create`: Project scaffolding for Gel-backed applications

The `@edgedb/create` package provides a starting point for various frameworks with everything you need to start building an EdgeDB-backed application. We aim to follow the same conventions as the original "create-app" templates, but with EdgeDB as the database. There are a few different templates to choose from, including: Next.js, Remix, Express, Node HTTP Server.
The `@gel/create` package provides a starting point for various frameworks with everything you need to start building an Gel-backed application. We aim to follow the same conventions as the original "create-app" templates, but with Gel as the database. There are a few different templates to choose from, including: Next.js, Remix, Express, Node HTTP Server.

Important points to note:

- **Upstream changes:** We try to actively monitor and incorporate significant changes from the original "create-app" templates to to ensure developers have access to the latest features and best practices.
- **Support for major options:** While we strive to support the major options offered by the upstream "create-apps", we might not cover every possible configuration or permutation due to the vast scope of possibilities.
- **EdgeDB CLI installation:** For users who do not have the EdgeDB CLI installed, we automatically install it using our typical installation procedure.
- **Gel CLI installation:** For users who do not have the Gel CLI installed, we automatically install it using our typical installation procedure.

## Usage

```bash
$ npm create @edgedb
$ npm create @gel
# or
yarn create @edgedb
yarn create @gel
# or
pnpm create @edgedb
pnpm create @gel
# or
bun create @edgedb
bun create @gel
```

After running the command, you will be prompted to provide a project name and choose a template. You can also specify whether to use EdgeDB Auth, initialize a git repository, and install dependencies.
After running the command, you will be prompted to provide a project name and choose a template. You can also specify whether to use Gel Auth, initialize a git repository, and install dependencies.

The tool will then create a new directory with the specified name and set up the project.

Expand All @@ -42,7 +42,7 @@ Navigate into `packages/create`:
$ cd packages/create
```

Build `@edgedb/generate`
Build `@gel/generate`

```bash
$ yarn build
Expand Down
11 changes: 6 additions & 5 deletions packages/create/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "@edgedb/create",
"name": "@gel/create",
"version": "0.2.2",
"type": "module",
"description": "Create a new EdgeDB-based project",
"homepage": "https://edgedb.com/docs",
"author": "EdgeDB <info@edgedb.com>",
"description": "Create a new Gel-based project",
"homepage": "https://geldata.com/docs",
"author": "Gel <info@geldata.com>",
"engines": {
"node": ">= 18.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/edgedb/edgedb-js.git"
"url": "https://github.com/geldata/gel-js.git",
"directory": "packages/create"
},
"license": "Apache-2.0",
"sideEffects": false,
Expand Down
6 changes: 3 additions & 3 deletions packages/create/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pc from "picocolors";
import { baseRecipe, recipes as _recipes } from "./recipes/index.js";

async function main() {
p.intro("Welcome to the EdgeDB Create CLI 🚀");
p.intro("Welcome to the Gel Create CLI 🚀");

const baseOptions = await baseRecipe.getOptions();
const recipeOptions: any[] = [];
Expand All @@ -25,14 +25,14 @@ async function main() {
}

p.outro(`\
Your EdgeDB project has been initialized! 🚀
Your Gel project has been initialized! 🚀
Enter your project directory using: ${pc.green(
`cd ${baseOptions.projectName}`,
)}
Follow the instructions in the ${pc.green("README.md")} file to get started.
Need help? Join our community at ${pc.green("https://edgedb.com/community")}`);
Need help? Join our community at ${pc.green("https://geldata.com/community")}`);
}

await main();
6 changes: 3 additions & 3 deletions packages/create/src/recipes/_base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { updatePackage } from "write-package";
import { getPackageManager, copyTemplateFiles } from "../../utils.js";
import type { Framework, BaseRecipe, BaseOptions } from "../types.js";

const logger = debug("@edgedb/create:recipe:base");
const logger = debug("@gel/create:recipe:base");

const recipe: BaseRecipe = {
async getOptions() {
Expand All @@ -34,9 +34,9 @@ const recipe: BaseRecipe = {
{ value: "none", label: "None" },
],
}),
useEdgeDBAuth: () =>
useGelAuth: () =>
p.confirm({
message: "Use the EdgeDB Auth extension?",
message: "Use the Gel Auth extension?",
initialValue: true,
}),
},
Expand Down
4 changes: 2 additions & 2 deletions packages/create/src/recipes/_base/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"edgedb": "1.x"
"gel": "1.x"
},
"devDependencies": {
"@edgedb/generate": "0.x",
"@gel/generate": "0.x",
"@typescript-eslint/eslint-plugin": "6.x",
"@typescript-eslint/parser": "6.x",
"@eslint/eslintrc": "2.x",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,126 +6,126 @@ import debug from "debug";
import type { BaseOptions, Recipe } from "../types.js";
import { copyTemplateFiles, execInLoginShell } from "../../utils.js";

const logger = debug("@edgedb/create:recipe:edgedb");
const logger = debug("@gel/create:recipe:gel");

interface EdgeDBOptions {
interface GelOptions {
initializeProject: boolean;
}

const recipe: Recipe<EdgeDBOptions> = {
const recipe: Recipe<GelOptions> = {
getOptions() {
return p.group({
initializeProject: () =>
p.confirm({
message: "Initialize a new EdgeDB project with edgedb project init?",
message: "Initialize a new Gel project with gel project init?",
initialValue: true,
}),
});
},

async apply(
{ projectDir, useEdgeDBAuth }: BaseOptions,
{ initializeProject }: EdgeDBOptions,
{ projectDir, useGelAuth }: BaseOptions,
{ initializeProject }: GelOptions,
) {
logger("Running edgedb recipe");
logger("Checking for existing EdgeDB CLI");
logger("Running gel recipe");
logger("Checking for existing Gel CLI");

const spinner = p.spinner();

if (initializeProject) {
let edgedbCliVersion: string | null = null;
let gelCliVersion: string | null = null;
let shouldInstallCli: boolean | symbol = true;
try {
const { stdout } = await execInLoginShell("edgedb --version");
edgedbCliVersion = stdout.trim();
logger(edgedbCliVersion);
const { stdout } = await execInLoginShell("gel --version");
gelCliVersion = stdout.trim();
logger(gelCliVersion);
} catch (_error) {
logger("No EdgeDB CLI detected");
logger("No Gel CLI detected");
shouldInstallCli = await p.confirm({
message:
"The EdgeDB CLI is required to initialize a project. Install now?",
"The Gel CLI is required to initialize a project. Install now?",
initialValue: true,
});
}

if (edgedbCliVersion === null) {
if (gelCliVersion === null) {
if (shouldInstallCli === false) {
logger("User declined to install EdgeDB CLI");
throw new Error("EdgeDB CLI is required");
logger("User declined to install Gel CLI");
throw new Error("Gel CLI is required");
}

logger("Installing EdgeDB CLI");
logger("Installing Gel CLI");

spinner.start("Installing EdgeDB CLI");
spinner.start("Installing Gel CLI");
const { stdout, stderr } = await execInLoginShell(
"curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh -s -- -y",
"curl --proto '=https' --tlsv1.2 -sSf https://sh.geldata.com | sh -s -- -y",
);
logger({ stdout, stderr });
spinner.stop("EdgeDB CLI installed");
spinner.stop("Gel CLI installed");
}

try {
const { stdout } = await execInLoginShell("edgedb --version");
edgedbCliVersion = stdout.trim();
logger(edgedbCliVersion);
const { stdout } = await execInLoginShell("gel --version");
gelCliVersion = stdout.trim();
logger(gelCliVersion);
} catch (error) {
logger("EdgeDB CLI could not be installed.");
logger("Gel CLI could not be installed.");
logger(error);
throw new Error("EdgeDB CLI could not be installed.");
throw new Error("Gel CLI could not be installed.");
}

spinner.start("Initializing EdgeDB project");
spinner.start("Initializing Gel project");
try {
await execInLoginShell("edgedb project init --non-interactive", {
await execInLoginShell("gel project init --non-interactive", {
cwd: projectDir,
});
const { stdout, stderr } = await execInLoginShell(
"edgedb query 'select sys::get_version_as_str()'",
"gel query 'select sys::get_version_as_str()'",
{ cwd: projectDir },
);
const serverVersion = JSON.parse(stdout.trim());
logger(`EdgeDB server version: ${serverVersion}`);
logger(`Gel server version: ${serverVersion}`);
if (serverVersion === "") {
const err = new Error(
"There was a problem initializing the EdgeDB project",
"There was a problem initializing the Gel project",
);
spinner.stop(err.message);
logger({ stdout, stderr });

throw err;
}
spinner.stop(`EdgeDB v${serverVersion} project initialized`);
spinner.stop(`Gel v${serverVersion} project initialized`);
} catch (error) {
logger(error);
throw error;
} finally {
spinner.stop();
}
} else {
logger("Skipping edgedb project init");
logger("Copying basic EdgeDB project files");
logger("Skipping gel project init");
logger("Copying basic Gel project files");

const dirname = path.dirname(new URL(import.meta.url).pathname);
await copyTemplateFiles(path.resolve(dirname, "./template"), projectDir);
}

if (useEdgeDBAuth) {
if (useGelAuth) {
logger("Adding auth extension to project");

spinner.start("Enabling auth extension in EdgeDB schema");
spinner.start("Enabling auth extension in Gel schema");
const filePath = path.resolve(projectDir, "./dbschema/default.esdl");
const data = await fs.readFile(filePath, "utf8");
await fs.writeFile(filePath, `using extension auth;\n\n${data}`);
spinner.stop("Auth extension enabled in EdgeDB schema");
spinner.stop("Auth extension enabled in Gel schema");

if (initializeProject) {
logger("Creating and applying initial migration");
spinner.start("Creating and applying initial migration");
try {
await execInLoginShell("edgedb migration create", {
await execInLoginShell("gel migration create", {
cwd: projectDir,
});
await execInLoginShell("edgedb migrate", { cwd: projectDir });
await execInLoginShell("gel migrate", { cwd: projectDir });
spinner.stop("Initial migration created and applied");
} catch (error) {
logger(error);
Expand Down
2 changes: 1 addition & 1 deletion packages/create/src/recipes/_install/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as p from "@clack/prompts";
import type { BaseOptions, Recipe } from "../types.js";
import { execInLoginShell } from "../../utils.js";

const logger = debug("@edgedb/create:recipe:install");
const logger = debug("@gel/create:recipe:install");

interface InstallOptions {
shouldGitInit: boolean;
Expand Down
Loading

0 comments on commit ed081d7

Please sign in to comment.