@atomicsmash/init-testing 1.0.0-beta.4 → 1.0.0-beta.6
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 +11 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -128,24 +128,28 @@ await Promise.all([
|
|
|
128
128
|
return data.toString().split("\n");
|
|
129
129
|
})
|
|
130
130
|
.then((fileLines) => {
|
|
131
|
-
const
|
|
131
|
+
const linesToCheck = [
|
|
132
132
|
"/test-results/",
|
|
133
133
|
"/playwright-report/",
|
|
134
134
|
"/blob-report/",
|
|
135
135
|
"/playwright/.cache/",
|
|
136
136
|
];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
const linesToAddToGitignore = [];
|
|
138
|
+
for (const line of linesToCheck) {
|
|
139
|
+
if (!fileLines.includes(line)) {
|
|
140
|
+
linesToAddToGitignore.push(line);
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
return
|
|
143
|
+
return {
|
|
144
|
+
linesToAddToGitignore,
|
|
145
|
+
fileEndsWithEmptyLine: fileLines.at(-1) === "",
|
|
146
|
+
};
|
|
143
147
|
})
|
|
144
|
-
.then(async (linesToAddToGitignore) => {
|
|
148
|
+
.then(async ({ linesToAddToGitignore, fileEndsWithEmptyLine }) => {
|
|
145
149
|
if (linesToAddToGitignore.length === 0) {
|
|
146
150
|
return false;
|
|
147
151
|
}
|
|
148
|
-
await appendFile(`${process.cwd()}/.gitignore`,
|
|
152
|
+
await appendFile(`${process.cwd()}/.gitignore`, `${fileEndsWithEmptyLine ? "\n" : "\n\n"}# Testing tools\n${linesToAddToGitignore.join(`\n`)}\n`);
|
|
149
153
|
return true;
|
|
150
154
|
})
|
|
151
155
|
.then((wasFileUpdated) => {
|