@quadnix/octo-build 0.0.4 → 0.0.6
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/README.md +4 -2
- package/dist/commands/build/build.command.d.ts +14 -0
- package/dist/commands/build/build.command.js +104 -0
- package/dist/commands/build/build.command.js.map +1 -0
- package/dist/commands/build/index.d.ts +1 -0
- package/dist/commands/build/index.js +2 -0
- package/dist/commands/build/index.js.map +1 -0
- package/dist/{main.d.ts → commands/build/main.d.ts} +3 -4
- package/dist/{main.js → commands/build/main.js} +3 -4
- package/dist/commands/build/main.js.map +1 -0
- package/dist/commands/build/models/build-configuration.interface.js.map +1 -0
- package/dist/commands/build/models/run-arguments.interface.js.map +1 -0
- package/dist/{parsers → commands/build/parsers}/build-file.parser.d.ts +1 -1
- package/dist/commands/build/parsers/build-file.parser.js.map +1 -0
- package/dist/{streams → commands/build/streams}/stream-manager.d.ts +1 -2
- package/dist/{streams → commands/build/streams}/stream-manager.js +10 -8
- package/dist/commands/build/streams/stream-manager.js.map +1 -0
- package/dist/commands/create/create.command.d.ts +11 -0
- package/dist/commands/create/create.command.js +51 -0
- package/dist/commands/create/create.command.js.map +1 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/index.d.ts +10 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/index.js +117 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/index.js.map +1 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/README.md.ejs +20 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/eslint.config.js.ejs +130 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/gitignore.ejs +82 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/package.json.ejs +54 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/prettierrc.ejs +5 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/app.config.ts.ejs +23 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/env.ejs +2 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/main.ts.ejs +22 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/module-definitions.ts.ejs +202 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo/gitkeep.ejs +0 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/app.config.ts.ejs +25 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/env.ejs +5 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/main.ts.ejs +22 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/module-definitions.ts.ejs +52 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo/gitkeep.ejs +0 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/website/error.html.ejs +8 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/website/index.html.ejs +8 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/tsconfig.build.json.ejs +11 -0
- package/dist/commands/create/generator-octo-app-template/generators/app/templates/tsconfig.json.ejs +39 -0
- package/dist/commands/create/index.d.ts +1 -0
- package/dist/commands/create/index.js +2 -0
- package/dist/commands/create/index.js.map +1 -0
- package/dist/index.js +13 -92
- package/dist/index.js.map +1 -1
- package/dist/utilities/process/process.utility.d.ts +1 -2
- package/dist/utilities/process/process.utility.js.map +1 -1
- package/package.json +15 -12
- package/dist/main.js.map +0 -1
- package/dist/models/build-configuration.interface.js.map +0 -1
- package/dist/models/run-arguments.interface.js.map +0 -1
- package/dist/parsers/build-file.parser.js.map +0 -1
- package/dist/streams/stream-manager.js.map +0 -1
- package/dist/{models → commands/build/models}/build-configuration.interface.d.ts +7 -7
- /package/dist/{models → commands/build/models}/build-configuration.interface.js +0 -0
- /package/dist/{models → commands/build/models}/run-arguments.interface.d.ts +0 -0
- /package/dist/{models → commands/build/models}/run-arguments.interface.js +0 -0
- /package/dist/{parsers → commands/build/parsers}/build-file.parser.js +0 -0
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Octo
|
|
2
|
+
http://octo.quadnix.com/
|
|
3
|
+
|
|
2
4
|
The open-source infrastructure management and CICD tool.
|
|
3
5
|
|
|
4
6
|
> Disclaimer,
|
|
5
|
-
> This library is currently in
|
|
6
|
-
> We
|
|
7
|
+
> This library is still under development and is currently in version `0.x.x`.
|
|
8
|
+
> We plan to release version `1.x.x` when it is deemed ready for production use.
|
|
7
9
|
|
|
8
10
|
# Local Setup
|
|
9
11
|
> npm install
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
+
export declare const buildCommand: {
|
|
3
|
+
builder: (yargs: Argv) => Argv;
|
|
4
|
+
command: string;
|
|
5
|
+
describe: string;
|
|
6
|
+
handler: (argv: ArgumentsCamelCase<{
|
|
7
|
+
buildFilePath: string;
|
|
8
|
+
sourcePath: string;
|
|
9
|
+
concurrency: number;
|
|
10
|
+
dryRun: boolean;
|
|
11
|
+
logsDir: string;
|
|
12
|
+
timeout: number;
|
|
13
|
+
}>) => Promise<void>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { accessSync, constants, existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join, resolve, sep } from 'path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { load } from 'js-yaml';
|
|
5
|
+
import { Main } from './main.js';
|
|
6
|
+
import { BuildFileParser } from './parsers/build-file.parser.js';
|
|
7
|
+
export const buildCommand = {
|
|
8
|
+
builder: (yargs) => {
|
|
9
|
+
return yargs
|
|
10
|
+
.option('buildFilePath', {
|
|
11
|
+
alias: 'b',
|
|
12
|
+
default: 'build.yml',
|
|
13
|
+
description: 'The path to build file relative to sourcePath.',
|
|
14
|
+
type: 'string',
|
|
15
|
+
})
|
|
16
|
+
.option('sourcePath', {
|
|
17
|
+
alias: 's',
|
|
18
|
+
default: '.',
|
|
19
|
+
description: 'The path to the source of the project',
|
|
20
|
+
type: 'string',
|
|
21
|
+
})
|
|
22
|
+
.option('concurrency', {
|
|
23
|
+
alias: 'c',
|
|
24
|
+
default: 5,
|
|
25
|
+
description: 'The number of concurrent jobs to run.',
|
|
26
|
+
type: 'number',
|
|
27
|
+
})
|
|
28
|
+
.option('dryRun', {
|
|
29
|
+
default: false,
|
|
30
|
+
description: 'Runs the program without actually executing any of the jobs.',
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
})
|
|
33
|
+
.option('logsDir', {
|
|
34
|
+
default: 'false',
|
|
35
|
+
description: 'Enables writing logs to files in the specified directory.',
|
|
36
|
+
type: 'string',
|
|
37
|
+
})
|
|
38
|
+
.option('timeout', {
|
|
39
|
+
default: 0,
|
|
40
|
+
description: 'Defines the maximum amount of time (in minutes) this program can run.',
|
|
41
|
+
type: 'number',
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
command: 'build',
|
|
45
|
+
describe: 'Build a project using Octo build steps.',
|
|
46
|
+
handler: async (argv) => {
|
|
47
|
+
let { buildFilePath, sourcePath } = argv;
|
|
48
|
+
let logsDir = argv.logsDir;
|
|
49
|
+
const { concurrency, dryRun, timeout } = argv;
|
|
50
|
+
// Resolve file paths.
|
|
51
|
+
if (sourcePath.endsWith(sep)) {
|
|
52
|
+
sourcePath = sourcePath.substring(0, sourcePath.length - 1);
|
|
53
|
+
}
|
|
54
|
+
sourcePath = resolve(sourcePath);
|
|
55
|
+
if (buildFilePath.startsWith(sep)) {
|
|
56
|
+
buildFilePath = buildFilePath.substring(1);
|
|
57
|
+
}
|
|
58
|
+
buildFilePath = resolve(join(sourcePath, buildFilePath));
|
|
59
|
+
logsDir = !logsDir || logsDir.toLowerCase() === 'false' ? undefined : resolve(logsDir);
|
|
60
|
+
// Ensure build file exists.
|
|
61
|
+
if (!existsSync(buildFilePath)) {
|
|
62
|
+
console.log(chalk.red('Cannot find build file: ' + buildFilePath));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
// Ensure logsDir exists, and is writable.
|
|
66
|
+
try {
|
|
67
|
+
if (logsDir) {
|
|
68
|
+
accessSync(logsDir, constants.W_OK);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.log(chalk.red("Logs directory doesn't exist, or is not writable: " + logsDir));
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
// Prepare args.
|
|
76
|
+
const args = {
|
|
77
|
+
buildFilePath,
|
|
78
|
+
concurrency,
|
|
79
|
+
dryRun,
|
|
80
|
+
logsDir,
|
|
81
|
+
sourcePath,
|
|
82
|
+
timeout,
|
|
83
|
+
};
|
|
84
|
+
// Ensure build file can be loaded, and parsed.
|
|
85
|
+
let json;
|
|
86
|
+
try {
|
|
87
|
+
json = load(readFileSync(buildFilePath, 'utf-8'));
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.log(chalk.red('Unable to parse build file: ' + error.message));
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
const buildConfiguration = BuildFileParser.parse(json);
|
|
94
|
+
try {
|
|
95
|
+
const main = new Main(args, buildConfiguration);
|
|
96
|
+
await main.start();
|
|
97
|
+
console.log(chalk.green('Success'));
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.log(chalk.red(error));
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
//# 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":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MA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C,GAAG,CAAC,oDAAoD,GAAG,OAAO,CAAC,CAAC,CAAC;YACvF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,gBAAgB;QAChB,MAAM,IAAI,GAAkB;YAC1B,aAAa;YACb,WAAW;YACX,MAAM;YACN,OAAO;YACP,UAAU;YACV,OAAO;SACR,CAAC;QAEF,+CAA+C;QAC/C,IAAI,IAAa,CAAC;QAClB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,8BAA8B,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACvE,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,kBAAkB,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;YAChD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildCommand } from './build.command.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IRunArguments } from './models/run-arguments.interface.js';
|
|
1
|
+
import type { ChildProcessWithoutNullStreams } from 'child_process';
|
|
2
|
+
import type { IBuildConfiguration } from './models/build-configuration.interface.js';
|
|
3
|
+
import type { IRunArguments } from './models/run-arguments.interface.js';
|
|
5
4
|
export declare class Main {
|
|
6
5
|
private readonly args;
|
|
7
6
|
private readonly configuration;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { mkdirSync } from 'fs';
|
|
2
|
-
import pLimit from 'p-limit';
|
|
3
2
|
import { join, resolve } from 'path';
|
|
3
|
+
import pLimit from 'p-limit';
|
|
4
|
+
import { ProcessUtility } from '../../utilities/process/process.utility.js';
|
|
4
5
|
import { StreamManager } from './streams/stream-manager.js';
|
|
5
|
-
import { ProcessUtility } from './utilities/process/process.utility.js';
|
|
6
6
|
export class Main {
|
|
7
|
-
args;
|
|
8
|
-
configuration;
|
|
9
7
|
constructor(args, configuration) {
|
|
10
8
|
this.args = args;
|
|
11
9
|
this.configuration = configuration;
|
|
@@ -38,6 +36,7 @@ export class Main {
|
|
|
38
36
|
scheduleJobs() {
|
|
39
37
|
const streamManager = new StreamManager();
|
|
40
38
|
const timestamp = Date.now();
|
|
39
|
+
// Ensure logsDir exists, and is writable.
|
|
41
40
|
const logsPathPrefix = this.args.logsDir ? resolve(join(this.args.logsDir, `${timestamp}`)) : undefined;
|
|
42
41
|
if (logsPathPrefix) {
|
|
43
42
|
mkdirSync(logsPathPrefix, '0744');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/commands/build/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MA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T,IAAI,OAAO,EAAE,CAAC;oBACZ,YAAY,CAAC,OAAO,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-configuration.interface.js","sourceRoot":"","sources":["../../../../src/commands/build/models/build-configuration.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-arguments.interface.js","sourceRoot":"","sources":["../../../../src/commands/build/models/run-arguments.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-file.parser.js","sourceRoot":"","sources":["../../../../src/commands/build/parsers/build-file.parser.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAC,KAAK,CAAC,OAAY;QACvB,MAAM,IAAI,GAA4B,EAAE,CAAC;QACzC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;YACvD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAChE,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,GAAG;gBACd,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,EAAE;gBAC9B,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,OAAO;gBAC9C,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;gBAC7B,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;aAClC,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE;YACzB,GAAG,EACD,OAAO,EAAE,GAAG,EAAE,SAAS;gBACvB,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,QAAQ;gBACzC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC;gBAC3C,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS;gBACvB,CAAC,CAAC,EAAE;YACR,IAAI;SACL,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { ChildProcessWithoutNullStreams } from 'child_process';
|
|
1
|
+
import type { ChildProcessWithoutNullStreams } from 'child_process';
|
|
3
2
|
export declare class StreamManager {
|
|
4
3
|
private colors;
|
|
5
4
|
registerStream(jobName: string, stream: ChildProcessWithoutNullStreams, options: {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import { createWriteStream } from 'fs';
|
|
3
2
|
import { join, resolve } from 'path';
|
|
3
|
+
import chalk, {} from 'chalk';
|
|
4
4
|
export class StreamManager {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
constructor() {
|
|
6
|
+
this.colors = {
|
|
7
|
+
BLUE: chalk.blue,
|
|
8
|
+
CYAN: chalk.cyan,
|
|
9
|
+
GREEN: chalk.green,
|
|
10
|
+
MAGENTA: chalk.magenta,
|
|
11
|
+
YELLOW: chalk.yellow,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
12
14
|
registerStream(jobName, stream, options) {
|
|
13
15
|
const colorKeys = Object.keys(this.colors);
|
|
14
16
|
const randomColor = this.colors[colorKeys[(colorKeys.length * Math.random()) << 0]];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-manager.js","sour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CAAC;QAEH,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,OAAO,MAAM,CAAC,CAAC,EAAE;gBAC7F,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
+
export declare const createCommand: {
|
|
3
|
+
builder: (yargs: Argv) => Argv;
|
|
4
|
+
command: string;
|
|
5
|
+
describe: string;
|
|
6
|
+
handler: (argv: ArgumentsCamelCase<{
|
|
7
|
+
template: string;
|
|
8
|
+
name: string;
|
|
9
|
+
path: string;
|
|
10
|
+
}>) => Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { dirname, resolve } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { createEnv } from 'yeoman-environment';
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
export const createCommand = {
|
|
7
|
+
builder: (yargs) => {
|
|
8
|
+
return yargs
|
|
9
|
+
.option('template', {
|
|
10
|
+
alias: 't',
|
|
11
|
+
choices: ['aws-ecs-server', 'aws-s3-website'],
|
|
12
|
+
demandOption: true,
|
|
13
|
+
description: 'Template to use for creation.',
|
|
14
|
+
type: 'string',
|
|
15
|
+
})
|
|
16
|
+
.option('name', {
|
|
17
|
+
alias: 'n',
|
|
18
|
+
demandOption: true,
|
|
19
|
+
description: 'Name of the app to create. A new directory will be created with the same name.',
|
|
20
|
+
type: 'string',
|
|
21
|
+
})
|
|
22
|
+
.option('path', {
|
|
23
|
+
alias: 'p',
|
|
24
|
+
default: '.',
|
|
25
|
+
description: 'Path to create the app.',
|
|
26
|
+
type: 'string',
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
command: 'create',
|
|
30
|
+
describe: 'Create a new Octo app from a template.',
|
|
31
|
+
handler: async (argv) => {
|
|
32
|
+
const { name, path, template } = argv;
|
|
33
|
+
console.log(chalk.blue(`Creating app with template "${template}"...`));
|
|
34
|
+
const env = createEnv();
|
|
35
|
+
env.register(resolve(__dirname, 'generator-octo-app-template/generators/app/index.js'), {
|
|
36
|
+
namespace: 'generator-octo-app-template:app',
|
|
37
|
+
});
|
|
38
|
+
try {
|
|
39
|
+
await env.run(['generator-octo-app-template:app', name, path, template], {
|
|
40
|
+
skipCache: true,
|
|
41
|
+
skipInstall: false,
|
|
42
|
+
});
|
|
43
|
+
console.log(chalk.green(`Successfully created app!`));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(chalk.red(`Failed to create app! ${error.message}`));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=create.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.command.js","sourceRoot":"","sources":["../../../src/commands/create/create.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,CAAC,KAAW,EAAQ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OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Generator, { type BaseOptions } from 'yeoman-generator';
|
|
2
|
+
export default class extends Generator {
|
|
3
|
+
private readonly appName;
|
|
4
|
+
private readonly appPath;
|
|
5
|
+
private readonly appTemplate;
|
|
6
|
+
constructor(args: string[], opts: BaseOptions);
|
|
7
|
+
initializing(): Promise<void>;
|
|
8
|
+
writing(): Promise<void>;
|
|
9
|
+
end(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { readdir, stat } from 'fs/promises';
|
|
2
|
+
import { join, resolve } from 'path';
|
|
3
|
+
import Generator, {} from 'yeoman-generator';
|
|
4
|
+
export default class extends Generator {
|
|
5
|
+
constructor(args, opts) {
|
|
6
|
+
super(args, opts);
|
|
7
|
+
this.appName = args[0];
|
|
8
|
+
this.appPath = args[1];
|
|
9
|
+
this.appTemplate = args[2];
|
|
10
|
+
}
|
|
11
|
+
async initializing() {
|
|
12
|
+
const targetPath = resolve(join(this.appPath, this.appName));
|
|
13
|
+
// Check if directory already exists and is not empty.
|
|
14
|
+
let targetPathStat;
|
|
15
|
+
try {
|
|
16
|
+
targetPathStat = await stat(targetPath);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code !== 'ENOENT') {
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (targetPathStat && targetPathStat.isDirectory()) {
|
|
24
|
+
const files = await readdir(targetPath);
|
|
25
|
+
if (files.length > 0) {
|
|
26
|
+
throw new Error(`Directory '${targetPath}' already exists and is not empty! Please choose a different name or path.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Set the destination root to the app directory.
|
|
30
|
+
this.destinationRoot(targetPath);
|
|
31
|
+
}
|
|
32
|
+
async writing() {
|
|
33
|
+
// Create eslint.config.js (ESLint v9 flat config)
|
|
34
|
+
this.fs.copyTpl(this.templatePath('eslint.config.js.ejs'), this.destinationPath('eslint.config.js'));
|
|
35
|
+
// Create .gitignore
|
|
36
|
+
this.fs.copyTpl(this.templatePath('gitignore.ejs'), this.destinationPath('.gitignore'));
|
|
37
|
+
// Create package.json
|
|
38
|
+
this.fs.copyTpl(this.templatePath('package.json.ejs'), this.destinationPath('package.json'), {
|
|
39
|
+
description: `Infrastructure definition using Octo for ${this.appName}`,
|
|
40
|
+
name: this.appName,
|
|
41
|
+
version: '0.0.1',
|
|
42
|
+
});
|
|
43
|
+
await this.addDependencies({
|
|
44
|
+
'@quadnix/octo': '^0.0.22',
|
|
45
|
+
'@quadnix/octo-aws-cdk': '^0.0.11',
|
|
46
|
+
'@quadnix/octo-event-listeners': '^0.0.1',
|
|
47
|
+
'env-smart': '^2.3.2',
|
|
48
|
+
});
|
|
49
|
+
await this.addDevDependencies({
|
|
50
|
+
'@types/jest': '^30.0.0',
|
|
51
|
+
'@types/node': '^20.0.0',
|
|
52
|
+
eslint: '^9.0.0',
|
|
53
|
+
'eslint-config-prettier': '^10.1.8',
|
|
54
|
+
'eslint-import-resolver-typescript': '^4.4.4',
|
|
55
|
+
'eslint-plugin-import': '^2.32.0',
|
|
56
|
+
'eslint-plugin-jsonc': '^2.20.1',
|
|
57
|
+
'eslint-plugin-prettier': '^5.5.4',
|
|
58
|
+
jest: '^30.0.0',
|
|
59
|
+
'jsonc-eslint-parser': '^2.4.0',
|
|
60
|
+
prettier: '^3.6.2',
|
|
61
|
+
rimraf: '^6.0.0',
|
|
62
|
+
'source-map-support': '^0.5.21',
|
|
63
|
+
'ts-jest': '^29.0.0',
|
|
64
|
+
'ts-node': '^10.9.2',
|
|
65
|
+
'tsconfig-paths': '^4.2.0',
|
|
66
|
+
typescript: '^5.0.0',
|
|
67
|
+
'typescript-eslint': '^8.0.0',
|
|
68
|
+
});
|
|
69
|
+
// Create .prettierrc
|
|
70
|
+
this.fs.copyTpl(this.templatePath('prettierrc.ejs'), this.destinationPath('.prettierrc'));
|
|
71
|
+
// Create README.md
|
|
72
|
+
this.fs.copyTpl(this.templatePath('README.md.ejs'), this.destinationPath('README.md'), {
|
|
73
|
+
description: `Infrastructure definition using Octo for ${this.appName}`,
|
|
74
|
+
name: this.appName,
|
|
75
|
+
});
|
|
76
|
+
// Create tsconfig.json and tsconfig.build.json
|
|
77
|
+
this.fs.copyTpl(this.templatePath('tsconfig.json.ejs'), this.destinationPath('tsconfig.json'));
|
|
78
|
+
this.fs.copyTpl(this.templatePath('tsconfig.build.json.ejs'), this.destinationPath('tsconfig.build.json'));
|
|
79
|
+
// Create src directory and main files
|
|
80
|
+
if (this.appTemplate === 'aws-ecs-server') {
|
|
81
|
+
const templatePath = `src/${this.appTemplate}`;
|
|
82
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/octo/gitkeep.ejs`), this.destinationPath('src/.octo/.gitkeep'));
|
|
83
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/app.config.ts.ejs`), this.destinationPath('src/app.config.ts'));
|
|
84
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/env.ejs`), this.destinationPath('src/.env'));
|
|
85
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/main.ts.ejs`), this.destinationPath('src/main.ts'));
|
|
86
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/module-definitions.ts.ejs`), this.destinationPath('src/module-definitions.ts'));
|
|
87
|
+
}
|
|
88
|
+
else if (this.appTemplate === 'aws-s3-website') {
|
|
89
|
+
const templatePath = `src/${this.appTemplate}`;
|
|
90
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/octo/gitkeep.ejs`), this.destinationPath('src/.octo/.gitkeep'));
|
|
91
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/website/error.html.ejs`), this.destinationPath('src/website/error.html'), {
|
|
92
|
+
name: this.appName,
|
|
93
|
+
});
|
|
94
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/website/index.html.ejs`), this.destinationPath('src/website/index.html'), {
|
|
95
|
+
name: this.appName,
|
|
96
|
+
});
|
|
97
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/app.config.ts.ejs`), this.destinationPath('src/app.config.ts'));
|
|
98
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/env.ejs`), this.destinationPath('src/.env'));
|
|
99
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/main.ts.ejs`), this.destinationPath('src/main.ts'));
|
|
100
|
+
this.fs.copyTpl(this.templatePath(`${templatePath}/module-definitions.ts.ejs`), this.destinationPath('src/module-definitions.ts'));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new Error(`Unsupported app template: ${this.appTemplate}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
end() {
|
|
107
|
+
const targetPath = resolve(join(this.appPath, this.appName));
|
|
108
|
+
this.log('✅ Your TypeScript app has been generated successfully!');
|
|
109
|
+
this.log(`📁 App created at: ${targetPath}`);
|
|
110
|
+
this.log('📦 Next steps:');
|
|
111
|
+
this.log(` cd ${targetPath}`);
|
|
112
|
+
this.log(' npm install');
|
|
113
|
+
this.log(' npm run build');
|
|
114
|
+
this.log(' npm start');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create/generator-octo-app-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM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,cAAc,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;YACvG,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,GAAG,YAAY,4BAA4B,CAAC,EAC9D,IAAI,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAClD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7D,IAAI,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,CAAC,sBAAsB,UAAU,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/commands/create/generator-octo-app-template/generators/app/templates/README.md.ejs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# <%= name %>
|
|
2
|
+
<%= description %>
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
```bash
|
|
6
|
+
npm install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Fix Me
|
|
10
|
+
Before running the app, ensure,
|
|
11
|
+
- `src/.env` values are appropriately set.
|
|
12
|
+
|
|
13
|
+
## Development
|
|
14
|
+
```bash
|
|
15
|
+
# Build app
|
|
16
|
+
npm run build
|
|
17
|
+
|
|
18
|
+
# Run app. This will create the infrastructure defined in your app.
|
|
19
|
+
npm start
|
|
20
|
+
```
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import configPrettier from 'eslint-config-prettier';
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import jsoncPlugin from 'eslint-plugin-jsonc';
|
|
5
|
+
import prettier from 'eslint-plugin-prettier';
|
|
6
|
+
import jsoncParser from 'jsonc-eslint-parser';
|
|
7
|
+
import tseslint from 'typescript-eslint';
|
|
8
|
+
|
|
9
|
+
export default tseslint.config(
|
|
10
|
+
// Base configurations
|
|
11
|
+
js.configs.recommended,
|
|
12
|
+
...tseslint.configs.recommended,
|
|
13
|
+
|
|
14
|
+
// TypeScript files configuration
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
parser: tseslint.parser,
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 2022,
|
|
21
|
+
extraFileExtensions: ['.json'],
|
|
22
|
+
project: './tsconfig.json',
|
|
23
|
+
sourceType: 'module',
|
|
24
|
+
tsconfigRootDir: import.meta.dirname,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
plugins: {
|
|
28
|
+
'@typescript-eslint': tseslint.plugin,
|
|
29
|
+
import: importPlugin,
|
|
30
|
+
prettier: prettier,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
'@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
|
|
34
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
35
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
36
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
37
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
38
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
39
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
40
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
41
|
+
'import/order': [
|
|
42
|
+
'error',
|
|
43
|
+
{
|
|
44
|
+
alphabetize: { caseInsensitive: false, order: 'asc', orderImportKind: 'asc' },
|
|
45
|
+
named: { enabled: true, types: 'mixed' },
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
'max-len': ['error', { code: 120, ignoreStrings: true }],
|
|
49
|
+
'no-duplicate-imports': ['error', { includeExports: true }],
|
|
50
|
+
'prettier/prettier': 'error',
|
|
51
|
+
'sort-imports': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
allowSeparatedGroups: true,
|
|
55
|
+
ignoreCase: false,
|
|
56
|
+
ignoreDeclarationSort: true,
|
|
57
|
+
ignoreMemberSort: false,
|
|
58
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
'sort-keys': ['error', 'asc', { caseSensitive: false, minKeys: 2, natural: false }],
|
|
62
|
+
},
|
|
63
|
+
settings: {
|
|
64
|
+
'import/resolver': {
|
|
65
|
+
typescript: {
|
|
66
|
+
alwaysTryTypes: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
// JSON/JSONC files configuration
|
|
73
|
+
{
|
|
74
|
+
files: ['**/*.json', '**/*.jsonc'],
|
|
75
|
+
languageOptions: {
|
|
76
|
+
parser: jsoncParser,
|
|
77
|
+
},
|
|
78
|
+
plugins: {
|
|
79
|
+
jsonc: jsoncPlugin,
|
|
80
|
+
},
|
|
81
|
+
rules: {
|
|
82
|
+
...jsoncPlugin.configs['recommended-with-jsonc'].rules,
|
|
83
|
+
'jsonc/sort-keys': ['error', 'asc', { caseSensitive: false, minKeys: 2, natural: false }],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// JavaScript files configuration
|
|
88
|
+
{
|
|
89
|
+
files: ['**/*.js', '**/*.mjs'],
|
|
90
|
+
languageOptions: {
|
|
91
|
+
ecmaVersion: 2022,
|
|
92
|
+
sourceType: 'module',
|
|
93
|
+
},
|
|
94
|
+
plugins: {
|
|
95
|
+
import: importPlugin,
|
|
96
|
+
prettier: prettier,
|
|
97
|
+
},
|
|
98
|
+
rules: {
|
|
99
|
+
'import/order': [
|
|
100
|
+
'error',
|
|
101
|
+
{
|
|
102
|
+
alphabetize: { caseInsensitive: false, order: 'asc', orderImportKind: 'asc' },
|
|
103
|
+
named: { enabled: true, types: 'mixed' },
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
'max-len': ['error', { code: 120, ignoreStrings: true }],
|
|
107
|
+
'no-duplicate-imports': ['error', { includeExports: true }],
|
|
108
|
+
'prettier/prettier': 'error',
|
|
109
|
+
'sort-imports': [
|
|
110
|
+
'error',
|
|
111
|
+
{
|
|
112
|
+
allowSeparatedGroups: true,
|
|
113
|
+
ignoreCase: false,
|
|
114
|
+
ignoreDeclarationSort: true,
|
|
115
|
+
ignoreMemberSort: false,
|
|
116
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
'sort-keys': ['error', 'asc', { caseSensitive: false, minKeys: 2, natural: false }],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
// Global ignores
|
|
124
|
+
{
|
|
125
|
+
ignores: ['dist/**', 'node_modules/**', 'coverage/**', '*.min.js', 'package-lock.json'],
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
// Prettier config to disable conflicting rules
|
|
129
|
+
configPrettier,
|
|
130
|
+
);
|