eleventy-test 0.1.0 → 0.1.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/dist/index.d.ts +2 -2
- package/dist/index.js +16 -16
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ScenarioOutput from "./ScenarioOutput";
|
|
2
2
|
export * from "./eleventyUtils";
|
|
3
|
-
export declare function buildScenarios(projectRoot: string, returnArray?: true): Promise<ScenarioOutput[]>;
|
|
4
|
-
export declare function buildScenarios(projectRoot: string, returnArray?: false): Promise<{
|
|
3
|
+
export declare function buildScenarios(projectRoot: string, returnArray?: true, scenariosDir?: string, globalInputDir?: string): Promise<ScenarioOutput[]>;
|
|
4
|
+
export declare function buildScenarios(projectRoot: string, returnArray?: false, scenariosDir?: string, globalInputDir?: string): Promise<{
|
|
5
5
|
[key: string]: ScenarioOutput;
|
|
6
6
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -81,25 +81,28 @@ var ScenarioOutput = class {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// src/eleventyUtils.ts
|
|
84
|
+
function installEleventy(eleventyVersion, cwd3, command) {
|
|
85
|
+
try {
|
|
86
|
+
(0, import_child_process.execSync)(`${command} @11ty/eleventy${eleventyVersion}@npm:@11ty/eleventy@${eleventyVersion}`, { cwd: cwd3 });
|
|
87
|
+
} catch (e) {
|
|
88
|
+
console.error(`Couldn't install eleventy ${eleventyVersion} using yarn`);
|
|
89
|
+
throw e;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
84
92
|
function ensureEleventyExists(projectRoot, eleventyVersion) {
|
|
85
93
|
const eleventyDir = (0, import_path2.join)(projectRoot, "node_modules/@11ty/eleventy" + eleventyVersion);
|
|
86
94
|
if ((0, import_fs2.existsSync)(eleventyDir)) {
|
|
87
95
|
return eleventyDir;
|
|
88
96
|
} else {
|
|
89
|
-
console.log(
|
|
97
|
+
console.log(`Eleventy version ${eleventyVersion} could not be found. Installing...`);
|
|
90
98
|
if ((0, import_fs2.existsSync)((0, import_path2.join)(projectRoot, "package-lock.json"))) {
|
|
91
|
-
|
|
99
|
+
installEleventy(eleventyVersion, projectRoot, "npm install --save-dev");
|
|
92
100
|
} else if ((0, import_fs2.existsSync)((0, import_path2.join)(projectRoot, "yarn.lock"))) {
|
|
93
|
-
|
|
94
|
-
(0, import_child_process.execSync)(`yarn add -D @11ty/eleventy${eleventyVersion}@npm:@11ty/eleventy@${eleventyVersion}`, { cwd: projectRoot });
|
|
95
|
-
} catch (e) {
|
|
96
|
-
console.error(`Couldn't install eleventy ${eleventyVersion} using yarn`);
|
|
97
|
-
throw e;
|
|
98
|
-
}
|
|
99
|
-
return eleventyDir;
|
|
101
|
+
installEleventy(eleventyVersion, projectRoot, "yarn add -D");
|
|
100
102
|
} else {
|
|
101
|
-
throw new Error(
|
|
103
|
+
throw new Error(`Error while installing eleventy${eleventyVersion}: Could not determine package manager`);
|
|
102
104
|
}
|
|
105
|
+
return eleventyDir;
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
async function buildEleventy({
|
|
@@ -145,13 +148,10 @@ async function buildEleventy({
|
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
// src/index.ts
|
|
148
|
-
|
|
149
|
-
var DIR_SCENARIOS = (0, import_path3.join)(DIR_BASE, "scenarios");
|
|
150
|
-
var DIR_INPUT = (0, import_path3.join)(DIR_BASE, "input");
|
|
151
|
-
async function buildScenarios(projectRoot = (0, import_process2.cwd)(), returnArray = true) {
|
|
151
|
+
async function buildScenarios(projectRoot = (0, import_process2.cwd)(), returnArray = true, scenariosDir = "tests/scenarios/", globalInputDir = "tests/input") {
|
|
152
152
|
return new Promise(async (resolve, reject) => {
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
scenariosDir = (0, import_path3.join)(projectRoot, scenariosDir);
|
|
154
|
+
globalInputDir = (0, import_fs3.existsSync)((0, import_path3.join)(projectRoot, globalInputDir)) ? (0, import_path3.join)(projectRoot, globalInputDir) : "undefined";
|
|
155
155
|
const scenarioDirs = (0, import_fs3.readdirSync)(scenariosDir);
|
|
156
156
|
const scenarioOutputs = [];
|
|
157
157
|
for (let i = 0; i < scenarioDirs.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Multi-configuration testing for Eleventy plugins",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/Denperidge/eleventy-test.git",
|
|
7
7
|
"author": "Denperidge",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/*"
|
|
11
|
+
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"start": "node dist/index.js",
|
|
12
14
|
"watch": "npm-run-all --parallel 'build:js --watch' 'build:types -w'",
|
|
13
|
-
"build": "
|
|
15
|
+
"build": "npm-run-all --serial build:js build:types",
|
|
14
16
|
"build:js": "esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node",
|
|
15
17
|
"build:types": "tsc --declaration src/index.ts --emitDeclarationOnly --outDir ./dist",
|
|
16
18
|
"test": "ava tests/test.mjs --timeout=30s"
|
|
@@ -27,4 +29,4 @@
|
|
|
27
29
|
"npm-run-all": "^4.1.5",
|
|
28
30
|
"typescript": "^5.7.2"
|
|
29
31
|
}
|
|
30
|
-
}
|
|
32
|
+
}
|