mcp-new 1.5.0 → 1.6.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/dist/{chunk-YISSMIHU.js → chunk-LJNMSDBU.js} +975 -206
- package/dist/cli.js +955 -5
- package/dist/index.d.ts +23 -8
- package/dist/index.js +19 -46
- package/package.json +4 -2
- package/templates/ci/circleci/config.yml.ejs +219 -0
- package/templates/ci/github/ci.yml.ejs +184 -0
- package/templates/ci/gitlab/.gitlab-ci.yml.ejs +233 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
4
|
-
type
|
|
3
|
+
declare const BuiltinLanguageSchema: z.ZodEnum<["typescript", "python", "go", "rust", "java", "kotlin", "csharp", "elixir"]>;
|
|
4
|
+
type BuiltinLanguage = z.infer<typeof BuiltinLanguageSchema>;
|
|
5
|
+
declare const LanguageSchema: z.ZodString;
|
|
6
|
+
type Language = string;
|
|
7
|
+
declare const BUILTIN_LANGUAGES: BuiltinLanguage[];
|
|
8
|
+
declare function isBuiltinLanguage(lang: string): lang is BuiltinLanguage;
|
|
5
9
|
declare const JavaBuildToolSchema: z.ZodEnum<["maven", "gradle"]>;
|
|
6
10
|
type JavaBuildTool = z.infer<typeof JavaBuildToolSchema>;
|
|
7
11
|
declare const TransportSchema: z.ZodEnum<["stdio", "sse"]>;
|
|
@@ -82,7 +86,7 @@ type ResourceConfig = z.infer<typeof ResourceConfigSchema>;
|
|
|
82
86
|
declare const ProjectConfigSchema: z.ZodObject<{
|
|
83
87
|
name: z.ZodString;
|
|
84
88
|
description: z.ZodDefault<z.ZodString>;
|
|
85
|
-
language: z.
|
|
89
|
+
language: z.ZodString;
|
|
86
90
|
transport: z.ZodEnum<["stdio", "sse"]>;
|
|
87
91
|
tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
88
92
|
name: z.ZodString;
|
|
@@ -145,7 +149,7 @@ declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
145
149
|
}, "strip", z.ZodTypeAny, {
|
|
146
150
|
name: string;
|
|
147
151
|
description: string;
|
|
148
|
-
language:
|
|
152
|
+
language: string;
|
|
149
153
|
transport: "stdio" | "sse";
|
|
150
154
|
tools: {
|
|
151
155
|
name: string;
|
|
@@ -169,7 +173,7 @@ declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
169
173
|
javaBuildTool?: "maven" | "gradle" | undefined;
|
|
170
174
|
}, {
|
|
171
175
|
name: string;
|
|
172
|
-
language:
|
|
176
|
+
language: string;
|
|
173
177
|
transport: "stdio" | "sse";
|
|
174
178
|
description?: string | undefined;
|
|
175
179
|
tools?: {
|
|
@@ -217,6 +221,7 @@ interface CLIOptions {
|
|
|
217
221
|
fromPrompt?: boolean;
|
|
218
222
|
preset?: string;
|
|
219
223
|
yes?: boolean;
|
|
224
|
+
ci?: string;
|
|
220
225
|
}
|
|
221
226
|
|
|
222
227
|
interface MCPToolInputSchema {
|
|
@@ -368,6 +373,7 @@ declare abstract class BaseGenerator {
|
|
|
368
373
|
protected renderTemplates(): Promise<void>;
|
|
369
374
|
protected getTemplateData(): Record<string, unknown>;
|
|
370
375
|
protected installDependencies(): Promise<void>;
|
|
376
|
+
private installPluginDependencies;
|
|
371
377
|
private installNodeDependencies;
|
|
372
378
|
private installPythonDependencies;
|
|
373
379
|
private installGoDependencies;
|
|
@@ -411,13 +417,13 @@ declare class PresetGenerator extends BaseGenerator {
|
|
|
411
417
|
}
|
|
412
418
|
interface PresetGeneratorOptions {
|
|
413
419
|
projectName?: string;
|
|
414
|
-
presetId:
|
|
420
|
+
presetId: string;
|
|
415
421
|
language?: Language;
|
|
416
422
|
skipInstall?: boolean;
|
|
417
423
|
useDefaults?: boolean;
|
|
418
424
|
javaBuildTool?: JavaBuildTool;
|
|
419
425
|
}
|
|
420
|
-
declare function generateFromPreset(options: PresetGeneratorOptions): Promise<
|
|
426
|
+
declare function generateFromPreset(options: PresetGeneratorOptions): Promise<ProjectConfig>;
|
|
421
427
|
declare function validatePresetId(presetId: string): presetId is PresetId;
|
|
422
428
|
|
|
423
429
|
declare function parseOpenAPISpec(content: string): Promise<ParsedEndpoint[]>;
|
|
@@ -501,6 +507,10 @@ declare function renderTemplate(templatePath: string, data: Record<string, unkno
|
|
|
501
507
|
declare function renderTemplateToFile(templatePath: string, outputPath: string, data: Record<string, unknown>): Promise<void>;
|
|
502
508
|
declare function walkDir(dirPath: string, callback: (filePath: string, isDir: boolean) => Promise<void>): Promise<void>;
|
|
503
509
|
declare function getTemplateDir(): string;
|
|
510
|
+
/**
|
|
511
|
+
* Get the template directory for a language, supporting both built-in and plugin languages.
|
|
512
|
+
*/
|
|
513
|
+
declare function getTemplateDirForLanguage(language: string, pluginTemplateDir?: string): string;
|
|
504
514
|
declare function resolveOutputPath(basePath: string, ...segments: string[]): string;
|
|
505
515
|
|
|
506
516
|
declare function isGitInstalled(): Promise<boolean>;
|
|
@@ -535,6 +545,11 @@ declare function promptPreset(): Promise<PresetId>;
|
|
|
535
545
|
|
|
536
546
|
declare function promptJavaBuildTool(): Promise<JavaBuildTool>;
|
|
537
547
|
|
|
548
|
+
declare const CIProviderSchema: z.ZodEnum<["github", "gitlab", "circleci"]>;
|
|
549
|
+
type CIProvider = z.infer<typeof CIProviderSchema>;
|
|
550
|
+
|
|
551
|
+
declare function promptCIProvider(): Promise<CIProvider>;
|
|
552
|
+
|
|
538
553
|
interface WizardOptions {
|
|
539
554
|
defaultName?: string;
|
|
540
555
|
skipDescription?: boolean;
|
|
@@ -562,4 +577,4 @@ interface AddToolOptions {
|
|
|
562
577
|
}
|
|
563
578
|
declare function addToolCommand(options: AddToolOptions): Promise<void>;
|
|
564
579
|
|
|
565
|
-
export { BaseGenerator, type CLIOptions, type GenerationMethod, type GeneratorContext, type JavaBuildTool, JavaBuildToolSchema, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, PresetGenerator, type PresetGeneratorOptions, type PresetId$1 as PresetId, PresetIdSchema, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPreset, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, initCommand, initGitRepository, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptGenerationMethod, promptIncludeExampleTool, promptJavaBuildTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptPreset, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validatePresetId, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
|
|
580
|
+
export { BUILTIN_LANGUAGES, BaseGenerator, type BuiltinLanguage, BuiltinLanguageSchema, type CLIOptions, type GenerationMethod, type GeneratorContext, type JavaBuildTool, JavaBuildToolSchema, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, PresetGenerator, type PresetGeneratorOptions, type PresetId$1 as PresetId, PresetIdSchema, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPreset, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, getTemplateDirForLanguage, initCommand, initGitRepository, isBuiltinLanguage, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptCIProvider, promptGenerationMethod, promptIncludeExampleTool, promptJavaBuildTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptPreset, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validatePresetId, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BUILTIN_LANGUAGES,
|
|
2
3
|
BaseGenerator,
|
|
4
|
+
BuiltinLanguageSchema,
|
|
5
|
+
JavaBuildToolSchema,
|
|
6
|
+
LanguageSchema,
|
|
3
7
|
OpenAPIGenerator,
|
|
4
8
|
PresetGenerator,
|
|
9
|
+
PresetIdSchema,
|
|
10
|
+
ProjectConfigSchema,
|
|
5
11
|
PromptGenerator,
|
|
12
|
+
ResourceConfigSchema,
|
|
13
|
+
ToolConfigSchema,
|
|
14
|
+
ToolParameterSchema,
|
|
15
|
+
TransportSchema,
|
|
6
16
|
WizardGenerator,
|
|
7
17
|
addToolCommand,
|
|
8
18
|
copyDir,
|
|
@@ -20,8 +30,10 @@ import {
|
|
|
20
30
|
generateFromWizard,
|
|
21
31
|
getGitUser,
|
|
22
32
|
getTemplateDir,
|
|
33
|
+
getTemplateDirForLanguage,
|
|
23
34
|
initCommand,
|
|
24
35
|
initGitRepository,
|
|
36
|
+
isBuiltinLanguage,
|
|
25
37
|
isDirectory,
|
|
26
38
|
isGitInstalled,
|
|
27
39
|
isInsideGitRepository,
|
|
@@ -31,6 +43,7 @@ import {
|
|
|
31
43
|
projectNameRegex,
|
|
32
44
|
promptAddResources,
|
|
33
45
|
promptAddTools,
|
|
46
|
+
promptCIProvider,
|
|
34
47
|
promptGenerationMethod,
|
|
35
48
|
promptIncludeExampleTool,
|
|
36
49
|
promptJavaBuildTool,
|
|
@@ -61,52 +74,7 @@ import {
|
|
|
61
74
|
walkDir,
|
|
62
75
|
withSpinner,
|
|
63
76
|
writeFile
|
|
64
|
-
} from "./chunk-
|
|
65
|
-
|
|
66
|
-
// src/types/config.ts
|
|
67
|
-
import { z } from "zod";
|
|
68
|
-
var LanguageSchema = z.enum([
|
|
69
|
-
"typescript",
|
|
70
|
-
"python",
|
|
71
|
-
"go",
|
|
72
|
-
"rust",
|
|
73
|
-
"java",
|
|
74
|
-
"kotlin",
|
|
75
|
-
"csharp",
|
|
76
|
-
"elixir"
|
|
77
|
-
]);
|
|
78
|
-
var JavaBuildToolSchema = z.enum(["maven", "gradle"]);
|
|
79
|
-
var TransportSchema = z.enum(["stdio", "sse"]);
|
|
80
|
-
var ToolParameterSchema = z.object({
|
|
81
|
-
name: z.string(),
|
|
82
|
-
type: z.enum(["string", "number", "boolean", "object", "array"]),
|
|
83
|
-
description: z.string(),
|
|
84
|
-
required: z.boolean().default(true)
|
|
85
|
-
});
|
|
86
|
-
var ToolConfigSchema = z.object({
|
|
87
|
-
name: z.string(),
|
|
88
|
-
description: z.string(),
|
|
89
|
-
parameters: z.array(ToolParameterSchema).default([])
|
|
90
|
-
});
|
|
91
|
-
var ResourceConfigSchema = z.object({
|
|
92
|
-
name: z.string(),
|
|
93
|
-
uri: z.string(),
|
|
94
|
-
description: z.string(),
|
|
95
|
-
mimeType: z.string().optional()
|
|
96
|
-
});
|
|
97
|
-
var ProjectConfigSchema = z.object({
|
|
98
|
-
name: z.string().min(1, "Project name is required"),
|
|
99
|
-
description: z.string().default(""),
|
|
100
|
-
language: LanguageSchema,
|
|
101
|
-
transport: TransportSchema,
|
|
102
|
-
tools: z.array(ToolConfigSchema).default([]),
|
|
103
|
-
resources: z.array(ResourceConfigSchema).default([]),
|
|
104
|
-
includeExampleTool: z.boolean().default(true),
|
|
105
|
-
skipInstall: z.boolean().default(false),
|
|
106
|
-
initGit: z.boolean().default(true),
|
|
107
|
-
javaBuildTool: JavaBuildToolSchema.optional()
|
|
108
|
-
});
|
|
109
|
-
var PresetIdSchema = z.enum(["database", "rest-api", "filesystem"]);
|
|
77
|
+
} from "./chunk-LJNMSDBU.js";
|
|
110
78
|
|
|
111
79
|
// src/parsers/swagger.ts
|
|
112
80
|
import YAML from "yaml";
|
|
@@ -302,7 +270,9 @@ function nameToOperationId(name) {
|
|
|
302
270
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
303
271
|
}
|
|
304
272
|
export {
|
|
273
|
+
BUILTIN_LANGUAGES,
|
|
305
274
|
BaseGenerator,
|
|
275
|
+
BuiltinLanguageSchema,
|
|
306
276
|
JavaBuildToolSchema,
|
|
307
277
|
LanguageSchema,
|
|
308
278
|
OpenAPIGenerator,
|
|
@@ -331,8 +301,10 @@ export {
|
|
|
331
301
|
generateFromWizard,
|
|
332
302
|
getGitUser,
|
|
333
303
|
getTemplateDir,
|
|
304
|
+
getTemplateDirForLanguage,
|
|
334
305
|
initCommand,
|
|
335
306
|
initGitRepository,
|
|
307
|
+
isBuiltinLanguage,
|
|
336
308
|
isDirectory,
|
|
337
309
|
isGitInstalled,
|
|
338
310
|
isInsideGitRepository,
|
|
@@ -344,6 +316,7 @@ export {
|
|
|
344
316
|
projectNameRegex,
|
|
345
317
|
promptAddResources,
|
|
346
318
|
promptAddTools,
|
|
319
|
+
promptCIProvider,
|
|
347
320
|
promptGenerationMethod,
|
|
348
321
|
promptIncludeExampleTool,
|
|
349
322
|
promptJavaBuildTool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-new",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "CLI generator for MCP servers. Like create-react-app, but for MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
"execa": "^8.0.0",
|
|
54
54
|
"fs-extra": "^11.2.0",
|
|
55
55
|
"inquirer": "^9.2.0",
|
|
56
|
+
"marked": "^12.0.2",
|
|
56
57
|
"ora": "^8.0.0",
|
|
58
|
+
"tar": "^7.5.6",
|
|
57
59
|
"yaml": "^2.4.0",
|
|
58
60
|
"zod": "^3.23.0"
|
|
59
61
|
},
|
|
@@ -70,4 +72,4 @@
|
|
|
70
72
|
"typescript": "^5.4.0",
|
|
71
73
|
"vitest": "^1.6.0"
|
|
72
74
|
}
|
|
73
|
-
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
<% if (language === 'typescript') { %>
|
|
4
|
+
orbs:
|
|
5
|
+
node: circleci/node@5
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-test:
|
|
9
|
+
docker:
|
|
10
|
+
- image: cimg/node:<%= nodeVersion %>.0
|
|
11
|
+
steps:
|
|
12
|
+
- checkout
|
|
13
|
+
- node/install-packages:
|
|
14
|
+
pkg-manager: npm
|
|
15
|
+
<% if (buildCommand) { %>
|
|
16
|
+
- run:
|
|
17
|
+
name: Build
|
|
18
|
+
command: <%= buildCommand %>
|
|
19
|
+
<% } %>
|
|
20
|
+
<% if (testCommand) { %>
|
|
21
|
+
- run:
|
|
22
|
+
name: Test
|
|
23
|
+
command: <%= testCommand %>
|
|
24
|
+
<% } %>
|
|
25
|
+
|
|
26
|
+
workflows:
|
|
27
|
+
build-and-test:
|
|
28
|
+
jobs:
|
|
29
|
+
- build-and-test
|
|
30
|
+
<% } else if (language === 'python') { %>
|
|
31
|
+
orbs:
|
|
32
|
+
python: circleci/python@2
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
build-and-test:
|
|
36
|
+
docker:
|
|
37
|
+
- image: cimg/python:<%= pythonVersion %>
|
|
38
|
+
steps:
|
|
39
|
+
- checkout
|
|
40
|
+
- python/install-packages:
|
|
41
|
+
pkg-manager: pip
|
|
42
|
+
pip-dependency-file: requirements.txt
|
|
43
|
+
<% if (testCommand) { %>
|
|
44
|
+
- run:
|
|
45
|
+
name: Test
|
|
46
|
+
command: |
|
|
47
|
+
pip install pytest
|
|
48
|
+
<%= testCommand %>
|
|
49
|
+
<% } %>
|
|
50
|
+
|
|
51
|
+
workflows:
|
|
52
|
+
build-and-test:
|
|
53
|
+
jobs:
|
|
54
|
+
- build-and-test
|
|
55
|
+
<% } else if (language === 'go') { %>
|
|
56
|
+
orbs:
|
|
57
|
+
go: circleci/go@1
|
|
58
|
+
|
|
59
|
+
jobs:
|
|
60
|
+
build-and-test:
|
|
61
|
+
docker:
|
|
62
|
+
- image: cimg/go:<%= goVersion %>
|
|
63
|
+
steps:
|
|
64
|
+
- checkout
|
|
65
|
+
- go/load-cache
|
|
66
|
+
- go/mod-download
|
|
67
|
+
- go/save-cache
|
|
68
|
+
<% if (buildCommand) { %>
|
|
69
|
+
- run:
|
|
70
|
+
name: Build
|
|
71
|
+
command: <%= buildCommand %>
|
|
72
|
+
<% } %>
|
|
73
|
+
<% if (testCommand) { %>
|
|
74
|
+
- run:
|
|
75
|
+
name: Test
|
|
76
|
+
command: <%= testCommand %>
|
|
77
|
+
<% } %>
|
|
78
|
+
|
|
79
|
+
workflows:
|
|
80
|
+
build-and-test:
|
|
81
|
+
jobs:
|
|
82
|
+
- build-and-test
|
|
83
|
+
<% } else if (language === 'rust') { %>
|
|
84
|
+
orbs:
|
|
85
|
+
rust: circleci/rust@1
|
|
86
|
+
|
|
87
|
+
jobs:
|
|
88
|
+
build-and-test:
|
|
89
|
+
docker:
|
|
90
|
+
- image: cimg/rust:<%= rustVersion %>
|
|
91
|
+
steps:
|
|
92
|
+
- checkout
|
|
93
|
+
- rust/clippy
|
|
94
|
+
<% if (buildCommand) { %>
|
|
95
|
+
- run:
|
|
96
|
+
name: Build
|
|
97
|
+
command: <%= buildCommand %>
|
|
98
|
+
<% } %>
|
|
99
|
+
<% if (testCommand) { %>
|
|
100
|
+
- run:
|
|
101
|
+
name: Test
|
|
102
|
+
command: <%= testCommand %>
|
|
103
|
+
<% } %>
|
|
104
|
+
|
|
105
|
+
workflows:
|
|
106
|
+
build-and-test:
|
|
107
|
+
jobs:
|
|
108
|
+
- build-and-test
|
|
109
|
+
<% } else if (language === 'java' || language === 'kotlin') { %>
|
|
110
|
+
jobs:
|
|
111
|
+
build-and-test:
|
|
112
|
+
docker:
|
|
113
|
+
- image: cimg/openjdk:<%= javaVersion %>.0
|
|
114
|
+
steps:
|
|
115
|
+
- checkout
|
|
116
|
+
<% if (installCommand.includes('gradle')) { %>
|
|
117
|
+
- restore_cache:
|
|
118
|
+
keys:
|
|
119
|
+
- gradle-{{ checksum "build.gradle" }}
|
|
120
|
+
- gradle-
|
|
121
|
+
<% if (buildCommand) { %>
|
|
122
|
+
- run:
|
|
123
|
+
name: Build
|
|
124
|
+
command: <%= buildCommand %>
|
|
125
|
+
<% } %>
|
|
126
|
+
<% if (testCommand) { %>
|
|
127
|
+
- run:
|
|
128
|
+
name: Test
|
|
129
|
+
command: <%= testCommand %>
|
|
130
|
+
<% } %>
|
|
131
|
+
- save_cache:
|
|
132
|
+
paths:
|
|
133
|
+
- ~/.gradle
|
|
134
|
+
key: gradle-{{ checksum "build.gradle" }}
|
|
135
|
+
<% } else { %>
|
|
136
|
+
- restore_cache:
|
|
137
|
+
keys:
|
|
138
|
+
- maven-{{ checksum "pom.xml" }}
|
|
139
|
+
- maven-
|
|
140
|
+
<% if (buildCommand) { %>
|
|
141
|
+
- run:
|
|
142
|
+
name: Build
|
|
143
|
+
command: <%= buildCommand %>
|
|
144
|
+
<% } %>
|
|
145
|
+
<% if (testCommand) { %>
|
|
146
|
+
- run:
|
|
147
|
+
name: Test
|
|
148
|
+
command: <%= testCommand %>
|
|
149
|
+
<% } %>
|
|
150
|
+
- save_cache:
|
|
151
|
+
paths:
|
|
152
|
+
- ~/.m2
|
|
153
|
+
key: maven-{{ checksum "pom.xml" }}
|
|
154
|
+
<% } %>
|
|
155
|
+
|
|
156
|
+
workflows:
|
|
157
|
+
build-and-test:
|
|
158
|
+
jobs:
|
|
159
|
+
- build-and-test
|
|
160
|
+
<% } else if (language === 'csharp') { %>
|
|
161
|
+
jobs:
|
|
162
|
+
build-and-test:
|
|
163
|
+
docker:
|
|
164
|
+
- image: mcr.microsoft.com/dotnet/sdk:<%= dotnetVersion %>
|
|
165
|
+
steps:
|
|
166
|
+
- checkout
|
|
167
|
+
- run:
|
|
168
|
+
name: Restore dependencies
|
|
169
|
+
command: <%= installCommand %>
|
|
170
|
+
<% if (buildCommand) { %>
|
|
171
|
+
- run:
|
|
172
|
+
name: Build
|
|
173
|
+
command: <%= buildCommand %>
|
|
174
|
+
<% } %>
|
|
175
|
+
<% if (testCommand) { %>
|
|
176
|
+
- run:
|
|
177
|
+
name: Test
|
|
178
|
+
command: <%= testCommand %>
|
|
179
|
+
<% } %>
|
|
180
|
+
|
|
181
|
+
workflows:
|
|
182
|
+
build-and-test:
|
|
183
|
+
jobs:
|
|
184
|
+
- build-and-test
|
|
185
|
+
<% } else if (language === 'elixir') { %>
|
|
186
|
+
jobs:
|
|
187
|
+
build-and-test:
|
|
188
|
+
docker:
|
|
189
|
+
- image: elixir:<%= elixirVersion %>
|
|
190
|
+
steps:
|
|
191
|
+
- checkout
|
|
192
|
+
- restore_cache:
|
|
193
|
+
keys:
|
|
194
|
+
- mix-{{ checksum "mix.lock" }}
|
|
195
|
+
- mix-
|
|
196
|
+
- run:
|
|
197
|
+
name: Install dependencies
|
|
198
|
+
command: <%= installCommand %>
|
|
199
|
+
<% if (buildCommand) { %>
|
|
200
|
+
- run:
|
|
201
|
+
name: Build
|
|
202
|
+
command: <%= buildCommand %>
|
|
203
|
+
<% } %>
|
|
204
|
+
<% if (testCommand) { %>
|
|
205
|
+
- run:
|
|
206
|
+
name: Test
|
|
207
|
+
command: <%= testCommand %>
|
|
208
|
+
<% } %>
|
|
209
|
+
- save_cache:
|
|
210
|
+
paths:
|
|
211
|
+
- deps
|
|
212
|
+
- _build
|
|
213
|
+
key: mix-{{ checksum "mix.lock" }}
|
|
214
|
+
|
|
215
|
+
workflows:
|
|
216
|
+
build-and-test:
|
|
217
|
+
jobs:
|
|
218
|
+
- build-and-test
|
|
219
|
+
<% } %>
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
<% if (language === 'typescript') { %>
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [<%= nodeVersion %>, 22]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: <%= installCommand %>
|
|
28
|
+
<% if (buildCommand) { %>
|
|
29
|
+
- name: Build
|
|
30
|
+
run: <%= buildCommand %>
|
|
31
|
+
<% } %>
|
|
32
|
+
<% if (testCommand) { %>
|
|
33
|
+
- name: Test
|
|
34
|
+
run: <%= testCommand %>
|
|
35
|
+
<% } %>
|
|
36
|
+
<% } else if (language === 'python') { %>
|
|
37
|
+
strategy:
|
|
38
|
+
matrix:
|
|
39
|
+
python-version: ['<%= pythonVersion %>', '3.12']
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
45
|
+
uses: actions/setup-python@v5
|
|
46
|
+
with:
|
|
47
|
+
python-version: ${{ matrix.python-version }}
|
|
48
|
+
cache: 'pip'
|
|
49
|
+
|
|
50
|
+
- name: Install dependencies
|
|
51
|
+
run: |
|
|
52
|
+
python -m pip install --upgrade pip
|
|
53
|
+
<%= installCommand %>
|
|
54
|
+
<% if (testCommand) { %>
|
|
55
|
+
- name: Test
|
|
56
|
+
run: <%= testCommand %>
|
|
57
|
+
<% } %>
|
|
58
|
+
<% } else if (language === 'go') { %>
|
|
59
|
+
strategy:
|
|
60
|
+
matrix:
|
|
61
|
+
go-version: ['<%= goVersion %>', '1.22']
|
|
62
|
+
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
|
|
66
|
+
- name: Set up Go ${{ matrix.go-version }}
|
|
67
|
+
uses: actions/setup-go@v5
|
|
68
|
+
with:
|
|
69
|
+
go-version: ${{ matrix.go-version }}
|
|
70
|
+
|
|
71
|
+
- name: Install dependencies
|
|
72
|
+
run: <%= installCommand %>
|
|
73
|
+
<% if (buildCommand) { %>
|
|
74
|
+
- name: Build
|
|
75
|
+
run: <%= buildCommand %>
|
|
76
|
+
<% } %>
|
|
77
|
+
<% if (testCommand) { %>
|
|
78
|
+
- name: Test
|
|
79
|
+
run: <%= testCommand %>
|
|
80
|
+
<% } %>
|
|
81
|
+
<% } else if (language === 'rust') { %>
|
|
82
|
+
strategy:
|
|
83
|
+
matrix:
|
|
84
|
+
rust-version: [<%= rustVersion %>]
|
|
85
|
+
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v4
|
|
88
|
+
|
|
89
|
+
- name: Set up Rust
|
|
90
|
+
uses: dtolnay/rust-toolchain@master
|
|
91
|
+
with:
|
|
92
|
+
toolchain: ${{ matrix.rust-version }}
|
|
93
|
+
|
|
94
|
+
- name: Cache cargo
|
|
95
|
+
uses: Swatinem/rust-cache@v2
|
|
96
|
+
|
|
97
|
+
- name: Install dependencies
|
|
98
|
+
run: <%= installCommand %>
|
|
99
|
+
<% if (buildCommand) { %>
|
|
100
|
+
- name: Build
|
|
101
|
+
run: <%= buildCommand %>
|
|
102
|
+
<% } %>
|
|
103
|
+
<% if (testCommand) { %>
|
|
104
|
+
- name: Test
|
|
105
|
+
run: <%= testCommand %>
|
|
106
|
+
<% } %>
|
|
107
|
+
<% } else if (language === 'java' || language === 'kotlin') { %>
|
|
108
|
+
strategy:
|
|
109
|
+
matrix:
|
|
110
|
+
java-version: ['<%= javaVersion %>']
|
|
111
|
+
|
|
112
|
+
steps:
|
|
113
|
+
- uses: actions/checkout@v4
|
|
114
|
+
|
|
115
|
+
- name: Set up JDK ${{ matrix.java-version }}
|
|
116
|
+
uses: actions/setup-java@v4
|
|
117
|
+
with:
|
|
118
|
+
java-version: ${{ matrix.java-version }}
|
|
119
|
+
distribution: 'temurin'
|
|
120
|
+
<% if (installCommand.includes('gradle')) { %>
|
|
121
|
+
cache: 'gradle'
|
|
122
|
+
<% } else { %>
|
|
123
|
+
cache: 'maven'
|
|
124
|
+
<% } %>
|
|
125
|
+
<% if (buildCommand) { %>
|
|
126
|
+
- name: Build
|
|
127
|
+
run: <%= buildCommand %>
|
|
128
|
+
<% } %>
|
|
129
|
+
<% if (testCommand) { %>
|
|
130
|
+
- name: Test
|
|
131
|
+
run: <%= testCommand %>
|
|
132
|
+
<% } %>
|
|
133
|
+
<% } else if (language === 'csharp') { %>
|
|
134
|
+
steps:
|
|
135
|
+
- uses: actions/checkout@v4
|
|
136
|
+
|
|
137
|
+
- name: Set up .NET <%= dotnetVersion %>
|
|
138
|
+
uses: actions/setup-dotnet@v4
|
|
139
|
+
with:
|
|
140
|
+
dotnet-version: '<%= dotnetVersion %>.x'
|
|
141
|
+
|
|
142
|
+
- name: Restore dependencies
|
|
143
|
+
run: <%= installCommand %>
|
|
144
|
+
<% if (buildCommand) { %>
|
|
145
|
+
- name: Build
|
|
146
|
+
run: <%= buildCommand %>
|
|
147
|
+
<% } %>
|
|
148
|
+
<% if (testCommand) { %>
|
|
149
|
+
- name: Test
|
|
150
|
+
run: <%= testCommand %>
|
|
151
|
+
<% } %>
|
|
152
|
+
<% } else if (language === 'elixir') { %>
|
|
153
|
+
strategy:
|
|
154
|
+
matrix:
|
|
155
|
+
elixir-version: ['<%= elixirVersion %>']
|
|
156
|
+
otp-version: ['26']
|
|
157
|
+
|
|
158
|
+
steps:
|
|
159
|
+
- uses: actions/checkout@v4
|
|
160
|
+
|
|
161
|
+
- name: Set up Elixir
|
|
162
|
+
uses: erlef/setup-beam@v1
|
|
163
|
+
with:
|
|
164
|
+
elixir-version: ${{ matrix.elixir-version }}
|
|
165
|
+
otp-version: ${{ matrix.otp-version }}
|
|
166
|
+
|
|
167
|
+
- name: Restore dependencies cache
|
|
168
|
+
uses: actions/cache@v4
|
|
169
|
+
with:
|
|
170
|
+
path: deps
|
|
171
|
+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
|
172
|
+
restore-keys: ${{ runner.os }}-mix-
|
|
173
|
+
|
|
174
|
+
- name: Install dependencies
|
|
175
|
+
run: <%= installCommand %>
|
|
176
|
+
<% if (buildCommand) { %>
|
|
177
|
+
- name: Build
|
|
178
|
+
run: <%= buildCommand %>
|
|
179
|
+
<% } %>
|
|
180
|
+
<% if (testCommand) { %>
|
|
181
|
+
- name: Test
|
|
182
|
+
run: <%= testCommand %>
|
|
183
|
+
<% } %>
|
|
184
|
+
<% } %>
|