-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: apply our format to the whole code base
- Loading branch information
Showing
20 changed files
with
477 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,48 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import {spawn} from 'child_process' | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { spawn } from 'child_process'; | ||
|
||
const relative = path => new URL(path, import.meta.url); | ||
const args = process.argv.slice(2) | ||
const args = process.argv.slice(2); | ||
fs.readdir(relative('../src/themes'), (err, files) => { | ||
if (err) { | ||
console.error('err', err) | ||
process.exit(1) | ||
} | ||
files.map(async (file) => { | ||
if (/\.styl/g.test(file)) { | ||
const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join(path.sep) | ||
let cmdargs = [ | ||
stylusBin, | ||
`src/themes/${file}`, | ||
'-u', | ||
'autoprefixer-stylus' | ||
] | ||
cmdargs = [...cmdargs, ...args] | ||
if (err) { | ||
console.error('err', err); | ||
process.exit(1); | ||
} | ||
files.map(async file => { | ||
if (/\.styl/g.test(file)) { | ||
const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join( | ||
path.sep | ||
); | ||
let cmdargs = [ | ||
stylusBin, | ||
`src/themes/${file}`, | ||
'-u', | ||
'autoprefixer-stylus', | ||
]; | ||
cmdargs = [...cmdargs, ...args]; | ||
|
||
const stylusCMD = spawn('node', cmdargs, { shell: true }) | ||
const stylusCMD = spawn('node', cmdargs, { shell: true }); | ||
|
||
stylusCMD.stdout.on('data', (data) => { | ||
console.log(`[Stylus Build ] stdout: ${data}`); | ||
}); | ||
stylusCMD.stdout.on('data', data => { | ||
console.log(`[Stylus Build ] stdout: ${data}`); | ||
}); | ||
|
||
stylusCMD.stderr.on('data', (data) => { | ||
console.error(`[Stylus Build ] stderr: ${data}`); | ||
}); | ||
stylusCMD.stderr.on('data', data => { | ||
console.error(`[Stylus Build ] stderr: ${data}`); | ||
}); | ||
|
||
stylusCMD.on('close', (code) => { | ||
const message = `[Stylus Build ] child process exited with code ${code}` | ||
stylusCMD.on('close', code => { | ||
const message = `[Stylus Build ] child process exited with code ${code}`; | ||
|
||
if (code !== 0) { | ||
console.error(message); | ||
process.exit(code) | ||
} | ||
console.log(message); | ||
}); | ||
} else { | ||
return | ||
if (code !== 0) { | ||
console.error(message); | ||
process.exit(code); | ||
} | ||
|
||
}) | ||
}) | ||
console.log(message); | ||
}); | ||
} else { | ||
return; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import cssnano from 'cssnano'; | ||
import path from 'path' | ||
import fs from 'fs' | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
const files = fs.readdirSync(path.resolve('lib/themes')) | ||
const files = fs.readdirSync(path.resolve('lib/themes')); | ||
|
||
files.forEach(file => { | ||
file = path.resolve('lib/themes', file) | ||
cssnano.process(fs.readFileSync(file)).then(result => { | ||
fs.writeFileSync(file, result.css) | ||
}).catch(e => { | ||
console.error(e) | ||
process.exit(1) | ||
}) | ||
}) | ||
file = path.resolve('lib/themes', file); | ||
cssnano | ||
.process(fs.readFileSync(file)) | ||
.then(result => { | ||
fs.writeFileSync(file, result.css); | ||
}) | ||
.catch(e => { | ||
console.error(e); | ||
process.exit(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<h1>To infinity and Beyond!</h1> | ||
<h1>To infinity and Beyond!</h1> |
Oops, something went wrong.