-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypes.d.ts
148 lines (141 loc) · 3.62 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import type { Agent } from "@antfu/ni";
export interface EnvironmentData {
root: string;
workspace: string;
astroPath: string;
cwd: string;
env: ProcessEnv;
}
export interface RunOptions {
workspace: string;
root: string;
astroPath: string;
/**
* @default true
*/
verify?: boolean;
/**
* Whether to skip cloning and setting up the remote Git repository.
* @default false
*/
skipGit?: boolean;
/**
* Equivalent to setting a custom value for `astro` in the `overrides` option.
* Used by the `--release` CLI flag.
*/
release?: string;
/** The package manager to use to run commands. If not set, tries to detect this automatically. */
agent?: Agent;
/** One or more scripts to run in the repository to build/prepare the project. */
build?: Task | Task[];
/**
* One or more scripts to run in the repository to execute tests.
*
* These can range from very simple:
* ```js
* // runs the `test` script defined in `package.json` with the current package manager
* test: "test",
* ```
*
* To a more complex series steps:
* ```js
* test: [
* "node ./setup-script",
* "pnpm --filter package-A test",
* "pnpm --filter package-B type-check",
* ],
* ```
*/
test?: Task | Task[];
/** One or more scripts to run before installing dependencies. */
beforeInstall?: Task | Task[];
/** One or more scripts to run before building the project. */
beforeBuild?: Task | Task[];
/** One or more scripts to run before running tests. */
beforeTest?: Task | Task[];
}
type Task = string | { script: string; args?: string[] } | (() => Promise<any>);
export interface CommandOptions {
suites?: string[];
repo?: string;
branch?: string;
tag?: string;
commit?: string;
release?: string;
verify?: boolean;
skipGit?: boolean;
}
export interface RepoOptions {
/**
* A `username/repo` identifier or Git URL for the repository to test. Examples:
*
* - `"withastro/starlight"`
* - `"https://github.com/withastro/starlight.git"`
*
* The shorthand style is assumed to be hosted on GitHub. The URL could point to other Git hosts.
*/
repo: string;
/**
* A subdirectory of the cloned repository to `cd` into before running tests.
* @default undefined
*/
dir?: string;
/**
* The branch of the repository to test.
* @default "main"
*/
branch?: string;
/**
* A Git tag to check out for tests. Overrides the `branch` and `commit` options if set.
* @default undefined
*/
tag?: string;
/**
* A Git commit hash to check out for tests. Overrides the `branch` option if set.
* @default undefined
*/
commit?: string;
/**
* Whether the repository should be shallow or deep cloned.
* @default true
*/
shallow?: boolean;
/**
* A map of dependencies to override in the repository being tested.
*
* `astro` will be overridden by default and you can specify additional `@astrojs/*`
* packages to override here. For example:
*
* ```js
* {
* "@astrojs/internal-helpers": true,
* "@astrojs/markdown-remark": true,
* }
* ```
*
* An override can also be set to a custom path to the override to use, but usually the
* automatic behavior provided by setting `true` is sufficient.
*/
overrides?: Overrides;
}
export interface Overrides {
[key: string]: string | boolean;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
interface DependencyInfo {
from: string;
version: string;
resolved: string;
path: string;
}
interface PackageInfo {
name: string;
version: string;
path: string;
private: boolean;
dependencies: Record<string, DependencyInfo>;
devDependencies: Record<string, DependencyInfo>;
optionalDependencies: Record<string, DependencyInfo>;
}