Skip to content
This repository was archived by the owner on May 7, 2022. It is now read-only.

Commit c6b9625

Browse files
committed
create-react-app脚手架版本
1 parent 70af39d commit c6b9625

Some content is hidden

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

71 files changed

+8946
-18303
lines changed

.babelrc

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

.eslintrc.js

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

.flowconfig

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

.gitignore

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,23 @@
1-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
22

3-
*.iml
3+
# dependencies
4+
/node_modules
45

5-
## Directory-based project format:
6-
.idea/
7-
# if you remove the above rule, at least ignore the following:
6+
# testing
7+
/coverage
88

9-
# User-specific stuff:
10-
# .idea/workspace.xml
11-
# .idea/tasks.xml
12-
# .idea/dictionaries
9+
# production
10+
/build
1311

14-
# Sensitive or high-churn files:
15-
# .idea/dataSources.ids
16-
# .idea/dataSources.xml
17-
# .idea/sqlDataSources.xml
18-
# .idea/dynamic.xml
19-
# .idea/uiDesigner.xml
20-
21-
# Gradle:
22-
# .idea/gradle.xml
23-
# .idea/libraries
24-
25-
# Mongo Explorer plugin:
26-
# .idea/mongoSettings.xml
27-
28-
## File-based project format:
29-
*.ipr
30-
*.iws
31-
32-
## Plugin-specific files:
33-
34-
# IntelliJ
35-
/out/
36-
37-
# mpeltonen/sbt-idea plugin
38-
.idea_modules/
39-
# JIRA plugin
40-
atlassian-ide-plugin.xml
41-
42-
# Crashlytics plugin (for Android Studio and IntelliJ)
43-
com_crashlytics_export_strings.xml
44-
crashlytics.properties
45-
crashlytics-build.properties
46-
node_modules/
47-
.sass-cache/
48-
bower_components/
49-
app/bower_components
12+
# misc
5013
.DS_Store
51-
.tmp
52-
ios
53-
.yo-rc.json
54-
.jshintrc
55-
.gitattributes
56-
.editorconfig
57-
.babelrc
58-
npm-debug.log
59-
build/
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*
6022

61-
.idea/
23+
.idea

.project

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

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
language: node_js
22
node_js:
3+
- "9"
4+
- "8"
35
- "7"
46
- "6"
57

6-
script: npm run lint
8+
script: npm run build

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 二月
3+
Copyright (c) 2018 二月
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

config/env.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
'use strict';
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
const paths = require('./paths');
6+
7+
delete require.cache[require.resolve('./paths')];
8+
9+
const NODE_ENV = process.env.NODE_ENV;
10+
if (!NODE_ENV) {
11+
throw new Error(
12+
'The NODE_ENV environment variable is required but was not specified.'
13+
);
14+
}
15+
16+
var dotenvFiles = [
17+
`${paths.dotenv}.${NODE_ENV}.local`,
18+
`${paths.dotenv}.${NODE_ENV}`,
19+
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
20+
paths.dotenv,
21+
].filter(Boolean);
22+
23+
dotenvFiles.forEach(dotenvFile => {
24+
if (fs.existsSync(dotenvFile)) {
25+
require('dotenv-expand')(
26+
require('dotenv').config({
27+
path: dotenvFile,
28+
})
29+
);
30+
}
31+
});
32+
33+
const appDirectory = fs.realpathSync(process.cwd());
34+
process.env.NODE_PATH = (process.env.NODE_PATH || '')
35+
.split(path.delimiter)
36+
.filter(folder => folder && !path.isAbsolute(folder))
37+
.map(folder => path.resolve(appDirectory, folder))
38+
.join(path.delimiter);
39+
40+
const REACT_APP = /^REACT_APP_/i;
41+
42+
function getClientEnvironment(publicUrl) {
43+
const raw = Object.keys(process.env)
44+
.filter(key => REACT_APP.test(key))
45+
.reduce(
46+
(env, key) => {
47+
env[key] = process.env[key];
48+
return env;
49+
},
50+
{
51+
NODE_ENV: process.env.NODE_ENV || 'development',
52+
PUBLIC_URL: publicUrl,
53+
}
54+
);
55+
const stringified = {
56+
'process.env': Object.keys(raw).reduce((env, key) => {
57+
env[key] = JSON.stringify(raw[key]);
58+
return env;
59+
}, {}),
60+
};
61+
62+
return { raw, stringified };
63+
}
64+
65+
module.exports = getClientEnvironment;

config/jest/cssTransform.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
// This is a custom Jest transformer turning style imports into empty objects.
4+
// http://facebook.github.io/jest/docs/en/webpack.html
5+
6+
module.exports = {
7+
process() {
8+
return 'module.exports = {};';
9+
},
10+
getCacheKey() {
11+
// The output is always the same.
12+
return 'cssTransform';
13+
},
14+
};

config/jest/fileTransform.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const path = require('path');
4+
5+
// This is a custom Jest transformer turning file imports into filenames.
6+
// http://facebook.github.io/jest/docs/en/webpack.html
7+
8+
module.exports = {
9+
process(src, filename) {
10+
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
11+
},
12+
};

0 commit comments

Comments
 (0)