Skip to content
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

Use Flow & prettier #309

Merged
merged 4 commits into from
Sep 1, 2017
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
9 changes: 9 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[ignore]

[include]

[libs]

[lints]

[options]
33 changes: 33 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Binaries downloaded upon install
bin/elm-interface-to-json

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
elm-stuff
tmp

# Specific to .npmignore
.travis.yml
README.md
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ install:

script:
- elm-format --validate src tests examples readme-example
- flow check
- cd examples
- elm-make --output=/dev/null --yes
- cd ../readme-example
Expand Down
69 changes: 49 additions & 20 deletions elm-css.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
#!/usr/bin/env node
//@flow

var elmCss = require('./');
var program = require('commander');
var chalk = require('chalk');
var pkg = require('./package.json');
var elmCss = require("./");
var program = require("commander");
var chalk = require("chalk");
var pkg = require("./package.json");
var sourcePath = null;

program
.version(pkg.version)
.usage('PATH # path to your Stylesheets.elm file')
.option('-o, --output [outputDir]', '(optional) directory in which to write CSS file', process.cwd())
.option('-m, --module [moduleName]', '(optional) name of stylesheets module in your project', null, 'Stylesheets')
.option('-p, --port [portName]', '(optional) name of the port from which to read CSS results', null, 'files')
.option('-r, --root [projectDir]', '(optional) root directory of the project', process.cwd())
.option('-e, --pathToMake [pathToMake]', '(optional) path to elm-make')
.usage("PATH # path to your Stylesheets.elm file")
.option(
"-o, --output [outputDir]",
"(optional) directory in which to write CSS file",
process.cwd()
)
.option(
"-m, --module [moduleName]",
"(optional) name of stylesheets module in your project",
null,
"Stylesheets"
)
.option(
"-p, --port [portName]",
"(optional) name of the port from which to read CSS results",
null,
"files"
)
.option(
"-r, --root [projectDir]",
"(optional) root directory of the project",
process.cwd()
)
.option("-e, --pathToMake [pathToMake]", "(optional) path to elm-make")
.action(function(src) {
sourcePath = src;
})
.parse(process.argv);

if(!sourcePath) {
console.log(chalk.red("You must specifiy a path to your Stylesheets.elm file. See the README for information on how to build a Stylesheets.elm file."));
if (!sourcePath) {
console.log(
chalk.red(
"You must specifiy a path to your Stylesheets.elm file. See the README for information on how to build a Stylesheets.elm file."
)
);
program.outputHelp();
process.exit(1);
}
Expand All @@ -32,12 +55,18 @@ elmCss(
program.module,
program.port,
program.pathToMake
).then(function (results) {
console.log(chalk.green('Successfully generated output! The following css files were created: '));
results.forEach(function (result) {
console.log(chalk.blue('- ' + result.filename));
)
.then(function(results) {
console.log(
chalk.green(
"Successfully generated output! The following css files were created: "
)
);
results.forEach(function(result) {
console.log(chalk.blue("- " + result.filename));
});
})
.catch(function(error) {
console.log(chalk.red(error));
process.exit(1);
});
}).catch(function (error) {
console.log(chalk.red(error));
process.exit(1);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"chalk": "1.1.1",
"commander": "2.9.0",
"node-elm-compiler": "2.3.2",
"node-elm-compiler": "4.3.3",
"tmp": "0.0.28"
},
"devDependencies": {
Expand Down