Skip to content

Commit 861c6e8

Browse files
committed
reset
1 parent b3d0ad8 commit 861c6e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+4607
-3
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["react"],
3+
"plugins": ["syntax-dynamic-import"]
4+
}

.gitignore

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
14
/node_modules
2-
coverage
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
313
.DS_Store
4-
*/.DS_Store
514
.env.local
615
.env.development.local
716
.env.test.local
817
.env.production.local
18+
*.idea
19+
*.iml
920

1021
npm-debug.log*
1122
yarn-debug.log*
1223
yarn-error.log*
1324
package-lock.json
25+
yarn.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 cangdu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 373 additions & 1 deletion
Large diffs are not rendered by default.

bin/react-scripts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Copyright (c) 2015-present, Facebook, Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
const spawn = require('react-dev-utils/crossSpawn');
12+
const args = process.argv.slice(2);
13+
14+
const scriptIndex = args.findIndex(
15+
x => x === 'build' || x === 'eject' || x === 'start' || x === 'test'
16+
);
17+
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
18+
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
19+
20+
switch (script) {
21+
case 'build':
22+
case 'eject':
23+
case 'start':
24+
case 'test': {
25+
const result = spawn.sync(
26+
'node',
27+
nodeArgs
28+
.concat(require.resolve('../scripts/' + script))
29+
.concat(args.slice(scriptIndex + 1)),
30+
{ stdio: 'inherit' }
31+
);
32+
if (result.signal) {
33+
if (result.signal === 'SIGKILL') {
34+
console.log(
35+
'The build failed because the process exited too early. ' +
36+
'This probably means the system ran out of memory or someone called ' +
37+
'`kill -9` on the process.'
38+
);
39+
} else if (result.signal === 'SIGTERM') {
40+
console.log(
41+
'The build failed because the process exited too early. ' +
42+
'Someone might have called `kill` or `killall`, or the system could ' +
43+
'be shutting down.'
44+
);
45+
}
46+
process.exit(1);
47+
}
48+
process.exit(result.status);
49+
break;
50+
}
51+
default:
52+
console.log('Unknown script "' + script + '".');
53+
console.log('Perhaps you need to update react-scripts?');
54+
console.log(
55+
'See: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#updating-to-new-releases'
56+
);
57+
break;
58+
}

config/env.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// @remove-on-eject-begin
2+
/**
3+
* Copyright (c) 2015-present, Facebook, Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
// @remove-on-eject-end
9+
'use strict';
10+
11+
const fs = require('fs');
12+
const path = require('path');
13+
const paths = require('./paths');
14+
15+
// Make sure that including paths.js after env.js will read .env variables.
16+
delete require.cache[require.resolve('./paths')];
17+
18+
const NODE_ENV = process.env.NODE_ENV;
19+
if (!NODE_ENV) {
20+
throw new Error(
21+
'The NODE_ENV environment variable is required but was not specified.'
22+
);
23+
}
24+
25+
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
26+
var dotenvFiles = [
27+
`${paths.dotenv}.${NODE_ENV}.local`,
28+
`${paths.dotenv}.${NODE_ENV}`,
29+
// Don't include `.env.local` for `test` environment
30+
// since normally you expect tests to produce the same
31+
// results for everyone
32+
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
33+
paths.dotenv,
34+
].filter(Boolean);
35+
36+
// Load environment variables from .env* files. Suppress warnings using silent
37+
// if this file is missing. dotenv will never modify any environment variables
38+
// that have already been set.
39+
// https://github.com/motdotla/dotenv
40+
dotenvFiles.forEach(dotenvFile => {
41+
if (fs.existsSync(dotenvFile)) {
42+
require('dotenv').config({
43+
path: dotenvFile,
44+
});
45+
}
46+
});
47+
48+
// We support resolving modules according to `NODE_PATH`.
49+
// This lets you use absolute paths in imports inside large monorepos:
50+
// https://github.com/facebookincubator/create-react-app/issues/253.
51+
// It works similar to `NODE_PATH` in Node itself:
52+
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
53+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
54+
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
55+
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
56+
// We also resolve them to make sure all tools using them work consistently.
57+
const appDirectory = fs.realpathSync(process.cwd());
58+
process.env.NODE_PATH = (process.env.NODE_PATH || '')
59+
.split(path.delimiter)
60+
.filter(folder => folder && !path.isAbsolute(folder))
61+
.map(folder => path.resolve(appDirectory, folder))
62+
.join(path.delimiter);
63+
64+
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
65+
// injected into the application via DefinePlugin in Webpack configuration.
66+
const REACT_APP = /^REACT_APP_/i;
67+
68+
function getClientEnvironment(publicUrl) {
69+
const raw = Object.keys(process.env)
70+
.filter(key => REACT_APP.test(key))
71+
.reduce(
72+
(env, key) => {
73+
env[key] = process.env[key];
74+
return env;
75+
},
76+
{
77+
// Useful for determining whether we’re running in production mode.
78+
// Most importantly, it switches React into the correct mode.
79+
NODE_ENV: process.env.NODE_ENV || 'development',
80+
// Useful for resolving the correct path to static assets in `public`.
81+
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
82+
// This should only be used as an escape hatch. Normally you would put
83+
// images into the `src` and `import` them in code to get their paths.
84+
PUBLIC_URL: publicUrl,
85+
STATIC_ENV: process.env.STATIC_ENV || 'development',
86+
}
87+
);
88+
// Stringify all values so we can feed into Webpack DefinePlugin
89+
const stringified = {
90+
'process.env': Object.keys(raw).reduce((env, key) => {
91+
env[key] = JSON.stringify(raw[key]);
92+
return env;
93+
}, {}),
94+
};
95+
96+
return { raw, stringified };
97+
}
98+
99+
module.exports = getClientEnvironment;

config/jest/babelTransform.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @remove-file-on-eject
2+
/**
3+
* Copyright (c) 2014-present, Facebook, Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
'use strict';
9+
10+
const babelJest = require('babel-jest');
11+
12+
module.exports = babelJest.createTransformer({
13+
presets: [require.resolve('babel-preset-react-app')],
14+
babelrc: false,
15+
});

config/jest/cssTransform.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// @remove-on-eject-begin
2+
/**
3+
* Copyright (c) 2014-present, Facebook, Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
// @remove-on-eject-end
9+
'use strict';
10+
11+
// This is a custom Jest transformer turning style imports into empty objects.
12+
// http://facebook.github.io/jest/docs/tutorial-webpack.html
13+
14+
module.exports = {
15+
process() {
16+
return 'module.exports = {};';
17+
},
18+
getCacheKey() {
19+
// The output is always the same.
20+
return 'cssTransform';
21+
},
22+
};

config/jest/fileTransform.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @remove-on-eject-begin
2+
/**
3+
* Copyright (c) 2014-present, Facebook, Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
// @remove-on-eject-end
9+
'use strict';
10+
11+
const path = require('path');
12+
13+
// This is a custom Jest transformer turning file imports into filenames.
14+
// http://facebook.github.io/jest/docs/tutorial-webpack.html
15+
16+
module.exports = {
17+
process(src, filename) {
18+
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
19+
},
20+
};

0 commit comments

Comments
 (0)