Skip to content

Commit 976f2ad

Browse files
committed
Format for Standard v14
1 parent ebe509c commit 976f2ad

File tree

6 files changed

+52
-52
lines changed

6 files changed

+52
-52
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ module.exports = async manifest => {
2020
...manifest
2121
})
2222

23-
return install({unlinks, directories, files, symlinks, io})
23+
return install({ unlinks, directories, files, symlinks, io })
2424
}

lib/install.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const makeGroups = (key, items) => {
66
const sortedDescending = [...items].sort((x, y) => y[key] - x[key])
77

88
const { groups } = sortedDescending.reduce(
9-
({i, groups}, item) => {
9+
({ i, groups }, item) => {
1010
const next = item[key]
1111
const isNewGroup = next < i
1212
return {
@@ -15,7 +15,7 @@ const makeGroups = (key, items) => {
1515
? [[item], ...groups]
1616
: [[...groups[0], item], ...groups.slice(1)]
1717
}
18-
}, {i: Infinity, groups: []}
18+
}, { i: Infinity, groups: [] }
1919
)
2020

2121
return groups
@@ -32,7 +32,7 @@ const checkAccess = io => async ({
3232
source
3333
}) => {
3434
try {
35-
await io.checkAccess({target: source})
35+
await io.checkAccess({ target: source })
3636
} catch (err) {
3737
console.error(`* Read failed: ${source}`)
3838
throw err
@@ -48,10 +48,10 @@ const installDirectory = io => async ({
4848
dmode
4949
}) => {
5050
try {
51-
await io.overwriteDirectory({source, destination})
52-
await io.chmodRecursive({fmode, dmode, target: destination})
53-
await io.chownRecursive({owner, target: destination})
54-
await io.chgrpRecursive({group, target: destination})
51+
await io.overwriteDirectory({ source, destination })
52+
await io.chmodRecursive({ fmode, dmode, target: destination })
53+
await io.chownRecursive({ owner, target: destination })
54+
await io.chgrpRecursive({ group, target: destination })
5555
console.info(`${source} => ${destination}`)
5656
} catch (err) {
5757
console.error(`* Install failed: ${source} => ${destination}`)
@@ -63,7 +63,7 @@ const unlink = io => async ({
6363
source
6464
}) => {
6565
try {
66-
await io.unlink({target: source})
66+
await io.unlink({ target: source })
6767
console.info(`${source} <= /dev/null`)
6868
} catch (err) {
6969
console.error(`* Unlink failed: ${source} <= /dev/null #`)
@@ -79,10 +79,10 @@ const installFile = io => async ({
7979
fmode
8080
}) => {
8181
try {
82-
await io.copyFile({source, destination})
83-
await io.chmod({mode: fmode, target: destination})
84-
await io.chown({owner, target: destination})
85-
await io.chgrp({group, target: destination})
82+
await io.copyFile({ source, destination })
83+
await io.chmod({ mode: fmode, target: destination })
84+
await io.chown({ owner, target: destination })
85+
await io.chgrp({ group, target: destination })
8686
console.info(`${source} +> ${destination}`)
8787
} catch (err) {
8888
console.error(`* Install failed: ${source} +> ${destination}`)
@@ -95,15 +95,15 @@ const installSymlink = io => async ({
9595
destination
9696
}) => {
9797
try {
98-
await io.makeSymlink({source, destination})
98+
await io.makeSymlink({ source, destination })
9999
console.info(`${source} -> ${destination}`)
100100
} catch (err) {
101101
console.error(`* Link failed: ${source} -> ${destination}`)
102102
throw err
103103
}
104104
}
105105

106-
module.exports = async ({unlinks, directories, files, symlinks, io}) => {
106+
module.exports = async ({ unlinks, directories, files, symlinks, io }) => {
107107
await Promise.all([...directories, ...files].map(checkAccess(io)))
108108
console.log('>> Unlinking paths')
109109
if (isEmpty(unlinks)) console.log('Nothing to do')

lib/io/linux.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,37 @@ const {
1010
makeSymlink
1111
} = require('./shared')
1212

13-
const unlink = ({target}) => exec(`rm -rf ${target}`)
13+
const unlink = ({ target }) => exec(`rm -rf ${target}`)
1414

15-
const makeDirRecursive = ({target}) => exec(`mkdir -p ${target}`)
15+
const makeDirRecursive = ({ target }) => exec(`mkdir -p ${target}`)
1616

17-
const chmodRecursive = ({fmode, dmode, target}) => Promise.all([
17+
const chmodRecursive = ({ fmode, dmode, target }) => Promise.all([
1818
exec(`find ${target} -type f -exec chmod ${fmode.toString(8)} {} +`),
1919
exec(`find ${target} -type d -exec chmod ${dmode.toString(8)} {} +`)
2020
])
2121

22-
const chown = ({owner, target}) => exec(`chown ${owner} ${target}`)
22+
const chown = ({ owner, target }) => exec(`chown ${owner} ${target}`)
2323

24-
const chownRecursive = ({owner, target}) => exec(`chown -R ${owner} ${target}`)
24+
const chownRecursive = ({ owner, target }) => exec(`chown -R ${owner} ${target}`)
2525

26-
const chgrp = ({group, target}) => exec(`chgrp ${group} ${target}`)
26+
const chgrp = ({ group, target }) => exec(`chgrp ${group} ${target}`)
2727

28-
const chgrpRecursive = ({group, target}) => exec(`chgrp -R ${group} ${target}`)
28+
const chgrpRecursive = ({ group, target }) => exec(`chgrp -R ${group} ${target}`)
2929

30-
const overwriteDirectory = async ({source, destination}) => {
31-
await makeDirRecursive({target: path.dirname(destination)})
30+
const overwriteDirectory = async ({ source, destination }) => {
31+
await makeDirRecursive({ target: path.dirname(destination) })
3232
return exec(`rsync -rtc --del --links ${source}/ ${destination}`)
3333
}
3434

35-
const copyFileLiunx = async ({source, destination}) => {
36-
await makeDirRecursive({target: path.dirname(destination)})
37-
return copyFile({source, destination})
35+
const copyFileLiunx = async ({ source, destination }) => {
36+
await makeDirRecursive({ target: path.dirname(destination) })
37+
return copyFile({ source, destination })
3838
}
3939

40-
const makeSymlinkLinux = async ({source, destination}) => {
41-
await makeDirRecursive({target: path.dirname(source)})
42-
await unlink({target: source})
43-
return makeSymlink({source, destination})
40+
const makeSymlinkLinux = async ({ source, destination }) => {
41+
await makeDirRecursive({ target: path.dirname(source) })
42+
await unlink({ target: source })
43+
return makeSymlink({ source, destination })
4444
}
4545

4646
module.exports = {

lib/io/noop.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@
22

33
const path = require('path')
44

5-
const checkAccess = ({target}) => {
5+
const checkAccess = ({ target }) => {
66
console.log(`Access ok for ${target}`)
77
}
88

9-
const unlink = ({target}) => {
9+
const unlink = ({ target }) => {
1010
console.log(`Unlink ${target}`)
1111
}
1212

13-
const makeDirRecursive = ({target}) => {
13+
const makeDirRecursive = ({ target }) => {
1414
console.log(`Create directory ${target}`)
1515
}
1616

17-
const chmod = ({mode, target}) => {
17+
const chmod = ({ mode, target }) => {
1818
console.log(`Set mode ${mode.toString(8)} on ${target}`)
1919
}
2020

21-
const chmodRecursive = ({fmode, dmode, target}) => {
21+
const chmodRecursive = ({ fmode, dmode, target }) => {
2222
console.log(`Set recursive fmode ${fmode.toString(8)} and dmode ${dmode.toString(8)} on ${target}`)
2323
}
2424

25-
const chown = ({owner, target}) => {
25+
const chown = ({ owner, target }) => {
2626
console.log(`Set owner ${owner} on ${target}`)
2727
}
2828

29-
const chownRecursive = ({owner, target}) => {
29+
const chownRecursive = ({ owner, target }) => {
3030
console.log(`Set recursive owner ${owner} on ${target}`)
3131
}
3232

33-
const chgrp = ({group, target}) => {
33+
const chgrp = ({ group, target }) => {
3434
console.log(`Set group ${group} on ${target}`)
3535
}
3636

37-
const chgrpRecursive = ({group, target}) => {
37+
const chgrpRecursive = ({ group, target }) => {
3838
console.log(`Set recursive group ${group} on ${target}`)
3939
}
4040

41-
const overwriteDirectory = ({source, destination}) => {
42-
makeDirRecursive({target: path.dirname(destination)})
41+
const overwriteDirectory = ({ source, destination }) => {
42+
makeDirRecursive({ target: path.dirname(destination) })
4343
console.log(`Copy directory ${source} to ${destination}`)
4444
}
4545

46-
const copyFile = ({source, destination}) => {
46+
const copyFile = ({ source, destination }) => {
4747
console.log(`Copy file ${source} to ${destination}`)
4848
}
4949

50-
const makeSymlink = ({source, destination}) => {
51-
makeDirRecursive({target: path.dirname(destination)})
50+
const makeSymlink = ({ source, destination }) => {
51+
makeDirRecursive({ target: path.dirname(destination) })
5252
console.log(`Make symlink from ${source} to ${destination}`)
5353
}
5454

lib/io/shared.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const fsChmodAsync = promisify(fs.chmod)
88
const fsCopyFileAsync = promisify(fs.copyFile)
99
const fsSymlink = promisify(fs.symlink)
1010

11-
const checkAccess = ({target}) => fsAccessAsync(target, fs.constants.R_OK)
12-
const chmod = ({mode, target}) => fsChmodAsync(target, mode)
13-
const copyFile = ({source, destination}) => fsCopyFileAsync(source, destination)
14-
const makeSymlink = ({source, destination}) => fsSymlink(destination, source)
11+
const checkAccess = ({ target }) => fsAccessAsync(target, fs.constants.R_OK)
12+
const chmod = ({ mode, target }) => fsChmodAsync(target, mode)
13+
const copyFile = ({ source, destination }) => fsCopyFileAsync(source, destination)
14+
const makeSymlink = ({ source, destination }) => fsSymlink(destination, source)
1515

1616
module.exports = {
1717
checkAccess,

lib/normalize.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ module.exports = async ({
140140

141141
const normalizeTargets = x => x.map(normalizeTarget)
142142

143-
const addType = (type, targets) => targets.map(x => ({...x, type}))
143+
const addType = (type, targets) => targets.map(x => ({ ...x, type }))
144144
const targetsByType = [
145145
addType('unlink', unlinks),
146146
addType('directory', directories),
@@ -152,6 +152,6 @@ module.exports = async ({
152152
targetsByType.map(x => Promise.all(normalizeTargets(x)))
153153
)
154154

155-
const [ ul, di, fi, sl ] = normalized.map(x => x.filter(isNotNil))
156-
return {unlinks: ul, directories: di, files: fi, symlinks: sl}
155+
const [ul, di, fi, sl] = normalized.map(x => x.filter(isNotNil))
156+
return { unlinks: ul, directories: di, files: fi, symlinks: sl }
157157
}

0 commit comments

Comments
 (0)