Skip to content
Permalink
Browse files

fix: harmonize logs for all OS

  • Loading branch information...
NicoPennec committed May 10, 2019
1 parent 78f1f32 commit 276e8fa3489e33c5bb5585be1dfb7a31dc17e828
Showing with 10 additions and 3 deletions.
  1. +3 −1 .eslintrc.js
  2. +7 −2 lib/module.js
@@ -21,7 +21,9 @@ module.exports = {
// Allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// Do not allow console.logs etc...
'no-console': 2
'no-console': 2,
// Allow sparse arrays
'no-sparse-arrays': 0
},
globals: {
'jest/globals': true,
@@ -80,13 +80,13 @@ module.exports = function module (moduleOptions) {
const xmlGeneratePath = path.join(this.options.generate.dir, options.path)
await fs.ensureFile(xmlGeneratePath)
await fs.writeFile(xmlGeneratePath, xml)
consola.success('Generated', xmlGeneratePath.replace(this.options.generate.dir, ''))
consola.success('Generated', getPathname(this.options.generate.dir, xmlGeneratePath))
if (options.gzip) {
const gzip = await sitemap.toGzip()
const gzipGeneratePath = path.join(this.options.generate.dir, options.pathGzip)
await fs.ensureFile(gzipGeneratePath)
await fs.writeFile(gzipGeneratePath, gzip)
consola.success('Generated', gzipGeneratePath.replace(this.options.generate.dir, ''))
consola.success('Generated', getPathname(this.options.generate.dir, gzipGeneratePath))
}
})

@@ -228,4 +228,9 @@ function flattenRoutes (router, path = '', routes = []) {
return routes
}

// Convert a file path to a url pathname
function getPathname (dirPath, filePath) {
return [, ...path.relative(dirPath, filePath).split(path.sep)].join('/')
}

module.exports.meta = require('../package.json')

0 comments on commit 276e8fa

Please sign in to comment.
You can’t perform that action at this time.