File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
cli-service/generator/template Expand file tree Collapse file tree 2 files changed +9
-2
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -62,11 +62,18 @@ module.exports = class GeneratorAPI {
62
62
filter : file => path . basename ( file . path ) !== '.DS_Store'
63
63
} )
64
64
for ( const file of _files ) {
65
- const relativePath = path . relative ( fileDir , file . path )
65
+ let filename = path . basename ( file . path )
66
+ // dotfiles are ignored when published to npm, therefore in templates
67
+ // we need to use underscore instead (e.g. "_gitignore")
68
+ if ( filename . charAt ( 0 ) === '_' ) {
69
+ filename = `.${ filename . slice ( 1 ) } `
70
+ }
71
+ const normalizedPath = path . join ( path . dirname ( file . path ) , filename )
72
+ const targetPath = path . relative ( fileDir , normalizedPath )
66
73
const content = renderFile ( file . path , data , ejsOptions )
67
74
// only set file if it's not all whitespace, or is a Buffer (binary files)
68
75
if ( Buffer . isBuffer ( content ) || / [ ^ \s ] / . test ( content ) ) {
69
- files [ relativePath ] = content
76
+ files [ targetPath ] = content
70
77
}
71
78
}
72
79
} )
You can’t perform that action at this time.
0 commit comments