Skip to content
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

[fix] rename dotfiles to avoid template problems #2990

Merged
merged 2 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/odd-ligers-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

include missing .npmrc in templates
2 changes: 1 addition & 1 deletion packages/create-svelte/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async function main() {
*/
function write_template_files(template, typescript, name, cwd) {
const dir = dist(`templates/${template}`);
copy(`${dir}/assets`, cwd, (name) => name.replace('gitignore', '.gitignore'));
copy(`${dir}/assets`, cwd, (name) => name.replace('DOT-', '.'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use regex here too, for the off chance that there will ever be any file containing DOT- in it's name...

Suggested change
copy(`${dir}/assets`, cwd, (name) => name.replace('DOT-', '.'));
copy(`${dir}/assets`, cwd, (name) => name.replace(/^DOT-/, '.'));

Copy link
Contributor

@dreitzner dreitzner Dec 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DOT- could also be extracted as constant into packages/create-svelte/utils.js

copy(`${dir}/package.json`, `${cwd}/package.json`);

const manifest = `${dir}/files.${typescript ? 'ts' : 'js'}.json`;
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/scripts/build-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function generate_templates(shared) {
contents
});
} else {
const dest = path.join(assets, name).replace('.gitignore', 'gitignore'); // npm does wacky stuff to gitignores
const dest = path.join(assets, name.replace(/^\./, 'DOT-'));
mkdirp(path.dirname(dest));
fs.copyFileSync(path.join(cwd, name), dest);
}
Expand Down