qunit-migrate
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "qunit-migrate", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"bin": "src/index.js", | ||
"description": "Migrate old QUnit code to 2.x", | ||
"main": "index.js", | ||
"main": "src/main.js", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "./node_modules/mocha/bin/mocha -u bdd tests/main.js" |
@@ -11,3 +11,3 @@ # QUnit Migrate [![Build Status](https://travis-ci.org/apsdehal/qunit-migrate.svg?branch=master)](https://travis-ci.org/apsdehal/qunit-migrate) | ||
> qunit-migrate "file1, file2, file3" -d -q -w | ||
> $ qunit-migrate "file1, file2, file3" -d -q -w | ||
@@ -62,1 +62,18 @@ __-w__: If you want to write the output to file, default: false | ||
``` | ||
## API | ||
> $ npm install --save qunit-migrate | ||
```js | ||
var qunitMigrate = require('qunit-migrate'); | ||
var data = 'Some old qunit code'; | ||
var options = { | ||
doubleQuotes: true, | ||
definitions: true | ||
}; | ||
var modifiedData = qunitMigrate(data, options); // Fixed code | ||
``` | ||
## License | ||
MIT © [Amanpreet Singh](https://apsdehal.in) |
@@ -9,3 +9,15 @@ #!/usr/bin/env node | ||
var shouldWeWrite = args.w; | ||
var files = args._[0].split(','); | ||
var help = args.h || args.help; | ||
if (help) { | ||
console.log(spitHelp()); | ||
process.exit(0); | ||
} | ||
var files = args._[0].split(',').map(function (x) { | ||
// Append .js to all files even if they don't have one | ||
// And strip any extra whitespace | ||
return x.toString().trim().split(".js")[0] + ".js"; | ||
});; | ||
var options = { | ||
@@ -43,1 +55,11 @@ definitions: definitions, | ||
} | ||
function spitHelp() { | ||
return 'QUnit Migrate\nMigrate your old QUnit code to new api.\n\n' | ||
+ 'Usage: qunit-migrate "file1, file2, file3" -d -q -w\n\nOptions:\n' | ||
+ '-w: If you want to write the output to file, default: false\n' | ||
+ '-d: If you want definitions support, this will try to add QUnit deps to AMD definitions and anonymous requires.\n Keep in mind, qunit-migrate currently doesn\'t check if qunit definition is already present or not.\n' | ||
+ '-q: If you want double quoutes support, by default we convert to single quotes'; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46221
1058
78