mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-11 22:50:06 +00:00
chore: Fix lefthook config for windows (#22676)
Co-authored-by: RomanDavydchuk <[email protected]>
This commit is contained in:
co-authored by
RomanDavydchuk
parent
f72bbaf088
commit
85d9465ad9
+1
-12
@@ -28,18 +28,7 @@ pre-commit:
|
|||||||
- rebase
|
- rebase
|
||||||
workspace_deps_check:
|
workspace_deps_check:
|
||||||
glob: '**/package.json'
|
glob: '**/package.json'
|
||||||
run: |
|
run: node scripts/check-workspace-deps.mjs {staged_files}
|
||||||
if grep -l '"workspace:\^"' {staged_files} 2>/dev/null; then
|
|
||||||
echo ""
|
|
||||||
echo "ERROR: Found 'workspace:^' in package.json files."
|
|
||||||
echo ""
|
|
||||||
echo "Use 'workspace:*' instead to pin exact versions."
|
|
||||||
echo "Using 'workspace:^' causes npm to resolve semver ranges when users"
|
|
||||||
echo "install from npm, which can lead to version mismatches between"
|
|
||||||
echo "@n8n/* packages and break n8n startup."
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
skip:
|
skip:
|
||||||
- merge
|
- merge
|
||||||
- rebase
|
- rebase
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { existsSync } from 'node:fs';
|
||||||
|
|
||||||
|
const isPackageJson = (file) => file.endsWith('package.json');
|
||||||
|
const files = process.argv.slice(2).filter((file) => file && isPackageJson(file) && existsSync(file));
|
||||||
|
let foundError = false;
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
try {
|
||||||
|
const content = readFileSync(file, 'utf8');
|
||||||
|
if (content.includes('"workspace:^"')) {
|
||||||
|
if (!foundError) {
|
||||||
|
console.log('');
|
||||||
|
console.log("ERROR: Found 'workspace:^' in package.json files.");
|
||||||
|
console.log('');
|
||||||
|
console.log("Use 'workspace:*' instead to pin exact versions.");
|
||||||
|
console.log("Using 'workspace:^' causes npm to resolve semver ranges when users");
|
||||||
|
console.log("install from npm, which can lead to version mismatches between");
|
||||||
|
console.log("@n8n/* packages and break n8n startup.");
|
||||||
|
console.log('');
|
||||||
|
}
|
||||||
|
foundError = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Ignore read errors for individual files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundError) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user