@akago/akago_backend_commands 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/LICENCE.md ADDED
@@ -0,0 +1,9 @@
1
+ # The MIT License
2
+
3
+ Copyright 2022 Harminder Virk, contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ This subdirectory contains a minimal AdonisJS app used only for its commands.
2
+
3
+ # Install
4
+
5
+ ```
6
+ npm install
7
+ npm run build
8
+ npm link
9
+ ```
10
+
11
+ # Develop
12
+
13
+ ```
14
+ npm run build:watch
15
+ # In another shell
16
+ npm link
17
+ # You have to link each time you run build:watch
18
+ ```
package/dist/ace.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import 'ts-node-maintained/register/esm';
3
+ await import('./bin/console.js');
4
+ //# sourceMappingURL=ace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ace.js","sourceRoot":"","sources":["../ace.js"],"names":[],"mappings":";AAuBA,OAAO,iCAAiC,CAAA;AAKxC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { Ignitor, prettyPrintError } from '@adonisjs/core';
2
+ import 'reflect-metadata';
3
+ const APP_ROOT = new URL('../', import.meta.url);
4
+ const IMPORTER = (filePath) => {
5
+ if (filePath.startsWith('./') || filePath.startsWith('../')) {
6
+ return import(new URL(filePath, APP_ROOT).href);
7
+ }
8
+ return import(filePath);
9
+ };
10
+ new Ignitor(APP_ROOT, { importer: IMPORTER })
11
+ .tap((app) => {
12
+ app.booting(async () => { });
13
+ app.listen('SIGTERM', () => app.terminate());
14
+ app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
15
+ })
16
+ .ace()
17
+ .handle(process.argv.splice(2))
18
+ .catch((error) => {
19
+ process.exitCode = 1;
20
+ prettyPrintError(error);
21
+ });
22
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.js","sourceRoot":"","sources":["../../bin/console.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,kBAAkB,CAAA;AAMzB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAMhD,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAE,EAAE;IACpC,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,OAAO,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;KAC1C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC,CAAA;IAC3B,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAA;IAC5C,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAA;AACjE,CAAC,CAAC;KACD,GAAG,EAAE;KACL,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC9B,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACpB,gBAAgB,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,25 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { args } from '@adonisjs/core/ace';
11
+ import { EnvCommand } from '../lib/env_command.js';
12
+ export default class Ace extends EnvCommand {
13
+ static commandName = 'ace';
14
+ static description = 'Run an ace command inside the deployed API container. Wrap the command in double quotes.';
15
+ async runInEnv(env) {
16
+ this.logger.info(`Running ace command : ${this.command}`);
17
+ const fullCommand = `docker -c ${env.serverName} exec -it api node ace ${this.command}`;
18
+ await this.$ `${fullCommand.split(' ')}`;
19
+ }
20
+ }
21
+ __decorate([
22
+ args.string(),
23
+ __metadata("design:type", String)
24
+ ], Ace.prototype, "command", void 0);
25
+ //# sourceMappingURL=ace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ace.js","sourceRoot":"","sources":["../../commands/ace.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAWlD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,UAAU;IACzC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,MAAM,CAAC,WAAW,GAChB,0FAA0F,CAAA;IAK5F,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QACzD,MAAM,WAAW,GAAG,aAAa,GAAG,CAAC,UAAU,0BAA0B,IAAI,CAAC,OAAO,EAAE,CAAA;QACvF,MAAM,IAAI,CAAC,CAAC,CAAA,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;IACzC,CAAC;;AANO;IADP,IAAI,CAAC,MAAM,EAAE;;oCACS"}
@@ -0,0 +1,10 @@
1
+ import { EnvCommand } from '../lib/env_command.js';
2
+ export default class Btop extends EnvCommand {
3
+ static commandName = 'btop';
4
+ static description = 'Show ressource usage on server.';
5
+ async runInEnv(env) {
6
+ this.logger.info(`Running btop on ${env.serverName}...`);
7
+ await this.$ `ssh -t ${env.serverName} btop`;
8
+ }
9
+ }
10
+ //# sourceMappingURL=btop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"btop.js","sourceRoot":"","sources":["../../commands/btop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGlD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,UAAU;IAC1C,MAAM,CAAC,WAAW,GAAG,MAAM,CAAA;IAC3B,MAAM,CAAC,WAAW,GAAG,iCAAiC,CAAA;IAEtD,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,UAAU,KAAK,CAAC,CAAA;QACxD,MAAM,IAAI,CAAC,CAAC,CAAA,UAAU,GAAG,CAAC,UAAU,OAAO,CAAA;IAC7C,CAAC"}
@@ -0,0 +1,38 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { flags } from '@adonisjs/core/ace';
11
+ import { EnvCommand } from '../lib/env_command.js';
12
+ export default class Deploy extends EnvCommand {
13
+ static commandName = 'deploy';
14
+ async runInEnv(env) {
15
+ const skipMigration = await this.prompt.confirm('Do you want to skip database migrations ?', {
16
+ default: false,
17
+ });
18
+ this.logger.info(`Deploying ${env.name} => ${env.serverName}`);
19
+ if (this.prune)
20
+ await this.deployStep(env, 'prune', `system prune -f`);
21
+ if (!skipMigration)
22
+ await this.deployStep(env, 'migrate', `compose run --build --rm ${env.apiService} node ace migration:run --connection=migrations`);
23
+ await this.deployStep(env, 'deploy', `compose up --build -d ${env.apiService} backup admin`);
24
+ this.logger.success(`Deployed ${env.name} => ${env.serverName}`);
25
+ }
26
+ async deployStep(env, name, command) {
27
+ const prefix = `doppler run -c ${env.name} -- docker -c ${env.serverName}`;
28
+ this.logger.info(name);
29
+ const fullCommand = `${prefix} ${command}`;
30
+ await this.$ `${fullCommand.split(' ')}`;
31
+ this.logger.success(name);
32
+ }
33
+ }
34
+ __decorate([
35
+ flags.boolean(),
36
+ __metadata("design:type", Boolean)
37
+ ], Deploy.prototype, "prune", void 0);
38
+ //# sourceMappingURL=deploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../commands/deploy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGlD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,UAAU;IAC5C,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;IAK7B,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,2CAA2C,EAAE;YAC3F,OAAO,EAAE,KAAK;SACf,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;QAE9D,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAA;QAEtE,IAAI,CAAC,aAAa;YAChB,MAAM,IAAI,CAAC,UAAU,CACnB,GAAG,EACH,SAAS,EACT,4BAA4B,GAAG,CAAC,UAAU,iDAAiD,CAC5F,CAAA;QAEH,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,yBAAyB,GAAG,CAAC,UAAU,eAAe,CAAC,CAAA;QAE5F,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;IAClE,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,GAAgB,EAAE,IAAY,EAAE,OAAe;QAC9D,MAAM,MAAM,GAAG,kBAAkB,GAAG,CAAC,IAAI,iBAAiB,GAAG,CAAC,UAAU,EAAE,CAAA;QAC1E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEtB,MAAM,WAAW,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,CAAA;QAC1C,MAAM,IAAI,CAAC,CAAC,CAAA,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;QAEvC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;;AA/BO;IADP,KAAK,CAAC,OAAO,EAAE;;qCACM"}
@@ -0,0 +1,26 @@
1
+ import { EnvCommand } from '../lib/env_command.js';
2
+ export default class Ace extends EnvCommand {
3
+ static commandName = 'health';
4
+ async runInEnv(env) {
5
+ this.logger.info(`Running health check`);
6
+ const health = (await this
7
+ .$ilent `docker -c ${env.serverName} exec -t ${env.apiService} curl http://localhost/health`).json();
8
+ if (health.isHealthy)
9
+ this.logger.success('API is healthy');
10
+ else
11
+ this.logger.error('API is not healthy');
12
+ if (health.status === 'ok')
13
+ this.logger.success('API status is ok');
14
+ else if (health.status === 'warning')
15
+ this.logger.warning('API status is in warning');
16
+ else if (health.status === 'error')
17
+ this.logger.error('API status is in error');
18
+ if (['warning', 'error'].includes(health.status)) {
19
+ this.logger.info('Responsible checks');
20
+ health.checks
21
+ .filter((c) => c.status === health.status)
22
+ .map((c) => this.logger.info(JSON.stringify(c)));
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../../commands/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAOlD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,UAAU;IACzC,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;IAE7B,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;QACxC,MAAM,MAAM,GAAG,CACb,MAAM,IAAI;aACP,MAAM,CAAA,aAAa,GAAG,CAAC,UAAU,YAAY,GAAG,CAAC,UAAU,+BAA+B,CAC9F,CAAC,IAAI,EAAE,CAAA;QAER,IAAI,MAAM,CAAC,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;;YACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAE5C,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;YAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;aAC9D,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAA;aAChF,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAE/E,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;YACtC,MAAM,CAAC,MAAM;iBACV,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC;iBAC9C,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACzD,CAAC;IACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { EnvCommand } from '../lib/env_command.js';
2
+ export default class Logs extends EnvCommand {
3
+ static commandName = 'logs';
4
+ async runInEnv(env) {
5
+ const containers = (await this.$ilent `docker -c ${env.serverName} ps --format "{{.Names}}"`).lines();
6
+ const container = await this.prompt.choice('Which containers ?', containers);
7
+ if (container.length > 0)
8
+ await this.$ `docker -c ${env.serverName} logs --tail 100 -f ${container}`;
9
+ }
10
+ }
11
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGlD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,UAAU;IAC1C,MAAM,CAAC,WAAW,GAAG,MAAM,CAAA;IAE3B,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,MAAM,UAAU,GAAG,CACjB,MAAM,IAAI,CAAC,MAAM,CAAA,aAAa,GAAG,CAAC,UAAU,2BAA2B,CACxE,CAAC,KAAK,EAAE,CAAA;QACT,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAA;QAC5E,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;YACtB,MAAM,IAAI,CAAC,CAAC,CAAA,aAAa,GAAG,CAAC,UAAU,uBAAuB,SAAS,EAAE,CAAA;IAC7E,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Database } from '../config.js';
2
+ import { EnvCommand } from '../lib/env_command.js';
3
+ export default class SQL extends EnvCommand {
4
+ static commandName = 'sql';
5
+ async runInEnv(env) {
6
+ this.logger.info('Connecting to database...');
7
+ await this.$ `docker -c ${env.serverName} exec -it db psql -U postgres -d ${Database.name}`;
8
+ }
9
+ }
10
+ //# sourceMappingURL=sql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql.js","sourceRoot":"","sources":["../../commands/sql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGlD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,UAAU;IACzC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAA;IAE1B,KAAK,CAAC,QAAQ,CAAC,GAAgB;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;QAC7C,MAAM,IAAI,CAAC,CAAC,CAAA,aAAa,GAAG,CAAC,UAAU,oCAAoC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC5F,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { EnvCommand } from '../lib/env_command.js';
2
+ export default class Tests extends EnvCommand {
3
+ static commandName = 'tests';
4
+ macosContextName = 'desktop-linux';
5
+ async run() {
6
+ const localAnimation = this.logger.await('Retrieving local docker context');
7
+ localAnimation.start();
8
+ const contexts = (await this.$ilent `docker context ls --format "{{ .Name }}"`).lines();
9
+ const context = contexts.includes(this.macosContextName) ? this.macosContextName : 'default';
10
+ localAnimation.update('Retrived docker local context', {
11
+ suffix: context,
12
+ });
13
+ localAnimation.stop();
14
+ this.logger.info('Running tests in watch mode');
15
+ await this
16
+ .$ `doppler run -c test -- docker -c ${context} compose up --build --no-log-prefix api-test`;
17
+ }
18
+ }
19
+ //# sourceMappingURL=tests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tests.js","sourceRoot":"","sources":["../../commands/tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,UAAU;IAC3C,MAAM,CAAC,WAAW,GAAG,OAAO,CAAA;IAE5B,gBAAgB,GAAG,eAAe,CAAA;IAElC,KAAK,CAAC,GAAG;QAEP,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;QAC3E,cAAc,CAAC,KAAK,EAAE,CAAA;QACtB,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAA,0CAA0C,CAAC,CAAC,KAAK,EAAE,CAAA;QACtF,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAA;QAC5F,cAAc,CAAC,MAAM,CAAC,+BAA+B,EAAE;YACrD,MAAM,EAAE,OAAO;SAChB,CAAC,CAAA;QACF,cAAc,CAAC,IAAI,EAAE,CAAA;QAErB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA;QAC/C,MAAM,IAAI;aACP,CAAC,CAAA,oCAAoC,OAAO,8CAA8C,CAAA;IAC/F,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,11 @@
1
+ import { Environment } from './lib/environment.js';
2
+ export const Environments = [
3
+ new Environment('dev', 'libelaw-dev'),
4
+ new Environment('staging', 'libelaw-staging'),
5
+ new Environment('prod', 'libelaw-prod'),
6
+ new Environment('local', 'default'),
7
+ ];
8
+ export const Database = {
9
+ name: 'libelaw',
10
+ };
11
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC;IACrC,IAAI,WAAW,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAC7C,IAAI,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC;IACvC,IAAI,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC;CACpC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,SAAS;CAChB,CAAA"}
@@ -0,0 +1,40 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { BaseCommand, flags } from '@adonisjs/core/ace';
11
+ import { $ } from 'zx';
12
+ import { Environments } from '../config.js';
13
+ export class EnvCommand extends BaseCommand {
14
+ warnProd = true;
15
+ $ilent = $;
16
+ $ = $({
17
+ stdio: [process.stdin, process.stdout, process.stderr],
18
+ });
19
+ async run() {
20
+ const envName = this.env ??
21
+ (await this.prompt.choice('Which environment ?', Environments.map((e) => e.name)));
22
+ const env = Environments.find((e) => e.name === envName);
23
+ if (this.warnProd && env.name === 'prod') {
24
+ const confirmation = await this.prompt.confirm('You are about to run this command on production environment. Do you confirm ?', {
25
+ default: false,
26
+ });
27
+ if (!confirmation) {
28
+ this.logger.error('Did not confirm deployment');
29
+ return;
30
+ }
31
+ }
32
+ await this.runInEnv(env);
33
+ }
34
+ async runInEnv(_env) { }
35
+ }
36
+ __decorate([
37
+ flags.string({ required: false }),
38
+ __metadata("design:type", Object)
39
+ ], EnvCommand.prototype, "env", void 0);
40
+ //# sourceMappingURL=env_command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env_command.js","sourceRoot":"","sources":["../../lib/env_command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,CAAC,EAAE,MAAM,IAAI,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,MAAM,OAAO,UAAW,SAAQ,WAAW;IAIzC,QAAQ,GAAG,IAAI,CAAA;IACf,MAAM,GAAG,CAAC,CAAA;IACV,CAAC,GAAG,CAAC,CAAC;QACJ,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;KAEvD,CAAC,CAAA;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GACX,IAAI,CAAC,GAAG;YACR,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACvB,qBAAqB,EACrB,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAChC,CAAC,CAAA;QACJ,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAE,CAAA;QAEzD,IAAI,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAC5C,+EAA+E,EAC/E;gBACE,OAAO,EAAE,KAAK;aACf,CACF,CAAA;YACD,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;gBAC/C,OAAM;YACR,CAAC;QACH,CAAC;QACD,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAiB,IAAkB,CAAC;CACpD;AAlCS;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;uCACH"}
@@ -0,0 +1,11 @@
1
+ export class Environment {
2
+ name;
3
+ serverName;
4
+ apiService;
5
+ constructor(name, serverName, apiService = 'api') {
6
+ this.name = name;
7
+ this.serverName = serverName;
8
+ this.apiService = apiService;
9
+ }
10
+ }
11
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../lib/environment.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IAEb;IACA;IACA;IAHT,YACS,IAAY,EACZ,UAAkB,EAClB,aAAqB,KAAK;QAF1B,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAgB;IAChC,CAAC;CACL"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@akago/akago_backend_commands",
3
+ "version": "1.0.0",
4
+ "description": "Commands for Akago Backend",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "tag": "latest"
8
+ },
9
+ "scripts": {
10
+ "build": "rm -rf dist && mkdir dist && touch dist/ace.js && chmod +x dist/ace.js && tsc",
11
+ "build:watch": "rm -rf dist && mkdir dist && touch dist/ace.js && chmod +x dist/ace.js && tsc --watch"
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "bin": {
17
+ "akago": "./dist/ace.js",
18
+ "ak": "./dist/ace.js"
19
+ },
20
+ "keywords": [],
21
+ "author": "",
22
+ "license": "MIT",
23
+ "type": "module",
24
+ "dependencies": {
25
+ "@adonisjs/core": "^6.19.3",
26
+ "@adonisjs/tsconfig": "^1.4.1",
27
+ "@swc/core": "^1.15.10",
28
+ "reflect-metadata": "^0.2.2",
29
+ "zx": "^8.8.5"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^25.0.10",
33
+ "ts-node-maintained": "^10.9.6",
34
+ "typescript": "^5.9.3"
35
+ }
36
+ }