Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Undoing console changes and fixing snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Walter committed Feb 6, 2019
1 parent c0a0607 commit be7cd93
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const dist = require('.')
const { cyan, gray, yellow, red } = require('chalk')

const writeFile = pify(fs.writeFile)
const logError = err => console.error('💥', red('Boom!'), err)
const logError = err => console.error(`💥 ${red('Boom!')}`, err)

async function run () {
const cli = meow(
Expand Down Expand Up @@ -69,15 +69,15 @@ async function run () {
fs.mkdirSync(dirname(path), { recursive: true })

// Inform the user about what files are being written.
const rel = path.replace(`${process.cwd()}/`, '')
const relative = path.replace(`${process.cwd()}/`, '')
if (moduleType === 'cjs') {
console.info('💿', cyan('Writing CommonJS dist file:'), gray(rel))
console.info(cyan('💿 Writing CommonJS dist file:'), gray(relative))
} else if (moduleType === 'esm') {
console.info('📦', cyan('Writing ES Module dist file:'), gray(rel))
console.info(cyan('📦 Writing ES Module dist file:'), gray(relative))
} else if (moduleType === 'browser') {
console.info('🌎', cyan('Writing Browser dist file:'), gray(rel))
console.info(cyan('🌎 Writing Browser dist file:'), gray(relative))
} else if (moduleType === 'iife') {
console.info('🎁', cyan('Writing IIFE dist file:'), gray(rel))
console.info(cyan('🎁 Writing IIFE dist file:'), gray(relative))
}

// Add the file write operation to the list of writes to be completed
Expand All @@ -91,7 +91,7 @@ async function run () {
// Filter the results for errors and log them.
results.filter(r => r instanceof Error).forEach(err => logError(err))
} else {
console.warn(yellow('🤷', 'No distribution files were specified'))
console.warn(yellow('🤷 No distribution files were specified'))
}
} catch (err) {
logError(err)
Expand Down
3 changes: 2 additions & 1 deletion test/dist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ test(
const name = 'exportDefaultLiteral'
const input = join(__dirname, `fixtures/${name}.js`)
const cjs = join(output, `${name}.js`)
t.snapshot(await dist({ name, input, cjs, browser: true }))
const browser = join(output, `${name}.browser.js`)
t.snapshot(await dist({ name, input, cjs, browser }))
}
)

Expand Down
2 changes: 1 addition & 1 deletion test/snapshots/dist.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Generated by [AVA](https://ava.li).
{
browser: [
'/home/ian/ianwalter/dist/dist/exportDefaultLiteral.browser.js',
'/fakePath/exportDefaultLiteral.browser.js',
`var exportDefaultLiteral = 'Hello World';␊
export default exportDefaultLiteral;␊
Expand Down
Binary file modified test/snapshots/dist.test.js.snap
Binary file not shown.

0 comments on commit be7cd93

Please sign in to comment.