alex-c-line 2.0.0 → 2.0.2
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 +16 -12
- package/dist/configs/index.cjs +16 -35
- package/dist/configs/index.d.cts +5 -5
- package/dist/configs/index.d.ts +5 -5
- package/dist/configs/index.js +4 -18
- package/dist/configs/internal/index.cjs +2 -7
- package/dist/configs/internal/index.d.cts +5 -5
- package/dist/configs/internal/index.d.ts +5 -7
- package/dist/configs/internal/index.js +1 -5
- package/dist/index.cjs +46 -175
- package/dist/index.js +40 -164
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://github.com/alextheman231/alex-c-line/actions/workflows/ci.yml)
|
|
8
8
|
[](https://github.com/alextheman231/alex-c-line/actions/workflows/publish.yml)
|
|
9
9
|
|
|
10
|
-
<img src="./
|
|
10
|
+
<img src="./media/alex-c-line.png" alt="alex-c-line artwork" width=250 height=250>
|
|
11
11
|
|
|
12
12
|
This is my command-line tool, which serves as a developer toolkit that can be used in any repository to streamline the developer workflow. It provides a flexible configuration system so you can customise its behaviour to match your workflow.
|
|
13
13
|
|
|
@@ -40,24 +40,24 @@ alex-c-line say-hello
|
|
|
40
40
|
Some commands may even take extra arguments. For example:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
alex-c-line
|
|
43
|
+
alex-c-line version increment v1.2.3 major
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Flags may also be passed through in the following way.
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
alex-c-line
|
|
49
|
+
alex-c-line version increment v1.2.3 major --no-prefix
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Note that for `
|
|
52
|
+
Note that for `local-package use` specifically, you will need to add `--` before the local `alex-c-line` arguments to ensure that all flags get passed through correctly. Example:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
alex-c-line
|
|
55
|
+
alex-c-line local-package use alex-c-line -- version increment v1.2.3 major --no-prefix
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Configs
|
|
59
59
|
|
|
60
|
-
Some commands also support usage of the config system. For example, `pre-commit
|
|
60
|
+
Some commands also support usage of the config system. For example, `pre-commit` supports the `alex-c-line.config.js` file, and `local-package use` supports the more user-specific `.alex-c-line.private.config.js` file. `alex-c-line.config.js` is intended for shared configurations per repository, whereas `.alex-c-line.private.config.js` are for configurations specific to the user's usage.
|
|
61
61
|
|
|
62
62
|
The `configs` subpath provides some helper functions and types that may be helpful when constructing these configs. Namely, `defineAlexCLineConfig` can be used as a type helper, so that you get better type hints in the editor.
|
|
63
63
|
|
|
@@ -65,9 +65,11 @@ The `configs` subpath provides some helper functions and types that may be helpf
|
|
|
65
65
|
import { defineAlexCLineConfig } from "alex-c-line/configs";
|
|
66
66
|
|
|
67
67
|
export default defineAlexCLineConfig({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
template: {
|
|
69
|
+
pullRequest: {
|
|
70
|
+
category: "general",
|
|
71
|
+
projectType: "package",
|
|
72
|
+
}
|
|
71
73
|
},
|
|
72
74
|
preCommit: {
|
|
73
75
|
packageManager: "pnpm",
|
|
@@ -84,9 +86,11 @@ import type { AlexCLineConfig } from "alex-c-line/configs";
|
|
|
84
86
|
import { scripts } from "./package.json" with { type: "json" };
|
|
85
87
|
|
|
86
88
|
const alexCLineConfig: AlexCLineConfig<keyof typeof scripts> = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
template: {
|
|
90
|
+
pullRequest: {
|
|
91
|
+
category: "general",
|
|
92
|
+
projectType: "package",
|
|
93
|
+
}
|
|
90
94
|
},
|
|
91
95
|
preCommit: {
|
|
92
96
|
packageManager: "pnpm",
|
package/dist/configs/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
20
16
|
}
|
|
21
17
|
return to;
|
|
22
18
|
};
|
|
@@ -24,13 +20,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
20
|
value: mod,
|
|
25
21
|
enumerable: true
|
|
26
22
|
}) : target, mod));
|
|
27
|
-
|
|
28
23
|
//#endregion
|
|
29
24
|
require("@alextheman/utility");
|
|
30
25
|
let zod = require("zod");
|
|
31
26
|
zod = __toESM(zod);
|
|
32
27
|
let _alextheman_utility_internal = require("@alextheman/utility/internal");
|
|
33
|
-
|
|
34
28
|
//#region src/configs/helpers/preCommit/definePreCommitConfig.ts
|
|
35
29
|
const preCommitStepOptionsSchema = zod.default.strictObject({ arguments: zod.default.array(zod.default.string()).optional() });
|
|
36
30
|
const preCommitConfigSchema = zod.default.strictObject({
|
|
@@ -49,7 +43,6 @@ const preCommitConfigSchema = zod.default.strictObject({
|
|
|
49
43
|
function definePreCommitConfig(config) {
|
|
50
44
|
return config;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
//#endregion
|
|
54
47
|
//#region src/configs/helpers/template/pullRequest/defineTemplatePullRequestSchema.ts
|
|
55
48
|
const templatePullRequestBaseSchema = zod.default.strictObject({ projectName: zod.default.string().optional() });
|
|
@@ -64,17 +57,13 @@ const templatePullRequestSchema = zod.default.discriminatedUnion("category", [te
|
|
|
64
57
|
function defineCreatePullRequestTemplateConfig(config) {
|
|
65
58
|
return config;
|
|
66
59
|
}
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/configs/helpers/defineAlexCLineConfig.ts
|
|
70
|
-
const alexCLineConfigSchema = zod.default.strictObject({
|
|
60
|
+
zod.default.strictObject({
|
|
71
61
|
preCommit: preCommitConfigSchema,
|
|
72
62
|
template: zod.default.object({ pullRequest: templatePullRequestSchema })
|
|
73
63
|
}).partial();
|
|
74
64
|
function defineAlexCLineConfig(config) {
|
|
75
65
|
return config;
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
//#endregion
|
|
79
68
|
//#region src/configs/types/ConfigFileName.ts
|
|
80
69
|
const ConfigFileName = {
|
|
@@ -82,17 +71,13 @@ const ConfigFileName = {
|
|
|
82
71
|
ES_MODULES_JAVASCRIPT: "alex-c-line.config.mjs",
|
|
83
72
|
COMMON_JS_JAVASCRIPT: "alex-c-line.config.cjs"
|
|
84
73
|
};
|
|
85
|
-
|
|
86
74
|
//#endregion
|
|
87
75
|
//#region src/configs/types/template/pullRequest/PullRequestTemplateCategory.ts
|
|
88
76
|
const PullRequestTemplateCategory = {
|
|
89
77
|
GENERAL: "general",
|
|
90
78
|
INFRASTRUCTURE: "infrastructure"
|
|
91
79
|
};
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/configs/helpers/defineAlexCLinePrivateConfig.ts
|
|
95
|
-
const alexCLinePrivateConfigSchema = zod.default.object({ localPackage: zod.default.strictObject({
|
|
80
|
+
zod.default.object({ localPackage: zod.default.strictObject({
|
|
96
81
|
enableCache: zod.default.boolean().optional(),
|
|
97
82
|
localPackages: zod.default.record(zod.default.string(), zod.default.strictObject({
|
|
98
83
|
packageManager: zod.default.enum(_alextheman_utility_internal.PackageManager),
|
|
@@ -105,25 +90,21 @@ const alexCLinePrivateConfigSchema = zod.default.object({ localPackage: zod.defa
|
|
|
105
90
|
function defineAlexCLinePrivateConfig(config) {
|
|
106
91
|
return config;
|
|
107
92
|
}
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/configs/helpers/preCommit/definePreCommitPrivateConfig.ts
|
|
111
|
-
const preCommitPrivateConfigSchema = zod.default.strictObject({ disableSteps: zod.default.array(zod.default.string()).optional() });
|
|
93
|
+
zod.default.strictObject({ disableSteps: zod.default.array(zod.default.string()).optional() });
|
|
112
94
|
function definePreCommitPrivateConfig(config) {
|
|
113
95
|
return config;
|
|
114
96
|
}
|
|
115
|
-
|
|
116
97
|
//#endregion
|
|
117
98
|
exports.ConfigFileName = ConfigFileName;
|
|
118
|
-
Object.defineProperty(exports,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
99
|
+
Object.defineProperty(exports, "DependencyGroup", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function() {
|
|
102
|
+
return _alextheman_utility_internal.DependencyGroup;
|
|
103
|
+
}
|
|
123
104
|
});
|
|
124
105
|
exports.PullRequestTemplateCategory = PullRequestTemplateCategory;
|
|
125
106
|
exports.defineAlexCLineConfig = defineAlexCLineConfig;
|
|
126
107
|
exports.defineAlexCLinePrivateConfig = defineAlexCLinePrivateConfig;
|
|
127
108
|
exports.defineCreatePullRequestTemplateConfig = defineCreatePullRequestTemplateConfig;
|
|
128
109
|
exports.definePreCommitConfig = definePreCommitConfig;
|
|
129
|
-
exports.definePreCommitPrivateConfig = definePreCommitPrivateConfig;
|
|
110
|
+
exports.definePreCommitPrivateConfig = definePreCommitPrivateConfig;
|
package/dist/configs/index.d.cts
CHANGED
|
@@ -9,14 +9,14 @@ interface BaseOptions {
|
|
|
9
9
|
}
|
|
10
10
|
interface StepRunner<ExecaOptions extends Options = BaseOptions> {
|
|
11
11
|
<NewOpts extends Options>(options: NewOpts): StepRunner<ExecaOptions & NewOpts>;
|
|
12
|
-
(command: string, args?:
|
|
13
|
-
(strings: TemplateStringsArray, ...interpolations: TemplateExpression
|
|
12
|
+
(command: string, args?: ReadonlyArray<string>): Promise<Result<ExecaOptions>>;
|
|
13
|
+
(strings: TemplateStringsArray, ...interpolations: Array<TemplateExpression>): Promise<Result<ExecaOptions>>;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/configs/types/preCommit/PreCommitConfig.d.ts
|
|
17
17
|
interface PreCommitStepOptions {
|
|
18
18
|
/** Arguments to pass to the given script */
|
|
19
|
-
arguments?: string
|
|
19
|
+
arguments?: Array<string>;
|
|
20
20
|
}
|
|
21
21
|
type StepFunction = (stepRunner: StepRunner) => void | Promise<void>;
|
|
22
22
|
interface PreCommitConfig<ScriptName extends string = string> {
|
|
@@ -25,7 +25,7 @@ interface PreCommitConfig<ScriptName extends string = string> {
|
|
|
25
25
|
/** Allow the hook to run even if there are no staged changes. */
|
|
26
26
|
allowNoStagedChanges?: boolean;
|
|
27
27
|
/** The steps to run in the pre-commit hook. */
|
|
28
|
-
steps:
|
|
28
|
+
steps: Array<StepFunction | ScriptName | [ScriptName, PreCommitStepOptions]>;
|
|
29
29
|
/** Update the git index after the run */
|
|
30
30
|
updateIndex?: boolean;
|
|
31
31
|
}
|
|
@@ -96,7 +96,7 @@ declare function definePreCommitConfig<ScriptName extends string = string>(confi
|
|
|
96
96
|
//#region src/configs/types/preCommit/PreCommitPrivateConfig.d.ts
|
|
97
97
|
interface PreCommitPrivateConfig<ScriptName extends string = string> {
|
|
98
98
|
/** List of script names to skip */
|
|
99
|
-
disableSteps?: ScriptName
|
|
99
|
+
disableSteps?: Array<ScriptName>;
|
|
100
100
|
}
|
|
101
101
|
//#endregion
|
|
102
102
|
//#region src/configs/helpers/preCommit/definePreCommitPrivateConfig.d.ts
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ interface BaseOptions {
|
|
|
10
10
|
}
|
|
11
11
|
interface StepRunner<ExecaOptions extends Options = BaseOptions> {
|
|
12
12
|
<NewOpts extends Options>(options: NewOpts): StepRunner<ExecaOptions & NewOpts>;
|
|
13
|
-
(command: string, args?:
|
|
14
|
-
(strings: TemplateStringsArray, ...interpolations: TemplateExpression
|
|
13
|
+
(command: string, args?: ReadonlyArray<string>): Promise<Result<ExecaOptions>>;
|
|
14
|
+
(strings: TemplateStringsArray, ...interpolations: Array<TemplateExpression>): Promise<Result<ExecaOptions>>;
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/configs/types/preCommit/PreCommitConfig.d.ts
|
|
18
18
|
interface PreCommitStepOptions {
|
|
19
19
|
/** Arguments to pass to the given script */
|
|
20
|
-
arguments?: string
|
|
20
|
+
arguments?: Array<string>;
|
|
21
21
|
}
|
|
22
22
|
type StepFunction = (stepRunner: StepRunner) => void | Promise<void>;
|
|
23
23
|
interface PreCommitConfig<ScriptName extends string = string> {
|
|
@@ -26,7 +26,7 @@ interface PreCommitConfig<ScriptName extends string = string> {
|
|
|
26
26
|
/** Allow the hook to run even if there are no staged changes. */
|
|
27
27
|
allowNoStagedChanges?: boolean;
|
|
28
28
|
/** The steps to run in the pre-commit hook. */
|
|
29
|
-
steps:
|
|
29
|
+
steps: Array<StepFunction | ScriptName | [ScriptName, PreCommitStepOptions]>;
|
|
30
30
|
/** Update the git index after the run */
|
|
31
31
|
updateIndex?: boolean;
|
|
32
32
|
}
|
|
@@ -97,7 +97,7 @@ declare function definePreCommitConfig<ScriptName extends string = string>(confi
|
|
|
97
97
|
//#region src/configs/types/preCommit/PreCommitPrivateConfig.d.ts
|
|
98
98
|
interface PreCommitPrivateConfig<ScriptName extends string = string> {
|
|
99
99
|
/** List of script names to skip */
|
|
100
|
-
disableSteps?: ScriptName
|
|
100
|
+
disableSteps?: Array<ScriptName>;
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region src/configs/helpers/preCommit/definePreCommitPrivateConfig.d.ts
|
package/dist/configs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "@alextheman/utility";
|
|
2
2
|
import z from "zod";
|
|
3
3
|
import { DependencyGroup, PackageManager } from "@alextheman/utility/internal";
|
|
4
|
-
|
|
5
4
|
//#region src/configs/helpers/preCommit/definePreCommitConfig.ts
|
|
6
5
|
const preCommitStepOptionsSchema = z.strictObject({ arguments: z.array(z.string()).optional() });
|
|
7
6
|
const preCommitConfigSchema = z.strictObject({
|
|
@@ -20,7 +19,6 @@ const preCommitConfigSchema = z.strictObject({
|
|
|
20
19
|
function definePreCommitConfig(config) {
|
|
21
20
|
return config;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
23
|
//#region src/configs/helpers/template/pullRequest/defineTemplatePullRequestSchema.ts
|
|
26
24
|
const templatePullRequestBaseSchema = z.strictObject({ projectName: z.string().optional() });
|
|
@@ -35,17 +33,13 @@ const templatePullRequestSchema = z.discriminatedUnion("category", [templatePull
|
|
|
35
33
|
function defineCreatePullRequestTemplateConfig(config) {
|
|
36
34
|
return config;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/configs/helpers/defineAlexCLineConfig.ts
|
|
41
|
-
const alexCLineConfigSchema = z.strictObject({
|
|
36
|
+
z.strictObject({
|
|
42
37
|
preCommit: preCommitConfigSchema,
|
|
43
38
|
template: z.object({ pullRequest: templatePullRequestSchema })
|
|
44
39
|
}).partial();
|
|
45
40
|
function defineAlexCLineConfig(config) {
|
|
46
41
|
return config;
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
//#endregion
|
|
50
44
|
//#region src/configs/types/ConfigFileName.ts
|
|
51
45
|
const ConfigFileName = {
|
|
@@ -53,17 +47,13 @@ const ConfigFileName = {
|
|
|
53
47
|
ES_MODULES_JAVASCRIPT: "alex-c-line.config.mjs",
|
|
54
48
|
COMMON_JS_JAVASCRIPT: "alex-c-line.config.cjs"
|
|
55
49
|
};
|
|
56
|
-
|
|
57
50
|
//#endregion
|
|
58
51
|
//#region src/configs/types/template/pullRequest/PullRequestTemplateCategory.ts
|
|
59
52
|
const PullRequestTemplateCategory = {
|
|
60
53
|
GENERAL: "general",
|
|
61
54
|
INFRASTRUCTURE: "infrastructure"
|
|
62
55
|
};
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/configs/helpers/defineAlexCLinePrivateConfig.ts
|
|
66
|
-
const alexCLinePrivateConfigSchema = z.object({ localPackage: z.strictObject({
|
|
56
|
+
z.object({ localPackage: z.strictObject({
|
|
67
57
|
enableCache: z.boolean().optional(),
|
|
68
58
|
localPackages: z.record(z.string(), z.strictObject({
|
|
69
59
|
packageManager: z.enum(PackageManager),
|
|
@@ -76,13 +66,9 @@ const alexCLinePrivateConfigSchema = z.object({ localPackage: z.strictObject({
|
|
|
76
66
|
function defineAlexCLinePrivateConfig(config) {
|
|
77
67
|
return config;
|
|
78
68
|
}
|
|
79
|
-
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/configs/helpers/preCommit/definePreCommitPrivateConfig.ts
|
|
82
|
-
const preCommitPrivateConfigSchema = z.strictObject({ disableSteps: z.array(z.string()).optional() });
|
|
69
|
+
z.strictObject({ disableSteps: z.array(z.string()).optional() });
|
|
83
70
|
function definePreCommitPrivateConfig(config) {
|
|
84
71
|
return config;
|
|
85
72
|
}
|
|
86
|
-
|
|
87
73
|
//#endregion
|
|
88
|
-
export { ConfigFileName, DependencyGroup, PullRequestTemplateCategory, defineAlexCLineConfig, defineAlexCLinePrivateConfig, defineCreatePullRequestTemplateConfig, definePreCommitConfig, definePreCommitPrivateConfig };
|
|
74
|
+
export { ConfigFileName, DependencyGroup, PullRequestTemplateCategory, defineAlexCLineConfig, defineAlexCLinePrivateConfig, defineCreatePullRequestTemplateConfig, definePreCommitConfig, definePreCommitPrivateConfig };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
2
|
//#region src/configs/internal/alexCLineConfig.ts
|
|
4
3
|
const alexCLineConfig = {
|
|
5
4
|
preCommit: {
|
|
@@ -16,7 +15,6 @@ const alexCLineConfig = {
|
|
|
16
15
|
projectType: "package"
|
|
17
16
|
} }
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
//#endregion
|
|
21
19
|
//#region src/configs/internal/infrastructureConfig.ts
|
|
22
20
|
const infrastructureConfig = {
|
|
@@ -36,7 +34,6 @@ const infrastructureConfig = {
|
|
|
36
34
|
requireConfirmationFrom: "AlexMan123456"
|
|
37
35
|
} }
|
|
38
36
|
};
|
|
39
|
-
|
|
40
37
|
//#endregion
|
|
41
38
|
//#region src/configs/internal/packageConfig.ts
|
|
42
39
|
function packageConfig(steps = [
|
|
@@ -56,7 +53,6 @@ function packageConfig(steps = [
|
|
|
56
53
|
} }
|
|
57
54
|
};
|
|
58
55
|
}
|
|
59
|
-
|
|
60
56
|
//#endregion
|
|
61
57
|
//#region src/configs/internal/testConfig.ts
|
|
62
58
|
const testConfig = {
|
|
@@ -70,9 +66,8 @@ const testConfig = {
|
|
|
70
66
|
projectType: "package"
|
|
71
67
|
} }
|
|
72
68
|
};
|
|
73
|
-
|
|
74
69
|
//#endregion
|
|
75
70
|
exports.alexCLineConfig = alexCLineConfig;
|
|
76
71
|
exports.infrastructureConfig = infrastructureConfig;
|
|
77
72
|
exports.packageConfig = packageConfig;
|
|
78
|
-
exports.testConfig = testConfig;
|
|
73
|
+
exports.testConfig = testConfig;
|
|
@@ -8,14 +8,14 @@ interface BaseOptions {
|
|
|
8
8
|
}
|
|
9
9
|
interface StepRunner<ExecaOptions extends Options = BaseOptions> {
|
|
10
10
|
<NewOpts extends Options>(options: NewOpts): StepRunner<ExecaOptions & NewOpts>;
|
|
11
|
-
(command: string, args?:
|
|
12
|
-
(strings: TemplateStringsArray, ...interpolations: TemplateExpression
|
|
11
|
+
(command: string, args?: ReadonlyArray<string>): Promise<Result<ExecaOptions>>;
|
|
12
|
+
(strings: TemplateStringsArray, ...interpolations: Array<TemplateExpression>): Promise<Result<ExecaOptions>>;
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/configs/types/preCommit/PreCommitConfig.d.ts
|
|
16
16
|
interface PreCommitStepOptions {
|
|
17
17
|
/** Arguments to pass to the given script */
|
|
18
|
-
arguments?: string
|
|
18
|
+
arguments?: Array<string>;
|
|
19
19
|
}
|
|
20
20
|
type StepFunction = (stepRunner: StepRunner) => void | Promise<void>;
|
|
21
21
|
interface PreCommitConfig<ScriptName extends string = string> {
|
|
@@ -24,7 +24,7 @@ interface PreCommitConfig<ScriptName extends string = string> {
|
|
|
24
24
|
/** Allow the hook to run even if there are no staged changes. */
|
|
25
25
|
allowNoStagedChanges?: boolean;
|
|
26
26
|
/** The steps to run in the pre-commit hook. */
|
|
27
|
-
steps:
|
|
27
|
+
steps: Array<StepFunction | ScriptName | [ScriptName, PreCommitStepOptions]>;
|
|
28
28
|
/** Update the git index after the run */
|
|
29
29
|
updateIndex?: boolean;
|
|
30
30
|
}
|
|
@@ -114,7 +114,7 @@ declare const PreCommitStep: {
|
|
|
114
114
|
type PreCommitStep = "build" | "format" | "lint" | "test";
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/configs/internal/packageConfig.d.ts
|
|
117
|
-
declare function packageConfig<ScriptName extends string = PreCommitStep>(steps?:
|
|
117
|
+
declare function packageConfig<ScriptName extends string = PreCommitStep>(steps?: Array<StepFunction | ScriptName | PreCommitStep | [ScriptName | PreCommitStep, PreCommitStepOptions]>): AlexCLineConfig<PreCommitStep>;
|
|
118
118
|
//#endregion
|
|
119
119
|
//#region src/configs/internal/testConfig.d.ts
|
|
120
120
|
declare const testConfig: AlexCLineConfig<"artwork">;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { PackageManager } from "@alextheman/utility/internal";
|
|
2
2
|
import { Options, Result, TemplateExpression } from "execa";
|
|
3
|
-
import "@alextheman/utility";
|
|
4
|
-
|
|
5
3
|
//#region src/cli/commands/root/pre-commit/createStepRunner.d.ts
|
|
6
4
|
interface BaseOptions {
|
|
7
5
|
stdio: "inherit";
|
|
@@ -9,14 +7,14 @@ interface BaseOptions {
|
|
|
9
7
|
}
|
|
10
8
|
interface StepRunner<ExecaOptions extends Options = BaseOptions> {
|
|
11
9
|
<NewOpts extends Options>(options: NewOpts): StepRunner<ExecaOptions & NewOpts>;
|
|
12
|
-
(command: string, args?:
|
|
13
|
-
(strings: TemplateStringsArray, ...interpolations: TemplateExpression
|
|
10
|
+
(command: string, args?: ReadonlyArray<string>): Promise<Result<ExecaOptions>>;
|
|
11
|
+
(strings: TemplateStringsArray, ...interpolations: Array<TemplateExpression>): Promise<Result<ExecaOptions>>;
|
|
14
12
|
}
|
|
15
13
|
//#endregion
|
|
16
14
|
//#region src/configs/types/preCommit/PreCommitConfig.d.ts
|
|
17
15
|
interface PreCommitStepOptions {
|
|
18
16
|
/** Arguments to pass to the given script */
|
|
19
|
-
arguments?: string
|
|
17
|
+
arguments?: Array<string>;
|
|
20
18
|
}
|
|
21
19
|
type StepFunction = (stepRunner: StepRunner) => void | Promise<void>;
|
|
22
20
|
interface PreCommitConfig<ScriptName extends string = string> {
|
|
@@ -25,7 +23,7 @@ interface PreCommitConfig<ScriptName extends string = string> {
|
|
|
25
23
|
/** Allow the hook to run even if there are no staged changes. */
|
|
26
24
|
allowNoStagedChanges?: boolean;
|
|
27
25
|
/** The steps to run in the pre-commit hook. */
|
|
28
|
-
steps:
|
|
26
|
+
steps: Array<StepFunction | ScriptName | [ScriptName, PreCommitStepOptions]>;
|
|
29
27
|
/** Update the git index after the run */
|
|
30
28
|
updateIndex?: boolean;
|
|
31
29
|
}
|
|
@@ -115,7 +113,7 @@ declare const PreCommitStep: {
|
|
|
115
113
|
type PreCommitStep = "build" | "format" | "lint" | "test";
|
|
116
114
|
//#endregion
|
|
117
115
|
//#region src/configs/internal/packageConfig.d.ts
|
|
118
|
-
declare function packageConfig<ScriptName extends string = PreCommitStep>(steps?:
|
|
116
|
+
declare function packageConfig<ScriptName extends string = PreCommitStep>(steps?: Array<StepFunction | ScriptName | PreCommitStep | [ScriptName | PreCommitStep, PreCommitStepOptions]>): AlexCLineConfig<PreCommitStep>;
|
|
119
117
|
//#endregion
|
|
120
118
|
//#region src/configs/internal/testConfig.d.ts
|
|
121
119
|
declare const testConfig: AlexCLineConfig<"artwork">;
|
|
@@ -14,7 +14,6 @@ const alexCLineConfig = {
|
|
|
14
14
|
projectType: "package"
|
|
15
15
|
} }
|
|
16
16
|
};
|
|
17
|
-
|
|
18
17
|
//#endregion
|
|
19
18
|
//#region src/configs/internal/infrastructureConfig.ts
|
|
20
19
|
const infrastructureConfig = {
|
|
@@ -34,7 +33,6 @@ const infrastructureConfig = {
|
|
|
34
33
|
requireConfirmationFrom: "AlexMan123456"
|
|
35
34
|
} }
|
|
36
35
|
};
|
|
37
|
-
|
|
38
36
|
//#endregion
|
|
39
37
|
//#region src/configs/internal/packageConfig.ts
|
|
40
38
|
function packageConfig(steps = [
|
|
@@ -54,7 +52,6 @@ function packageConfig(steps = [
|
|
|
54
52
|
} }
|
|
55
53
|
};
|
|
56
54
|
}
|
|
57
|
-
|
|
58
55
|
//#endregion
|
|
59
56
|
//#region src/configs/internal/testConfig.ts
|
|
60
57
|
const testConfig = {
|
|
@@ -68,6 +65,5 @@ const testConfig = {
|
|
|
68
65
|
projectType: "package"
|
|
69
66
|
} }
|
|
70
67
|
};
|
|
71
|
-
|
|
72
68
|
//#endregion
|
|
73
|
-
export { alexCLineConfig, infrastructureConfig, packageConfig, testConfig };
|
|
69
|
+
export { alexCLineConfig, infrastructureConfig, packageConfig, testConfig };
|