skuba 0.0.0-master-20231001235226 → 0.0.0-master-20231121000709
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/config/prettier.js +1 -1
- package/lib/api/jest/index.d.ts +2 -2
- package/lib/api/jest/index.js +19 -1
- package/lib/api/jest/index.js.map +2 -2
- package/lib/api/net/compose.js +2 -1
- package/lib/api/net/compose.js.map +2 -2
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +5 -2
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +0 -4
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/patchRenovateConfig.js +13 -11
- package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
- package/lib/cli/init/getConfig.d.ts +3 -3
- package/lib/cli/init/getConfig.js +8 -8
- package/lib/cli/init/getConfig.js.map +2 -2
- package/lib/cli/init/index.js +0 -1
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/types.d.ts +99 -27
- package/lib/cli/init/types.js +26 -35
- package/lib/cli/init/types.js.map +2 -2
- package/lib/utils/error.d.ts +30 -10
- package/lib/utils/error.js +10 -20
- package/lib/utils/error.js.map +2 -2
- package/lib/utils/exec.js +2 -2
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/manifest.d.ts +3 -3
- package/lib/utils/manifest.js +9 -9
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/template.d.ts +43 -13
- package/lib/utils/template.js +15 -15
- package/lib/utils/template.js.map +2 -2
- package/package.json +21 -21
- package/template/express-rest-api/.buildkite/pipeline.yml +3 -2
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +3 -3
- package/template/express-rest-api/README.md +6 -6
- package/template/express-rest-api/package.json +2 -2
- package/template/greeter/.buildkite/pipeline.yml +3 -2
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/Dockerfile +3 -3
- package/template/greeter/README.md +3 -3
- package/template/greeter/package.json +2 -2
- package/template/koa-rest-api/.buildkite/pipeline.yml +3 -2
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +3 -3
- package/template/koa-rest-api/README.md +6 -6
- package/template/koa-rest-api/package.json +5 -5
- package/template/koa-rest-api/src/app.test.ts +8 -4
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +4 -3
- package/template/lambda-sqs-worker/.nvmrc +1 -1
- package/template/lambda-sqs-worker/Dockerfile +3 -3
- package/template/lambda-sqs-worker/README.md +6 -6
- package/template/lambda-sqs-worker/package.json +3 -3
- package/template/lambda-sqs-worker/serverless.yml +1 -1
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +4 -3
- package/template/lambda-sqs-worker-cdk/Dockerfile +3 -3
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +4 -4
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/README.md +1 -1
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/README.md +2 -2
package/lib/cli/init/types.d.ts
CHANGED
|
@@ -1,28 +1,100 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type InitConfigInput =
|
|
3
|
-
export declare const
|
|
4
|
-
destinationDir:
|
|
5
|
-
templateComplete:
|
|
6
|
-
templateData:
|
|
7
|
-
ownerName:
|
|
8
|
-
repoName:
|
|
9
|
-
platformName:
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type InitConfigInput = z.infer<typeof initConfigInputSchema>;
|
|
3
|
+
export declare const initConfigInputSchema: z.ZodObject<{
|
|
4
|
+
destinationDir: z.ZodString;
|
|
5
|
+
templateComplete: z.ZodBoolean;
|
|
6
|
+
templateData: z.ZodObject<{
|
|
7
|
+
ownerName: z.ZodString;
|
|
8
|
+
repoName: z.ZodString;
|
|
9
|
+
platformName: z.ZodUnion<[z.ZodLiteral<"amd64">, z.ZodLiteral<"arm64">]>;
|
|
10
|
+
}, "strip", z.ZodString, z.objectOutputType<{
|
|
11
|
+
ownerName: z.ZodString;
|
|
12
|
+
repoName: z.ZodString;
|
|
13
|
+
platformName: z.ZodUnion<[z.ZodLiteral<"amd64">, z.ZodLiteral<"arm64">]>;
|
|
14
|
+
}, z.ZodString, "strip">, z.objectInputType<{
|
|
15
|
+
ownerName: z.ZodString;
|
|
16
|
+
repoName: z.ZodString;
|
|
17
|
+
platformName: z.ZodUnion<[z.ZodLiteral<"amd64">, z.ZodLiteral<"arm64">]>;
|
|
18
|
+
}, z.ZodString, "strip">>;
|
|
19
|
+
templateName: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
templateName: string;
|
|
22
|
+
destinationDir: string;
|
|
23
|
+
templateComplete: boolean;
|
|
24
|
+
templateData: {
|
|
25
|
+
repoName: string;
|
|
26
|
+
ownerName: string;
|
|
27
|
+
platformName: "arm64" | "amd64";
|
|
28
|
+
} & {
|
|
29
|
+
[k: string]: string;
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
templateName: string;
|
|
33
|
+
destinationDir: string;
|
|
34
|
+
templateComplete: boolean;
|
|
35
|
+
templateData: {
|
|
36
|
+
repoName: string;
|
|
37
|
+
ownerName: string;
|
|
38
|
+
platformName: "arm64" | "amd64";
|
|
39
|
+
} & {
|
|
40
|
+
[k: string]: string;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
export type InitConfig = z.infer<typeof initConfigSchema>;
|
|
44
|
+
declare const initConfigSchema: z.ZodObject<{
|
|
45
|
+
templateName: z.ZodString;
|
|
46
|
+
destinationDir: z.ZodString;
|
|
47
|
+
templateComplete: z.ZodBoolean;
|
|
48
|
+
templateData: z.ZodObject<{
|
|
49
|
+
ownerName: z.ZodString;
|
|
50
|
+
repoName: z.ZodString;
|
|
51
|
+
orgName: z.ZodString;
|
|
52
|
+
teamName: z.ZodString;
|
|
53
|
+
port: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodString, z.objectOutputType<{
|
|
55
|
+
ownerName: z.ZodString;
|
|
56
|
+
repoName: z.ZodString;
|
|
57
|
+
orgName: z.ZodString;
|
|
58
|
+
teamName: z.ZodString;
|
|
59
|
+
port: z.ZodString;
|
|
60
|
+
}, z.ZodString, "strip">, z.objectInputType<{
|
|
61
|
+
ownerName: z.ZodString;
|
|
62
|
+
repoName: z.ZodString;
|
|
63
|
+
orgName: z.ZodString;
|
|
64
|
+
teamName: z.ZodString;
|
|
65
|
+
port: z.ZodString;
|
|
66
|
+
}, z.ZodString, "strip">>;
|
|
67
|
+
entryPoint: z.ZodOptional<z.ZodString>;
|
|
68
|
+
type: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"application">, z.ZodLiteral<"package">]>>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
templateName: string;
|
|
71
|
+
destinationDir: string;
|
|
72
|
+
templateComplete: boolean;
|
|
73
|
+
templateData: {
|
|
74
|
+
port: string;
|
|
75
|
+
orgName: string;
|
|
76
|
+
repoName: string;
|
|
77
|
+
ownerName: string;
|
|
78
|
+
teamName: string;
|
|
79
|
+
} & {
|
|
80
|
+
[k: string]: string;
|
|
81
|
+
};
|
|
82
|
+
entryPoint?: string | undefined;
|
|
83
|
+
type?: "package" | "application" | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
templateName: string;
|
|
86
|
+
destinationDir: string;
|
|
87
|
+
templateComplete: boolean;
|
|
88
|
+
templateData: {
|
|
89
|
+
port: string;
|
|
90
|
+
orgName: string;
|
|
91
|
+
repoName: string;
|
|
92
|
+
ownerName: string;
|
|
93
|
+
teamName: string;
|
|
94
|
+
} & {
|
|
95
|
+
[k: string]: string;
|
|
96
|
+
};
|
|
97
|
+
entryPoint?: string | undefined;
|
|
98
|
+
type?: "package" | "application" | undefined;
|
|
99
|
+
}>;
|
|
28
100
|
export {};
|
package/lib/cli/init/types.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,49 +15,42 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var types_exports = {};
|
|
30
20
|
__export(types_exports, {
|
|
31
|
-
|
|
21
|
+
initConfigInputSchema: () => initConfigInputSchema
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(types_exports);
|
|
34
|
-
var
|
|
24
|
+
var import_zod = require("zod");
|
|
35
25
|
var import_manifest = require("../../utils/manifest");
|
|
36
|
-
const
|
|
37
|
-
destinationDir:
|
|
38
|
-
templateComplete:
|
|
39
|
-
templateData:
|
|
40
|
-
ownerName:
|
|
41
|
-
repoName:
|
|
42
|
-
platformName:
|
|
43
|
-
}).
|
|
44
|
-
templateName:
|
|
45
|
-
};
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
templateData:
|
|
50
|
-
ownerName:
|
|
51
|
-
repoName:
|
|
26
|
+
const initConfigInputSchema = import_zod.z.object({
|
|
27
|
+
destinationDir: import_zod.z.string(),
|
|
28
|
+
templateComplete: import_zod.z.boolean(),
|
|
29
|
+
templateData: import_zod.z.object({
|
|
30
|
+
ownerName: import_zod.z.string(),
|
|
31
|
+
repoName: import_zod.z.string(),
|
|
32
|
+
platformName: import_zod.z.union([import_zod.z.literal("amd64"), import_zod.z.literal("arm64")])
|
|
33
|
+
}).catchall(import_zod.z.string()),
|
|
34
|
+
templateName: import_zod.z.string()
|
|
35
|
+
});
|
|
36
|
+
const initConfigSchema = initConfigInputSchema.omit({
|
|
37
|
+
templateData: true
|
|
38
|
+
}).extend({
|
|
39
|
+
templateData: import_zod.z.object({
|
|
40
|
+
ownerName: import_zod.z.string(),
|
|
41
|
+
repoName: import_zod.z.string(),
|
|
52
42
|
// Derived from ownerName
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
// TODO: use zod to transform `InitConfigInput` -> `InitConfig`?
|
|
44
|
+
orgName: import_zod.z.string(),
|
|
45
|
+
teamName: import_zod.z.string(),
|
|
55
46
|
// Generated by init command
|
|
56
|
-
port:
|
|
57
|
-
}).
|
|
58
|
-
entryPoint:
|
|
59
|
-
type: import_manifest.
|
|
47
|
+
port: import_zod.z.string()
|
|
48
|
+
}).catchall(import_zod.z.string()),
|
|
49
|
+
entryPoint: import_zod.z.string().optional(),
|
|
50
|
+
type: import_manifest.projectTypeSchema.optional()
|
|
60
51
|
});
|
|
61
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
53
|
0 && (module.exports = {
|
|
63
|
-
|
|
54
|
+
initConfigInputSchema
|
|
64
55
|
});
|
|
65
56
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/init/types.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\n\nimport { projectTypeSchema } from '../../utils/manifest';\n\nexport type InitConfigInput = z.infer<typeof initConfigInputSchema>;\n\nexport const initConfigInputSchema = z.object({\n destinationDir: z.string(),\n templateComplete: z.boolean(),\n templateData: z\n .object({\n ownerName: z.string(),\n repoName: z.string(),\n platformName: z.union([z.literal('amd64'), z.literal('arm64')]),\n })\n .catchall(z.string()),\n templateName: z.string(),\n});\n\nexport type InitConfig = z.infer<typeof initConfigSchema>;\n\nconst initConfigSchema = initConfigInputSchema\n .omit({\n templateData: true,\n })\n .extend({\n templateData: z\n .object({\n ownerName: z.string(),\n repoName: z.string(),\n\n // Derived from ownerName\n // TODO: use zod to transform `InitConfigInput` -> `InitConfig`?\n orgName: z.string(),\n teamName: z.string(),\n\n // Generated by init command\n port: z.string(),\n })\n .catchall(z.string()),\n\n entryPoint: z.string().optional(),\n type: projectTypeSchema.optional(),\n });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAElB,sBAAkC;AAI3B,MAAM,wBAAwB,aAAE,OAAO;AAAA,EAC5C,gBAAgB,aAAE,OAAO;AAAA,EACzB,kBAAkB,aAAE,QAAQ;AAAA,EAC5B,cAAc,aACX,OAAO;AAAA,IACN,WAAW,aAAE,OAAO;AAAA,IACpB,UAAU,aAAE,OAAO;AAAA,IACnB,cAAc,aAAE,MAAM,CAAC,aAAE,QAAQ,OAAO,GAAG,aAAE,QAAQ,OAAO,CAAC,CAAC;AAAA,EAChE,CAAC,EACA,SAAS,aAAE,OAAO,CAAC;AAAA,EACtB,cAAc,aAAE,OAAO;AACzB,CAAC;AAID,MAAM,mBAAmB,sBACtB,KAAK;AAAA,EACJ,cAAc;AAChB,CAAC,EACA,OAAO;AAAA,EACN,cAAc,aACX,OAAO;AAAA,IACN,WAAW,aAAE,OAAO;AAAA,IACpB,UAAU,aAAE,OAAO;AAAA;AAAA;AAAA,IAInB,SAAS,aAAE,OAAO;AAAA,IAClB,UAAU,aAAE,OAAO;AAAA;AAAA,IAGnB,MAAM,aAAE,OAAO;AAAA,EACjB,CAAC,EACA,SAAS,aAAE,OAAO,CAAC;AAAA,EAEtB,YAAY,aAAE,OAAO,EAAE,SAAS;AAAA,EAChC,MAAM,kCAAkB,SAAS;AACnC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/error.d.ts
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { inspect } from 'util';
|
|
3
|
-
import
|
|
4
|
-
export type ConcurrentlyErrors =
|
|
5
|
-
export declare const
|
|
6
|
-
command:
|
|
7
|
-
command:
|
|
8
|
-
name:
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export type ConcurrentlyErrors = z.infer<typeof concurrentlyErrorsSchema>;
|
|
5
|
+
export declare const concurrentlyErrorsSchema: z.ZodArray<z.ZodObject<{
|
|
6
|
+
command: z.ZodObject<{
|
|
7
|
+
command: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name: string;
|
|
11
|
+
command: string;
|
|
12
|
+
}, {
|
|
13
|
+
name: string;
|
|
14
|
+
command: string;
|
|
15
|
+
}>;
|
|
16
|
+
index: z.ZodNumber;
|
|
17
|
+
exitCode: z.ZodNumber;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
index: number;
|
|
20
|
+
exitCode: number;
|
|
21
|
+
command: {
|
|
22
|
+
name: string;
|
|
23
|
+
command: string;
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
index: number;
|
|
27
|
+
exitCode: number;
|
|
28
|
+
command: {
|
|
29
|
+
name: string;
|
|
30
|
+
command: string;
|
|
31
|
+
};
|
|
32
|
+
}>, "many">;
|
|
13
33
|
/**
|
|
14
34
|
* Creates an error that returns its plain `message` rather than a full stack
|
|
15
35
|
* trace when `util.inspect`ed.
|
package/lib/utils/error.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,35 +15,27 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var error_exports = {};
|
|
30
20
|
__export(error_exports, {
|
|
31
|
-
|
|
21
|
+
concurrentlyErrorsSchema: () => concurrentlyErrorsSchema,
|
|
32
22
|
createTerseError: () => createTerseError,
|
|
33
23
|
handleCliError: () => handleCliError,
|
|
34
24
|
isErrorWithCode: () => isErrorWithCode
|
|
35
25
|
});
|
|
36
26
|
module.exports = __toCommonJS(error_exports);
|
|
37
27
|
var import_util = require("util");
|
|
38
|
-
var
|
|
28
|
+
var import_zod = require("zod");
|
|
39
29
|
var import_logging = require("./logging");
|
|
40
30
|
var import_validation = require("./validation");
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
command:
|
|
44
|
-
command:
|
|
45
|
-
name:
|
|
31
|
+
const concurrentlyErrorsSchema = import_zod.z.array(
|
|
32
|
+
import_zod.z.object({
|
|
33
|
+
command: import_zod.z.object({
|
|
34
|
+
command: import_zod.z.string(),
|
|
35
|
+
name: import_zod.z.string()
|
|
46
36
|
}),
|
|
47
|
-
index:
|
|
48
|
-
exitCode:
|
|
37
|
+
index: import_zod.z.number(),
|
|
38
|
+
exitCode: import_zod.z.number()
|
|
49
39
|
})
|
|
50
40
|
);
|
|
51
41
|
const createTerseError = (message) => Object.assign(new Error(message), {
|
|
@@ -64,7 +54,7 @@ const handleCliError = (err) => {
|
|
|
64
54
|
const isErrorWithCode = (err, code) => (0, import_validation.hasProp)(err, "code") && err.code === code;
|
|
65
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
56
|
0 && (module.exports = {
|
|
67
|
-
|
|
57
|
+
concurrentlyErrorsSchema,
|
|
68
58
|
createTerseError,
|
|
69
59
|
handleCliError,
|
|
70
60
|
isErrorWithCode
|
package/lib/utils/error.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/error.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport type { ExecaError } from 'execa';\nimport { z } from 'zod';\n\nimport { log } from './logging';\nimport { hasNumberProp, hasProp } from './validation';\n\nexport type ConcurrentlyErrors = z.infer<typeof concurrentlyErrorsSchema>;\n\nexport const concurrentlyErrorsSchema = z.array(\n z.object({\n command: z.object({\n command: z.string(),\n name: z.string(),\n }),\n index: z.number(),\n exitCode: z.number(),\n }),\n);\n\n/**\n * Creates an error that returns its plain `message` rather than a full stack\n * trace when `util.inspect`ed.\n *\n * This can be useful for terser handling and logging of known error scenarios\n * that have descriptive messages.\n *\n * https://nodejs.org/api/util.html#custom-inspection-functions-on-objects\n */\nexport const createTerseError = (message?: string) =>\n Object.assign(new Error(message), {\n [inspect.custom]: () => message,\n });\n\nconst isExecaError = (err: unknown): err is ExecaError =>\n hasNumberProp(err, 'exitCode');\n\nexport const handleCliError = (err: unknown) => {\n if (isExecaError(err)) {\n process.exitCode = err.exitCode;\n return;\n }\n\n log.err(inspect(err));\n process.exitCode = 1;\n return;\n};\n\nexport const isErrorWithCode = <T>(\n err: unknown,\n code: T,\n): err is Record<PropertyKey, unknown> & { code: T } =>\n hasProp(err, 'code') && err.code === code;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAGxB,iBAAkB;AAElB,qBAAoB;AACpB,wBAAuC;AAIhC,MAAM,2BAA2B,aAAE;AAAA,EACxC,aAAE,OAAO;AAAA,IACP,SAAS,aAAE,OAAO;AAAA,MAChB,SAAS,aAAE,OAAO;AAAA,MAClB,MAAM,aAAE,OAAO;AAAA,IACjB,CAAC;AAAA,IACD,OAAO,aAAE,OAAO;AAAA,IAChB,UAAU,aAAE,OAAO;AAAA,EACrB,CAAC;AACH;AAWO,MAAM,mBAAmB,CAAC,YAC/B,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;AAAA,EAChC,CAAC,oBAAQ,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,YACpB,iCAAc,KAAK,UAAU;AAExB,MAAM,iBAAiB,CAAC,QAAiB;AAC9C,MAAI,aAAa,GAAG,GAAG;AACrB,YAAQ,WAAW,IAAI;AACvB;AAAA,EACF;AAEA,qBAAI,QAAI,qBAAQ,GAAG,CAAC;AACpB,UAAQ,WAAW;AACnB;AACF;AAEO,MAAM,kBAAkB,CAC7B,KACA,aAEA,2BAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/exec.js
CHANGED
|
@@ -116,11 +116,11 @@ const execConcurrently = async (commands, { maxProcesses, nameLength, outputStre
|
|
|
116
116
|
}
|
|
117
117
|
).result;
|
|
118
118
|
} catch (err) {
|
|
119
|
-
const result = import_error.
|
|
119
|
+
const result = import_error.concurrentlyErrorsSchema.safeParse(err);
|
|
120
120
|
if (!result.success) {
|
|
121
121
|
throw err;
|
|
122
122
|
}
|
|
123
|
-
const failed = result.
|
|
123
|
+
const failed = result.data.filter(({ exitCode }) => exitCode !== 0).sort(({ index: indexA }, { index: indexB }) => indexA - indexB).map((subprocess) => subprocess.command.name);
|
|
124
124
|
throw Error(
|
|
125
125
|
`${failed.join(", ")} subprocess${failed.length === 1 ? "" : "es"} failed.`
|
|
126
126
|
);
|
package/lib/utils/exec.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/exec.ts"],
|
|
4
|
-
"sourcesContent": ["import { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\nimport type { Color } from 'chalk';\nimport concurrently from 'concurrently';\nimport execa, { type ExecaChildProcess } from 'execa';\nimport npmRunPath from 'npm-run-path';\nimport npmWhich from 'npm-which';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,oBAAmB;AACnB,kBAAiB;AAGjB,0BAAyB;AACzB,mBAA8C;AAC9C,0BAAuB;AACvB,uBAAqB;AAErB,
|
|
4
|
+
"sourcesContent": ["import { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\nimport type { Color } from 'chalk';\nimport concurrently from 'concurrently';\nimport execa, { type ExecaChildProcess } from 'execa';\nimport npmRunPath from 'npm-run-path';\nimport npmWhich from 'npm-which';\n\nimport { concurrentlyErrorsSchema, isErrorWithCode } from './error';\nimport { log } from './logging';\n\nclass YarnSpamFilter extends stream.Transform {\n silenced = false;\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Yarn spews the entire installed dependency tree after this message\n if (str.startsWith('info Direct dependencies')) {\n this.silenced = true;\n }\n\n if (\n !this.silenced &&\n // This isn't very useful given the command generates a lockfile\n !str.startsWith('info No lockfile found')\n ) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nclass YarnWarningFilter extends stream.Transform {\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Filter out annoying deprecation warnings that users can do little about\n if (!str.startsWith('warning skuba >')) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nexport type Exec = (\n command: string,\n ...args: string[]\n) => ExecaChildProcess<string>;\n\ninterface ExecConcurrentlyCommand {\n command: string;\n name: string;\n prefixColor?: typeof Color;\n}\n\ninterface ExecConcurrentlyOptions {\n /**\n * The maximum number of processes that can execute concurrently.\n *\n * Defaults to the CPU core count.\n */\n maxProcesses?: number;\n\n /**\n * A set length to pad names to.\n *\n * Defaults to the length of the longest command name.\n */\n nameLength?: number;\n\n /**\n * The stream that logging output will be written to.\n *\n * Defaults to `process.stdout`.\n */\n outputStream?: stream.Writable;\n}\n\ntype ExecOptions = execa.Options & { streamStdio?: true | 'yarn' };\n\nconst envWithPath = {\n PATH: npmRunPath({ cwd: __dirname }),\n};\n\nconst runCommand = (command: string, args: string[], opts?: ExecOptions) => {\n const subprocess = execa(command, args, {\n localDir: __dirname,\n preferLocal: true,\n stdio: 'inherit',\n ...opts,\n });\n\n switch (opts?.streamStdio) {\n case 'yarn':\n const stderrFilter = new YarnWarningFilter();\n const stdoutFilter = new YarnSpamFilter();\n\n subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);\n subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);\n\n break;\n\n case true:\n subprocess.stderr?.pipe(process.stderr);\n subprocess.stdout?.pipe(process.stdout);\n\n break;\n }\n\n return subprocess;\n};\n\nconst whichCallback = npmWhich(__dirname);\n\nconst which = util.promisify<string, string>(whichCallback);\n\nexport const createExec =\n (opts: ExecOptions): Exec =>\n (command, ...args) =>\n runCommand(command, args, opts);\n\nexport const exec: Exec = (command, ...args) => runCommand(command, args);\n\nexport const execConcurrently = async (\n commands: ExecConcurrentlyCommand[],\n { maxProcesses, nameLength, outputStream }: ExecConcurrentlyOptions = {},\n) => {\n const maxNameLength =\n nameLength ??\n commands.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n try {\n await concurrently(\n commands.map(({ command, name, prefixColor }) => ({\n command,\n env: envWithPath,\n name: name.padEnd(maxNameLength),\n prefixColor,\n })),\n {\n maxProcesses: maxProcesses ?? cpus().length,\n\n outputStream,\n\n // Use a minimalist logging prefix.\n prefix: '{name} \u2502',\n },\n ).result;\n } catch (err) {\n const result = concurrentlyErrorsSchema.safeParse(err);\n\n if (!result.success) {\n throw err;\n }\n\n const failed = result.data\n .filter(({ exitCode }) => exitCode !== 0)\n .sort(({ index: indexA }, { index: indexB }) => indexA - indexB)\n .map((subprocess) => subprocess.command.name);\n\n throw Error(\n `${failed.join(', ')} subprocess${\n failed.length === 1 ? '' : 'es'\n } failed.`,\n );\n }\n};\n\nexport const ensureCommands = async (...names: string[]) => {\n let success = true;\n\n await Promise.all(\n names.map(async (name) => {\n const result = await hasCommand(name);\n\n if (!result) {\n success = false;\n\n log.err(log.bold(name), 'needs to be installed.');\n }\n }),\n );\n\n if (!success) {\n process.exit(1);\n }\n};\n\nexport const hasCommand = async (name: string) => {\n try {\n await which(name);\n\n return true;\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return false;\n }\n\n throw err;\n }\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["stream", "npmRunPath", "execa", "npmWhich", "util", "concurrently"]
|
|
7
7
|
}
|
package/lib/utils/manifest.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';
|
|
2
|
-
import
|
|
3
|
-
export type ProjectType =
|
|
4
|
-
export declare const
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export type ProjectType = z.infer<typeof projectTypeSchema>;
|
|
4
|
+
export declare const projectTypeSchema: z.ZodUnion<[z.ZodLiteral<"application">, z.ZodLiteral<"package">]>;
|
|
5
5
|
export declare const PROJECT_TYPES: readonly ["application", "package"];
|
|
6
6
|
export declare const getSkubaManifest: () => Promise<NormalizedPackageJson>;
|
|
7
7
|
export declare const getConsumerManifest: () => Promise<readPkgUp.NormalizedReadResult | undefined>;
|
package/lib/utils/manifest.js
CHANGED
|
@@ -29,21 +29,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var manifest_exports = {};
|
|
30
30
|
__export(manifest_exports, {
|
|
31
31
|
PROJECT_TYPES: () => PROJECT_TYPES,
|
|
32
|
-
ProjectType: () => ProjectType,
|
|
33
32
|
getConsumerManifest: () => getConsumerManifest,
|
|
34
33
|
getEntryPointFromManifest: () => getEntryPointFromManifest,
|
|
35
34
|
getPropFromConsumerManifest: () => getPropFromConsumerManifest,
|
|
36
35
|
getSkubaManifest: () => getSkubaManifest,
|
|
37
|
-
getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest
|
|
36
|
+
getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest,
|
|
37
|
+
projectTypeSchema: () => projectTypeSchema
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(manifest_exports);
|
|
40
40
|
var import_read_pkg_up = __toESM(require("read-pkg-up"));
|
|
41
|
-
var
|
|
41
|
+
var import_zod = require("zod");
|
|
42
42
|
var import_validation = require("./validation");
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
);
|
|
43
|
+
const projectTypeSchema = import_zod.z.union([
|
|
44
|
+
import_zod.z.literal("application"),
|
|
45
|
+
import_zod.z.literal("package")
|
|
46
|
+
]);
|
|
47
47
|
const PROJECT_TYPES = ["application", "package"];
|
|
48
48
|
const DEFAULT_ENTRY_POINT = "src/app.ts";
|
|
49
49
|
let skubaManifest;
|
|
@@ -73,11 +73,11 @@ const getEntryPointFromManifest = async () => {
|
|
|
73
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
74
74
|
0 && (module.exports = {
|
|
75
75
|
PROJECT_TYPES,
|
|
76
|
-
ProjectType,
|
|
77
76
|
getConsumerManifest,
|
|
78
77
|
getEntryPointFromManifest,
|
|
79
78
|
getPropFromConsumerManifest,
|
|
80
79
|
getSkubaManifest,
|
|
81
|
-
getStringPropFromConsumerManifest
|
|
80
|
+
getStringPropFromConsumerManifest,
|
|
81
|
+
projectTypeSchema
|
|
82
82
|
});
|
|
83
83
|
//# sourceMappingURL=manifest.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/manifest.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport { z } from 'zod';\n\nimport { hasProp } from './validation';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = () => readPkgUp();\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,iBAAkB;AAElB,wBAAwB;AAIjB,MAAM,oBAAoB,aAAE,MAAM;AAAA,EACvC,aAAE,QAAQ,aAAa;AAAA,EACvB,aAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,UAAM,mBAAAA,SAAU;AAE5C,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
|
|
6
6
|
"names": ["readPkgUp"]
|
|
7
7
|
}
|
package/lib/utils/template.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
export declare const TEMPLATE_NAMES: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package"];
|
|
3
3
|
export type TemplateName = (typeof TEMPLATE_NAMES)[number];
|
|
4
4
|
export declare const TEMPLATE_NAMES_WITH_BYO: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package", "github →"];
|
|
@@ -17,18 +17,48 @@ interface TemplateDocumentationConfig {
|
|
|
17
17
|
filename: string;
|
|
18
18
|
}
|
|
19
19
|
export declare const TEMPLATE_DOCUMENTATION_CONFIG: Record<TemplateName, TemplateDocumentationConfig>;
|
|
20
|
-
export type TemplateConfig =
|
|
21
|
-
export declare const
|
|
22
|
-
fields:
|
|
23
|
-
name:
|
|
24
|
-
message:
|
|
25
|
-
initial:
|
|
26
|
-
validate:
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
export type TemplateConfig = z.infer<typeof templateConfigSchema>;
|
|
21
|
+
export declare const templateConfigSchema: z.ZodObject<{
|
|
22
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
message: z.ZodString;
|
|
25
|
+
initial: z.ZodString;
|
|
26
|
+
validate: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
message: string;
|
|
29
|
+
name: string;
|
|
30
|
+
initial: string;
|
|
31
|
+
validate?: ((args_0: string, ...args_1: unknown[]) => string | boolean) | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
message: string;
|
|
34
|
+
name: string;
|
|
35
|
+
initial: string;
|
|
36
|
+
validate?: ((args_0: string, ...args_1: unknown[]) => string | boolean) | undefined;
|
|
37
|
+
}>, "many">;
|
|
38
|
+
entryPoint: z.ZodOptional<z.ZodString>;
|
|
39
|
+
noSkip: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
type: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"application">, z.ZodLiteral<"package">]>>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
fields: {
|
|
43
|
+
message: string;
|
|
44
|
+
name: string;
|
|
45
|
+
initial: string;
|
|
46
|
+
validate?: ((args_0: string, ...args_1: unknown[]) => string | boolean) | undefined;
|
|
47
|
+
}[];
|
|
48
|
+
entryPoint?: string | undefined;
|
|
49
|
+
noSkip?: boolean | undefined;
|
|
50
|
+
type?: "package" | "application" | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
fields: {
|
|
53
|
+
message: string;
|
|
54
|
+
name: string;
|
|
55
|
+
initial: string;
|
|
56
|
+
validate?: ((args_0: string, ...args_1: unknown[]) => string | boolean) | undefined;
|
|
57
|
+
}[];
|
|
58
|
+
entryPoint?: string | undefined;
|
|
59
|
+
noSkip?: boolean | undefined;
|
|
60
|
+
type?: "package" | "application" | undefined;
|
|
61
|
+
}>;
|
|
32
62
|
export declare const TEMPLATE_CONFIG_FILENAME = "skuba.template.js";
|
|
33
63
|
export declare const TEMPLATE_DIR: string;
|
|
34
64
|
export declare const BASE_TEMPLATE_DIR: string;
|
package/lib/utils/template.js
CHANGED
|
@@ -34,14 +34,14 @@ __export(template_exports, {
|
|
|
34
34
|
TEMPLATE_DOCUMENTATION_CONFIG: () => TEMPLATE_DOCUMENTATION_CONFIG,
|
|
35
35
|
TEMPLATE_NAMES: () => TEMPLATE_NAMES,
|
|
36
36
|
TEMPLATE_NAMES_WITH_BYO: () => TEMPLATE_NAMES_WITH_BYO,
|
|
37
|
-
TemplateConfig: () => TemplateConfig,
|
|
38
37
|
ensureTemplateConfigDeletion: () => ensureTemplateConfigDeletion,
|
|
39
|
-
readBaseTemplateFile: () => readBaseTemplateFile
|
|
38
|
+
readBaseTemplateFile: () => readBaseTemplateFile,
|
|
39
|
+
templateConfigSchema: () => templateConfigSchema
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(template_exports);
|
|
42
42
|
var import_path = __toESM(require("path"));
|
|
43
43
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
44
|
-
var
|
|
44
|
+
var import_zod = require("zod");
|
|
45
45
|
var import_manifest = require("./manifest");
|
|
46
46
|
const TEMPLATE_NAMES = [
|
|
47
47
|
"express-rest-api",
|
|
@@ -83,18 +83,18 @@ const TEMPLATE_DOCUMENTATION_CONFIG = {
|
|
|
83
83
|
filename: "package.md"
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
const
|
|
87
|
-
fields:
|
|
88
|
-
|
|
89
|
-
name:
|
|
90
|
-
message:
|
|
91
|
-
initial:
|
|
92
|
-
validate:
|
|
86
|
+
const templateConfigSchema = import_zod.z.object({
|
|
87
|
+
fields: import_zod.z.array(
|
|
88
|
+
import_zod.z.object({
|
|
89
|
+
name: import_zod.z.string(),
|
|
90
|
+
message: import_zod.z.string(),
|
|
91
|
+
initial: import_zod.z.string(),
|
|
92
|
+
validate: import_zod.z.function().args(import_zod.z.string()).returns(import_zod.z.union([import_zod.z.boolean(), import_zod.z.string()])).optional()
|
|
93
93
|
})
|
|
94
94
|
),
|
|
95
|
-
entryPoint:
|
|
96
|
-
noSkip:
|
|
97
|
-
type: import_manifest.
|
|
95
|
+
entryPoint: import_zod.z.string().optional(),
|
|
96
|
+
noSkip: import_zod.z.boolean().optional(),
|
|
97
|
+
type: import_manifest.projectTypeSchema.optional()
|
|
98
98
|
});
|
|
99
99
|
const TEMPLATE_CONFIG_FILENAME = "skuba.template.js";
|
|
100
100
|
const TEMPLATE_DIR = import_path.default.join(__dirname, "..", "..", "template");
|
|
@@ -109,8 +109,8 @@ const readBaseTemplateFile = (src) => import_fs_extra.default.promises.readFile(
|
|
|
109
109
|
TEMPLATE_DOCUMENTATION_CONFIG,
|
|
110
110
|
TEMPLATE_NAMES,
|
|
111
111
|
TEMPLATE_NAMES_WITH_BYO,
|
|
112
|
-
TemplateConfig,
|
|
113
112
|
ensureTemplateConfigDeletion,
|
|
114
|
-
readBaseTemplateFile
|
|
113
|
+
readBaseTemplateFile,
|
|
114
|
+
templateConfigSchema
|
|
115
115
|
});
|
|
116
116
|
//# sourceMappingURL=template.js.map
|