Skip to content

Commit

Permalink
Merge pull request #4115 from oliviertassinari/codemod-fix
Browse files Browse the repository at this point in the history
[Codemod] Add a babel transpilation for npm
  • Loading branch information
oliviertassinari committed Apr 29, 2016
2 parents be8cfd6 + 5adec9e commit f35eed0
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/material-ui-codemod/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015", "stage-1"],
"plugins": ["add-module-exports"]
}
1 change: 1 addition & 0 deletions packages/material-ui-codemod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/transforms
5 changes: 5 additions & 0 deletions packages/material-ui-codemod/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Material-UI codemod

> Codemod scripts for Material-UI
[![npm version](https://img.shields.io/npm/v/material-ui-codemod.svg?style=flat-square)](https://www.npmjs.com/package/material-ui-codemod)
[![npm downloads](https://img.shields.io/npm/dm/material-ui-codemod.svg?style=flat-square)](https://www.npmjs.com/package/material-ui-codemod)

This repository contains a collection of codemod scripts based for use with
[JSCodeshift](https://github.com/facebook/jscodeshift) that help update Material-UI
APIs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sinon from 'sinon';
/* eslint-env mocha */

import fs from 'fs';
import path from 'path';
import {assert} from 'chai';
Expand All @@ -20,12 +21,12 @@ describe('material-ui-codemod', () => {
const actual = transform({
source: read('./import-path.spec/actual.js'),
}, {
jscodeshift: jscodeshift
jscodeshift: jscodeshift,
});

const expected = read('./import-path.spec/expected.js');

assert.equal(
assert.strictEqual(
trim(actual),
trim(expected),
'The transformed version should be correct'
Expand Down
11 changes: 9 additions & 2 deletions packages/material-ui-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "material-ui-codemod",
"author": "Material-UI collaborators",
"version": "0.1.0",
"version": "0.1.4",
"description": "Codemod scripts for Material-UI",
"keywords": [
"react",
Expand All @@ -10,16 +10,23 @@
"jscodeshift"
],
"scripts": {
"test": "babel-node test.js"
"test": "babel-node test.js",
"build": "rimraf transforms && babel ./modules --out-dir ./transforms",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
"url": "https://github.com/callemall/material-ui.git"
},
"files": [
"modules",
"transforms"
],
"homepage": "https://github.com/callemall/material-ui/tree/master/packages/material-ui-codemod",
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.7.5",
"babel-plugin-add-module-exports": "^0.1.4",
"jscodeshift": "^0.3.18"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-codemod/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const mocha = new Mocha({
const paths = [];

if (!argv.component) {
paths.push('transforms/**/*.spec.js');
paths.push('modules/**/*.spec.js');
}

let pattern;
Expand Down

0 comments on commit f35eed0

Please sign in to comment.