@danceroutine/tango-cli 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +25 -39
- package/bin/tango.js +8 -0
- package/dist/domain/TangoCliCommandModule.d.ts +9 -0
- package/dist/runCli-Btn_GxD3.js.map +1 -1
- package/dist/runCli.d.ts +6 -0
- package/package.json +52 -49
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Pedro Del Moral Lopez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`@danceroutine/tango-cli` provides the `tango` command-line executable.
|
|
4
4
|
|
|
5
|
-
This package gives Tango one unified command surface for project setup and maintenance workflows. It
|
|
5
|
+
This package gives Tango one unified command surface for project setup and maintenance workflows. It owns the public CLI, while the behavior is composed from domain packages such as migrations and codegen.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -10,10 +10,6 @@ This package gives Tango one unified command surface for project setup and maint
|
|
|
10
10
|
pnpm add -D @danceroutine/tango-cli
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The CLI is typically a development dependency because it supports setup, generation, and migration workflows rather than application runtime behavior.
|
|
14
|
-
|
|
15
|
-
## What the CLI is for
|
|
16
|
-
|
|
17
13
|
Use the `tango` binary when you want to:
|
|
18
14
|
|
|
19
15
|
- scaffold a new Tango project
|
|
@@ -21,19 +17,17 @@ Use the `tango` binary when you want to:
|
|
|
21
17
|
- apply migrations to a database
|
|
22
18
|
- inspect a migration plan or status
|
|
23
19
|
|
|
24
|
-
The CLI package owns the executable itself. The feature packages still own their underlying behavior. For example, `@danceroutine/tango-migrations` owns migration generation and execution, while `@danceroutine/tango-cli` is the package that exposes those workflows through the `tango` binary.
|
|
25
|
-
|
|
26
20
|
## Common commands
|
|
27
21
|
|
|
28
22
|
```bash
|
|
29
23
|
tango new my-app --framework express --package-manager pnpm --dialect sqlite
|
|
30
|
-
tango make:migrations --
|
|
31
|
-
tango migrate --
|
|
32
|
-
tango plan --
|
|
33
|
-
tango status --
|
|
24
|
+
tango make:migrations --config ./tango.config.ts --models ./src/models.ts --name add_posts
|
|
25
|
+
tango migrate --config ./tango.config.ts
|
|
26
|
+
tango plan --config ./tango.config.ts
|
|
27
|
+
tango status --config ./tango.config.ts
|
|
34
28
|
```
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
Projects scaffolded through `tango new` use Tango's transparent runtime and `Model.objects` by default, so the generated application code stays focused on models, resources, and host-framework wiring.
|
|
37
31
|
|
|
38
32
|
## Using the package programmatically
|
|
39
33
|
|
|
@@ -41,39 +35,27 @@ The root export is intentionally small. If you need to embed Tango's CLI into a
|
|
|
41
35
|
|
|
42
36
|
```ts
|
|
43
37
|
import type { Argv } from 'yargs';
|
|
44
|
-
import {
|
|
45
|
-
createDefaultCommandModules,
|
|
46
|
-
runCli,
|
|
47
|
-
type TangoCliCommandModule,
|
|
48
|
-
} from '@danceroutine/tango-cli';
|
|
38
|
+
import { createDefaultCommandModules, runCli, type TangoCliCommandModule } from '@danceroutine/tango-cli';
|
|
49
39
|
|
|
50
40
|
class AppCommandModule implements TangoCliCommandModule {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
readonly id = 'app';
|
|
42
|
+
|
|
43
|
+
register(parser: Argv): Argv {
|
|
44
|
+
return parser.command(
|
|
45
|
+
'seed-demo-data',
|
|
46
|
+
'Load demo data into the local database',
|
|
47
|
+
() => {},
|
|
48
|
+
async () => {}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
61
51
|
}
|
|
62
52
|
|
|
63
53
|
await runCli({
|
|
64
|
-
|
|
54
|
+
modules: [...createDefaultCommandModules(), new AppCommandModule()],
|
|
65
55
|
});
|
|
66
56
|
```
|
|
67
57
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## Documentation
|
|
71
|
-
|
|
72
|
-
- Official documentation: https://danceroutine.github.io
|
|
73
|
-
- CLI reference: https://danceroutine.github.io/reference/cli-api
|
|
74
|
-
- Migrations topic: https://danceroutine.github.io/topics/migrations
|
|
75
|
-
|
|
76
|
-
## Development
|
|
58
|
+
## Developer workflow
|
|
77
59
|
|
|
78
60
|
```bash
|
|
79
61
|
pnpm --filter @danceroutine/tango-cli build
|
|
@@ -81,9 +63,13 @@ pnpm --filter @danceroutine/tango-cli typecheck
|
|
|
81
63
|
pnpm --filter @danceroutine/tango-cli test
|
|
82
64
|
```
|
|
83
65
|
|
|
84
|
-
|
|
66
|
+
## Bugs and support
|
|
85
67
|
|
|
86
|
-
- https://
|
|
68
|
+
- Documentation: <https://tangowebframework.dev>
|
|
69
|
+
- Config API: <https://tangowebframework.dev/reference/config-api>
|
|
70
|
+
- CLI reference: <https://tangowebframework.dev/reference/cli-api>
|
|
71
|
+
- Migrations topic: <https://tangowebframework.dev/topics/migrations>
|
|
72
|
+
- Issue tracker: <https://github.com/danceroutine/tango/issues>
|
|
87
73
|
|
|
88
74
|
## License
|
|
89
75
|
|
package/bin/tango.js
ADDED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { Argv } from 'yargs';
|
|
2
|
+
/**
|
|
3
|
+
* Contract for modules that attach one command subtree to the shared Tango CLI.
|
|
4
|
+
*/
|
|
2
5
|
export interface TangoCliCommandModule {
|
|
6
|
+
/**
|
|
7
|
+
* Stable identifier used to describe the module within composed CLI setups.
|
|
8
|
+
*/
|
|
3
9
|
readonly id: string;
|
|
10
|
+
/**
|
|
11
|
+
* Register the module's commands on the shared yargs parser.
|
|
12
|
+
*/
|
|
4
13
|
register(parser: Argv): Argv;
|
|
5
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCli-Btn_GxD3.js","names":["parser: Argv","parser: Argv","options: RunCliOptions"],"sources":["../src/commands/CodegenCommandModule.ts","../src/commands/MigrationsCommandModule.ts","../src/commands/createDefaultCommandModules.ts","../src/runCli.ts"],"sourcesContent":["import type { Argv } from 'yargs';\nimport { registerCodegenCommands } from '@danceroutine/tango-codegen';\nimport type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\n\n/**\n * CLI module that mounts Tango's code-generation commands.\n */\nexport class CodegenCommandModule implements TangoCliCommandModule {\n readonly id = 'codegen';\n\n /**\n * Register the code-generation command tree on the shared parser.\n */\n register(parser: Argv): Argv {\n return registerCodegenCommands(parser);\n }\n}\n","import type { Argv } from 'yargs';\nimport { registerMigrationsCommands } from '@danceroutine/tango-migrations';\nimport type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\n\n/**\n * CLI module that mounts Tango's migration commands.\n */\nexport class MigrationsCommandModule implements TangoCliCommandModule {\n readonly id = 'migrations';\n\n /**\n * Register the migration command tree on the shared parser.\n */\n register(parser: Argv): Argv {\n return registerMigrationsCommands(parser);\n }\n}\n","import type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\nimport { CodegenCommandModule } from './CodegenCommandModule';\nimport { MigrationsCommandModule } from './MigrationsCommandModule';\n\n/**\n * Create the standard command modules shipped with Tango's CLI.\n */\nexport function createDefaultCommandModules(): readonly TangoCliCommandModule[] {\n return [new MigrationsCommandModule(), new CodegenCommandModule()];\n}\n","import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport type { TangoCliCommandModule } from './domain/TangoCliCommandModule';\nimport { createDefaultCommandModules } from './commands/createDefaultCommandModules';\n\nexport type RunCliOptions = {\n argv?: readonly string[];\n modules?: readonly TangoCliCommandModule[];\n};\n\n/**\n * Run Tango's CLI with a supplied argv list and command module set.\n *\n * This is the entry point used by the binary, and it is also useful in tests\n * or host applications that want to customize which commands are available.\n */\nexport async function runCli(options: RunCliOptions = {}): Promise<void> {\n const modules = options.modules ?? createDefaultCommandModules();\n const argvInput = options.argv ?? hideBin(process.argv);\n\n let parser = yargs([...argvInput]);\n parser = parser.scriptName('tango');\n\n for (const module of modules) {\n parser = module.register(parser);\n }\n\n await parser\n .demandCommand(1, 'You must specify a command')\n .strict()\n .exitProcess(false)\n .help()\n .alias('help', 'h')\n .alias('version', 'v')\n .parseAsync();\n}\n"],"mappings":";;;;;;IAOa,uBAAN,MAA4D;CAC/D,KAAc;;;;CAKd,SAASA,QAAoB;AACzB,SAAO,wBAAwB,OAAO;CACzC;AACJ;;;;ICTY,0BAAN,MAA+D;CAClE,KAAc;;;;CAKd,SAASC,QAAoB;AACzB,SAAO,2BAA2B,OAAO;CAC5C;AACJ;;;;ACTM,SAAS,8BAAgE;AAC5E,QAAO,CAAC,IAAI,2BAA2B,IAAI,sBAAuB;AACrE;;;;
|
|
1
|
+
{"version":3,"file":"runCli-Btn_GxD3.js","names":["parser: Argv","parser: Argv","options: RunCliOptions"],"sources":["../src/commands/CodegenCommandModule.ts","../src/commands/MigrationsCommandModule.ts","../src/commands/createDefaultCommandModules.ts","../src/runCli.ts"],"sourcesContent":["import type { Argv } from 'yargs';\nimport { registerCodegenCommands } from '@danceroutine/tango-codegen';\nimport type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\n\n/**\n * CLI module that mounts Tango's code-generation commands.\n */\nexport class CodegenCommandModule implements TangoCliCommandModule {\n readonly id = 'codegen';\n\n /**\n * Register the code-generation command tree on the shared parser.\n */\n register(parser: Argv): Argv {\n return registerCodegenCommands(parser);\n }\n}\n","import type { Argv } from 'yargs';\nimport { registerMigrationsCommands } from '@danceroutine/tango-migrations';\nimport type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\n\n/**\n * CLI module that mounts Tango's migration commands.\n */\nexport class MigrationsCommandModule implements TangoCliCommandModule {\n readonly id = 'migrations';\n\n /**\n * Register the migration command tree on the shared parser.\n */\n register(parser: Argv): Argv {\n return registerMigrationsCommands(parser);\n }\n}\n","import type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\nimport { CodegenCommandModule } from './CodegenCommandModule';\nimport { MigrationsCommandModule } from './MigrationsCommandModule';\n\n/**\n * Create the standard command modules shipped with Tango's CLI.\n */\nexport function createDefaultCommandModules(): readonly TangoCliCommandModule[] {\n return [new MigrationsCommandModule(), new CodegenCommandModule()];\n}\n","import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport type { TangoCliCommandModule } from './domain/TangoCliCommandModule';\nimport { createDefaultCommandModules } from './commands/createDefaultCommandModules';\n\nexport type RunCliOptions = {\n /**\n * Argument vector to parse. When omitted, the current process argv is used.\n */\n argv?: readonly string[];\n\n /**\n * Command modules to register before parsing. The built-in set is used by default.\n */\n modules?: readonly TangoCliCommandModule[];\n};\n\n/**\n * Run Tango's CLI with a supplied argv list and command module set.\n *\n * This is the entry point used by the binary, and it is also useful in tests\n * or host applications that want to customize which commands are available.\n */\nexport async function runCli(options: RunCliOptions = {}): Promise<void> {\n const modules = options.modules ?? createDefaultCommandModules();\n const argvInput = options.argv ?? hideBin(process.argv);\n\n let parser = yargs([...argvInput]);\n parser = parser.scriptName('tango');\n\n for (const module of modules) {\n parser = module.register(parser);\n }\n\n await parser\n .demandCommand(1, 'You must specify a command')\n .strict()\n .exitProcess(false)\n .help()\n .alias('help', 'h')\n .alias('version', 'v')\n .parseAsync();\n}\n"],"mappings":";;;;;;IAOa,uBAAN,MAA4D;CAC/D,KAAc;;;;CAKd,SAASA,QAAoB;AACzB,SAAO,wBAAwB,OAAO;CACzC;AACJ;;;;ICTY,0BAAN,MAA+D;CAClE,KAAc;;;;CAKd,SAASC,QAAoB;AACzB,SAAO,2BAA2B,OAAO;CAC5C;AACJ;;;;ACTM,SAAS,8BAAgE;AAC5E,QAAO,CAAC,IAAI,2BAA2B,IAAI,sBAAuB;AACrE;;;;ACcM,eAAe,OAAOC,UAAyB,CAAE,GAAiB;CACrE,MAAM,UAAU,QAAQ,WAAW,6BAA6B;CAChE,MAAM,YAAY,QAAQ,QAAQ,QAAQ,QAAQ,KAAK;CAEvD,IAAI,SAAS,MAAM,CAAC,GAAG,SAAU,EAAC;AAClC,UAAS,OAAO,WAAW,QAAQ;AAEnC,MAAK,MAAM,UAAU,QACjB,UAAS,OAAO,SAAS,OAAO;AAGpC,OAAM,OACD,cAAc,GAAG,6BAA6B,CAC9C,QAAQ,CACR,YAAY,MAAM,CAClB,MAAM,CACN,MAAM,QAAQ,IAAI,CAClB,MAAM,WAAW,IAAI,CACrB,YAAY;AACpB"}
|
package/dist/runCli.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { TangoCliCommandModule } from './domain/TangoCliCommandModule';
|
|
2
2
|
export type RunCliOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Argument vector to parse. When omitted, the current process argv is used.
|
|
5
|
+
*/
|
|
3
6
|
argv?: readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* Command modules to register before parsing. The built-in set is used by default.
|
|
9
|
+
*/
|
|
4
10
|
modules?: readonly TangoCliCommandModule[];
|
|
5
11
|
};
|
|
6
12
|
/**
|
package/package.json
CHANGED
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsdown",
|
|
22
|
-
"test": "vitest run --coverage",
|
|
23
|
-
"test:watch": "vitest",
|
|
24
|
-
"typecheck": "tsc --noEmit"
|
|
25
|
-
},
|
|
26
|
-
"keywords": [
|
|
27
|
-
"tango",
|
|
28
|
-
"cli",
|
|
29
|
-
"migrations",
|
|
30
|
-
"codegen"
|
|
31
|
-
],
|
|
32
|
-
"author": "Pedro Del Moral Lopez",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/danceroutine/tango.git",
|
|
37
|
-
"directory": "packages/cli"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@danceroutine/tango-codegen": "workspace:*",
|
|
41
|
-
"@danceroutine/tango-migrations": "workspace:*",
|
|
42
|
-
"yargs": "^17.7.2"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/node": "^22.9.0",
|
|
46
|
-
"@types/yargs": "^17.0.33",
|
|
47
|
-
"tsdown": "^0.4.0",
|
|
48
|
-
"typescript": "^5.6.3",
|
|
49
|
-
"vitest": "^4.0.6"
|
|
2
|
+
"name": "@danceroutine/tango-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Unified Tango command line interface for migrations and code generation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"tango": "bin/tango.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
50
15
|
}
|
|
51
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"tango",
|
|
23
|
+
"cli",
|
|
24
|
+
"migrations",
|
|
25
|
+
"codegen"
|
|
26
|
+
],
|
|
27
|
+
"author": "Pedro Del Moral Lopez",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/danceroutine/tango.git",
|
|
32
|
+
"directory": "packages/cli"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"yargs": "^17.7.2",
|
|
36
|
+
"@danceroutine/tango-codegen": "1.0.0",
|
|
37
|
+
"@danceroutine/tango-migrations": "1.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^22.9.0",
|
|
41
|
+
"@types/yargs": "^17.0.33",
|
|
42
|
+
"tsdown": "^0.4.0",
|
|
43
|
+
"typescript": "^5.6.3",
|
|
44
|
+
"vitest": "^4.0.6"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsdown",
|
|
48
|
+
"test": "vitest run --coverage",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"typecheck": "pnpm run typecheck:prod && pnpm run typecheck:test",
|
|
51
|
+
"typecheck:prod": "tsc --noEmit -p tsconfig.json",
|
|
52
|
+
"typecheck:test": "tsc --noEmit -p tsconfig.tests.json"
|
|
53
|
+
}
|
|
54
|
+
}
|