Skip to content

Commit 53ae126

Browse files
committed
Merge pull request #1 from johnotander/update-immutable-css-cli
Add strict option, update dependencies
2 parents 2f39a70 + d2bfabe commit 53ae126

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

cli.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ const cli = meow(`
1717
1818
Options
1919
-j, --json Return json to std out
20+
-s, --strict Lint mutations in the same file
2021
2122
Example
2223
$ immutable-css vendor.css app.css
2324
$ immutable-css src/css/**/*.css
25+
$ immutable-css app.css --strict
2426
$ immutable-css src/css/**/*.css --json > mutations.json
2527
`, {
2628
alias: {
2729
h: 'help',
28-
j: 'json'
30+
j: 'json',
31+
s: 'strict'
2932
}
3033
})
3134

@@ -39,6 +42,11 @@ if (isBlank(cli.input)) {
3942
process.exit(1)
4043
}
4144

45+
var opts = {}
46+
if (cli.flags.strict) {
47+
opts.strict = true
48+
}
49+
4250
var root = null
4351
cli.input.forEach(file => {
4452
if (isValidFile(file)) {
@@ -56,7 +64,7 @@ cli.input.forEach(file => {
5664
})
5765

5866
root = atImport.process(root)
59-
root = immutableCss.process(root)
67+
root = immutableCss.process(root, opts)
6068

6169
if (cli.flags.json) {
6270
console.log(JSON.stringify(root.messages))

package.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
"scripts": {
1414
"test": "ava"
1515
},
16-
"repository": {
17-
"type": "git",
18-
"url": "https://github.com/johnotander/immutable-css-cli.git"
19-
},
16+
"repository": "johnotander/immutable-css-cli",
2017
"keywords": [
2118
"cli",
2219
"cli-app",
@@ -27,19 +24,15 @@
2724
"mutations"
2825
],
2926
"license": "MIT",
30-
"bugs": {
31-
"url": "https://github.com/johnotander/immutable-css-cli/issues"
32-
},
33-
"homepage": "https://github.com/johnotander/immutable-css-cli",
3427
"dependencies": {
3528
"chalk": "^1.1.1",
36-
"file-exists": "^0.1.1",
37-
"immutable-css": "^1.0.1",
29+
"file-exists": "^1.0.0",
30+
"immutable-css": "^1.1.0",
3831
"is-blank": "^1.1.0",
3932
"is-css": "^1.0.0",
40-
"meow": "^3.4.2",
41-
"postcss": "^5.0.10",
42-
"postcss-import": "^7.1.0"
33+
"meow": "^3.7.0",
34+
"postcss": "^5.0.14",
35+
"postcss-import": "^7.1.3"
4336
},
4437
"devDependencies": {
4538
"ava": "*"

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ immutable-css -h
2323

2424
Options
2525
-j, --json Return json to std out
26+
-s, --strict Lint mutations in the same file
2627

2728
Example
2829
$ immutable-css vendor.css app.css
2930
$ immutable-css src/css/**/*.css
31+
$ immutable-css app.css --strict
3032
$ immutable-css src/css/**/*.css --json > mutations.json
3133
```
3234

test/test.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ import test from 'ava'
22
import childProcess from 'child_process'
33

44
test('immutable-css-cli lints stylesheets', t => {
5-
t.plan(1)
6-
75
const cp = childProcess.execFile('../cli.js', ['fixtures/basscss.css', 'fixtures/basscss-mutations.css'], { cwd: __dirname })
8-
cp.on('close', code => t.is(code, 1))
6+
cp.on('close', code => {
7+
t.is(code, 1)
8+
t.end()
9+
})
10+
})
11+
12+
test('immutable-css-cli --strict lints stylesheets strictly', t => {
13+
const cp = childProcess.execFile('../cli.js', ['fixtures/basscss.css', 'fixtures/basscss-mutations.css', '--strict'], { cwd: __dirname })
14+
cp.on('close', code => {
15+
t.is(code, 1)
16+
t.end()
17+
})
918
})

0 commit comments

Comments
 (0)