Skip to content

Commit dbd0217

Browse files
committed
random fixes + license
1 parent 5a2c460 commit dbd0217

File tree

10 files changed

+178
-99
lines changed

10 files changed

+178
-99
lines changed

LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
BSD License
2+
3+
For create-react-app software
4+
5+
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
* Neither the name Facebook nor the names of its contributors may be used to
18+
endorse or promote products derived from this software without specific
19+
prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PATENTS

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Additional Grant of Patent Rights Version 2
2+
3+
"Software" means the create-react-app software distributed by Facebook, Inc.
4+
5+
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
6+
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
7+
(subject to the termination provision below) license under any Necessary
8+
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
9+
transfer the Software. For avoidance of doubt, no license is granted under
10+
Facebook’s rights in any patent claims that are infringed by (i) modifications
11+
to the Software made by you or any third party or (ii) the Software in
12+
combination with any software or other technology.
13+
14+
The license granted hereunder will terminate, automatically and without notice,
15+
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
16+
directly or indirectly, or take a direct financial interest in, any Patent
17+
Assertion: (i) against Facebook or any of its subsidiaries or corporate
18+
affiliates, (ii) against any party if such Patent Assertion arises in whole or
19+
in part from any software, technology, product or service of Facebook or any of
20+
its subsidiaries or corporate affiliates, or (iii) against any party relating
21+
to the Software. Notwithstanding the foregoing, if Facebook or any of its
22+
subsidiaries or corporate affiliates files a lawsuit alleging patent
23+
infringement against you in the first instance, and you respond by filing a
24+
patent infringement counterclaim in that lawsuit against that party that is
25+
unrelated to the Software, the license granted hereunder will not terminate
26+
under section (i) of this paragraph due to such counterclaim.
27+
28+
A "Necessary Claim" is a claim of a patent owned by Facebook that is
29+
necessarily infringed by the Software standing alone.
30+
31+
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
32+
or contributory infringement or inducement to infringe any patent, including a
33+
cross-claim or counterclaim.

global-cli/index.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* of patent rights can be found in the PATENTS file in the same directory.
1010
*/
1111

12-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13-
// /!\ DO NOT MODIFY THIS FILE /!\
14-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13+
// /!\ DO NOT MODIFY THIS FILE /!\
14+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1515
//
1616
// create-react-app is installed globally on people's computers. This means
1717
// that it is extremely difficult to have them upgrade the version and
@@ -21,17 +21,17 @@
2121
// The only job of create-react-app is to init the repository and then
2222
// forward all the commands to the local version of create-react-app.
2323
//
24-
// If you need to add a new command, please add it to local-cli/.
24+
// If you need to add a new command, please add it to the scripts/ folder.
2525
//
2626
// The only reason to modify this file is to add more warnings and
27-
// troubleshooting information for the `react init` command.
27+
// troubleshooting information for the `create-react-app` command.
2828
//
2929
// Do not make breaking changes! We absolutely don't want to have to
3030
// tell people to update their global version of create-react-app.
3131
//
32-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33-
// /!\ DO NOT MODIFY THIS FILE /!\
34-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33+
// /!\ DO NOT MODIFY THIS FILE /!\
34+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3535

3636
'use strict';
3737

@@ -40,18 +40,18 @@ var path = require('path');
4040
var spawn = require('child_process').spawn;
4141
var chalk = require('chalk');
4242
var semver = require('semver');
43+
var argv = require('minimist')(process.argv.slice(2));
44+
4345
/**
44-
* Used arguments:
45-
* -v --version - to print current version of create-react-app and create-react-app-scripts dependency
46+
* Arguments:
47+
* --version - to print current version
4648
* --verbose - to print logs while init
47-
* --scripts-version <alternative create-react-app-scripts package> - override default (https://registry.npmjs.org/create-react-app-scripts@latest),
48-
* package to install, examples:
49-
* - "0.22.0-rc1" - A new app will be created using a specific version of React CLI from npm repo
50-
* - "https://registry.npmjs.org/create-react-app-scripts/-/create-react-app-scripts-0.20.0.tgz" - a .tgz archive from any npm repo
51-
* - "/Users/home/create-react-app/create-react-app-scripts-0.22.0.tgz" - for package prepared with `npm pack`, useful for e2e tests
49+
* --scripts-version <alternative package>
50+
* Example of valid values:
51+
* - a specific npm version: "0.22.0-rc1"
52+
* - a .tgz archive from any npm repo: "https://registry.npmjs.org/create-react-app-scripts/-/create-react-app-scripts-0.20.0.tgz"
53+
* - a package prepared with `npm pack`: "/Users/home/vjeux/create-react-app/create-react-app-scripts-0.22.0.tgz"
5254
*/
53-
var argv = require('minimist')(process.argv.slice(2));
54-
5555
var commands = argv._;
5656
if (commands.length === 0) {
5757
console.error(
@@ -60,8 +60,8 @@ if (commands.length === 0) {
6060
process.exit(1);
6161
}
6262

63-
if (argv.v || argv.version) {
64-
console.log('create-react-app: ' + require('./package.json').version);
63+
if (argv.version) {
64+
console.log('create-react-app version: ' + require('./package.json').version);
6565
process.exit();
6666
}
6767

@@ -70,7 +70,7 @@ createApp(commands[0], argv.verbose, argv['scripts-version']);
7070
function createApp(name, verbose, version) {
7171
if (fs.existsSync(name)) {
7272
console.log('Directory `' + name + '` already exists. Aborting.');
73-
process.exit();
73+
process.exit(1);
7474
}
7575

7676
var root = path.resolve(name);
@@ -146,11 +146,12 @@ function checkNodeVersion() {
146146
if (!packageJson.engines || !packageJson.engines.node) {
147147
return;
148148
}
149+
149150
if (!semver.satisfies(process.version, packageJson.engines.node)) {
150151
console.error(
151152
chalk.red(
152-
'You are currently running Node %s but React CLI requires %s. ' +
153-
'Please use a supported version of Node.\n'
153+
'You are currently running Node %s but create-react-app requires %s.' +
154+
' Please use a supported version of Node.\n'
154155
),
155156
process.version,
156157
packageJson.engines.node

scripts/build.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
process.env.NODE_ENV = 'production';
211

312
var spawnSync = require('child_process').spawnSync;

scripts/export-scripts.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

scripts/graduate.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
var fs = require('fs');
11+
12+
console.log('Extracting scripts...');
13+
14+
var hostPath = __dirname;
15+
var selfPath = hostPath + '/node_modules/create-react-app-scripts';
16+
17+
var files = [
18+
'scripts',
19+
'.webpack.config.dev.js',
20+
'.webpack.config.prod.js',
21+
'.babelrc',
22+
'.eslintrc',
23+
];
24+
25+
// Ensure that the host folder is clean and we won't override any files
26+
files.forEach(function(file) {
27+
if (fs.existsSync(hostPath + '/' + file)) {
28+
console.error(
29+
'`' + file + '` already exists on your app folder, we cannot ' +
30+
'continue as you would lose all the changes in that file.',
31+
'Please delete it (maybe make a copy for backup) and run this ' +
32+
'command again.'
33+
);
34+
process.exit(1);
35+
}
36+
});
37+
38+
// Move the files over
39+
files.forEach(function(file) {
40+
fs.renameSync(selfPath + '/' + file, hostPath + '/' + file);
41+
});
42+
43+
var hostPackage = require(hostPath + '/package.json');
44+
45+
console.log('Done!');

scripts/init.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
var fs = require('fs');
211

312
module.exports = function(hostPath, appName) {
@@ -15,7 +24,8 @@ module.exports = function(hostPath, appName) {
1524
// Setup the script rules
1625
hostPackage.scripts = {};
1726
['start', 'build'].forEach(function(command) {
18-
hostPackage.scripts[command] = 'node node_modules/create-react-app-scripts/scripts/' + command + '.js';
27+
hostPackage.scripts[command] =
28+
'node node_modules/create-react-app-scripts/scripts/' + command + '.js';
1929
});
2030

2131
fs.writeFileSync(hostPath + '/package.json', JSON.stringify(hostPackage, null, 2));

scripts/start.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
process.env.NODE_ENV = 'development';
211

312
var webpack = require('webpack');

webpack.config.dev.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
var path = require('path');
211
var autoprefixer = require('autoprefixer');
312
var webpack = require('webpack');

webpack.config.prod.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
var path = require('path');
211
var autoprefixer = require('autoprefixer');
312
var webpack = require('webpack');

0 commit comments

Comments
 (0)