Merge pull request #2 from F-loat/master

fix: rename and update .gitignore
This commit is contained in:
fxy060608 2018-12-21 18:51:05 +08:00 committed by GitHub
commit e716eef03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 14 deletions

View File

@ -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)
})
}
}

View File

@ -1,10 +0,0 @@
.DS_Store
.project
.vscode
node_modules/
unpackage/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View 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*