@wp-tester/config 0.1.2 → 0.1.3
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/config.d.ts.map +1 -1
- package/dist/config.js +16 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/options/ci.d.ts +10 -0
- package/dist/options/ci.d.ts.map +1 -0
- package/dist/options/ci.js +429 -0
- package/dist/options/ci.js.map +1 -0
- package/dist/options/index.d.ts +7 -0
- package/dist/options/index.d.ts.map +1 -1
- package/dist/options/index.js +5 -0
- package/dist/options/index.js.map +1 -1
- package/dist/resolved-types.d.ts +10 -3
- package/dist/resolved-types.d.ts.map +1 -1
- package/dist/schema.json +3 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wp-tester-config.d.ts +4 -2
- package/dist/wp-tester-config.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAuH,MAAM,kBAAkB,CAAC;AAWpL,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,GAAG,MAAM,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAqOjC"}
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile } from "fs/promises";
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
|
+
import { dirname, join } from "path";
|
|
3
4
|
import { getProjectRootMount } from "./auto-mount.js";
|
|
4
5
|
import { detectProjectType } from "./options/project-type-detect.js";
|
|
5
6
|
import { getProjectDir, resolveAbsolute, normalizeConfigPath } from "./path-utils.js";
|
|
@@ -53,8 +54,8 @@ export async function resolveConfig(config) {
|
|
|
53
54
|
other: true,
|
|
54
55
|
};
|
|
55
56
|
const reporters = {
|
|
56
|
-
...(resolvedConfig.reporters ?? {}),
|
|
57
57
|
default: undefined, // Will be set below
|
|
58
|
+
json: undefined, // Will be set below if configured
|
|
58
59
|
};
|
|
59
60
|
// Normalize default reporter:
|
|
60
61
|
// - `true` or empty object `{}` -> apply default options (show all)
|
|
@@ -75,6 +76,20 @@ export async function resolveConfig(config) {
|
|
|
75
76
|
// Object with specific options -> use as-is
|
|
76
77
|
reporters.default = inputDefault;
|
|
77
78
|
}
|
|
79
|
+
// Resolve JSON reporter if configured
|
|
80
|
+
const inputJson = resolvedConfig.reporters?.json;
|
|
81
|
+
if (inputJson) {
|
|
82
|
+
// Get config directory for default output path
|
|
83
|
+
const configDir = configPath ? dirname(configPath) : projectDir;
|
|
84
|
+
const defaultOutputFile = join(configDir, "wp-tester-results.json");
|
|
85
|
+
const resolvedJson = {
|
|
86
|
+
...inputJson,
|
|
87
|
+
outputFile: inputJson.outputFile
|
|
88
|
+
? resolveAbsolute(inputJson.outputFile, configDir)
|
|
89
|
+
: defaultOutputFile,
|
|
90
|
+
};
|
|
91
|
+
reporters.json = resolvedJson;
|
|
92
|
+
}
|
|
78
93
|
// Expand environments with version arrays into multiple environments
|
|
79
94
|
const expandedEnvironments = await expandEnvironments(resolvedConfig.environments, projectDir);
|
|
80
95
|
// Resolve environments: convert ExpandedEnvironment[] to ResolvedEnvironment[]
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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cAAc,CAAC,KAAK,EACpB,WAAW,CACZ,CAAC;IAEF,wDAAwD;IACxD,OAAO;QACL,GAAG,cAAc;QACjB,WAAW;QACX,WAAW;QACX,SAAS;QACT,YAAY,EAAE,oBAAoB;QAClC,KAAK,EAAE,aAAa;KACrB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { WPTesterConfig, EnvironmentVariables, Environment, Tests, PHPUnitConfig, TestType, Reporters, BaseReporterOptions, DefaultReporterOptions, Mount, Blueprint, JsonReporterOptions, WatchConfig, } from "./types.js";
|
|
2
|
-
export type { ResolvedEnvironment, ResolvedWPTesterConfig, ResolvedPHPUnitConfig, ResolvedTests, ResolvedBlueprint, ResolvedReporters, ResolvedPath, } from './resolved-types.js';
|
|
2
|
+
export type { ResolvedEnvironment, ResolvedWPTesterConfig, ResolvedPHPUnitConfig, ResolvedTests, ResolvedBlueprint, ResolvedReporters, ResolvedJsonReporterOptions, ResolvedPath, } from './resolved-types.js';
|
|
3
3
|
export { resolveConfig, } from "./config.js";
|
|
4
4
|
export { readConfigFile, writeConfigFile, getDefaultConfig, isConfigWritable, } from "./config-file.js";
|
|
5
5
|
export { configPath, getSchemaPath, getProjectDir, getConfigDir, getConfigPath, normalizeConfigPath, resolveAbsolute, getWorkingDirectory, toResolvedPath, } from "./path-utils.js";
|
|
@@ -11,5 +11,6 @@ export type { ProjectType } from './options/project-type-detect.js';
|
|
|
11
11
|
export { optionNames, optionMap, setupOptions, type OptionName, type ConfigOption, type ConfigOptionContext } from './options/index.js';
|
|
12
12
|
export { smokeTestsOption } from './options/smoke-tests.js';
|
|
13
13
|
export { phpunitOption } from './options/phpunit.js';
|
|
14
|
+
export { ciOption } from './options/ci.js';
|
|
14
15
|
export { findPhpUnitConfig, findPhpUnitExecutable, parseBootstrapPath } from './options/phpunit-detect.js';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
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MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,5 +10,6 @@ export { hostToVfs, vfsToHost } from './path-mappers.js';
|
|
|
10
10
|
export { optionNames, optionMap, setupOptions } from './options/index.js';
|
|
11
11
|
export { smokeTestsOption } from './options/smoke-tests.js';
|
|
12
12
|
export { phpunitOption } from './options/phpunit.js';
|
|
13
|
+
export { ciOption } from './options/ci.js';
|
|
13
14
|
export { findPhpUnitConfig, findPhpUnitExecutable, parseBootstrapPath } from './options/phpunit-detect.js';
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,YAAY;AACZ,OAAO,EACL,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,EAClB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,kBAAkB,GAEnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGtD,UAAU;AACV,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAgE,MAAM,iBAAiB,CAAC;AACrI,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WPTesterConfig } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* CI config option
|
|
4
|
+
* Creates a GitHub Action workflow for running wp-tester
|
|
5
|
+
*/
|
|
6
|
+
export declare function ciOption(config: WPTesterConfig, context?: {
|
|
7
|
+
configPath?: string;
|
|
8
|
+
skipPrompt?: boolean;
|
|
9
|
+
}): Promise<WPTesterConfig>;
|
|
10
|
+
//# sourceMappingURL=ci.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/options/ci.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAwR/C;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACtD,OAAO,CAAC,cAAc,CAAC,CA8NzB"}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import * as clack from "@clack/prompts";
|
|
2
|
+
import { mkdir, writeFile, access, readFile } from "fs/promises";
|
|
3
|
+
import { join, dirname, relative } from "path";
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
import pc from "picocolors";
|
|
6
|
+
import { getProjectDir } from "../path-utils.js";
|
|
7
|
+
const WORKFLOW_PATH = ".github/workflows/wp-tester.yml";
|
|
8
|
+
/**
|
|
9
|
+
* Check if the project is a git repository
|
|
10
|
+
*/
|
|
11
|
+
function isGitRepo(projectPath) {
|
|
12
|
+
try {
|
|
13
|
+
execSync("git rev-parse --git-dir", {
|
|
14
|
+
cwd: projectPath,
|
|
15
|
+
encoding: "utf8",
|
|
16
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
17
|
+
});
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the root directory of the git repository
|
|
26
|
+
* @param projectPath - Starting directory to search from
|
|
27
|
+
* @returns Absolute path to git root, or null if not in a git repo
|
|
28
|
+
*/
|
|
29
|
+
function getGitRoot(projectPath) {
|
|
30
|
+
try {
|
|
31
|
+
const result = execSync("git rev-parse --show-toplevel", {
|
|
32
|
+
cwd: projectPath,
|
|
33
|
+
encoding: "utf8",
|
|
34
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
35
|
+
});
|
|
36
|
+
return result.trim();
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Detect the default branch name from git
|
|
44
|
+
*/
|
|
45
|
+
function detectDefaultBranch(projectPath) {
|
|
46
|
+
try {
|
|
47
|
+
// Try to get the default branch from remote HEAD
|
|
48
|
+
const result = execSync("git symbolic-ref refs/remotes/origin/HEAD", {
|
|
49
|
+
cwd: projectPath,
|
|
50
|
+
encoding: "utf8",
|
|
51
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
52
|
+
}).trim();
|
|
53
|
+
// Result is like "refs/remotes/origin/main"
|
|
54
|
+
const branch = result.split("/").pop();
|
|
55
|
+
if (branch) {
|
|
56
|
+
return branch;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Remote HEAD not set, try other methods
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
// Check which common branch names exist locally
|
|
64
|
+
const branches = execSync("git branch --list main master trunk", {
|
|
65
|
+
cwd: projectPath,
|
|
66
|
+
encoding: "utf8",
|
|
67
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
68
|
+
}).trim();
|
|
69
|
+
// Parse branch list and return first match
|
|
70
|
+
const branchList = branches
|
|
71
|
+
.split("\n")
|
|
72
|
+
.map((b) => b.replace("*", "").trim())
|
|
73
|
+
.filter((b) => b.length > 0);
|
|
74
|
+
if (branchList.includes("main"))
|
|
75
|
+
return "main";
|
|
76
|
+
if (branchList.includes("master"))
|
|
77
|
+
return "master";
|
|
78
|
+
if (branchList.includes("trunk"))
|
|
79
|
+
return "trunk";
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Git command failed
|
|
83
|
+
}
|
|
84
|
+
// Default to "main"
|
|
85
|
+
return "main";
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Extract configuration from existing workflow
|
|
89
|
+
*/
|
|
90
|
+
function extractConfigFromWorkflow(content) {
|
|
91
|
+
const config = {};
|
|
92
|
+
// Extract branches
|
|
93
|
+
const branchMatch = content.match(/branches:\s*\[([^\]]+)\]/);
|
|
94
|
+
if (branchMatch) {
|
|
95
|
+
config.branches = branchMatch[1]
|
|
96
|
+
.split(",")
|
|
97
|
+
.map((b) => b.trim().replace(/['"]/g, ""))
|
|
98
|
+
.filter((b) => b.length > 0);
|
|
99
|
+
}
|
|
100
|
+
// Extract Node.js version
|
|
101
|
+
const nodeMatch = content.match(/node-version:\s*['"]?(\d+)['"]?/);
|
|
102
|
+
if (nodeMatch) {
|
|
103
|
+
config.nodeVersion = nodeMatch[1];
|
|
104
|
+
}
|
|
105
|
+
// Check if caching is enabled
|
|
106
|
+
config.enableCaching = content.includes("actions/cache@");
|
|
107
|
+
// Extract wp-tester args
|
|
108
|
+
const argsMatch = content.match(/npx\s+(?:@wp-tester\/cli|wp-tester)(?:@\S+)?\s+test\s*(.*?)(?:\s*\$\{\{|$)/m);
|
|
109
|
+
if (argsMatch && argsMatch[1]) {
|
|
110
|
+
config.wpTesterArgs = argsMatch[1].trim();
|
|
111
|
+
}
|
|
112
|
+
return config;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Generate the GitHub Action workflow content
|
|
116
|
+
*/
|
|
117
|
+
function generateWorkflowContent(config) {
|
|
118
|
+
const { branches, nodeVersion, enableCaching, wpTesterArgs } = config;
|
|
119
|
+
// Clean up args - split by whitespace for multi-line formatting
|
|
120
|
+
const argsArray = wpTesterArgs
|
|
121
|
+
.split(/\s+/)
|
|
122
|
+
.map((arg) => arg.trim())
|
|
123
|
+
.filter((arg) => arg.length > 0);
|
|
124
|
+
const branchList = branches.join(", ");
|
|
125
|
+
const cacheStep = enableCaching
|
|
126
|
+
? `
|
|
127
|
+
- name: Cache node modules
|
|
128
|
+
uses: actions/cache@v4
|
|
129
|
+
with:
|
|
130
|
+
path: ~/.npm
|
|
131
|
+
key: \${{ runner.os }}-node-\${{ hashFiles('**/package-lock.json') }}
|
|
132
|
+
restore-keys: |
|
|
133
|
+
\${{ runner.os }}-node-
|
|
134
|
+
`
|
|
135
|
+
: "";
|
|
136
|
+
return `# WP Tester - WordPress Testing Workflow
|
|
137
|
+
# This workflow runs wp-tester to test your WordPress plugin/theme
|
|
138
|
+
#
|
|
139
|
+
# For more information, see: https://github.com/bgrgicak/wp-tester
|
|
140
|
+
#
|
|
141
|
+
# Configuration:
|
|
142
|
+
# - Branches: ${branchList}
|
|
143
|
+
# - Node.js: ${nodeVersion}
|
|
144
|
+
# - Caching: ${enableCaching ? "enabled" : "disabled"}
|
|
145
|
+
#
|
|
146
|
+
# To customize:
|
|
147
|
+
# - Add arguments like --test=phpunit or --failed-only
|
|
148
|
+
# - See 'npx wp-tester --help' for all available options
|
|
149
|
+
|
|
150
|
+
name: WP Tester
|
|
151
|
+
|
|
152
|
+
on:
|
|
153
|
+
push:
|
|
154
|
+
branches: [${branchList}]
|
|
155
|
+
pull_request:
|
|
156
|
+
branches: [${branchList}]
|
|
157
|
+
workflow_dispatch:
|
|
158
|
+
inputs:
|
|
159
|
+
wp-tester-args:
|
|
160
|
+
description: 'Additional arguments for wp-tester'
|
|
161
|
+
required: false
|
|
162
|
+
default: ''
|
|
163
|
+
|
|
164
|
+
jobs:
|
|
165
|
+
test:
|
|
166
|
+
name: WP Tester
|
|
167
|
+
runs-on: ubuntu-latest
|
|
168
|
+
|
|
169
|
+
steps:
|
|
170
|
+
- name: Checkout code
|
|
171
|
+
uses: actions/checkout@v4
|
|
172
|
+
|
|
173
|
+
- name: Setup Node.js
|
|
174
|
+
uses: actions/setup-node@v4
|
|
175
|
+
with:
|
|
176
|
+
node-version: '${nodeVersion}'
|
|
177
|
+
${cacheStep}
|
|
178
|
+
- name: Run WP Tester
|
|
179
|
+
run: >
|
|
180
|
+
npx @wp-tester/cli@latest test${argsArray.length > 0 ? `\n ${argsArray.join("\n ")}` : ""}
|
|
181
|
+
\${{ github.event.inputs.wp-tester-args }}
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Check if workflow file already exists
|
|
186
|
+
*/
|
|
187
|
+
async function workflowExists(projectPath) {
|
|
188
|
+
try {
|
|
189
|
+
await access(join(projectPath, WORKFLOW_PATH));
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Read existing workflow file
|
|
198
|
+
*/
|
|
199
|
+
async function readExistingWorkflow(projectPath) {
|
|
200
|
+
try {
|
|
201
|
+
const content = await readFile(join(projectPath, WORKFLOW_PATH), "utf8");
|
|
202
|
+
return content;
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Display success message with workflow details
|
|
210
|
+
*/
|
|
211
|
+
function displaySuccessMessage(workflowPath, config) {
|
|
212
|
+
const relativePath = relative(process.cwd(), workflowPath) || workflowPath;
|
|
213
|
+
const branchInfo = config.branches.length === 1
|
|
214
|
+
? `Triggers on push/PR to '${config.branches[0]}' branch`
|
|
215
|
+
: `Triggers on: ${config.branches.join(", ")}`;
|
|
216
|
+
const cacheInfo = config.enableCaching ? " with caching" : "";
|
|
217
|
+
const message = `${pc.cyan(relativePath)}
|
|
218
|
+
|
|
219
|
+
${branchInfo}
|
|
220
|
+
Node.js ${config.nodeVersion}${cacheInfo}
|
|
221
|
+
You can also trigger it manually from GitHub Actions.`;
|
|
222
|
+
clack.note(message, pc.green("✓ GitHub Action created successfully!"));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Display configuration help
|
|
226
|
+
*/
|
|
227
|
+
function displayConfigHelp() {
|
|
228
|
+
const helpText = `
|
|
229
|
+
${pc.bold("wp-tester CLI Arguments")}
|
|
230
|
+
|
|
231
|
+
${pc.cyan("Common options:")}
|
|
232
|
+
--test=<type> Run specific tests: wp, plugin, theme, phpunit
|
|
233
|
+
--passWithNoTests Allow passing when no tests found
|
|
234
|
+
|
|
235
|
+
Press enter to run tests using default options.
|
|
236
|
+
`;
|
|
237
|
+
clack.note(helpText, "Configuration Help");
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* CI config option
|
|
241
|
+
* Creates a GitHub Action workflow for running wp-tester
|
|
242
|
+
*/
|
|
243
|
+
export async function ciOption(config, context) {
|
|
244
|
+
const configPath = context?.configPath;
|
|
245
|
+
const skipPrompt = context?.skipPrompt ?? false;
|
|
246
|
+
const projectPath = getProjectDir(config, configPath);
|
|
247
|
+
// Check if this is a git repository and get the git root
|
|
248
|
+
if (!isGitRepo(projectPath)) {
|
|
249
|
+
clack.log.warn("This directory is not a git repository. GitHub Actions require git.");
|
|
250
|
+
const continueAnyway = await clack.confirm({
|
|
251
|
+
message: "Continue anyway?",
|
|
252
|
+
initialValue: false,
|
|
253
|
+
});
|
|
254
|
+
if (clack.isCancel(continueAnyway) || !continueAnyway) {
|
|
255
|
+
return config;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Get the git root directory - this is where the workflow should be stored
|
|
259
|
+
const gitRoot = getGitRoot(projectPath);
|
|
260
|
+
const workflowBasePath = gitRoot || projectPath;
|
|
261
|
+
// Check if user wants to set up CI
|
|
262
|
+
if (!skipPrompt) {
|
|
263
|
+
const setupCI = await clack.select({
|
|
264
|
+
message: "Would you like to create a GitHub Action for automated testing?",
|
|
265
|
+
options: [
|
|
266
|
+
{
|
|
267
|
+
value: true,
|
|
268
|
+
label: "Yes",
|
|
269
|
+
hint: "Create .github/workflows/wp-tester.yml",
|
|
270
|
+
},
|
|
271
|
+
{ value: false, label: "No", hint: "Skip CI setup" },
|
|
272
|
+
],
|
|
273
|
+
initialValue: true,
|
|
274
|
+
});
|
|
275
|
+
if (clack.isCancel(setupCI)) {
|
|
276
|
+
clack.cancel("Setup cancelled.");
|
|
277
|
+
process.exit(0);
|
|
278
|
+
}
|
|
279
|
+
if (!setupCI) {
|
|
280
|
+
return config;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Default configuration
|
|
284
|
+
let workflowConfig = {
|
|
285
|
+
branches: [detectDefaultBranch(workflowBasePath)],
|
|
286
|
+
nodeVersion: "20",
|
|
287
|
+
enableCaching: true,
|
|
288
|
+
wpTesterArgs: "",
|
|
289
|
+
};
|
|
290
|
+
// Check if workflow already exists
|
|
291
|
+
const exists = await workflowExists(workflowBasePath);
|
|
292
|
+
if (exists) {
|
|
293
|
+
const existingContent = await readExistingWorkflow(workflowBasePath);
|
|
294
|
+
if (existingContent) {
|
|
295
|
+
const extracted = extractConfigFromWorkflow(existingContent);
|
|
296
|
+
workflowConfig = {
|
|
297
|
+
...workflowConfig,
|
|
298
|
+
...extracted,
|
|
299
|
+
branches: extracted.branches || workflowConfig.branches,
|
|
300
|
+
wpTesterArgs: extracted.wpTesterArgs || "",
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
const overwrite = await clack.select({
|
|
304
|
+
message: `${WORKFLOW_PATH} already exists. What would you like to do?`,
|
|
305
|
+
options: [
|
|
306
|
+
{
|
|
307
|
+
value: "edit",
|
|
308
|
+
label: "Edit configuration",
|
|
309
|
+
hint: "Modify settings (preserves detected values)",
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
value: "overwrite",
|
|
313
|
+
label: "Overwrite with defaults",
|
|
314
|
+
hint: "Start fresh with default configuration",
|
|
315
|
+
},
|
|
316
|
+
{ value: "skip", label: "Keep existing", hint: "Don't make changes" },
|
|
317
|
+
],
|
|
318
|
+
initialValue: "edit",
|
|
319
|
+
});
|
|
320
|
+
if (clack.isCancel(overwrite)) {
|
|
321
|
+
clack.cancel("Setup cancelled.");
|
|
322
|
+
process.exit(0);
|
|
323
|
+
}
|
|
324
|
+
if (overwrite === "skip") {
|
|
325
|
+
clack.log.info("Keeping existing workflow file.");
|
|
326
|
+
return config;
|
|
327
|
+
}
|
|
328
|
+
if (overwrite === "overwrite") {
|
|
329
|
+
workflowConfig = {
|
|
330
|
+
branches: [detectDefaultBranch(workflowBasePath)],
|
|
331
|
+
nodeVersion: "20",
|
|
332
|
+
enableCaching: true,
|
|
333
|
+
wpTesterArgs: "",
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// Configure branches
|
|
338
|
+
const branchInput = await clack.text({
|
|
339
|
+
message: "Target branches for CI triggers (comma-separated):",
|
|
340
|
+
initialValue: workflowConfig.branches.join(", "),
|
|
341
|
+
placeholder: "main, develop",
|
|
342
|
+
validate: (value) => {
|
|
343
|
+
if (!value || value.trim().length === 0) {
|
|
344
|
+
return "At least one branch is required";
|
|
345
|
+
}
|
|
346
|
+
return undefined;
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
if (clack.isCancel(branchInput)) {
|
|
350
|
+
clack.cancel("Setup cancelled.");
|
|
351
|
+
process.exit(0);
|
|
352
|
+
}
|
|
353
|
+
workflowConfig.branches = branchInput
|
|
354
|
+
.split(",")
|
|
355
|
+
.map((b) => b.trim())
|
|
356
|
+
.filter((b) => b.length > 0);
|
|
357
|
+
// Configure Node.js version
|
|
358
|
+
const nodeVersion = await clack.select({
|
|
359
|
+
message: "Node.js version:",
|
|
360
|
+
options: [
|
|
361
|
+
{ value: "22", label: "22 (Latest LTS)", hint: "Recommended" },
|
|
362
|
+
{ value: "20", label: "20 (LTS)" },
|
|
363
|
+
{ value: "18", label: "18 (Maintenance LTS)" },
|
|
364
|
+
],
|
|
365
|
+
initialValue: workflowConfig.nodeVersion,
|
|
366
|
+
});
|
|
367
|
+
if (clack.isCancel(nodeVersion)) {
|
|
368
|
+
clack.cancel("Setup cancelled.");
|
|
369
|
+
process.exit(0);
|
|
370
|
+
}
|
|
371
|
+
workflowConfig.nodeVersion = nodeVersion;
|
|
372
|
+
// Configure caching
|
|
373
|
+
const enableCaching = await clack.confirm({
|
|
374
|
+
message: "Enable npm caching for faster builds?",
|
|
375
|
+
initialValue: workflowConfig.enableCaching,
|
|
376
|
+
});
|
|
377
|
+
if (clack.isCancel(enableCaching)) {
|
|
378
|
+
clack.cancel("Setup cancelled.");
|
|
379
|
+
process.exit(0);
|
|
380
|
+
}
|
|
381
|
+
workflowConfig.enableCaching = enableCaching;
|
|
382
|
+
// Show help for wp-tester arguments
|
|
383
|
+
displayConfigHelp();
|
|
384
|
+
// Configure wp-tester arguments
|
|
385
|
+
const argsInput = await clack.text({
|
|
386
|
+
message: "wp-tester arguments (press Enter for defaults):",
|
|
387
|
+
placeholder: "e.g., --test=phpunit --failed-only",
|
|
388
|
+
initialValue: workflowConfig.wpTesterArgs,
|
|
389
|
+
});
|
|
390
|
+
if (clack.isCancel(argsInput)) {
|
|
391
|
+
clack.cancel("Setup cancelled.");
|
|
392
|
+
process.exit(0);
|
|
393
|
+
}
|
|
394
|
+
workflowConfig.wpTesterArgs =
|
|
395
|
+
typeof argsInput === "string" ? argsInput.trim() : "";
|
|
396
|
+
// Generate workflow content
|
|
397
|
+
const workflowContent = generateWorkflowContent(workflowConfig);
|
|
398
|
+
// Show preview
|
|
399
|
+
clack.note(pc.dim(workflowContent), "Workflow Preview");
|
|
400
|
+
// Confirm creation
|
|
401
|
+
const confirmCreate = await clack.confirm({
|
|
402
|
+
message: "Create this workflow?",
|
|
403
|
+
initialValue: true,
|
|
404
|
+
});
|
|
405
|
+
if (clack.isCancel(confirmCreate) || !confirmCreate) {
|
|
406
|
+
clack.log.info("Workflow creation cancelled.");
|
|
407
|
+
return config;
|
|
408
|
+
}
|
|
409
|
+
// Create directory and file with spinner
|
|
410
|
+
const workflowFullPath = join(workflowBasePath, WORKFLOW_PATH);
|
|
411
|
+
const workflowDir = dirname(workflowFullPath);
|
|
412
|
+
const spinner = clack.spinner();
|
|
413
|
+
spinner.start("Creating workflow file...");
|
|
414
|
+
try {
|
|
415
|
+
await mkdir(workflowDir, { recursive: true });
|
|
416
|
+
await writeFile(workflowFullPath, workflowContent, "utf8");
|
|
417
|
+
spinner.stop("Workflow file created!");
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
421
|
+
spinner.stop("Failed to create workflow file");
|
|
422
|
+
clack.log.error(`Error: ${message}`);
|
|
423
|
+
process.exit(1);
|
|
424
|
+
}
|
|
425
|
+
// Display success message
|
|
426
|
+
displaySuccessMessage(workflowFullPath, workflowConfig);
|
|
427
|
+
return config;
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=ci.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci.js","sourceRoot":"","sources":["../../src/options/ci.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EA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gBAAgB,EAAE,cAAc,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/options/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { projectRootOption } from './project-root.js';
|
|
|
3
3
|
import { projectTypeOption } from './project-type.js';
|
|
4
4
|
import { smokeTestsOption } from './smoke-tests.js';
|
|
5
5
|
import { phpunitOption } from './phpunit.js';
|
|
6
|
+
import { ciOption } from './ci.js';
|
|
6
7
|
export interface ConfigOptionContext {
|
|
7
8
|
configPath?: string;
|
|
8
9
|
[key: string]: unknown;
|
|
@@ -29,6 +30,12 @@ declare const optionMapInternal: {
|
|
|
29
30
|
configPath: string;
|
|
30
31
|
};
|
|
31
32
|
};
|
|
33
|
+
ci: {
|
|
34
|
+
handler: typeof ciOption;
|
|
35
|
+
getContext: (configPath: string) => {
|
|
36
|
+
configPath: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
32
39
|
};
|
|
33
40
|
export declare const optionMap: Record<string, ConfigOptionDefinition>;
|
|
34
41
|
export type OptionName = keyof typeof optionMapInternal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9G,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,mBAAmB,CAAC;CAC1D;AAED,QAAA,MAAM,iBAAiB;;;;;;;;;;;;iCAYM,MAAM;;;;;;;iCAIN,MAAM;;;;CAEe,CAAC;AAEnD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAqB,CAAC;AAEnF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAExD,eAAO,MAAM,WAAW,EAAqC,KAAK,CAAC,UAAU,CAAC,CAAC;AAE/E,eAAO,MAAM,YAAY,gBAAmD,CAAC"}
|
package/dist/options/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { projectRootOption } from './project-root.js';
|
|
|
2
2
|
import { projectTypeOption } from './project-type.js';
|
|
3
3
|
import { smokeTestsOption } from './smoke-tests.js';
|
|
4
4
|
import { phpunitOption } from './phpunit.js';
|
|
5
|
+
import { ciOption } from './ci.js';
|
|
5
6
|
const optionMapInternal = {
|
|
6
7
|
'project-root': {
|
|
7
8
|
handler: projectRootOption,
|
|
@@ -15,6 +16,10 @@ const optionMapInternal = {
|
|
|
15
16
|
'phpunit': {
|
|
16
17
|
handler: phpunitOption,
|
|
17
18
|
getContext: (configPath) => ({ promptIfNotDetected: true, configPath }),
|
|
19
|
+
},
|
|
20
|
+
'ci': {
|
|
21
|
+
handler: ciOption,
|
|
22
|
+
getContext: (configPath) => ({ configPath }),
|
|
18
23
|
}
|
|
19
24
|
};
|
|
20
25
|
export const optionMap = optionMapInternal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAchC,MAAM,iBAAiB,GAAG;IACxB,cAAc,EAAE;QACd,OAAO,EAAE,iBAAiB;KAC3B;IACD,cAAc,EAAE;QACd,OAAO,EAAE,iBAAiB;KAC3B;IACD,aAAa,EAAE;QACb,OAAO,EAAE,gBAAgB;KAC1B;IACD,SAAS,EAAE;QACT,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;KAChF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;KACrD;CAC+C,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAA2C,iBAAiB,CAAC;AAInF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAsB,CAAC;AAE/E,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/resolved-types.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { BlueprintV1Declaration } from "@wp-playground/blueprints";
|
|
2
|
-
import type { Mount, Tests, Environment, WPTesterConfig, TestMode, ProjectType, BaseReporterOptions
|
|
2
|
+
import type { Mount, Tests, Environment, WPTesterConfig, TestMode, ProjectType, BaseReporterOptions } from "./wp-tester-config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolved JSON reporter options with required outputFile.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResolvedJsonReporterOptions extends BaseReporterOptions {
|
|
7
|
+
/** Absolute path where the JSON report file will be written */
|
|
8
|
+
outputFile: string;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Resolved reporters configuration.
|
|
5
12
|
* Supports boolean shorthand for default reporter (true = enable with defaults).
|
|
@@ -7,8 +14,8 @@ import type { Mount, Tests, Environment, WPTesterConfig, TestMode, ProjectType,
|
|
|
7
14
|
export interface ResolvedReporters {
|
|
8
15
|
/** Default reporter options (supports boolean shorthand: true = enable with defaults) */
|
|
9
16
|
default?: boolean | BaseReporterOptions;
|
|
10
|
-
/** JSON reporter options */
|
|
11
|
-
json?:
|
|
17
|
+
/** JSON reporter options with resolved outputFile path */
|
|
18
|
+
json?: ResolvedJsonReporterOptions;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* Resolved PHPUnit configuration with resolved paths and required testMode.
|