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

Ets 269 add the cli to scaffold the service #29

Merged
merged 33 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5ca559f
Wip: Add prisma provider
juliano-soares Jul 3, 2023
68e7b1b
fix: add new text for CLI add command
rsaz Jul 13, 2023
a559b3f
add drivers
rsaz Aug 1, 2023
ebe6fed
feat: add process to install database driver when opt-in
VitorCaminha Aug 4, 2023
db8178d
add prisma client version question
rsaz Aug 5, 2023
674f7df
feat: add prisma provider configuration expressots.config file
VitorCaminha Aug 7, 2023
ccff34d
fix: using yarn and pnpm to install dependencies
VitorCaminha Aug 7, 2023
62f403b
fix: CLI documentation link
juliano-soares Aug 7, 2023
b3e18e3
remove src & add comment to @expressots/prisma download
rsaz Aug 8, 2023
2e3b425
fix: replace providers object when it already exists in expressots co…
VitorCaminha Aug 8, 2023
bc42738
feat: add base repository templatess
rsaz Aug 9, 2023
b72f389
Merge branch 'ETS-269-Add-the-CLI-to-scaffold-the-service' of https:/…
rsaz Aug 9, 2023
475e6b2
feat: change base repository and interface to fix DI and typescript e…
VitorCaminha Aug 27, 2023
a42c9bb
feat: add base repository and interface from prisma provider template
juliano-soares Aug 29, 2023
50bded6
Wip: Add prisma provider
juliano-soares Jul 3, 2023
83eef1c
fix: add new text for CLI add command
rsaz Jul 13, 2023
7c1d4fd
add drivers
rsaz Aug 1, 2023
80e848e
feat: add process to install database driver when opt-in
VitorCaminha Aug 4, 2023
867a755
add prisma client version question
rsaz Aug 5, 2023
0b656f3
feat: add prisma provider configuration expressots.config file
VitorCaminha Aug 7, 2023
08cc02d
fix: using yarn and pnpm to install dependencies
VitorCaminha Aug 7, 2023
0dfe00b
remove src & add comment to @expressots/prisma download
rsaz Aug 8, 2023
3390346
feat: add base repository templatess
rsaz Aug 9, 2023
eea0c6f
fix: replace providers object when it already exists in expressots co…
VitorCaminha Aug 8, 2023
96fb098
feat: change base repository and interface to fix DI and typescript e…
VitorCaminha Aug 27, 2023
d643830
feat: add base repository and interface from prisma provider template
juliano-soares Aug 29, 2023
bebce23
fix: merge main
rsaz Oct 6, 2023
5cf14fa
fix: linter fix
rsaz Oct 6, 2023
0093412
fix: add prisma provider download cmd
rsaz Oct 6, 2023
54933ca
fix: add prisma question to override install
rsaz Oct 6, 2023
7ffd673
feat: add script pck.json codegen
rsaz Oct 6, 2023
8d1766e
feat: add better log messages during installation
rsaz Oct 6, 2023
9277285
fix: copy prisma base repository templates
rsaz Oct 7, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"start": "node ./bin/cli.js",
"start:dev": "tsnd ./src/cli.ts",
"build": "npm run clean && tsc -p tsconfig.json && yarn cp:templates && chmod +x ./bin/cli.js",
"cp:templates": "cp -r ./src/generate/templates ./bin/generate/templates",
"cp:templates": "cp -r ./src/generate/templates ./bin/generate/templates && cp -r ./src/providers/prisma/templates ./bin/providers/prisma/templates",
"clean": "rimraf ./bin",
"format": "prettier --write \"./src/**/*.ts\" --cache",
"lint": "eslint \"./src/**/*.ts\"",
Expand Down
10 changes: 10 additions & 0 deletions src/@types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ export const enum Pattern {
CAMEL_CASE = "camelCase",
}

interface IProviders {
prisma?: {
schemaName: string;
schemaPath: string;
entitiesPath: string;
entityNamePattern: string;
};
}

/**
* The configuration object for the Expresso CLI.
*
Expand All @@ -18,4 +27,5 @@ export interface ExpressoConfig {
scaffoldPattern: Pattern;
sourceRoot: string;
opinionated: boolean;
providers?: IProviders;
}
2 changes: 2 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { hideBin } from "yargs/helpers";
import { generateProject } from "./generate";
import { infoProject } from "./info";
import { createProject } from "./new";
import { generateProviders } from "./providers";

export const CLI_VERSION = "1.3.4";

Expand All @@ -13,6 +14,7 @@ console.log(`\n[🐎 Expressots]\n`);
yargs(hideBin(process.argv))
.scriptName("expressots")
.command(createProject())
.command(generateProviders())
.command(generateProject())
.command(infoProject())
.example("$0 new expressots-demo", "Create interactively")
Expand Down
42 changes: 42 additions & 0 deletions src/providers/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Argv, CommandModule } from "yargs";
import { prismaProvider } from "./prisma/prisma.provider";

// eslint-disable-next-line @typescript-eslint/ban-types
type CommandModuleArgs = {};

const generateProviders = (): CommandModule<CommandModuleArgs, any> => {
return {
command: "add <provider> [library-version] [provider-version]",
describe: "Scaffold a new provider",
aliases: ["a"],
builder: (yargs: Argv): Argv => {
yargs
.positional("provider", {
choices: ["prisma"] as const,
describe: "The provider to add to the project",
type: "string",
})
.option("library-version", {
describe: "The library version to install",
type: "string",
default: "latest",
alias: "v",
})
.option("provider-version", {
describe: "The version of the provider to install",
type: "string",
default: "latest",
alias: "vp",
});

return yargs;
},
handler: async ({ provider, libraryVersion, providerVersion }) => {
if (provider === "prisma") {
await prismaProvider(libraryVersion, providerVersion);
}
},
};
};

export { generateProviders };
1 change: 1 addition & 0 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./cli";
Loading