Skip to content

Add strict option, update dependencies #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ const cli = meow(`

Options
-j, --json Return json to std out
-s, --strict Lint mutations in the same file

Example
$ immutable-css vendor.css app.css
$ immutable-css src/css/**/*.css
$ immutable-css app.css --strict
$ immutable-css src/css/**/*.css --json > mutations.json
`, {
alias: {
h: 'help',
j: 'json'
j: 'json',
s: 'strict'
}
})

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

var opts = {}
if (cli.flags.strict) {
opts.strict = true
}

var root = null
cli.input.forEach(file => {
if (isValidFile(file)) {
Expand All @@ -56,7 +64,7 @@ cli.input.forEach(file => {
})

root = atImport.process(root)
root = immutableCss.process(root)
root = immutableCss.process(root, opts)

if (cli.flags.json) {
console.log(JSON.stringify(root.messages))
Expand Down
19 changes: 6 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"scripts": {
"test": "ava"
},
"repository": {
"type": "git",
"url": "https://github.com/johnotander/immutable-css-cli.git"
},
"repository": "johnotander/immutable-css-cli",
"keywords": [
"cli",
"cli-app",
Expand All @@ -27,19 +24,15 @@
"mutations"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/johnotander/immutable-css-cli/issues"
},
"homepage": "https://github.com/johnotander/immutable-css-cli",
"dependencies": {
"chalk": "^1.1.1",
"file-exists": "^0.1.1",
"immutable-css": "^1.0.1",
"file-exists": "^1.0.0",
"immutable-css": "^1.1.0",
"is-blank": "^1.1.0",
"is-css": "^1.0.0",
"meow": "^3.4.2",
"postcss": "^5.0.10",
"postcss-import": "^7.1.0"
"meow": "^3.7.0",
"postcss": "^5.0.14",
"postcss-import": "^7.1.3"
},
"devDependencies": {
"ava": "*"
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ immutable-css -h

Options
-j, --json Return json to std out
-s, --strict Lint mutations in the same file

Example
$ immutable-css vendor.css app.css
$ immutable-css src/css/**/*.css
$ immutable-css app.css --strict
$ immutable-css src/css/**/*.css --json > mutations.json
```

Expand Down
15 changes: 12 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ import test from 'ava'
import childProcess from 'child_process'

test('immutable-css-cli lints stylesheets', t => {
t.plan(1)

const cp = childProcess.execFile('../cli.js', ['fixtures/basscss.css', 'fixtures/basscss-mutations.css'], { cwd: __dirname })
cp.on('close', code => t.is(code, 1))
cp.on('close', code => {
t.is(code, 1)
t.end()
})
})

test('immutable-css-cli --strict lints stylesheets strictly', t => {
const cp = childProcess.execFile('../cli.js', ['fixtures/basscss.css', 'fixtures/basscss-mutations.css', '--strict'], { cwd: __dirname })
cp.on('close', code => {
t.is(code, 1)
t.end()
})
})