From d982d5e153186b45a523e740d3ae7be699adda48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= <paul@oshannessy.com>
Date: Tue, 2 Jun 2015 14:13:11 -0700
Subject: [PATCH] Move react-tools from root.

ReactTools is deprecated, it doesn't belong at the root of the project. We'll remove it after 0.14 but for now this moves it so that it's contained and not intermixed with the rest of the project. The currect behavior of copying src/ into the package is maintained.
---
 bin/jsx                        | 51 ------------------------------------------
 grunt/tasks/npm-react-tools.js | 18 +++++----------
 main.js                        | 38 -------------------------------
 npm-react-tools/bin/jsx        | 51 ++++++++++++++++++++++++++++++++++++++++++
 npm-react-tools/main.js        | 38 +++++++++++++++++++++++++++++++
 npm-react-tools/package.json   | 32 ++++++++++++++++++++++++++
 package.json                   | 32 +++-----------------------
 packages/react/package.json    |  5 +----
 8 files changed, 130 insertions(+), 135 deletions(-)
 delete mode 100755 bin/jsx
 delete mode 100644 main.js
 create mode 100755 npm-react-tools/bin/jsx
 create mode 100644 npm-react-tools/main.js
 create mode 100644 npm-react-tools/package.json

diff --git a/bin/jsx b/bin/jsx
deleted file mode 100755
index 616d7af..0000000
--- a/bin/jsx
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env node
-// -*- mode: js -*-
-'use strict';
-
-var transform = require('../main').transform;
-
-require('commoner').version(
-  require('../package.json').version
-).resolve(function(id) {
-  return this.readModuleP(id);
-}).option(
-  '--harmony',
-  'Turns on JS transformations such as ES6 Classes etc.'
-).option(
-  '--target [version]',
-  'Specify your target version of ECMAScript. Valid values are "es3" and ' +
-  '"es5". The default is "es5". "es3" will avoid uses of defineProperty and ' +
-  'will quote reserved words. WARNING: "es5" is not properly supported, even ' +
-  'with the use of es5shim, es5sham. If you need to support IE8, use "es3".',
-  'es5'
-).option(
-  '--strip-types',
-  'Strips out type annotations.'
-).option(
-  '--es6module',
-  'Parses the file as a valid ES6 module. ' +
-  '(Note that this means implicit strict mode)'
-).option(
-  '--non-strict-es6module',
-  'Parses the file as an ES6 module, except disables implicit strict-mode. ' +
-  '(This is useful if you\'re porting non-ES6 modules to ES6, but haven\'t ' +
-  'yet verified that they are strict-mode safe yet)'
-).option(
-  '--source-map-inline',
-  'Embed inline sourcemap in transformed source'
-).process(function(id, source) {
-  // This is where JSX, ES6, etc. desugaring happens.
-  // We don't do any pre-processing of options so that the command line and the
-  // JS API both expose the same set of options. We do extract the options that
-  // we care about from commoner though so we aren't passing too many things
-  // along.
-  var options = {
-    harmony: this.options.harmony,
-    sourceMap: this.options.sourceMapInline,
-    stripTypes: this.options.stripTypes,
-    es6module: this.options.es6module,
-    nonStrictEs6module: this.options.nonStrictEs6module,
-    target: this.options.target
-  };
-  return transform(source, options);
-});
diff --git a/grunt/tasks/npm-react-tools.js b/grunt/tasks/npm-react-tools.js
index e68ecf8..f125f75 100644
--- a/grunt/tasks/npm-react-tools.js
+++ b/grunt/tasks/npm-react-tools.js
@@ -4,6 +4,7 @@ var fs = require('fs');
 var grunt = require('grunt');
 
 var src = 'npm-react-tools';
+var srcSrc = 'src/**/*.js';
 var dest = 'build/npm-react-tools/';
 
 function buildRelease() {
@@ -11,22 +12,13 @@ function buildRelease() {
     grunt.file.delete(dest);
   }
 
-  // read our required files from package.json
-  var pkgFiles = grunt.config.data.pkg.files;
-
   // copy all files from src first, includes custom README
   var mappings = grunt.file.expandMapping('**/*', dest, {cwd: src});
 
-  // make sure we also get package.json
-  pkgFiles.push('package.json');
-
-  pkgFiles.map(function(file) {
-    if (grunt.file.isDir(file)) {
-      mappings = mappings.concat(grunt.file.expandMapping(file + '**/*', dest));
-    } else {
-      mappings.push({src: [file], dest: dest + file});
-    }
-  });
+  // Also copy all files from src/ (for react-native)
+  mappings = mappings.concat(
+    grunt.file.expandMapping(srcSrc, dest)
+  );
 
   mappings.forEach(function(mapping) {
     var mappingSrc = mapping.src[0];
diff --git a/main.js b/main.js
deleted file mode 100644
index 0dc6d5e..0000000
--- a/main.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-
-var jstransform = require('jstransform/simple');
-
-function transformWithDetails(code, opts) {
-  opts = opts || {};
-
-  // Copy out the values we need and make sure they are compatible with
-  // jstransform options. Always set react:true.
-  var options = {
-    react: true,
-    harmony: opts.harmony,
-    stripTypes: opts.stripTypes,
-    sourceMapInline: opts.sourceMap,
-    sourceFilename: opts.sourceFilename,
-    es6module: opts.es6module,
-    nonStrictEs6module: opts.nonStrictEs6module,
-    target: opts.target,
-  };
-
-  return jstransform.transform(code, options);
-}
-
-module.exports = {
-  transform: function(input, options) {
-    return transformWithDetails(input, options).code;
-  },
-  transformWithDetails: transformWithDetails,
-};
diff --git a/npm-react-tools/bin/jsx b/npm-react-tools/bin/jsx
new file mode 100755
index 0000000..616d7af
--- /dev/null
+++ b/npm-react-tools/bin/jsx
@@ -0,0 +1,51 @@
+#!/usr/bin/env node
+// -*- mode: js -*-
+'use strict';
+
+var transform = require('../main').transform;
+
+require('commoner').version(
+  require('../package.json').version
+).resolve(function(id) {
+  return this.readModuleP(id);
+}).option(
+  '--harmony',
+  'Turns on JS transformations such as ES6 Classes etc.'
+).option(
+  '--target [version]',
+  'Specify your target version of ECMAScript. Valid values are "es3" and ' +
+  '"es5". The default is "es5". "es3" will avoid uses of defineProperty and ' +
+  'will quote reserved words. WARNING: "es5" is not properly supported, even ' +
+  'with the use of es5shim, es5sham. If you need to support IE8, use "es3".',
+  'es5'
+).option(
+  '--strip-types',
+  'Strips out type annotations.'
+).option(
+  '--es6module',
+  'Parses the file as a valid ES6 module. ' +
+  '(Note that this means implicit strict mode)'
+).option(
+  '--non-strict-es6module',
+  'Parses the file as an ES6 module, except disables implicit strict-mode. ' +
+  '(This is useful if you\'re porting non-ES6 modules to ES6, but haven\'t ' +
+  'yet verified that they are strict-mode safe yet)'
+).option(
+  '--source-map-inline',
+  'Embed inline sourcemap in transformed source'
+).process(function(id, source) {
+  // This is where JSX, ES6, etc. desugaring happens.
+  // We don't do any pre-processing of options so that the command line and the
+  // JS API both expose the same set of options. We do extract the options that
+  // we care about from commoner though so we aren't passing too many things
+  // along.
+  var options = {
+    harmony: this.options.harmony,
+    sourceMap: this.options.sourceMapInline,
+    stripTypes: this.options.stripTypes,
+    es6module: this.options.es6module,
+    nonStrictEs6module: this.options.nonStrictEs6module,
+    target: this.options.target
+  };
+  return transform(source, options);
+});
diff --git a/npm-react-tools/main.js b/npm-react-tools/main.js
new file mode 100644
index 0000000..0dc6d5e
--- /dev/null
+++ b/npm-react-tools/main.js
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ */
+
+'use strict';
+
+var jstransform = require('jstransform/simple');
+
+function transformWithDetails(code, opts) {
+  opts = opts || {};
+
+  // Copy out the values we need and make sure they are compatible with
+  // jstransform options. Always set react:true.
+  var options = {
+    react: true,
+    harmony: opts.harmony,
+    stripTypes: opts.stripTypes,
+    sourceMapInline: opts.sourceMap,
+    sourceFilename: opts.sourceFilename,
+    es6module: opts.es6module,
+    nonStrictEs6module: opts.nonStrictEs6module,
+    target: opts.target,
+  };
+
+  return jstransform.transform(code, options);
+}
+
+module.exports = {
+  transform: function(input, options) {
+    return transformWithDetails(input, options).code;
+  },
+  transformWithDetails: transformWithDetails,
+};
diff --git a/npm-react-tools/package.json b/npm-react-tools/package.json
new file mode 100644
index 0000000..35fc90a
--- /dev/null
+++ b/npm-react-tools/package.json
@@ -0,0 +1,32 @@
+{
+  "name": "react-tools",
+  "description": "A set of complementary tools to React, including the JSX transformer.",
+  "version": "0.14.0-alpha3",
+  "keywords": [
+    "react",
+    "jsx",
+    "transformer",
+    "view"
+  ],
+  "homepage": "https://facebook.github.io/react",
+  "bugs": "https://github.com/facebook/react/issues",
+  "license": "BSD-3-Clause",
+  "files": [
+    "main.js",
+    "bin/jsx",
+    "src/"
+  ],
+  "main": "main.js",
+  "bin": {
+    "jsx": "./bin/jsx"
+  },
+  "repository": "facebook/react",
+  "dependencies": {
+    "commoner": "^0.10.0",
+    "jstransform": "^11.0.0"
+  },
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "preferGlobal": true
+}
diff --git a/package.json b/package.json
index ca08a3d..32001f6 100644
--- a/package.json
+++ b/package.json
@@ -1,33 +1,7 @@
 {
-  "name": "react-tools",
-  "description": "A set of complementary tools to React, including the JSX transformer.",
+  "name": "react-build",
+  "private": true,
   "version": "0.14.0-beta1",
-  "keywords": [
-    "jsx",
-    "react",
-    "transformer",
-    "view"
-  ],
-  "homepage": "https://facebook.github.io/react",
-  "bugs": "https://github.com/facebook/react/issues",
-  "license": "BSD-3-Clause",
-  "files": [
-    "bin/jsx",
-    "main.js",
-    "src/"
-  ],
-  "main": "main.js",
-  "bin": {
-    "jsx": "./bin/jsx"
-  },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/facebook/react"
-  },
-  "dependencies": {
-    "commoner": "^0.10.0",
-    "jstransform": "^11.0.0"
-  },
   "devDependencies": {
     "babel": "^5.8.3",
     "babel-eslint": "^3.1.25",
@@ -54,6 +28,7 @@
     "gulp-util": "^3.0.5",
     "gzip-js": "~0.3.2",
     "jest-cli": "^0.4.13",
+    "jstransform": "^11.0.0",
     "object-assign": "^3.0.0",
     "optimist": "^0.6.1",
     "platform": "^1.1.0",
@@ -67,7 +42,6 @@
   "engines": {
     "node": ">=0.10.0"
   },
-  "preferGlobal": true,
   "commonerConfig": {
     "version": 7
   },
diff --git a/packages/react/package.json b/packages/react/package.json
index 15afb92..52531a3 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -16,10 +16,7 @@
     "lib/"
   ],
   "main": "react.js",
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/facebook/react"
-  },
+  "repository": "facebook/react",
   "engines": {
     "node": ">=0.10.0"
   },
