-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
Adapter build outputs are linted, formatted, and synced to Git #1832
Comments
Each adapter needs to ignore a different set of files. There was a standard set of files originally in the |
What if Adapter would internally generate/modify .gitignore ? It can be good feature? |
Yes, what I just said in my previous comment was that the adapter could modify |
We could put something like this inside /** Adds glob patterns to the
* @param {object} options
* @param {string[]} options.patterns An array of glob patterns to be inserted into the project's `.gitignore` file
* @param {boolean} [options.generate] Whether the `.gitignore` file should be created if it doesn't exist
* @param {string} options.name The name of the adapter
*/
export async function addToGitIgnore({ patterns, generate = false, name }) {
const path = '.gitignore';
const { existsSync } = await import('fs');
const { readFile, writeFile, appendFile } = await import('fs/promises');
if (!existsSync(path)) {
if (!generate) return;
await writeFile(path, '');
}
const file = await readFile(path, {
encoding: 'utf-8'
});
if (file.includes(`# Generated by ${name}`)) return;
const text = `\n# Generated by ${name}\n${patterns.join('\n')}`;
await appendFile(path, text);
} |
Describe the bug
Build outputs to the adapters are not in the
.eslintignore
,.prettierignore
, and.gitignore
by default. This means they are linted, formatted, and checked into version control by default. I suspect this is not desired behavior for most people.To Reproduce
adapter-vercel
)pnpm build
pnpm lint
,pnpm format
, orgit add .
will now also include these new build outputsTo fix, you can just add the build output to the relevant ignore files. I think they should be there by default.
I can provide a reproduction repo, stack traces, etc. if needed, but I think the issue is fairly self-explanatory.
Expected behavior
By default, these files should not be linted, formatted, or checked into version control.
Severity
Honestly, not that severe. It's a ~30 second fix for anyone creating a Svekte/kit project. But the bug fix would also be a ~30 second fix as well.
The text was updated successfully, but these errors were encountered: