fix: rename and update .gitignore

This commit is contained in:
F-loat 2018-12-21 18:09:54 +08:00
parent a46b69d0a2
commit 7ebb55da28
3 changed files with 30 additions and 14 deletions

View File

@ -13,14 +13,18 @@ async function generate(dir, files, base = '') {
nodir: true nodir: true
}).forEach(rawPath => { }).forEach(rawPath => {
const sourcePath = path.resolve(dir, rawPath) const sourcePath = path.resolve(dir, rawPath)
const filename = path.join(base, rawPath)
if (isBinary.sync(sourcePath)) { if (isBinary.sync(sourcePath)) {
files[path.join(base, rawPath)] = fs.readFileSync(sourcePath) // return buffer files[filename] = fs.readFileSync(sourcePath) // return buffer
} else { } else {
const content = fs.readFileSync(sourcePath, 'utf-8') const content = fs.readFileSync(sourcePath, 'utf-8')
if (sourcePath.indexOf('manifest.json') !== -1 || sourcePath.indexOf('pages.json') !== -1) { 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 { } else {
files[path.join(base, rawPath)] = content files[filename] = content
} }
} }
}) })

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*