Skip to content

Commit e263060

Browse files
committed
Fix prettier build, pin prettier version
1 parent 28fa45a commit e263060

File tree

3 files changed

+43
-35
lines changed

3 files changed

+43
-35
lines changed

index.js

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -204,43 +204,45 @@ function css(css, file) {
204204
)
205205
}
206206

207-
return postcss(config.plugins).process(css, options).then(result => {
208-
const tasks = []
209-
210-
if (options.to) {
211-
tasks.push(fs.outputFile(options.to, result.css))
212-
213-
if (result.map) {
214-
tasks.push(
215-
fs.outputFile(
216-
options.to.replace(
217-
path.extname(options.to),
218-
`${path.extname(options.to)}.map`
219-
),
220-
result.map
207+
return postcss(config.plugins)
208+
.process(css, options)
209+
.then(result => {
210+
const tasks = []
211+
212+
if (options.to) {
213+
tasks.push(fs.outputFile(options.to, result.css))
214+
215+
if (result.map) {
216+
tasks.push(
217+
fs.outputFile(
218+
options.to.replace(
219+
path.extname(options.to),
220+
`${path.extname(options.to)}.map`
221+
),
222+
result.map
223+
)
221224
)
225+
}
226+
} else {
227+
spinner.text = chalk.bold.green(
228+
`Finished ${relativePath} (${prettyHrtime(process.hrtime(time))})`
222229
)
230+
spinner.succeed()
231+
return process.stdout.write(result.css, 'utf8')
223232
}
224-
} else {
225-
spinner.text = chalk.bold.green(
226-
`Finished ${relativePath} (${prettyHrtime(process.hrtime(time))})`
227-
)
228-
spinner.succeed()
229-
return process.stdout.write(result.css, 'utf8')
230-
}
231233

232-
return Promise.all(tasks).then(() => {
233-
spinner.text = chalk.bold.green(
234-
`Finished ${relativePath} (${prettyHrtime(process.hrtime(time))})`
235-
)
236-
if (result.warnings().length) {
237-
spinner.fail()
238-
console.warn(reporter(result))
239-
} else spinner.succeed()
234+
return Promise.all(tasks).then(() => {
235+
spinner.text = chalk.bold.green(
236+
`Finished ${relativePath} (${prettyHrtime(process.hrtime(time))})`
237+
)
238+
if (result.warnings().length) {
239+
spinner.fail()
240+
console.warn(reporter(result))
241+
} else spinner.succeed()
240242

241-
return result
243+
return result
244+
})
242245
})
243-
})
244246
})
245247
.catch(err => {
246248
spinner.fail()

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"nyc": "^11.0.2",
4141
"per-env": "^1.0.2",
4242
"postcss-import": "^10.0.0",
43-
"prettier": "^1.5.3",
43+
"prettier": "1.7.4",
4444
"standard": "^10.0.2",
4545
"sugarss": "^1.0.0",
4646
"uuid": "^3.0.1"

test/watch.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ test.cb('--watch works', t => {
3636
// When the change is picked up:
3737
watcher.on('change', p => {
3838
if (p === 'output.css') {
39-
isEqual(p, 'test/fixtures/b.css').then(() => done()).catch(done)
39+
isEqual(p, 'test/fixtures/b.css')
40+
.then(() => done())
41+
.catch(done)
4042
}
4143
})
4244

@@ -113,7 +115,9 @@ test.cb('--watch postcss.config.js', t => {
113115
// When the change is picked up:
114116
watcher.on('change', p => {
115117
if (p === 'output.css') {
116-
isEqual(p, 'test/fixtures/a.css').then(() => done()).catch(done)
118+
isEqual(p, 'test/fixtures/a.css')
119+
.then(() => done())
120+
.catch(done)
117121
}
118122
})
119123

@@ -181,7 +185,9 @@ test.cb('--watch dependencies', t => {
181185
// When the change is picked up:
182186
watcher.on('change', p => {
183187
if (p === 'output.css') {
184-
isEqual(p, 'test/fixtures/b.css').then(() => done()).catch(done)
188+
isEqual(p, 'test/fixtures/b.css')
189+
.then(() => done())
190+
.catch(done)
185191
}
186192
})
187193

0 commit comments

Comments
 (0)