We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The original writeHash method takes an optional string for the hash.
However, the method that gets returned is writeHash.bind(null, result.hash)
writeHash.bind(null, result.hash)
As a result, as a workaround for #16 , I'm unable to write a custom hash.
My suggestion is to move the writeHash method to just below the const result = and change it to
const writeHash = (hash: string | undefined = result.hash) => hash && fs.writeFileSync(packageHashPath, hash, {});
This would allow me to use a concatenated hash for multiple files, like so:
/** @type {import('package-changed/types')} */ const { isPackageChanged } = require('package-changed'); /** @type {import('child_process')} */ const { execSync } = require('node:child_process'); (async () => { const { oldHash, hash: rootHash, writeHash } = await isPackageChanged({ noHashFile: true }); const { hash: nextjsHash } = await isPackageChanged({ noHashFile: true, cwd: './nextjs' }); const newHash = `${rootHash}${nextjsHash}`; if (newHash !== oldHash) { console.log("Package changed. Running 'rm -f .eslintcache && pnpm install'."); // dependencies in a package.json have changed since last run execSync('rm -f .eslintcache'); execSync('pnpm install'); writeHash(newHash); } })();
I will open a PR for this shortly.
The text was updated successfully, but these errors were encountered:
change writeHash to use a default parameter instead of bind (thdk#17)
7625df8
No branches or pull requests
The original writeHash method takes an optional string for the hash.
However, the method that gets returned is
writeHash.bind(null, result.hash)
As a result, as a workaround for #16 , I'm unable to write a custom hash.
My suggestion is to move the writeHash method to just below the const result = and change it to
This would allow me to use a concatenated hash for multiple files, like so:
I will open a PR for this shortly.
The text was updated successfully, but these errors were encountered: