mirror of
https://gitee.com/dcloud/uni-preset-vue
synced 2025-04-09 15:23:08 +08:00
Merge pull request #2 from F-loat/master
fix: rename and update .gitignore
This commit is contained in:
commit
e716eef03a
14
generator.js
14
generator.js
@ -13,14 +13,20 @@ async function generate(dir, files, base = '') {
|
||||
nodir: true
|
||||
}).forEach(rawPath => {
|
||||
const sourcePath = path.resolve(dir, rawPath)
|
||||
const filename = path.join(base, rawPath)
|
||||
|
||||
if (isBinary.sync(sourcePath)) {
|
||||
files[path.join(base, rawPath)] = fs.readFileSync(sourcePath) // return buffer
|
||||
files[filename] = fs.readFileSync(sourcePath) // return buffer
|
||||
} else {
|
||||
const content = fs.readFileSync(sourcePath, 'utf-8')
|
||||
if (sourcePath.indexOf('manifest.json') !== -1 || sourcePath.indexOf('pages.json') !== -1) {
|
||||
files[path.join(base, rawPath)] = JSON.stringify(JSON.parse(stripJsonComments(content)), null, 2)
|
||||
files[filename] = JSON.stringify(JSON.parse(stripJsonComments(content)), null, 2)
|
||||
} else if (filename.charAt(0) === '_' && filename.charAt(1) !== '_') {
|
||||
files[`.${filename.slice(1)}`] = content
|
||||
} else if (filename.charAt(0) === '_' && filename.charAt(1) === '_') {
|
||||
files[`${filename.slice(1)}`] = content
|
||||
} else {
|
||||
files[path.join(base, rawPath)] = content
|
||||
files[filename] = content
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -75,4 +81,4 @@ module.exports = (api, options, rootOptions) => {
|
||||
await generate(path.resolve(__dirname, './template/common'), files)
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
10
template/common/.gitignore
vendored
10
template/common/.gitignore
vendored
@ -1,10 +0,0 @@
|
||||
.DS_Store
|
||||
.project
|
||||
.vscode
|
||||
|
||||
node_modules/
|
||||
unpackage/
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
22
template/common/_gitignore
Normal file
22
template/common/_gitignore
Normal file
@ -0,0 +1,22 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
unpackage/
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.project
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw*
|
Loading…
x
Reference in New Issue
Block a user