@riao/cli 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.
Files changed (52) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/LICENSE.md +20 -0
  3. package/README.md +38 -0
  4. package/bin/database-create-command.d.ts +21 -0
  5. package/bin/database-create-command.js +83 -0
  6. package/bin/database-create-command.js.map +1 -0
  7. package/bin/index.d.ts +2 -0
  8. package/bin/index.js +23 -0
  9. package/bin/index.js.map +1 -0
  10. package/bin/migration-create-command.d.ts +13 -0
  11. package/bin/migration-create-command.js +52 -0
  12. package/bin/migration-create-command.js.map +1 -0
  13. package/bin/migration-run-command.d.ts +14 -0
  14. package/bin/migration-run-command.js +34 -0
  15. package/bin/migration-run-command.js.map +1 -0
  16. package/bin/schema-build-command.d.ts +12 -0
  17. package/bin/schema-build-command.js +32 -0
  18. package/bin/schema-build-command.js.map +1 -0
  19. package/bin/seed-create-command.d.ts +13 -0
  20. package/bin/seed-create-command.js +50 -0
  21. package/bin/seed-create-command.js.map +1 -0
  22. package/bin/seed-run-command.d.ts +15 -0
  23. package/bin/seed-run-command.js +38 -0
  24. package/bin/seed-run-command.js.map +1 -0
  25. package/index.d.ts +1 -0
  26. package/index.js +5 -0
  27. package/index.js.map +1 -0
  28. package/name-class-and-file.d.ts +10 -0
  29. package/name-class-and-file.js +46 -0
  30. package/name-class-and-file.js.map +1 -0
  31. package/options/database-option.d.ts +2 -0
  32. package/options/database-option.js +10 -0
  33. package/options/database-option.js.map +1 -0
  34. package/options/db-type-option.d.ts +13 -0
  35. package/options/db-type-option.js +54 -0
  36. package/options/db-type-option.js.map +1 -0
  37. package/options/direction-option.d.ts +2 -0
  38. package/options/direction-option.js +11 -0
  39. package/options/direction-option.js.map +1 -0
  40. package/options/index.d.ts +6 -0
  41. package/options/index.js +17 -0
  42. package/options/index.js.map +1 -0
  43. package/options/name-option.d.ts +2 -0
  44. package/options/name-option.js +9 -0
  45. package/options/name-option.js.map +1 -0
  46. package/options/seed-option.d.ts +2 -0
  47. package/options/seed-option.js +9 -0
  48. package/options/seed-option.js.map +1 -0
  49. package/options/steps-option.d.ts +2 -0
  50. package/options/steps-option.js +10 -0
  51. package/options/steps-option.js.map +1 -0
  52. package/package.json +32 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # riao-cli - Changelog
2
+
3
+ ## [1.0.0] Initial Release
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2022 riao-cli and others
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # riao-cli - Readme
2
+
3
+ ## Development
4
+
5
+ Run a dev test with `npm start`.
6
+
7
+ ## Running Tests
8
+
9
+ To run unit tests, `npm run test`
10
+
11
+ ## Scripts
12
+
13
+ You can write custom scripts in the `script/` directory. See `script/example.ts` as an example.
14
+
15
+ Run your script with `npm run script -- example`
16
+
17
+ ## Compiling
18
+
19
+ ### Debug Builds
20
+
21
+ To compile a debug build, run `npm run build`. The build output will appear in the `./dist` folder.
22
+
23
+ ### Prod Builds
24
+
25
+ To compile a production build, run `npm run lint:prod && npm run build`. The build output will appear in the `./dist` folder.
26
+
27
+ ## More
28
+
29
+ ### Generating Docs
30
+
31
+ `npm run doc` and browse docs/index.html!
32
+
33
+ ### Deploying to npm
34
+
35
+ 1. Did you bump your version?
36
+ 2. `npm run publish`
37
+
38
+ You can test your build by running `npm run script -- pack`
@@ -0,0 +1,21 @@
1
+ import { Command, OptionType } from 'ts-commands';
2
+ import { DbDrivers } from '../options';
3
+ interface Args {
4
+ name: string;
5
+ driver: DbDrivers;
6
+ }
7
+ export declare class DatabaseCreateCommand extends Command {
8
+ signature: string;
9
+ description: string;
10
+ positional: {
11
+ default: string;
12
+ key: string;
13
+ type: OptionType;
14
+ alias?: string;
15
+ description?: string;
16
+ choices?: string[] | number[];
17
+ }[];
18
+ options: import("ts-commands").CommandOptions[];
19
+ handle(args: Args): Promise<void>;
20
+ }
21
+ export {};
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DatabaseCreateCommand = void 0;
13
+ const path_1 = require("path");
14
+ const fs_1 = require("fs");
15
+ const database_1 = require("@riao/dbal/database");
16
+ const options_1 = require("../options");
17
+ const ts_commands_1 = require("ts-commands");
18
+ const name_class_and_file_1 = require("../name-class-and-file");
19
+ const options_2 = require("../options");
20
+ const child_process_1 = require("child_process");
21
+ class DatabaseCreateCommand extends ts_commands_1.Command {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.signature = 'db:create [name]';
25
+ this.description = 'Create a new database';
26
+ this.positional = [Object.assign(Object.assign({}, options_1.nameOption), { default: 'main' })];
27
+ this.options = [options_2.dbDriverOption];
28
+ }
29
+ handle(args) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ let { fileName, className } = (0, name_class_and_file_1.nameClassAndFile)(args.name);
32
+ const folderName = fileName.replace('.ts', '');
33
+ const constName = className.replace(/(?:^|\s)\S/, (a) => a.toLowerCase()) + 'db';
34
+ className += 'Database';
35
+ const rootDir = (0, database_1.getDatabasePath)();
36
+ const databaseDir = (0, path_1.join)(rootDir, folderName);
37
+ const migrationsDir = (0, path_1.join)(databaseDir, 'migrations');
38
+ const seedsDir = (0, path_1.join)(databaseDir, 'seeds');
39
+ const dbTypeProperties = options_2.dbDriverProperties[args.driver];
40
+ const baseClassName = dbTypeProperties.className;
41
+ const baseClassPackage = dbTypeProperties.package;
42
+ if ((0, fs_1.existsSync)(databaseDir)) {
43
+ throw new Error('Database ' + folderName + ' already exists!');
44
+ }
45
+ (0, fs_1.mkdirSync)(databaseDir, { recursive: true });
46
+ // Create index file
47
+ const indexFilePath = (0, path_1.join)(databaseDir, 'index.ts');
48
+ const indexFile = [
49
+ `import { ${baseClassName} } from \'${baseClassPackage}\';`,
50
+ '',
51
+ `export default class ${className} extends ${baseClassName} {`,
52
+ `\tname = '${folderName}';`,
53
+ '}',
54
+ '',
55
+ `export const ${constName} = new ${className}();`,
56
+ '',
57
+ ];
58
+ (0, fs_1.writeFileSync)(indexFilePath, indexFile.join('\n'));
59
+ // Create .env example
60
+ const envFileName = folderName + '.db.env';
61
+ const envFilePath = (0, path_1.join)(databaseDir, envFileName);
62
+ const envFile = [
63
+ 'host="localhost"',
64
+ `port=${dbTypeProperties.port}`,
65
+ 'username=""',
66
+ 'password=""',
67
+ 'database=""',
68
+ ];
69
+ (0, fs_1.writeFileSync)(envFilePath, envFile.join('\n'));
70
+ (0, fs_1.writeFileSync)(envFilePath + '.example', envFile.join('\n'));
71
+ // Create migrations dir
72
+ (0, fs_1.mkdirSync)(migrationsDir, { recursive: true });
73
+ (0, fs_1.writeFileSync)((0, path_1.join)(migrationsDir, '.gitignore'), '');
74
+ // Create seeds dir
75
+ (0, fs_1.mkdirSync)(seedsDir, { recursive: true });
76
+ (0, fs_1.writeFileSync)((0, path_1.join)(seedsDir, '.gitignore'), '');
77
+ // Install database
78
+ (0, child_process_1.execSync)('npm i ' + baseClassPackage);
79
+ });
80
+ }
81
+ }
82
+ exports.DatabaseCreateCommand = DatabaseCreateCommand;
83
+ //# sourceMappingURL=database-create-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-create-command.js","sourceRoot":"","sources":["../../../src/bin/database-create-command.ts"],"names":[],"mappings":"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"}
package/bin/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env ts-node
2
+ export {};
package/bin/index.js ADDED
@@ -0,0 +1,23 @@
1
+ #! /usr/bin/env ts-node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const ts_commands_1 = require("ts-commands");
5
+ const database_create_command_1 = require("./database-create-command");
6
+ const migration_create_command_1 = require("./migration-create-command");
7
+ const migration_run_command_1 = require("./migration-run-command");
8
+ const schema_build_command_1 = require("./schema-build-command");
9
+ const seed_create_command_1 = require("./seed-create-command");
10
+ const seed_run_command_1 = require("./seed-run-command");
11
+ (0, ts_commands_1.registerCommands)({
12
+ name: 'riao-cli',
13
+ commands: [
14
+ database_create_command_1.DatabaseCreateCommand,
15
+ migration_create_command_1.MigrationCreateCommand,
16
+ migration_run_command_1.MigrationRunCommand,
17
+ schema_build_command_1.SchemaBuildCommand,
18
+ seed_create_command_1.SeedCreateCommand,
19
+ seed_run_command_1.SeedRunCommand,
20
+ ],
21
+ forceExit: true,
22
+ });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/index.ts"],"names":[],"mappings":";;;AAEA,6CAA+C;AAE/C,uEAAkE;AAClE,yEAAoE;AACpE,mEAA8D;AAC9D,iEAA4D;AAC5D,+DAA0D;AAC1D,yDAAoD;AAEpD,IAAA,8BAAgB,EAAC;IAChB,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACT,+CAAqB;QACrB,iDAAsB;QACtB,2CAAmB;QACnB,yCAAkB;QAClB,uCAAiB;QACjB,iCAAc;KACd;IACD,SAAS,EAAE,IAAI;CACf,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Command } from 'ts-commands';
2
+ interface Args {
3
+ name: string;
4
+ database: string;
5
+ }
6
+ export declare class MigrationCreateCommand extends Command {
7
+ signature: string;
8
+ description: string;
9
+ positional: import("ts-commands").CommandOptions[];
10
+ options: import("ts-commands").CommandOptions[];
11
+ handle(args: Args): Promise<void>;
12
+ }
13
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MigrationCreateCommand = void 0;
13
+ const path_1 = require("path");
14
+ const fs_1 = require("fs");
15
+ const database_1 = require("@riao/dbal/database");
16
+ const options_1 = require("../options");
17
+ const ts_commands_1 = require("ts-commands");
18
+ const name_class_and_file_1 = require("../name-class-and-file");
19
+ class MigrationCreateCommand extends ts_commands_1.Command {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.signature = 'migration:create [name]';
23
+ this.description = 'Create a new migration file';
24
+ this.positional = [options_1.nameOption];
25
+ this.options = [options_1.databaseOption];
26
+ }
27
+ handle(args) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const { fileName, className } = (0, name_class_and_file_1.nameClassAndFile)(args.name);
30
+ const file = [
31
+ 'import { Migration } from \'riao-dbal\';',
32
+ '',
33
+ `export default class ${className} extends Migration {`,
34
+ '\tasync up() {',
35
+ '\t\t',
36
+ '\t}',
37
+ '',
38
+ '\tasync down() {',
39
+ '\t\t',
40
+ '\t}',
41
+ '}',
42
+ '',
43
+ ];
44
+ const databaseDir = (0, database_1.getDatabasePath)();
45
+ const db = yield (0, database_1.loadDatabase)(databaseDir, args.database);
46
+ const path = (0, path_1.join)(db.getMigrationsDirectory(), `${Date.now()}-${fileName}`);
47
+ (0, fs_1.writeFileSync)(path, file.join('\n'));
48
+ });
49
+ }
50
+ }
51
+ exports.MigrationCreateCommand = MigrationCreateCommand;
52
+ //# sourceMappingURL=migration-create-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-create-command.js","sourceRoot":"","sources":["../../../src/bin/migration-create-command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAwC;AACxC,2BAAmC;AACnC,kDAAoE;AACpE,wCAAwD;AACxD,6CAAkD;AAClD,gEAA0D;AAO1D,MAAa,sBAAuB,SAAQ,qBAAO;IAAnD;;QACC,cAAS,GAAG,yBAAyB,CAAC;QACtC,gBAAW,GAAG,6BAA6B,CAAC;QAE5C,eAAU,GAAG,CAAC,oBAAU,CAAC,CAAC;QAE1B,YAAO,GAAG,CAAC,wBAAc,CAAC,CAAC;IA8B5B,CAAC;IA5BM,MAAM,CAAC,IAAU;;YACtB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,sCAAgB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE5D,MAAM,IAAI,GAAG;gBACZ,0CAA0C;gBAC1C,EAAE;gBACF,wBAAwB,SAAS,sBAAsB;gBACvD,gBAAgB;gBAChB,MAAM;gBACN,KAAK;gBACL,EAAE;gBACF,kBAAkB;gBAClB,MAAM;gBACN,KAAK;gBACL,GAAG;gBACH,EAAE;aACF,CAAC;YAEF,MAAM,WAAW,GAAG,IAAA,0BAAe,GAAE,CAAC;YACtC,MAAM,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAE1D,MAAM,IAAI,GAAG,IAAA,WAAQ,EACpB,EAAE,CAAC,sBAAsB,EAAE,EAC3B,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAC3B,CAAC;YAEF,IAAA,kBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;KAAA;CACD;AApCD,wDAoCC"}
@@ -0,0 +1,14 @@
1
+ import { Command } from 'ts-commands';
2
+ interface Args {
3
+ database: string;
4
+ direction: 'up' | 'down';
5
+ steps: number;
6
+ }
7
+ export declare class MigrationRunCommand extends Command {
8
+ signature: string;
9
+ description: string;
10
+ positional: any[];
11
+ options: import("ts-commands").CommandOptions[];
12
+ handle(args: Args): Promise<void>;
13
+ }
14
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MigrationRunCommand = void 0;
13
+ const ts_commands_1 = require("ts-commands");
14
+ const migration_1 = require("@riao/dbal/migration");
15
+ const database_1 = require("@riao/dbal/database");
16
+ const options_1 = require("../options");
17
+ class MigrationRunCommand extends ts_commands_1.Command {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.signature = 'migration:run';
21
+ this.description = 'Run migrations';
22
+ this.positional = [];
23
+ this.options = [options_1.databaseOption, options_1.directionOption, options_1.stepsOption];
24
+ }
25
+ handle(args) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const db = yield (0, database_1.loadDatabase)(null, args.database);
28
+ const runner = new migration_1.MigrationRunner(db);
29
+ yield runner.run(undefined, undefined, args.direction, args.steps);
30
+ });
31
+ }
32
+ }
33
+ exports.MigrationRunCommand = MigrationRunCommand;
34
+ //# sourceMappingURL=migration-run-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-run-command.js","sourceRoot":"","sources":["../../../src/bin/migration-run-command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAkD;AAClD,oDAAuD;AACvD,kDAAmD;AACnD,wCAA0E;AAQ1E,MAAa,mBAAoB,SAAQ,qBAAO;IAAhD;;QACC,cAAS,GAAG,eAAe,CAAC;QAC5B,gBAAW,GAAG,gBAAgB,CAAC;QAE/B,eAAU,GAAG,EAAE,CAAC;QAEhB,YAAO,GAAG,CAAC,wBAAc,EAAE,yBAAe,EAAE,qBAAW,CAAC,CAAC;IAQ1D,CAAC;IANM,MAAM,CAAC,IAAU;;YACtB,MAAM,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,IAAI,2BAAe,CAAC,EAAE,CAAC,CAAC;YAEvC,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACpE,CAAC;KAAA;CACD;AAdD,kDAcC"}
@@ -0,0 +1,12 @@
1
+ import { Command } from 'ts-commands';
2
+ interface Args {
3
+ database: string;
4
+ }
5
+ export declare class SchemaBuildCommand extends Command {
6
+ signature: string;
7
+ description: string;
8
+ positional: any[];
9
+ options: import("ts-commands").CommandOptions[];
10
+ handle(args: Args): Promise<void>;
11
+ }
12
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SchemaBuildCommand = void 0;
13
+ const ts_commands_1 = require("ts-commands");
14
+ const database_1 = require("@riao/dbal/database");
15
+ const options_1 = require("../options");
16
+ class SchemaBuildCommand extends ts_commands_1.Command {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.signature = 'schema:build';
20
+ this.description = 'Build schema';
21
+ this.positional = [];
22
+ this.options = [options_1.databaseOption];
23
+ }
24
+ handle(args) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const db = yield (0, database_1.loadDatabase)(null, args.database);
27
+ yield db.buildSchema();
28
+ });
29
+ }
30
+ }
31
+ exports.SchemaBuildCommand = SchemaBuildCommand;
32
+ //# sourceMappingURL=schema-build-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-build-command.js","sourceRoot":"","sources":["../../../src/bin/schema-build-command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsC;AACtC,kDAAmD;AACnD,wCAA4C;AAM5C,MAAa,kBAAmB,SAAQ,qBAAO;IAA/C;;QACC,cAAS,GAAG,cAAc,CAAC;QAC3B,gBAAW,GAAG,cAAc,CAAC;QAE7B,eAAU,GAAG,EAAE,CAAC;QAEhB,YAAO,GAAG,CAAC,wBAAc,CAAC,CAAC;IAM5B,CAAC;IAJM,MAAM,CAAC,IAAU;;YACtB,MAAM,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnD,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;QACxB,CAAC;KAAA;CACD;AAZD,gDAYC"}
@@ -0,0 +1,13 @@
1
+ import { Command } from 'ts-commands';
2
+ interface Args {
3
+ name: string;
4
+ database: string;
5
+ }
6
+ export declare class SeedCreateCommand extends Command {
7
+ signature: string;
8
+ description: string;
9
+ positional: import("ts-commands").CommandOptions[];
10
+ options: import("ts-commands").CommandOptions[];
11
+ handle(args: Args): Promise<void>;
12
+ }
13
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SeedCreateCommand = void 0;
13
+ const path_1 = require("path");
14
+ const fs_1 = require("fs");
15
+ const database_1 = require("@riao/dbal/database");
16
+ const options_1 = require("../options");
17
+ const ts_commands_1 = require("ts-commands");
18
+ const name_class_and_file_1 = require("../name-class-and-file");
19
+ class SeedCreateCommand extends ts_commands_1.Command {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.signature = 'seed:create [name]';
23
+ this.description = 'Create a new seed file';
24
+ this.positional = [options_1.nameOption];
25
+ this.options = [options_1.databaseOption];
26
+ }
27
+ handle(args) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const { fileName, className } = (0, name_class_and_file_1.nameClassAndFile)(args.name);
30
+ const file = [
31
+ 'import { Seed } from \'riao-dbal/seed\';',
32
+ '',
33
+ `export default class ${className} extends Seed {`,
34
+ '\tpublic async up(): Promise<void> {',
35
+ '\t}',
36
+ '',
37
+ '\tpublic async down(): Promise<void> {',
38
+ '\t}',
39
+ '}',
40
+ '',
41
+ ];
42
+ const databaseDir = (0, database_1.getDatabasePath)();
43
+ const db = yield (0, database_1.loadDatabase)(databaseDir, args.database);
44
+ const path = (0, path_1.join)(db.getSeedsDirectory(), fileName);
45
+ (0, fs_1.writeFileSync)(path, file.join('\n'));
46
+ });
47
+ }
48
+ }
49
+ exports.SeedCreateCommand = SeedCreateCommand;
50
+ //# sourceMappingURL=seed-create-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-create-command.js","sourceRoot":"","sources":["../../../src/bin/seed-create-command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAwC;AACxC,2BAAmC;AACnC,kDAAoE;AACpE,wCAAwD;AACxD,6CAAkD;AAClD,gEAA0D;AAO1D,MAAa,iBAAkB,SAAQ,qBAAO;IAA9C;;QACC,cAAS,GAAG,oBAAoB,CAAC;QACjC,gBAAW,GAAG,wBAAwB,CAAC;QAEvC,eAAU,GAAG,CAAC,oBAAU,CAAC,CAAC;QAE1B,YAAO,GAAG,CAAC,wBAAc,CAAC,CAAC;IAyB5B,CAAC;IAvBM,MAAM,CAAC,IAAU;;YACtB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,sCAAgB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE5D,MAAM,IAAI,GAAG;gBACZ,0CAA0C;gBAC1C,EAAE;gBACF,wBAAwB,SAAS,iBAAiB;gBAClD,sCAAsC;gBACtC,KAAK;gBACL,EAAE;gBACF,wCAAwC;gBACxC,KAAK;gBACL,GAAG;gBACH,EAAE;aACF,CAAC;YAEF,MAAM,WAAW,GAAG,IAAA,0BAAe,GAAE,CAAC;YACtC,MAAM,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAE1D,MAAM,IAAI,GAAG,IAAA,WAAQ,EAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE,QAAQ,CAAC,CAAC;YAExD,IAAA,kBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;KAAA;CACD;AA/BD,8CA+BC"}
@@ -0,0 +1,15 @@
1
+ import { Command } from 'ts-commands';
2
+ interface Args {
3
+ database: string;
4
+ direction: 'up' | 'down';
5
+ seed: string;
6
+ steps: number;
7
+ }
8
+ export declare class SeedRunCommand extends Command {
9
+ signature: string;
10
+ description: string;
11
+ positional: any[];
12
+ options: import("ts-commands").CommandOptions[];
13
+ handle(args: Args): Promise<void>;
14
+ }
15
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SeedRunCommand = void 0;
13
+ const ts_commands_1 = require("ts-commands");
14
+ const seed_1 = require("@riao/dbal/seed");
15
+ const database_1 = require("@riao/dbal/database");
16
+ const options_1 = require("../options");
17
+ class SeedRunCommand extends ts_commands_1.Command {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.signature = 'seed:run';
21
+ this.description = 'Run seeds';
22
+ this.positional = [];
23
+ this.options = [options_1.databaseOption, options_1.directionOption, options_1.seedOption, options_1.stepsOption];
24
+ }
25
+ handle(args) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const db = yield (0, database_1.loadDatabase)(null, args.database);
28
+ const runner = new seed_1.SeedRunner(db);
29
+ yield runner.run(undefined, undefined, args.direction, args.steps, args.seed
30
+ ? args.seed.includes('.ts')
31
+ ? args.seed
32
+ : args.seed + '.ts'
33
+ : undefined);
34
+ });
35
+ }
36
+ }
37
+ exports.SeedRunCommand = SeedRunCommand;
38
+ //# sourceMappingURL=seed-run-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-run-command.js","sourceRoot":"","sources":["../../../src/bin/seed-run-command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAkD;AAClD,0CAA6C;AAC7C,kDAAmD;AACnD,wCAKoB;AASpB,MAAa,cAAe,SAAQ,qBAAO;IAA3C;;QACC,cAAS,GAAG,UAAU,CAAC;QACvB,gBAAW,GAAG,WAAW,CAAC;QAE1B,eAAU,GAAG,EAAE,CAAC;QAEhB,YAAO,GAAG,CAAC,wBAAc,EAAE,yBAAe,EAAE,oBAAU,EAAE,qBAAW,CAAC,CAAC;IAkBtE,CAAC;IAhBM,MAAM,CAAC,IAAU;;YACtB,MAAM,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,IAAI,iBAAU,CAAC,EAAE,CAAC,CAAC;YAElC,MAAM,MAAM,CAAC,GAAG,CACf,SAAS,EACT,SAAS,EACT,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,IAAI;gBACR,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;oBAC1B,CAAC,CAAC,IAAI,CAAC,IAAI;oBACX,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK;gBACpB,CAAC,CAAC,SAAS,CACZ,CAAC;QACH,CAAC;KAAA;CACD;AAxBD,wCAwBC"}
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const a = true;
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.a = void 0;
4
+ exports.a = true;
5
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,IAAI,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Create a class & filename
3
+ *
4
+ * @param name Input name, in either kebab-case or pascal-case
5
+ * @return Returns the file & class name
6
+ */
7
+ export declare function nameClassAndFile(name: string): {
8
+ fileName: string;
9
+ className: string;
10
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nameClassAndFile = void 0;
4
+ /**
5
+ * Create a class & filename
6
+ *
7
+ * @param name Input name, in either kebab-case or pascal-case
8
+ * @return Returns the file & class name
9
+ */
10
+ function nameClassAndFile(name) {
11
+ let kebabCase;
12
+ let pascalCase;
13
+ if (name.includes('-')) {
14
+ // Kebab case
15
+ kebabCase = name;
16
+ // Pascal case
17
+ pascalCase = name
18
+ // Convert to pascal case
19
+ .replace(/-([a-z])/gi, (g) => g[1].toLocaleUpperCase())
20
+ // Remove any remaining hyphens
21
+ .replace(/-/g, '')
22
+ // Capitalize first letter
23
+ .replace(/^([a-z])/, (g) => g.toLocaleUpperCase());
24
+ }
25
+ else {
26
+ const seperateByDash = (g) => g[0] + '-' + g[1];
27
+ // Kebab case
28
+ kebabCase = name
29
+ // Convert to kebab case
30
+ .replace(/([a-z0-9][A-Z0-9])/g, seperateByDash)
31
+ // Fix numbers followed by letters
32
+ .replace(/([0-9][a-zA-Z])/g, seperateByDash)
33
+ // To lowercase
34
+ .toLocaleLowerCase();
35
+ // Pascal case
36
+ pascalCase = name
37
+ // Capitalize first letter
38
+ .replace(/^([a-z])/, (g) => g.toLocaleUpperCase());
39
+ }
40
+ return {
41
+ fileName: `${kebabCase}.ts`,
42
+ className: pascalCase,
43
+ };
44
+ }
45
+ exports.nameClassAndFile = nameClassAndFile;
46
+ //# sourceMappingURL=name-class-and-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-class-and-file.js","sourceRoot":"","sources":["../../src/name-class-and-file.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC5C,IAAI,SAAiB,CAAC;IACtB,IAAI,UAAkB,CAAC;IAEvB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACvB,aAAa;QACb,SAAS,GAAG,IAAI,CAAC;QAEjB,cAAc;QACd,UAAU,GAAG,IAAI;YAChB,yBAAyB;aACxB,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;YACvD,+BAA+B;aAC9B,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,0BAA0B;aACzB,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;KACpD;SACI;QACJ,MAAM,cAAc,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,aAAa;QACb,SAAS,GAAG,IAAI;YACf,wBAAwB;aACvB,OAAO,CAAC,qBAAqB,EAAE,cAAc,CAAC;YAC/C,kCAAkC;aACjC,OAAO,CAAC,kBAAkB,EAAE,cAAc,CAAC;YAC5C,eAAe;aACd,iBAAiB,EAAE,CAAC;QAEtB,cAAc;QACd,UAAU,GAAG,IAAI;YAChB,0BAA0B;aACzB,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;KACpD;IAED,OAAO;QACN,QAAQ,EAAE,GAAG,SAAS,KAAK;QAC3B,SAAS,EAAE,UAAU;KACrB,CAAC;AACH,CAAC;AAvCD,4CAuCC"}
@@ -0,0 +1,2 @@
1
+ import { CommandOptions } from 'ts-commands';
2
+ export declare const databaseOption: CommandOptions;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseOption = void 0;
4
+ const ts_commands_1 = require("ts-commands");
5
+ exports.databaseOption = {
6
+ key: 'database',
7
+ type: ts_commands_1.OptionType.string,
8
+ default: 'main',
9
+ };
10
+ //# sourceMappingURL=database-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-option.js","sourceRoot":"","sources":["../../../src/options/database-option.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAE5C,QAAA,cAAc,GAAmB;IAC7C,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,wBAAU,CAAC,MAAM;IACvB,OAAO,EAAE,MAAM;CACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { CommandOptions } from 'ts-commands';
2
+ interface DbDriverPropertiesInterface {
3
+ package: string;
4
+ className: string;
5
+ port: number;
6
+ }
7
+ export declare const dbDriverProperties: {
8
+ [key: string]: DbDriverPropertiesInterface;
9
+ };
10
+ export type DbDrivers = keyof typeof dbDriverProperties;
11
+ export declare const dbDriverKeys: string[];
12
+ export declare const dbDriverOption: CommandOptions;
13
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dbDriverOption = exports.dbDriverKeys = exports.dbDriverProperties = void 0;
4
+ const ts_commands_1 = require("ts-commands");
5
+ exports.dbDriverProperties = {
6
+ mssql2017: {
7
+ package: 'riao-driver-mssql',
8
+ className: 'DatabaseMsSql2017',
9
+ port: 1433,
10
+ },
11
+ mssql2019: {
12
+ package: 'riao-driver-mssql',
13
+ className: 'DatabaseMsSql2019',
14
+ port: 1433,
15
+ },
16
+ mysql5: {
17
+ package: 'riao-driver-mysql',
18
+ className: 'DatabaseMySql5',
19
+ port: 3306,
20
+ },
21
+ mysql8: {
22
+ package: 'riao-driver-mysql',
23
+ className: 'DatabaseMySql8',
24
+ port: 3306,
25
+ },
26
+ pg12: {
27
+ package: 'riao-driver-postgres',
28
+ className: 'DatabasePostgres12',
29
+ port: 5432,
30
+ },
31
+ pg13: {
32
+ package: 'riao-driver-postgres',
33
+ className: 'DatabasePostgres13',
34
+ port: 5432,
35
+ },
36
+ pg14: {
37
+ package: 'riao-driver-postgres',
38
+ className: 'DatabasePostgres14',
39
+ port: 5432,
40
+ },
41
+ pg15: {
42
+ package: 'riao-driver-postgres',
43
+ className: 'DatabasePostgres15',
44
+ port: 5432,
45
+ },
46
+ };
47
+ exports.dbDriverKeys = Object.keys(exports.dbDriverProperties);
48
+ exports.dbDriverOption = {
49
+ key: 'driver',
50
+ type: ts_commands_1.OptionType.string,
51
+ default: 'mysql8',
52
+ choices: exports.dbDriverKeys,
53
+ };
54
+ //# sourceMappingURL=db-type-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-type-option.js","sourceRoot":"","sources":["../../../src/options/db-type-option.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAQ5C,QAAA,kBAAkB,GAE3B;IACH,SAAS,EAAE;QACV,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,IAAI;KACV;IACD,SAAS,EAAE;QACV,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,IAAI;KACV;IACD,MAAM,EAAE;QACP,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,gBAAgB;QAC3B,IAAI,EAAE,IAAI;KACV;IACD,MAAM,EAAE;QACP,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,gBAAgB;QAC3B,IAAI,EAAE,IAAI;KACV;IACD,IAAI,EAAE;QACL,OAAO,EAAE,sBAAsB;QAC/B,SAAS,EAAE,oBAAoB;QAC/B,IAAI,EAAE,IAAI;KACV;IACD,IAAI,EAAE;QACL,OAAO,EAAE,sBAAsB;QAC/B,SAAS,EAAE,oBAAoB;QAC/B,IAAI,EAAE,IAAI;KACV;IACD,IAAI,EAAE;QACL,OAAO,EAAE,sBAAsB;QAC/B,SAAS,EAAE,oBAAoB;QAC/B,IAAI,EAAE,IAAI;KACV;IACD,IAAI,EAAE;QACL,OAAO,EAAE,sBAAsB;QAC/B,SAAS,EAAE,oBAAoB;QAC/B,IAAI,EAAE,IAAI;KACV;CACD,CAAC;AAGW,QAAA,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,0BAAkB,CAAC,CAAC;AAE/C,QAAA,cAAc,GAAmB;IAC7C,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,wBAAU,CAAC,MAAM;IACvB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,oBAAY;CACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CommandOptions } from 'ts-commands';
2
+ export declare const directionOption: CommandOptions;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.directionOption = void 0;
4
+ const ts_commands_1 = require("ts-commands");
5
+ exports.directionOption = {
6
+ key: 'direction',
7
+ type: ts_commands_1.OptionType.string,
8
+ default: 'up',
9
+ choices: ['up', 'down'],
10
+ };
11
+ //# sourceMappingURL=direction-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direction-option.js","sourceRoot":"","sources":["../../../src/options/direction-option.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAE5C,QAAA,eAAe,GAAmB;IAC9C,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,wBAAU,CAAC,MAAM;IACvB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { databaseOption } from './database-option';
2
+ export { dbDriverOption, DbDrivers, dbDriverProperties, } from './db-type-option';
3
+ export { directionOption } from './direction-option';
4
+ export { nameOption } from './name-option';
5
+ export { seedOption } from './seed-option';
6
+ export { stepsOption } from './steps-option';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stepsOption = exports.seedOption = exports.nameOption = exports.directionOption = exports.dbDriverProperties = exports.dbDriverOption = exports.databaseOption = void 0;
4
+ var database_option_1 = require("./database-option");
5
+ Object.defineProperty(exports, "databaseOption", { enumerable: true, get: function () { return database_option_1.databaseOption; } });
6
+ var db_type_option_1 = require("./db-type-option");
7
+ Object.defineProperty(exports, "dbDriverOption", { enumerable: true, get: function () { return db_type_option_1.dbDriverOption; } });
8
+ Object.defineProperty(exports, "dbDriverProperties", { enumerable: true, get: function () { return db_type_option_1.dbDriverProperties; } });
9
+ var direction_option_1 = require("./direction-option");
10
+ Object.defineProperty(exports, "directionOption", { enumerable: true, get: function () { return direction_option_1.directionOption; } });
11
+ var name_option_1 = require("./name-option");
12
+ Object.defineProperty(exports, "nameOption", { enumerable: true, get: function () { return name_option_1.nameOption; } });
13
+ var seed_option_1 = require("./seed-option");
14
+ Object.defineProperty(exports, "seedOption", { enumerable: true, get: function () { return seed_option_1.seedOption; } });
15
+ var steps_option_1 = require("./steps-option");
16
+ Object.defineProperty(exports, "stepsOption", { enumerable: true, get: function () { return steps_option_1.stepsOption; } });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/options/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,mDAI0B;AAHzB,gHAAA,cAAc,OAAA;AAEd,oHAAA,kBAAkB,OAAA;AAEnB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+CAA6C;AAApC,2GAAA,WAAW,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { CommandOptions } from 'ts-commands';
2
+ export declare const nameOption: CommandOptions;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nameOption = void 0;
4
+ const ts_commands_1 = require("ts-commands");
5
+ exports.nameOption = {
6
+ key: 'name',
7
+ type: ts_commands_1.OptionType.string,
8
+ };
9
+ //# sourceMappingURL=name-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-option.js","sourceRoot":"","sources":["../../../src/options/name-option.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAE5C,QAAA,UAAU,GAAmB;IACzC,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,wBAAU,CAAC,MAAM;CACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CommandOptions } from 'ts-commands';
2
+ export declare const seedOption: CommandOptions;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.seedOption = void 0;
4
+ const ts_commands_1 = require("ts-commands");
5
+ exports.seedOption = {
6
+ key: 'seed',
7
+ type: ts_commands_1.OptionType.string,
8
+ };
9
+ //# sourceMappingURL=seed-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-option.js","sourceRoot":"","sources":["../../../src/options/seed-option.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAE5C,QAAA,UAAU,GAAmB;IACzC,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,wBAAU,CAAC,MAAM;CACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CommandOptions } from 'ts-commands';
2
+ export declare const stepsOption: CommandOptions;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stepsOption = void 0;
4
+ const ts_commands_1 = require("ts-commands");
5
+ exports.stepsOption = {
6
+ key: 'steps',
7
+ type: ts_commands_1.OptionType.number,
8
+ default: -1,
9
+ };
10
+ //# sourceMappingURL=steps-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps-option.js","sourceRoot":"","sources":["../../../src/options/steps-option.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAE5C,QAAA,WAAW,GAAmB;IAC1C,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,wBAAU,CAAC,MAAM;IACvB,OAAO,EAAE,CAAC,CAAC;CACX,CAAC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@riao/cli",
3
+ "version": "1.0.0",
4
+ "description": "riao cli",
5
+ "bin": {
6
+ "riao": "./bin/index.js"
7
+ },
8
+ "typescript-template": {
9
+ "base": "1.0.0",
10
+ "cli": "1.0.0",
11
+ "jasmine": "1.0.0",
12
+ "library": "1.0.0"
13
+ },
14
+ "scripts": {},
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/riao-project/riao-cli.git"
18
+ },
19
+ "author": "riao",
20
+ "license": "MIT",
21
+ "bugs": {
22
+ "url": "https://github.com/riao-project/riao-cli/issues"
23
+ },
24
+ "homepage": "https://github.com/riao-project/riao-cli#readme",
25
+ "keywords": [],
26
+ "dependencies": {
27
+ "@riao/dbal": "^1.0.1",
28
+ "ts-commands": "^1.1.0"
29
+ },
30
+ "main": "index.js",
31
+ "types": "index.d.ts"
32
+ }