Permalink
Browse files

Introduce transpiler

  • Loading branch information...
1 parent 8d3e534 commit 164992aa3b8e0f37d63f40ffd0f10b7520ffefba ksa committed Sep 18, 2016
Showing with 28 additions and 19 deletions.
  1. +1 −1 .babelrc
  2. +2 −0 .eslintignore
  3. +1 −0 .gitignore
  4. +8 −4 README.md
  5. +2 −0 bin/jest-codemods.js
  6. +9 −7 package.json
  7. +5 −3 src/{cli/tape-to-jest.js → cli.js}
  8. +0 −4 src/cli/bin.js
View
@@ -1,3 +1,3 @@
{
- "presets": ["es2015"]
+ "presets": ["es2015-node4"]
}
View
@@ -1 +1,3 @@
node_modules
+bin
+dist
View
@@ -2,3 +2,4 @@
node_modules
npm-debug.log*
coverage
+dist
View
@@ -15,28 +15,32 @@ Codemods are small programs that help you automate changes to your codebase. Thi
$ npm install --global jest-codemods
```
-This installs a binary `jest-covemods`.
+This installs a binary `jest-codemods`.
## Usage
Currently we support migrating from [Tape](https://github.com/substack/tape) to Jest.
```
-$ jest-covemods --help
+$ jest-codemods --help
+
+ Codemod that simplify migrating to Jest
Usage
- $ jest-covemods <path> [options]
+ $ jest-codemods <path> [options]
path Files or directory to transform. Can be a glob like src/**.test.js
+ Only files with Tape will be converted.
+
Options
--force, -f Bypass Git safety checks and forcibly run codemods
--dry, -d Dry run (no changes are made to files)
--parser The parser to use for parsing your source files (babel | babylon | flow) [babel]
```
-To transform all test files in a directory run `jest-covemods mySrcFolder` in your terminal.
+To transform all test files in a directory run `jest-codemods mySrcFolder` in your terminal.
Only files requiring or importing Tape will be transformed. Notice the console output for errors, manual intervention might be required.
@@ -0,0 +1,2 @@
+#!/usr/bin/env node
+require('../dist/cli');
View
@@ -9,18 +9,20 @@
"email": "kenneth.skovhus@gmail.com",
"url": "github.com/skovhus"
},
- "bin": "src/cli/bin.js",
+ "bin": "bin/jest-codemods.js",
"engines": {
"node": ">=4"
},
"files": [
- "src"
+ "bin",
+ "dist"
],
"scripts": {
- "check": "npm run lint && npm run test",
- "clean": "rm -rf lib coverage npm-debug.log",
+ "build": "babel src -d dist",
+ "check": "npm run lint && npm run test:cov",
+ "clean": "rm -rf lib coverage npm-debug.log dist",
"lint": "eslint --fix src",
- "prepublish": "npm run clean && npm run check",
+ "prepublish": "npm run clean && npm run check && npm run build",
"test:cov": "npm run test -- --coverage",
"test:watch": "npm run test -- --watch",
"test": "jest"
@@ -37,16 +39,16 @@
"codemods"
],
"dependencies": {
- "babel-register": "~6.14.0",
"execa": "~0.4.0",
"is-git-clean": "~1.0.0",
"jscodeshift": "~0.3.28",
"meow": "~3.7.0",
"update-notifier": "~1.0.2"
},
"devDependencies": {
+ "babel-cli": "^6.14.0",
"babel-jest": "^15.0.0",
- "babel-preset-es2015": "^6.14.0",
+ "babel-preset-es2015-node4": "2.1.0",
"eslint": "^3.5.0",
"eslint-config-airbnb-base": "^7.1.0",
"eslint-plugin-import": "^1.15.0",
@@ -58,12 +58,14 @@ function executeTransformation(files, flags) {
const cli = meow(
{
- description: 'Codemod to change test runner from Tape to Jest',
+ description: 'Codemod that simplify migrating to Jest',
help: `
Usage
- $ tape-to-jest <path> [options]
+ $ jest-codemods <path> [options]
- path Files or directory to transform. Can be a glob like src/**.test.js (only files with Tape will be converted)
+ path Files or directory to transform. Can be a glob like src/**.test.js
+
+ Only files with Tape will be converted.
Options
--force, -f Bypass Git safety checks and forcibly run codemods
View
@@ -1,4 +0,0 @@
-#!/usr/bin/env node
-/* eslint-disable import/no-commonjs */
-require('babel-register');
-require('./tape-to-jest');

0 comments on commit 164992a

Please sign in to comment.