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

Feature/segregate op nop scaffold #36

Merged
merged 17 commits into from
Mar 29, 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
42 changes: 20 additions & 22 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
{
"cSpell.ignoreWords": [
"Expresso"
],
"workbench.colorCustomizations": {
// "activityBar.foreground": "#38e715",
// "activityBarBadge.background": "#248d0f",
// "activityBarBadge.foreground": "#fcfcfc",
// "sideBar.border": "#38e715",
// "sideBarTitle.foreground": "#38e715",
// "sideBarSectionHeader.border": "#38e715",
// "editorGroupHeader.border": "#38e715",
// "editorGroupHeader.tabsBorder": "#38e715",
// "tab.border": "#38e715",
// "tab.activeBorderTop": "#38e715",
// "panel.border": "#38e715",
// "statusBar.border": "#38e715",
// "statusBar.foreground": "#38e715"
},
"editor.rulers": [
120
],
}
"cSpell.ignoreWords": ["Expresso"],
"workbench.colorCustomizations": {
// "activityBar.foreground": "#38e715",
// "activityBarBadge.background": "#248d0f",
// "activityBarBadge.foreground": "#fcfcfc",
// "sideBar.border": "#38e715",
// "sideBarTitle.foreground": "#38e715",
// "sideBarSectionHeader.border": "#38e715",
// "editorGroupHeader.border": "#38e715",
// "editorGroupHeader.tabsBorder": "#38e715",
// "tab.border": "#38e715",
// "tab.activeBorderTop": "#38e715",
// "panel.border": "#38e715",
// "statusBar.border": "#38e715",
// "statusBar.foreground": "#38e715"
},
"editor.rulers": [120],
"cSpell.words": ["nonopinionated", "usecase"],
"typescript.tsdk": "node_modules\\typescript\\lib"
}
15 changes: 12 additions & 3 deletions expressots.config.ts
Copy link
Member

Choose a reason for hiding this comment

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

I think this file can be removed

Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { ExpressoConfig, Pattern } from "./src/types";

const config: ExpressoConfig = {
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: false
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: true,
scaffoldSchematics: {
entity: "model",
provider: "adapter",
controller: "controller",
usecase: "operation",
dto: "payload",
module: "group",
middleware: "exjs",
},
};

export default config;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"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 -r ./src/providers/prisma/templates ./bin/providers/prisma/templates",
"clean": "rimraf ./bin",
"prepublish": "npm run build && npm pack",
"format": "prettier --write \"./src/**/*.ts\" --cache",
"lint": "eslint \"./src/**/*.ts\"",
"lint:fix": "eslint \"./src/**/*.ts\" --fix",
Expand All @@ -50,6 +51,7 @@
"@expressots/boost-ts": "1.1.1",
"chalk-animation": "2.0.3",
"cli-progress": "3.11.2",
"cli-table3": "^0.6.4",
"degit": "2.8.4",
"glob": "10.2.6",
"inquirer": "8.0.0",
Expand Down
9 changes: 9 additions & 0 deletions src/@types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ export interface ExpressoConfig {
sourceRoot: string;
opinionated: boolean;
providers?: IProviders;
scaffoldSchematics?: {
entity?: string;
controller?: string;
usecase?: string;
dto?: string;
module?: string;
provider?: string;
middleware?: string;
};
}
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { runCommandModule } from "./commands/project.commands";
import { generateProject } from "./generate";
import { helpCommand } from "./help/cli";
import { infoProject } from "./info";
import { createProject } from "./new";
import { generateProviders } from "./providers";

export const CLI_VERSION = "1.3.4";

console.log(`\n[🐎 Expressots]\n`);

yargs(hideBin(process.argv))
Expand All @@ -19,6 +18,7 @@ yargs(hideBin(process.argv))
.command(generateProviders())
.command(generateProject())
.command(infoProject())
.command(helpCommand())
.example("$0 new expressots-demo", "Create interactively")
.example("$0 new expressots-demo -d ./", "Create interactively with path")
.example("$0 new expressots-demo -p yarn -t opinionated", "Create silently")
Expand Down
4 changes: 2 additions & 2 deletions src/generate/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const coerceSchematicAliases = (arg: string) => {
return "entity";
case "mo":
return "module";
case "m":
case "mi":
return "middleware";
default:
return arg;
Expand All @@ -29,7 +29,7 @@ const coerceSchematicAliases = (arg: string) => {

const generateProject = (): CommandModule<CommandModuleArgs, any> => {
return {
command: "generate [schematic] [path]",
command: "generate [schematic] [path] [method]",
describe: "Scaffold a new resource",
aliases: ["g"],
builder: (yargs: Argv): Argv => {
Expand Down
Loading