@specwright/plugin 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/install.sh +62 -12
- package/package.json +1 -1
package/install.sh
CHANGED
|
@@ -112,6 +112,61 @@ echo "📦 Step 5: Installing documentation..."
|
|
|
112
112
|
cp "$PLUGIN_DIR/README-TESTING.md" "$TARGET_DIR/"
|
|
113
113
|
echo " ✅ README-TESTING.md installed"
|
|
114
114
|
|
|
115
|
+
# ── Step 6: Merge dependencies + scripts into package.json ──
|
|
116
|
+
echo "📦 Step 6: Merging dependencies and scripts into package.json..."
|
|
117
|
+
if [ -f "$TARGET_DIR/package.json" ]; then
|
|
118
|
+
node -e "
|
|
119
|
+
const fs = require('fs');
|
|
120
|
+
const path = require('path');
|
|
121
|
+
|
|
122
|
+
const targetPkgPath = path.join('$TARGET_DIR', 'package.json');
|
|
123
|
+
const snippetPath = path.join('$PLUGIN_DIR', 'package.json.snippet');
|
|
124
|
+
|
|
125
|
+
const pkg = JSON.parse(fs.readFileSync(targetPkgPath, 'utf-8'));
|
|
126
|
+
const snippet = JSON.parse(fs.readFileSync(snippetPath, 'utf-8'));
|
|
127
|
+
|
|
128
|
+
// Merge devDependencies
|
|
129
|
+
if (snippet.devDependencies) {
|
|
130
|
+
pkg.devDependencies = { ...(pkg.devDependencies || {}), ...snippet.devDependencies };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Merge scripts (don't overwrite existing)
|
|
134
|
+
if (snippet.scripts) {
|
|
135
|
+
pkg.scripts = pkg.scripts || {};
|
|
136
|
+
for (const [key, val] of Object.entries(snippet.scripts)) {
|
|
137
|
+
if (!pkg.scripts[key]) {
|
|
138
|
+
pkg.scripts[key] = val;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
fs.writeFileSync(targetPkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
144
|
+
console.log(' ✅ package.json updated (devDependencies + scripts merged)');
|
|
145
|
+
"
|
|
146
|
+
else
|
|
147
|
+
echo " ⚠️ No package.json found in target — skipping dependency merge"
|
|
148
|
+
echo " Manually merge contents of package.json.snippet into your package.json"
|
|
149
|
+
fi
|
|
150
|
+
|
|
151
|
+
# ── Step 7: Append .gitignore entries ──
|
|
152
|
+
echo "📦 Step 7: Updating .gitignore..."
|
|
153
|
+
if [ -f "$TARGET_DIR/.gitignore" ]; then
|
|
154
|
+
# Only append lines that don't already exist
|
|
155
|
+
while IFS= read -r line; do
|
|
156
|
+
[ -z "$line" ] && continue
|
|
157
|
+
[[ "$line" == \#* ]] && continue
|
|
158
|
+
grep -qF "$line" "$TARGET_DIR/.gitignore" 2>/dev/null || echo "$line" >> "$TARGET_DIR/.gitignore"
|
|
159
|
+
done < "$PLUGIN_DIR/.gitignore.snippet"
|
|
160
|
+
echo " ✅ .gitignore updated"
|
|
161
|
+
else
|
|
162
|
+
cp "$PLUGIN_DIR/.gitignore.snippet" "$TARGET_DIR/.gitignore"
|
|
163
|
+
echo " ✅ .gitignore created"
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
# ── Step 8: Create migrations/files directory ──
|
|
167
|
+
mkdir -p "$TARGET_DIR/e2e-tests/data/migrations/files"
|
|
168
|
+
touch "$TARGET_DIR/e2e-tests/data/migrations/files/.gitkeep"
|
|
169
|
+
|
|
115
170
|
# ── Done ──
|
|
116
171
|
echo ""
|
|
117
172
|
echo "╔══════════════════════════════════════════════╗"
|
|
@@ -120,29 +175,24 @@ echo "╚═══════════════════════
|
|
|
120
175
|
echo ""
|
|
121
176
|
echo "📋 Next steps:"
|
|
122
177
|
echo ""
|
|
123
|
-
echo " 1.
|
|
124
|
-
echo " into your package.json, then run: pnpm install"
|
|
125
|
-
echo ""
|
|
126
|
-
echo " 2. Install Playwright browsers: pnpx playwright install"
|
|
178
|
+
echo " 1. Install dependencies: pnpm install"
|
|
127
179
|
echo ""
|
|
128
|
-
echo "
|
|
129
|
-
echo " to your .gitignore"
|
|
180
|
+
echo " 2. Install Playwright browsers: npx playwright install"
|
|
130
181
|
echo ""
|
|
131
|
-
echo "
|
|
182
|
+
echo " 3. Update e2e-tests/data/authenticationData.js"
|
|
132
183
|
echo " → Set your app's login form testIDs"
|
|
133
184
|
echo ""
|
|
134
|
-
echo "
|
|
185
|
+
echo " 4. Update e2e-tests/data/testConfig.js"
|
|
135
186
|
echo " → Set your app's routes"
|
|
136
187
|
echo ""
|
|
137
|
-
echo "
|
|
188
|
+
echo " 5. Set credentials in .env:"
|
|
138
189
|
echo " TEST_USER_EMAIL=your-email@example.com"
|
|
139
190
|
echo " TEST_USER_PASSWORD=your-password"
|
|
140
191
|
echo " BASE_URL=http://localhost:5173"
|
|
141
192
|
echo ""
|
|
142
|
-
echo "
|
|
193
|
+
echo " 6. Start dev server and run tests:"
|
|
143
194
|
echo " pnpm test:bdd:auth # Run authentication tests"
|
|
144
195
|
echo " pnpm test:bdd # Run all tests (except auth)"
|
|
145
|
-
echo " pnpm test:bdd:all # Run everything including auth"
|
|
146
196
|
echo ""
|
|
147
|
-
echo "
|
|
197
|
+
echo " 7. Generate more tests: /e2e-automate (Claude Code CLI)"
|
|
148
198
|
echo ""
|