11import { CommandAzureGitlab } from '@/commands/externalCi/azure.js' ;
2+ import {
3+ CommandEnvs ,
4+ CommandGenerateEnvs ,
5+ } from '@/commands/externalCi/envs.js' ;
6+ import { Configuration } from '@/Configuration/index.js' ;
27import { AzureGitlabCIConf } from '@/Configuration/index.js' ;
38import { CommandModule , Options } from 'yargs' ;
49
@@ -7,31 +12,48 @@ export default {
712 describe :
813 'External continous integration generation commands. Azure Functions for now.' ,
914 builder : ( yargs ) => {
10- return yargs . command (
11- 'azure-gitlab' ,
12- 'Generate .gitlab-ci.yml file to deploy backend to Azure functions' ,
13- async ( yargs ) => {
14- yargs . options ( {
15- azureEnv : {
16- type : 'string' ,
17- describe : 'Comma separated environment variables names' ,
18- } ,
19- azureFnName : {
20- type : 'string' ,
21- describe : 'Globally unique name of azure service' ,
22- } ,
23- azureCors : {
24- type : 'string' ,
25- describe :
26- 'Space separated CORS addresses for production and staging' ,
27- } ,
28- } as {
29- [ P in keyof AzureGitlabCIConf ] : Options ;
30- } ) ;
31- } ,
32- async ( argv ) => {
33- await CommandAzureGitlab ( argv as any ) ;
34- } ,
35- ) ;
15+ return yargs
16+ . command (
17+ 'azure-gitlab' ,
18+ 'Generate .gitlab-ci.yml file to deploy backend to Azure functions' ,
19+ async ( yargs ) => {
20+ yargs . options ( {
21+ azureEnv : {
22+ type : 'string' ,
23+ describe : 'Comma separated environment variables names' ,
24+ } ,
25+ azureFnName : {
26+ type : 'string' ,
27+ describe : 'Globally unique name of azure service' ,
28+ } ,
29+ azureCors : {
30+ type : 'string' ,
31+ describe :
32+ 'Space separated CORS addresses for production and staging' ,
33+ } ,
34+ } as {
35+ [ P in keyof AzureGitlabCIConf ] : Options ;
36+ } ) ;
37+ } ,
38+ async ( argv ) => {
39+ await CommandAzureGitlab ( argv as any ) ;
40+ } ,
41+ )
42+ . command (
43+ 'env' ,
44+ `Inject envs from .env file to ${ Configuration . CONFIG_NAME } ` ,
45+ async ( yargs ) => { } ,
46+ async ( argv ) => {
47+ await CommandEnvs ( ) ;
48+ } ,
49+ )
50+ . command (
51+ 'env-generate' ,
52+ `Generate .env file from ${ Configuration . CONFIG_NAME } . Works idempotent. When you already have an .env file it adds missing keys ` ,
53+ async ( yargs ) => { } ,
54+ async ( argv ) => {
55+ await CommandGenerateEnvs ( ) ;
56+ } ,
57+ ) ;
3658 } ,
3759} as CommandModule ;
0 commit comments