@atomicsmash/init-testing 1.0.0-beta.3 → 1.0.0-beta.4
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/cli.js +33 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -123,12 +123,37 @@ await Promise.all([
|
|
|
123
123
|
console.log(result.status === "fulfilled" ? result.value : result.reason);
|
|
124
124
|
});
|
|
125
125
|
}),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/
|
|
133
|
-
|
|
126
|
+
readFile(`${process.cwd()}/.gitignore`)
|
|
127
|
+
.then((data) => {
|
|
128
|
+
return data.toString().split("\n");
|
|
129
|
+
})
|
|
130
|
+
.then((fileLines) => {
|
|
131
|
+
const linesToAddToGitignore = [
|
|
132
|
+
"/test-results/",
|
|
133
|
+
"/playwright-report/",
|
|
134
|
+
"/blob-report/",
|
|
135
|
+
"/playwright/.cache/",
|
|
136
|
+
];
|
|
137
|
+
for (const line of linesToAddToGitignore) {
|
|
138
|
+
if (fileLines.includes(line)) {
|
|
139
|
+
linesToAddToGitignore.splice(linesToAddToGitignore.indexOf(line), 1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return linesToAddToGitignore;
|
|
143
|
+
})
|
|
144
|
+
.then(async (linesToAddToGitignore) => {
|
|
145
|
+
if (linesToAddToGitignore.length === 0) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
await appendFile(`${process.cwd()}/.gitignore`, `\n# Testing tools\n${linesToAddToGitignore.join(`\n`)}`);
|
|
149
|
+
return true;
|
|
150
|
+
})
|
|
151
|
+
.then((wasFileUpdated) => {
|
|
152
|
+
if (wasFileUpdated) {
|
|
153
|
+
console.log(".gitignore updated");
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
console.log(".gitignore not updated as all values are already in the file.");
|
|
157
|
+
}
|
|
158
|
+
}),
|
|
134
159
|
]);
|