@useparagon/cli 0.0.1-canary.1
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/dist/codegen/codegen.types.d.ts +9 -0
- package/dist/codegen/codegen.types.js +3 -0
- package/dist/codegen/codegen.types.js.map +1 -0
- package/dist/codegen/codegen.utils.d.ts +4 -0
- package/dist/codegen/codegen.utils.js +70 -0
- package/dist/codegen/codegen.utils.js.map +1 -0
- package/dist/codegen/codegens/condition.codegen.d.ts +2 -0
- package/dist/codegen/codegens/condition.codegen.js +28 -0
- package/dist/codegen/codegens/condition.codegen.js.map +1 -0
- package/dist/codegen/codegens/event.codegen.d.ts +2 -0
- package/dist/codegen/codegens/event.codegen.js +35 -0
- package/dist/codegen/codegens/event.codegen.js.map +1 -0
- package/dist/codegen/codegens/integration.codegen.d.ts +2 -0
- package/dist/codegen/codegens/integration.codegen.js +18 -0
- package/dist/codegen/codegens/integration.codegen.js.map +1 -0
- package/dist/codegen/codegens/source.codegen.d.ts +5 -0
- package/dist/codegen/codegens/source.codegen.js +104 -0
- package/dist/codegen/codegens/source.codegen.js.map +1 -0
- package/dist/codegen/codegens/workflow.codegen.d.ts +3 -0
- package/dist/codegen/codegens/workflow.codegen.js +278 -0
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -0
- package/dist/commands/build/build.action.d.ts +8 -0
- package/dist/commands/build/build.action.js +49 -0
- package/dist/commands/build/build.action.js.map +1 -0
- package/dist/commands/build/build.command.d.ts +8 -0
- package/dist/commands/build/build.command.js +27 -0
- package/dist/commands/build/build.command.js.map +1 -0
- package/dist/commands/build/build.types.d.ts +6 -0
- package/dist/commands/build/build.types.js +3 -0
- package/dist/commands/build/build.types.js.map +1 -0
- package/dist/commands/build/build.utils.d.ts +1 -0
- package/dist/commands/build/build.utils.js +17 -0
- package/dist/commands/build/build.utils.js.map +1 -0
- package/dist/commands/build/index.d.ts +1 -0
- package/dist/commands/build/index.js +5 -0
- package/dist/commands/build/index.js.map +1 -0
- package/dist/commands/command.interface.d.ts +7 -0
- package/dist/commands/command.interface.js +3 -0
- package/dist/commands/command.interface.js.map +1 -0
- package/dist/commands/command.loader.d.ts +5 -0
- package/dist/commands/command.loader.js +27 -0
- package/dist/commands/command.loader.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +6 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init/index.d.ts +1 -0
- package/dist/commands/init/index.js +5 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/init.action.d.ts +11 -0
- package/dist/commands/init/init.action.js +92 -0
- package/dist/commands/init/init.action.js.map +1 -0
- package/dist/commands/init/init.command.d.ts +8 -0
- package/dist/commands/init/init.command.js +27 -0
- package/dist/commands/init/init.command.js.map +1 -0
- package/dist/commands/init/init.constants.d.ts +1 -0
- package/dist/commands/init/init.constants.js +21 -0
- package/dist/commands/init/init.constants.js.map +1 -0
- package/dist/commands/init/init.types.d.ts +7 -0
- package/dist/commands/init/init.types.js +3 -0
- package/dist/commands/init/init.types.js.map +1 -0
- package/dist/commands/init/init.utils.d.ts +11 -0
- package/dist/commands/init/init.utils.js +50 -0
- package/dist/commands/init/init.utils.js.map +1 -0
- package/dist/commands/login/index.d.ts +1 -0
- package/dist/commands/login/index.js +5 -0
- package/dist/commands/login/index.js.map +1 -0
- package/dist/commands/login/login.command.d.ts +5 -0
- package/dist/commands/login/login.command.js +26 -0
- package/dist/commands/login/login.command.js.map +1 -0
- package/dist/commands/login/login.types.d.ts +3 -0
- package/dist/commands/login/login.types.js +3 -0
- package/dist/commands/login/login.types.js.map +1 -0
- package/dist/commands/login/login.utils.d.ts +2 -0
- package/dist/commands/login/login.utils.js +47 -0
- package/dist/commands/login/login.utils.js.map +1 -0
- package/dist/compilers/compiler.interface.d.ts +3 -0
- package/dist/compilers/compiler.interface.js +3 -0
- package/dist/compilers/compiler.interface.js.map +1 -0
- package/dist/compilers/compiler.types.d.ts +23 -0
- package/dist/compilers/compiler.types.js +3 -0
- package/dist/compilers/compiler.types.js.map +1 -0
- package/dist/compilers/compiler.utils.d.ts +2 -0
- package/dist/compilers/compiler.utils.js +25 -0
- package/dist/compilers/compiler.utils.js.map +1 -0
- package/dist/compilers/event.compiler.d.ts +7 -0
- package/dist/compilers/event.compiler.js +25 -0
- package/dist/compilers/event.compiler.js.map +1 -0
- package/dist/compilers/integration.compiler.d.ts +9 -0
- package/dist/compilers/integration.compiler.js +55 -0
- package/dist/compilers/integration.compiler.js.map +1 -0
- package/dist/compilers/project.compiler.d.ts +10 -0
- package/dist/compilers/project.compiler.js +50 -0
- package/dist/compilers/project.compiler.js.map +1 -0
- package/dist/compilers/ts.compiler.d.ts +11 -0
- package/dist/compilers/ts.compiler.js +70 -0
- package/dist/compilers/ts.compiler.js.map +1 -0
- package/dist/compilers/workflow.compiler.d.ts +10 -0
- package/dist/compilers/workflow.compiler.js +36 -0
- package/dist/compilers/workflow.compiler.js.map +1 -0
- package/dist/config/config.constants.d.ts +4 -0
- package/dist/config/config.constants.js +12 -0
- package/dist/config/config.constants.js.map +1 -0
- package/dist/config/config.types.d.ts +31 -0
- package/dist/config/config.types.js +18 -0
- package/dist/config/config.types.js.map +1 -0
- package/dist/config/config.utils.d.ts +9 -0
- package/dist/config/config.utils.js +136 -0
- package/dist/config/config.utils.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/helpers/constants.d.ts +2 -0
- package/dist/helpers/constants.js +6 -0
- package/dist/helpers/constants.js.map +1 -0
- package/dist/helpers/json.d.ts +1 -0
- package/dist/helpers/json.js +8 -0
- package/dist/helpers/json.js.map +1 -0
- package/dist/helpers/spinners.d.ts +3 -0
- package/dist/helpers/spinners.js +6 -0
- package/dist/helpers/spinners.js.map +1 -0
- package/dist/helpers/strings.d.ts +1 -0
- package/dist/helpers/strings.js +8 -0
- package/dist/helpers/strings.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/index.d.ts +1 -0
- package/dist/logger/index.js +9 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.d.ts +3 -0
- package/dist/logger/logger.js +50 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/logger/logger.type.d.ts +8 -0
- package/dist/logger/logger.type.js +3 -0
- package/dist/logger/logger.type.js.map +1 -0
- package/dist/templates/configurations/javascript/.prettierignore +2 -0
- package/dist/templates/configurations/javascript/.prettierrc +11 -0
- package/dist/templates/configurations/typescript/.prettierignore +2 -0
- package/dist/templates/configurations/typescript/.prettierrc +19 -0
- package/dist/templates/javascript/src/events/hello-world.js +13 -0
- package/dist/templates/javascript/src/integrations/slack/config.js +11 -0
- package/dist/templates/javascript/src/integrations/slack/workflows/example-workflow.js +30 -0
- package/dist/templates/typescript/src/events/hello-world.ts +21 -0
- package/dist/templates/typescript/src/integrations/slack/config.ts +18 -0
- package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +30 -0
- package/dist/templates/typescript/tsconfig.json +31 -0
- package/package.json +56 -0
- package/paragon.json +3 -0
- package/sample/sample.js +404 -0
- package/src/codegen/codegen.types.ts +14 -0
- package/src/codegen/codegen.utils.ts +145 -0
- package/src/codegen/codegens/condition.codegen.ts +49 -0
- package/src/codegen/codegens/event.codegen.ts +39 -0
- package/src/codegen/codegens/integration.codegen.ts +23 -0
- package/src/codegen/codegens/source.codegen.ts +193 -0
- package/src/codegen/codegens/workflow.codegen.ts +495 -0
- package/src/commands/build/build.action.ts +73 -0
- package/src/commands/build/build.command.ts +61 -0
- package/src/commands/build/build.types.ts +7 -0
- package/src/commands/build/build.utils.ts +21 -0
- package/src/commands/build/index.ts +1 -0
- package/src/commands/command.interface.ts +22 -0
- package/src/commands/command.loader.ts +33 -0
- package/src/commands/index.ts +2 -0
- package/src/commands/init/index.ts +1 -0
- package/src/commands/init/init.action.ts +166 -0
- package/src/commands/init/init.command.ts +71 -0
- package/src/commands/init/init.constants.ts +29 -0
- package/src/commands/init/init.types.ts +8 -0
- package/src/commands/init/init.utils.ts +91 -0
- package/src/commands/login/index.ts +1 -0
- package/src/commands/login/login.command.ts +48 -0
- package/src/commands/login/login.types.ts +9 -0
- package/src/commands/login/login.utils.ts +68 -0
- package/src/compilers/compiler.interface.ts +9 -0
- package/src/compilers/compiler.types.ts +52 -0
- package/src/compilers/compiler.utils.ts +32 -0
- package/src/compilers/event.compiler.ts +33 -0
- package/src/compilers/integration.compiler.ts +84 -0
- package/src/compilers/project.compiler.ts +86 -0
- package/src/compilers/ts.compiler.ts +116 -0
- package/src/compilers/workflow.compiler.ts +69 -0
- package/src/config/config.constants.ts +27 -0
- package/src/config/config.types.ts +112 -0
- package/src/config/config.utils.ts +251 -0
- package/src/config/index.ts +2 -0
- package/src/helpers/constants.ts +9 -0
- package/src/helpers/json.ts +8 -0
- package/src/helpers/spinners.ts +3 -0
- package/src/helpers/strings.ts +9 -0
- package/src/index.ts +26 -0
- package/src/logger/index.ts +1 -0
- package/src/logger/logger.ts +97 -0
- package/src/logger/logger.type.ts +8 -0
- package/templates/configurations/javascript/.prettierignore +2 -0
- package/templates/configurations/javascript/.prettierrc +11 -0
- package/templates/configurations/typescript/.prettierignore +2 -0
- package/templates/configurations/typescript/.prettierrc +19 -0
- package/templates/javascript/src/events/hello-world.js +13 -0
- package/templates/javascript/src/integrations/slack/config.js +11 -0
- package/templates/javascript/src/integrations/slack/workflows/example-workflow.js +30 -0
- package/templates/typescript/src/events/hello-world.ts +21 -0
- package/templates/typescript/src/integrations/slack/config.ts +18 -0
- package/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +30 -0
- package/templates/typescript/tsconfig.json +31 -0
- package/tsconfig.json +13 -0
- package/tsconfig.release.json +13 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
|
+
const rimraf_1 = tslib_1.__importDefault(require("rimraf"));
|
|
8
|
+
const ts_compiler_1 = tslib_1.__importDefault(require("../../compilers/ts.compiler"));
|
|
9
|
+
const project_compiler_1 = require("../../compilers/project.compiler");
|
|
10
|
+
const build_utils_1 = require("./build.utils");
|
|
11
|
+
const spinners_1 = tslib_1.__importDefault(require("../../helpers/spinners"));
|
|
12
|
+
class BuildAction {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.projectCompiler = new project_compiler_1.ProjectCompiler();
|
|
15
|
+
}
|
|
16
|
+
handle(options) {
|
|
17
|
+
var _a;
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
if (options.language === 'typescript') {
|
|
20
|
+
yield (0, build_utils_1.getProjectRoot)('ts');
|
|
21
|
+
spinners_1.default.add('build-typescript', {
|
|
22
|
+
text: 'Building Typescript project...',
|
|
23
|
+
});
|
|
24
|
+
ts_compiler_1.default.run({ configPath: options.path });
|
|
25
|
+
spinners_1.default.succeed('build-typescript', {
|
|
26
|
+
text: 'Typescript project successfully built.',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const projectRoot = yield (0, build_utils_1.getProjectRoot)();
|
|
30
|
+
const output = yield this.projectCompiler.compile({
|
|
31
|
+
projectRoot,
|
|
32
|
+
integrations: (_a = options.integration) !== null && _a !== void 0 ? _a : [],
|
|
33
|
+
});
|
|
34
|
+
const outputFileName = `${Date.now()}-build.json`;
|
|
35
|
+
spinners_1.default.add('writing-output', {
|
|
36
|
+
text: `Writiing build in ./out/${outputFileName} file.`,
|
|
37
|
+
});
|
|
38
|
+
const outputPath = path_1.default.join(process.cwd(), 'out');
|
|
39
|
+
yield (0, rimraf_1.default)(outputPath);
|
|
40
|
+
yield fs_1.default.promises.mkdir(outputPath);
|
|
41
|
+
yield fs_1.default.promises.writeFile(path_1.default.resolve(outputPath, outputFileName), JSON.stringify(output, null, 2));
|
|
42
|
+
spinners_1.default.succeed('writing-output', {
|
|
43
|
+
text: `Created build in ./out/${outputFileName} file.`,
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BuildAction = BuildAction;
|
|
49
|
+
//# sourceMappingURL=build.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.action.js","sourceRoot":"","sources":["../../../src/commands/build/build.action.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,oDAAoB;AACpB,4DAA4B;AAG5B,sFAAqD;AACrD,uEAAmE;AAGnE,+CAA+C;AAE/C,8EAA8C;AAK9C,MAAa,WAAW;IAGtB;QACE,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAe,EAAE,CAAC;IAC/C,CAAC;IAKK,MAAM,CAAC,OAA4B;;;YAEvC,IAAI,OAAO,CAAC,QAAQ,KAAK,YAAY,EAAE;gBAGrC,MAAM,IAAA,4BAAc,EAAC,IAAI,CAAC,CAAC;gBAE3B,kBAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE;oBAC/B,IAAI,EAAE,gCAAgC;iBACvC,CAAC,CAAC;gBAEH,qBAAU,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;gBAE7C,kBAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE;oBACnC,IAAI,EAAE,wCAAwC;iBAC/C,CAAC,CAAC;aACJ;YAED,MAAM,WAAW,GAAW,MAAM,IAAA,4BAAc,GAAE,CAAC;YAEnD,MAAM,MAAM,GAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;gBAC7D,WAAW;gBACX,YAAY,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,EAAE;aACxC,CAAC,CAAC;YAEH,MAAM,cAAc,GAAW,GAAG,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;YAE1D,kBAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE;gBAC7B,IAAI,EAAE,2BAA2B,cAAc,QAAQ;aACxD,CAAC,CAAC;YAEH,MAAM,UAAU,GAAW,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;YAG3D,MAAM,IAAA,gBAAM,EAAC,UAAU,CAAC,CAAC;YACzB,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAEpC,MAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,cAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,EACxC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAChC,CAAC;YAEF,kBAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE;gBACjC,IAAI,EAAE,0BAA0B,cAAc,QAAQ;aACvD,CAAC,CAAC;;KACJ;CACF;AAxDD,kCAwDC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const build_action_1 = require("./build.action");
|
|
6
|
+
class BuildCommand {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.actionHandler = new build_action_1.BuildAction();
|
|
9
|
+
}
|
|
10
|
+
load(program) {
|
|
11
|
+
program
|
|
12
|
+
.command('build')
|
|
13
|
+
.description('Build project')
|
|
14
|
+
.option('--integration <integration...>', 'Build only specified integration')
|
|
15
|
+
.option('-p, --path [path]', 'Path to tsconfig file.')
|
|
16
|
+
.option('-l,--language [language]', 'Programming language to be used (TypeScript or JavaScript).', 'typescript')
|
|
17
|
+
.action((rawOptions) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const options = this.sanitizeOptions(rawOptions);
|
|
19
|
+
return this.actionHandler.handle(options);
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
sanitizeOptions(rawOptions) {
|
|
23
|
+
return rawOptions;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.BuildCommand = BuildCommand;
|
|
27
|
+
//# sourceMappingURL=build.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.command.js","sourceRoot":"","sources":["../../../src/commands/build/build.command.ts"],"names":[],"mappings":";;;;AAMA,iDAA6C;AAK7C,MAAa,YAAY;IAGvB;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,0BAAW,EAAE,CAAC;IACzC,CAAC;IAKD,IAAI,CAAC,OAAgB;QACnB,OAAO;aACJ,OAAO,CAAC,OAAO,CAAC;aAChB,WAAW,CAAC,eAAe,CAAC;aAC5B,MAAM,CACL,gCAAgC,EAChC,kCAAkC,CACnC;aACA,MAAM,CAAC,mBAAmB,EAAE,wBAAwB,CAAC;aASrD,MAAM,CACL,0BAA0B,EAC1B,6DAA6D,EAC7D,YAAY,CACb;aACA,MAAM,CAAC,CAAO,UAA+B,EAAE,EAAE;YAChD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAEjD,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;IAOO,eAAe,CACrB,UAA+B;QAE/B,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAjDD,oCAiDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.types.js","sourceRoot":"","sources":["../../../src/commands/build/build.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProjectRoot: (extension?: 'js' | 'ts') => Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectRoot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const glob_1 = require("glob");
|
|
6
|
+
const getProjectRoot = (extension = 'js') => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const integrationPaths = yield (0, glob_1.glob)(`${process.cwd()}/**/integrations/*/config.${extension}`, {
|
|
8
|
+
nodir: true,
|
|
9
|
+
});
|
|
10
|
+
if (!integrationPaths.length) {
|
|
11
|
+
throw new Error('');
|
|
12
|
+
}
|
|
13
|
+
const projectRoot = integrationPaths[0].split('/integrations/')[0];
|
|
14
|
+
return projectRoot;
|
|
15
|
+
});
|
|
16
|
+
exports.getProjectRoot = getProjectRoot;
|
|
17
|
+
//# sourceMappingURL=build.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.utils.js","sourceRoot":"","sources":["../../../src/commands/build/build.utils.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAMrB,MAAM,cAAc,GAAG,CAAO,YAAyB,IAAI,EAAE,EAAE;IACpE,MAAM,gBAAgB,GAAa,MAAM,IAAA,WAAI,EAC3C,GAAG,OAAO,CAAC,GAAG,EAAE,6BAA6B,SAAS,EAAE,EACxD;QACE,KAAK,EAAE,IAAI;KACZ,CACF,CAAC;IAEF,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;KACrB;IAED,MAAM,WAAW,GAAW,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,WAAW,CAAC;AACrB,CAAC,CAAA,CAAC;AAdW,QAAA,cAAc,kBAczB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './build.command';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.interface.js","sourceRoot":"","sources":["../../src/commands/command.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandLoader = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const build_1 = require("./build");
|
|
6
|
+
const login_1 = require("./login");
|
|
7
|
+
const init_1 = require("./init");
|
|
8
|
+
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
9
|
+
class CommandLoader {
|
|
10
|
+
static load(program) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
new build_1.BuildCommand().load(program);
|
|
13
|
+
new login_1.LoginCommand().load(program);
|
|
14
|
+
new init_1.InitCommand().load(program);
|
|
15
|
+
this.handleInvalidCommand(program);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
static handleInvalidCommand(program) {
|
|
19
|
+
program.on('command:*', () => {
|
|
20
|
+
logger_1.default.error(`Invalid command: '%s'`, program.args.join(' '));
|
|
21
|
+
logger_1.default.info(`See '--help' for a list of available commands.\n`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CommandLoader = CommandLoader;
|
|
27
|
+
//# sourceMappingURL=command.loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.loader.js","sourceRoot":"","sources":["../../src/commands/command.loader.ts"],"names":[],"mappings":";;;;AAEA,mCAAuC;AACvC,mCAAuC;AACvC,iCAAqC;AAErC,+DAA+B;AAE/B,MAAa,aAAa;IAKjB,MAAM,CAAO,IAAI,CAAC,OAAgB;;YACvC,IAAI,oBAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACjC,IAAI,oBAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACjC,IAAI,kBAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;KAAA;IAEO,MAAM,CAAC,oBAAoB,CAAC,OAAgB;QAClD,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;YAC3B,gBAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9D,gBAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApBD,sCAoBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./login/login.command"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./build/build.command"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,gEAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './init.command';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ProjectCompiler } from '../../compilers/project.compiler';
|
|
2
|
+
import { IAction } from '../command.interface';
|
|
3
|
+
import { InitCommandOptions } from './init.types';
|
|
4
|
+
export declare class InitAction implements IAction<InitCommandOptions, void> {
|
|
5
|
+
projectCompiler: ProjectCompiler;
|
|
6
|
+
constructor();
|
|
7
|
+
handle(options: InitCommandOptions): Promise<void>;
|
|
8
|
+
private initExistingProject;
|
|
9
|
+
private initTemplate;
|
|
10
|
+
private installDependencies;
|
|
11
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InitAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const prompts_1 = tslib_1.__importDefault(require("prompts"));
|
|
8
|
+
const codegen_utils_1 = require("../../codegen/codegen.utils");
|
|
9
|
+
const project_compiler_1 = require("../../compilers/project.compiler");
|
|
10
|
+
const spinners_1 = tslib_1.__importDefault(require("../../helpers/spinners"));
|
|
11
|
+
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
12
|
+
const init_constants_1 = require("./init.constants");
|
|
13
|
+
const init_utils_1 = require("./init.utils");
|
|
14
|
+
class InitAction {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.projectCompiler = new project_compiler_1.ProjectCompiler();
|
|
17
|
+
}
|
|
18
|
+
handle(options) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (options.createFromExisting) {
|
|
21
|
+
yield this.initExistingProject(options);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
yield this.initTemplate(options);
|
|
25
|
+
}
|
|
26
|
+
logger_1.default.success('Created new project.');
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
initExistingProject(options) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
spinners_1.default.add('get-projects', { text: 'Fetching projects...' });
|
|
32
|
+
yield (0, init_utils_1.sleep)(3);
|
|
33
|
+
spinners_1.default.succeed('get-projects', { text: 'Fetched projects' });
|
|
34
|
+
const projects = [
|
|
35
|
+
{ title: 'project-1', value: 'project-1' },
|
|
36
|
+
{ title: 'project-2', value: 'project-2' },
|
|
37
|
+
{ title: 'project-3', value: 'project-3' },
|
|
38
|
+
];
|
|
39
|
+
const { projectId } = yield (0, prompts_1.default)({
|
|
40
|
+
type: 'select',
|
|
41
|
+
name: 'projectId',
|
|
42
|
+
message: 'Select project',
|
|
43
|
+
choices: projects,
|
|
44
|
+
});
|
|
45
|
+
const projectName = (0, init_utils_1.sanitizeAppName)(projects.find(({ value }) => value === projectId).title);
|
|
46
|
+
const projectRoot = path_1.default.join(process.cwd(), projectName);
|
|
47
|
+
const projectSrcPath = path_1.default.join(projectRoot, 'src');
|
|
48
|
+
spinners_1.default.add('fetch-project-data', {
|
|
49
|
+
text: 'Fetching integrations...',
|
|
50
|
+
});
|
|
51
|
+
yield (0, init_utils_1.sleep)(3);
|
|
52
|
+
spinners_1.default.succeed('fetch-project-data', {
|
|
53
|
+
text: 'Fetched integrations',
|
|
54
|
+
});
|
|
55
|
+
const json = require(path_1.default.join(__dirname, '../../..', 'sample/sample.js')).samplebuild;
|
|
56
|
+
spinners_1.default.add('build-project', { text: 'Building Project...' });
|
|
57
|
+
yield (0, codegen_utils_1.generateProjectFiles)(json, projectSrcPath);
|
|
58
|
+
spinners_1.default.succeed('build-project', { text: 'Built Project' });
|
|
59
|
+
yield this.installDependencies(projectRoot, options);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
initTemplate(options) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const projectRoot = path_1.default
|
|
65
|
+
.resolve(options.extraArgs.slice(1).join(''))
|
|
66
|
+
.trim();
|
|
67
|
+
yield fs_extra_1.default.promises.mkdir(projectRoot, { recursive: true });
|
|
68
|
+
const templatePath = path_1.default.resolve(__dirname, `../../templates/${options.language}`);
|
|
69
|
+
yield fs_extra_1.default.copy(templatePath, projectRoot);
|
|
70
|
+
yield this.installDependencies(projectRoot, options);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
installDependencies(projectRoot, options) {
|
|
74
|
+
var _a;
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const projectName = (0, init_utils_1.sanitizeAppName)(path_1.default.basename(projectRoot));
|
|
77
|
+
const packageManager = (_a = options.packageManager) !== null && _a !== void 0 ? _a : (0, init_utils_1.getPkgManager)();
|
|
78
|
+
const defaultConfigPath = path_1.default.resolve(__dirname, `../../templates/configurations/${options.language}`);
|
|
79
|
+
yield fs_extra_1.default.copy(defaultConfigPath, projectRoot);
|
|
80
|
+
const packageJson = Object.assign({}, init_constants_1.defaultPackageJson);
|
|
81
|
+
packageJson.name = projectName;
|
|
82
|
+
if (options.language === 'typescript') {
|
|
83
|
+
packageJson.dependencies = Object.assign(Object.assign({}, packageJson.dependencies), { tslib: '2.3.1' });
|
|
84
|
+
packageJson.devDependencies = Object.assign(Object.assign({}, packageJson.devDependencies), { typescript: '^4.4.4', '@types/node': '^18.13.0' });
|
|
85
|
+
}
|
|
86
|
+
yield fs_extra_1.default.promises.writeFile(path_1.default.join(projectRoot, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
87
|
+
yield (0, init_utils_1.spawnAsync)(packageManager, ['install'], projectRoot);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.InitAction = InitAction;
|
|
92
|
+
//# sourceMappingURL=init.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.action.js","sourceRoot":"","sources":["../../../src/commands/init/init.action.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,wDAAwB;AACxB,8DAA8B;AAE9B,+DAAmE;AAEnE,uEAAmE;AAEnE,8EAA8C;AAC9C,k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
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InitCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const init_action_1 = require("./init.action");
|
|
6
|
+
class InitCommand {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.actionHandler = new init_action_1.InitAction();
|
|
9
|
+
}
|
|
10
|
+
load(program) {
|
|
11
|
+
program
|
|
12
|
+
.command('init')
|
|
13
|
+
.description('Initialize paragon project')
|
|
14
|
+
.option('--create-from-existing', 'Create from existing project.', false)
|
|
15
|
+
.option('-l,--language [language]', 'Programming language to be used (TypeScript or JavaScript).', 'typescript')
|
|
16
|
+
.option('-p, --package-manager [packageManager]', 'Specify package manager.')
|
|
17
|
+
.action((rawOptions) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const options = this.sanitizeOptions(rawOptions);
|
|
19
|
+
return this.actionHandler.handle(Object.assign(Object.assign({}, options), { extraArgs: program.args }));
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
sanitizeOptions(rawOptions) {
|
|
23
|
+
return rawOptions;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.InitCommand = InitCommand;
|
|
27
|
+
//# sourceMappingURL=init.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.command.js","sourceRoot":"","sources":["../../../src/commands/init/init.command.ts"],"names":[],"mappings":";;;;AASA,+CAA2C;AAK3C,MAAa,WAAW;IAGtB;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,wBAAU,EAAE,CAAC;IACxC,CAAC;IAKD,IAAI,CAAC,OAAgB;QACnB,OAAO;aACJ,OAAO,CAAC,MAAM,CAAC;aACf,WAAW,CAAC,4BAA4B,CAAC;aACzC,MAAM,CAAC,wBAAwB,EAAE,+BAA+B,EAAE,KAAK,CAAC;aASxE,MAAM,CACL,0BAA0B,EAC1B,6DAA6D,EAC7D,YAAY,CACb;aAOA,MAAM,CACL,wCAAwC,EACxC,0BAA0B,CAC3B;aACA,MAAM,CAAC,CAAO,UAA8B,EAAE,EAAE;YAC/C,MAAM,OAAO,GAAuB,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAErE,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,iCAC3B,OAAO,KACV,SAAS,EAAE,OAAO,CAAC,IAAI,IACvB,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;IAOO,eAAe,CAAC,UAA8B;QACpD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAxDD,kCAwDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultPackageJson: Record<string, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultPackageJson = void 0;
|
|
4
|
+
exports.defaultPackageJson = {
|
|
5
|
+
name: 'default-package.json',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
private: true,
|
|
8
|
+
engines: {
|
|
9
|
+
node: '>=14.17',
|
|
10
|
+
},
|
|
11
|
+
scripts: {
|
|
12
|
+
build: 'para build',
|
|
13
|
+
},
|
|
14
|
+
dependencies: {},
|
|
15
|
+
devDependencies: {
|
|
16
|
+
'@trivago/prettier-plugin-sort-imports': '^4.2.0',
|
|
17
|
+
prettier: '^2.2.1',
|
|
18
|
+
'prettier-plugin-organize-imports': '^3.2.3',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=init.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.constants.js","sourceRoot":"","sources":["../../../src/commands/init/init.constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,kBAAkB,GAAwB;IACrD,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;KAChB;IACD,OAAO,EAAE;QACP,KAAK,EAAE,YAAY;KACpB;IAID,YAAY,EAAE,EAGb;IAID,eAAe,EAAE;QACf,uCAAuC,EAAE,QAAQ;QACjD,QAAQ,EAAE,QAAQ;QAClB,kCAAkC,EAAE,QAAQ;KAC7C;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.types.js","sourceRoot":"","sources":["../../../src/commands/init/init.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KNOWN_PACKAGE_MANAGERS } from './../../helpers/constants';
|
|
2
|
+
export declare function getPkgManager(): (typeof KNOWN_PACKAGE_MANAGERS)[number];
|
|
3
|
+
export type GenericResolve<T = any> = {
|
|
4
|
+
(value?: T): void;
|
|
5
|
+
};
|
|
6
|
+
export type GenericReject<T = Error> = {
|
|
7
|
+
(error: T): void;
|
|
8
|
+
};
|
|
9
|
+
export declare function spawnAsync(command: string, args: string[], path: string): Promise<number>;
|
|
10
|
+
export declare const sanitizeAppName: (appName: string) => string;
|
|
11
|
+
export declare const sleep: (seconds: number) => Promise<void>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sleep = exports.sanitizeAppName = exports.spawnAsync = exports.getPkgManager = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
function getPkgManager() {
|
|
6
|
+
const userAgent = process.env.npm_config_user_agent || '';
|
|
7
|
+
if (userAgent.startsWith('yarn')) {
|
|
8
|
+
return 'yarn';
|
|
9
|
+
}
|
|
10
|
+
if (userAgent.startsWith('pnpm')) {
|
|
11
|
+
return 'pnpm';
|
|
12
|
+
}
|
|
13
|
+
if (userAgent.startsWith('bun')) {
|
|
14
|
+
return 'bun';
|
|
15
|
+
}
|
|
16
|
+
return 'npm';
|
|
17
|
+
}
|
|
18
|
+
exports.getPkgManager = getPkgManager;
|
|
19
|
+
function spawnAsync(command, args, path) {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const childProcess = (0, child_process_1.spawn)(command, args, {
|
|
22
|
+
stdio: 'inherit',
|
|
23
|
+
env: {},
|
|
24
|
+
cwd: path,
|
|
25
|
+
});
|
|
26
|
+
childProcess.on('exit', (code) => {
|
|
27
|
+
if (code !== 0) {
|
|
28
|
+
return reject(new Error(`Failed command '${command} ${args.join(' ')}' with exit code ${code}`));
|
|
29
|
+
}
|
|
30
|
+
return resolve(code);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.spawnAsync = spawnAsync;
|
|
35
|
+
const sanitizeAppName = (appName) => {
|
|
36
|
+
return appName
|
|
37
|
+
.replace(/([a-z\d])([A-Z])/g, '$1-$2')
|
|
38
|
+
.toLowerCase()
|
|
39
|
+
.replace(/\s/g, '-');
|
|
40
|
+
};
|
|
41
|
+
exports.sanitizeAppName = sanitizeAppName;
|
|
42
|
+
const sleep = (seconds) => {
|
|
43
|
+
return new Promise((res, _rej) => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
res();
|
|
46
|
+
}, seconds * 1000);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.sleep = sleep;
|
|
50
|
+
//# sourceMappingURL=init.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.utils.js","sourceRoot":"","sources":["../../../src/commands/init/init.utils.ts"],"names":[],"mappings":";;;AAAA,iDAAoD;AAOpD,SAAgB,aAAa;IAC3B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC;IAE1D,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,MAAM,CAAC;KACf;IAED,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,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CAAC,CAAC;AACL,CAAC,CAAC;AANW,QAAA,KAAK,SAMhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './login.command';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/login/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const config_1 = require("../../config");
|
|
6
|
+
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
7
|
+
const login_utils_1 = require("./login.utils");
|
|
8
|
+
class LoginCommand {
|
|
9
|
+
load(program) {
|
|
10
|
+
program
|
|
11
|
+
.command('login')
|
|
12
|
+
.description('Login to Paragon.')
|
|
13
|
+
.option('--username [username]', 'Email to login with', process.env.AUTH_USERNAME)
|
|
14
|
+
.option('--password [password]', 'Password to login with', process.env.AUTH_PASSWORD)
|
|
15
|
+
.action((_options) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
logger_1.default.info('Logging in...');
|
|
17
|
+
const config = yield (0, config_1.loadProjectConfig)();
|
|
18
|
+
const profile = yield (0, config_1.loadProfile)(config);
|
|
19
|
+
const auth = yield (0, config_1.loadAuthForProfile)(config);
|
|
20
|
+
const authWithToken = yield (0, login_utils_1.login)(auth, profile);
|
|
21
|
+
yield (0, config_1.updateAuthForProfile)(authWithToken, config);
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.LoginCommand = LoginCommand;
|
|
26
|
+
//# sourceMappingURL=login.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.command.js","sourceRoot":"","sources":["../../../src/commands/login/login.command.ts"],"names":[],"mappings":";;;;AAEA,yCASsB;AACtB,kEAAkC;AAGlC,+CAAsC;AAKtC,MAAa,YAAY;IAIvB,IAAI,CAAC,OAAgB;QACnB,OAAO;aACJ,OAAO,CAAC,OAAO,CAAC;aAChB,WAAW,CAAC,mBAAmB,CAAC;aAChC,MAAM,CACL,uBAAuB,EACvB,qBAAqB,EACrB,OAAO,CAAC,GAAG,CAAC,aAAa,CAC1B;aACA,MAAM,CACL,uBAAuB,EACvB,wBAAwB,EACxB,OAAO,CAAC,GAAG,CAAC,aAAa,CAC1B;aACA,MAAM,CAAC,CAAO,QAAa,EAAE,EAAE;YAC9B,gBAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC7B,MAAM,MAAM,GAAmB,MAAM,IAAA,0BAAiB,GAAE,CAAC;YACzD,MAAM,OAAO,GAAa,MAAM,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;YACpD,MAAM,IAAI,GAAU,MAAM,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;YACrD,MAAM,aAAa,GAAiB,MAAM,IAAA,mBAAK,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC/D,MAAM,IAAA,6BAAoB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACF;AA3BD,oCA2BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.types.js","sourceRoot":"","sources":["../../../src/commands/login/login.types.ts"],"names":[],"mappings":""}
|