Skip to content

Commit 87b710d

Browse files
authored
Merge pull request #4 from fs-webdev/develop
initial release for frontierMaster
2 parents 20be1b6 + 1b18f65 commit 87b710d

35 files changed

+748
-41
lines changed

.travis.yml

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
---
2-
dist: trusty
31
language: node_js
42
node_js:
5-
- 8
63
- 10
7-
cache:
8-
yarn: true
9-
directories:
10-
- .npm
114
before_install:
12-
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --nightly
13-
- export PATH="$HOME/.yarn/bin:$PATH"
14-
install: true
15-
script:
16-
- 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi'
17-
- 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi'
18-
- 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi'
19-
- 'if [ $TEST_SUITE = "kitchensink-eject" ]; then tasks/e2e-kitchensink-eject.sh; fi'
20-
- 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi'
21-
- 'if [ $TEST_SUITE = "behavior" ]; then tasks/e2e-behavior.sh; fi'
22-
env:
23-
matrix:
24-
- TEST_SUITE=simple
25-
- TEST_SUITE=installs
26-
- TEST_SUITE=kitchensink
27-
- TEST_SUITE=kitchensink-eject
28-
- TEST_SUITE=behavior
29-
matrix:
30-
include:
31-
- os: osx
32-
node_js: 8
33-
env: TEST_SUITE=behavior
34-
- node_js: 6
35-
env: TEST_SUITE=old-node
5+
- echo -e "machine github.com\n login $CI_USER_TOKEN" >> ~/.netrc
6+
install:
7+
- "npm i"
8+
- "cd packages/react-scripts && npm i"
9+
- "cd ../../"
10+
before_deploy:
11+
- "cd packages && tar -zcf react-scripts-$TRAVIS_TAG.tgz react-scripts"
12+
deploy:
13+
provider: releases
14+
skip_cleanup: true
15+
api_key:
16+
secure: ndsLlqyGuhr1aCeLJcQ+5Dph8qFbhd8wno1z+hVz5PsCN8GYZr1tukGZ4xXGs76o2XCpxDrEIxceywrjEHfkMJtDU04WbB0w5oF6bHalgGEqIuARC2QlFdzwzeeG5WWYO1jnTWL4VbvHPQzt1CxGgqW9gX1sEdgqE89AW72KoPD3BQQm6W4NmwwCsDDgi3xnTpDys055ryvPZZOJ1FZ010wFa9TOgQ183ApFcpqPWVxJuZemU5i7RRfkAgKDM5nrgLRYkDg2Xo8txPmVp9aHgPOwYgtTmEORnDDi9HkvU/4tBUh7t5p319p9ayAlt3eVJfgJ31qkrNJGFNu03pAYSGA7OPMJ76llFJygcYS7qaqIAiijRKLrI8bBm187N+cbKl8KUsc8GNBdKPBwNdQAS6+/Zn5QqSvgOTVGGKl1rRx20SYoPVQQvLchHUy+slh5xzrSmRLmZOyd7yi+SiB9sx49X/aJWNIBUAdrFo3aa9wSEwplEZ6geidzSUPQWPwF1UBKGCvYFyTnewHXSrBHx4erlmjhvx17UG8CCK9cn12Gkp1OsxFXd4Y0bIB/Jj1rICyQMDNcvOHMfDy/M4J0kPc3DuI7nLCRF21Ak8flUMGYkBZExvrqmtB+5NtQCy6LQ/IUVf+lP1TEcfultynhH+9mI0sWg2ikNN/zH1Cfxug=
17+
file: packages/react-scripts-$TRAVIS_TAG.tgz
18+
on:
19+
repo: fs-webdev/create-react-app
20+
tags: true

CHANGELOG-FRONTIER.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## 1.0.0
2+
Forked Create React [email protected]
3+
4+
#### :rocket: New Feature
5+
6+
- Got travis to automatically make the tar file and upload it to the github release when a new tag is made (and pushed)
7+
- Added a way to get User Input if they want their react app to have support for Polymer or Redux
8+
- Added new jest configuration option `transformIgnorePatterns`
9+
10+
#### :nail_care: Enhancement
11+
12+
- Changed the React Template to say "Frontier" instead of "React" in the App.js template
13+
14+
#### :memo: Documentation
15+
16+
- Added a README-FRONTIER.md and a CHANGELOG-FRONTIER.md

README-FRONTIER.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## How to test your local copy of react-scripts
2+
3+
- We found that creating a new react-app through this command could utilize your local react-scripts
4+
- You'll just need to change the path to your react-scripts version.
5+
- `npx create-react-app polyer-cra-test --scripts-version file:create-react-app/packages/react-scripts`
6+
7+
## How to make a Release
8+
9+
- When the "develop" branch is ready to merge into frontierMaster for a release, make a PR and be sure to squash all the commits into a single commit.
10+
- Create a tag on frontierMaster named `${SemverVersionOfFacebooksRelease}-frontier-${SemverVersionOfFrontiersRelease}`
11+
- Push that newly created tag up to github with `git push origin ${nameOfTagFromAbove}`
12+
- Travis will automatically catch that new tag, and create a tar file of react-scripts and upload it to the corresponding release on github.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"create-react-app": "node tasks/cra.js",
1010
"e2e": "tasks/e2e-simple.sh",
1111
"e2e:docker": "tasks/local-test.sh",
12-
"postinstall": "cd packages/react-error-overlay/ && yarn build:prod",
12+
"postinstall": "echo \"cd packages/react-error-overlay/ && yarn build:prod\"",
1313
"publish": "tasks/publish.sh",
1414
"start": "cd packages/react-scripts && node bin/react-scripts.js start",
1515
"screencast": "node ./tasks/screencast.js",

packages/react-scripts/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"name": "react-scripts",
33
"version": "2.1.1",
4+
"frontierVersion": "1.0.0",
45
"description": "Configuration and scripts for Create React App.",
5-
"repository": "facebook/create-react-app",
6+
"repository": "joeycozza/create-react-app",
67
"license": "MIT",
78
"engines": {
89
"node": ">=6"
910
},
1011
"bugs": {
11-
"url": "https://github.com/facebook/create-react-app/issues"
12+
"url": "https://github.com/joeycozza/create-react-app/issues"
1213
},
1314
"files": [
1415
"bin",
@@ -30,11 +31,11 @@
3031
"babel-eslint": "9.0.0",
3132
"babel-jest": "23.6.0",
3233
"babel-loader": "8.0.4",
33-
"babel-plugin-named-asset-import": "^0.2.3",
34-
"babel-preset-react-app": "^6.1.0",
34+
"babel-plugin-named-asset-import": "^0.2.2",
35+
"babel-preset-react-app": "^6.0.0",
3536
"bfj": "6.1.1",
3637
"case-sensitive-paths-webpack-plugin": "2.1.2",
37-
"chalk": "2.4.1",
38+
"chalk": "^2.4.1",
3839
"css-loader": "1.0.0",
3940
"dotenv": "6.0.0",
4041
"dotenv-expand": "4.2.0",
@@ -47,9 +48,11 @@
4748
"eslint-plugin-react": "7.11.1",
4849
"file-loader": "2.0.0",
4950
"fork-ts-checker-webpack-plugin-alt": "0.4.14",
51+
"fs-cli-goodies": "github:fs-webdev/fs-cli-goodies",
5052
"fs-extra": "7.0.0",
5153
"html-webpack-plugin": "4.0.0-alpha.2",
5254
"identity-obj-proxy": "3.0.0",
55+
"inquirer": "^6.2.0",
5356
"jest": "23.6.0",
5457
"jest-pnp-resolver": "1.0.1",
5558
"jest-resolve": "23.6.0",
@@ -61,7 +64,7 @@
6164
"postcss-preset-env": "6.0.6",
6265
"postcss-safe-parser": "4.0.1",
6366
"react-app-polyfill": "^0.1.3",
64-
"react-dev-utils": "^6.1.1",
67+
"react-dev-utils": "^6.1.0",
6568
"resolve": "1.8.1",
6669
"sass-loader": "7.1.0",
6770
"style-loader": "0.23.0",

packages/react-scripts/scripts/init.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const spawn = require('react-dev-utils/crossSpawn');
2222
const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
2323
const os = require('os');
2424
const verifyTypeScriptSetup = require('./utils/verifyTypeScriptSetup');
25+
const frontierInit = require('./utils/frontierInit');
2526

2627
function isInGitRepository() {
2728
try {
@@ -75,13 +76,14 @@ function tryGitInit(appPath) {
7576
}
7677
}
7778

78-
module.exports = function(
79+
module.exports = async function(
7980
appPath,
8081
appName,
8182
verbose,
8283
originalDirectory,
8384
template
8485
) {
86+
const answers = await frontierInit.promptForConfig(appPath);
8587
const ownPath = path.dirname(
8688
require.resolve(path.join(__dirname, '..', 'package.json'))
8789
);
@@ -114,6 +116,8 @@ module.exports = function(
114116
JSON.stringify(appPackage, null, 2) + os.EOL
115117
);
116118

119+
frontierInit.packageJsonWritten();
120+
117121
const readmeExists = fs.existsSync(path.join(appPath, 'README.md'));
118122
if (readmeExists) {
119123
fs.renameSync(
@@ -195,6 +199,8 @@ module.exports = function(
195199
}
196200
}
197201

202+
frontierInit.installFrontierDependencies(appPath, answers, useYarn, ownPath);
203+
198204
if (useTypeScript) {
199205
verifyTypeScriptSetup();
200206
}
@@ -217,6 +223,8 @@ module.exports = function(
217223
// Change displayed command to yarn instead of yarnpkg
218224
const displayedCommand = useYarn ? 'yarn' : 'npm';
219225

226+
frontierInit.cleanupFrontierCode(appPath);
227+
220228
console.log();
221229
console.log(`Success! Created ${appName} at ${appPath}`);
222230
console.log('Inside that directory, you can run several commands:');

packages/react-scripts/scripts/utils/createJestConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
8181
'resetModules',
8282
'snapshotSerializers',
8383
'watchPathIgnorePatterns',
84+
'transformIgnorePatterns'
8485
];
8586
if (overrides) {
8687
supportedKeys.forEach(key => {
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
'use strict';
2+
3+
const fs = require('fs-extra');
4+
const os = require('os');
5+
const path = require('path');
6+
const fsCli = require('fs-cli-goodies');
7+
const inquirer = require('inquirer');
8+
const osUtils = require('./osUtils');
9+
10+
module.exports = {
11+
installFrontierDependencies,
12+
promptForConfig,
13+
packageJsonWritten,
14+
cleanupFrontierCode,
15+
};
16+
17+
async function promptForConfig() {
18+
console.log(fsCli.fsLogo('Frontier React Scripts'));
19+
const questions = [
20+
{
21+
type: 'checkbox',
22+
name: 'additionalFeatures',
23+
message: 'What additional features does your app require',
24+
choices: [
25+
{
26+
value: 'polymer',
27+
name: 'Using a shared Polymer Component?',
28+
},
29+
{
30+
name: 'Redux',
31+
value: 'redux',
32+
},
33+
],
34+
},
35+
];
36+
const answers = await inquirer.prompt(questions);
37+
return answers;
38+
}
39+
40+
function packageJsonWritten() {}
41+
42+
function installFrontierDependencies(appPath, answers, useYarn, ownPath) {
43+
const { additionalFeatures } = answers;
44+
45+
if (additionalFeatures.includes('polymer')) {
46+
configurePolymer(appPath, useYarn);
47+
}
48+
if (additionalFeatures.includes('redux')) {
49+
configureRedux(appPath, useYarn, ownPath);
50+
}
51+
injectPolymerCode(appPath);
52+
53+
const defaultModules = [
54+
55+
56+
];
57+
installModulesSync(defaultModules, useYarn);
58+
}
59+
60+
function configurePolymer(appPath, useYarn) {
61+
const appPackage = require(path.join(appPath, 'package.json'));
62+
appPackage.vendorCopy = [
63+
{
64+
from:
65+
'node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js',
66+
to: 'public/vendor/custom-elements-es5-adapter.js',
67+
},
68+
{
69+
from:
70+
'node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js',
71+
to: 'public/vendor/webcomponents-bundle.js',
72+
},
73+
];
74+
75+
const { postinstall } = appPackage.scripts;
76+
appPackage.scripts.postinstall = postinstall
77+
? `${postinstall} && `
78+
: '' + 'vendor-copy';
79+
80+
fs.writeFileSync(
81+
path.join(appPath, 'package.json'),
82+
JSON.stringify(appPackage, null, 2) + os.EOL
83+
);
84+
85+
const polymerModules = [
86+
87+
'@webcomponents/[email protected]',
88+
];
89+
installModulesSync(polymerModules, useYarn, true);
90+
}
91+
92+
function injectPolymerCode(appPath) {
93+
const indexPath = path.join(appPath, 'public/index.html');
94+
const polymerCode = `
95+
<script src="%PUBLIC_URL%/vendor/webcomponents-bundle.js"></script>
96+
<script src="%PUBLIC_URL%/vendor/custom-elements-es5-adapter.js"></script>
97+
`;
98+
99+
let indexHtml = fs.readFileSync(indexPath, 'UTF8');
100+
indexHtml = indexHtml.replace(
101+
'<!--FRONTIER WEBCOMPONENT LOADER CODE FRONTIER -->',
102+
polymerCode
103+
);
104+
fs.writeFileSync(indexPath, indexHtml);
105+
}
106+
107+
function configureRedux(appPath, useYarn, ownPath) {
108+
const reduxModules = [
109+
110+
111+
112+
113+
];
114+
installModulesSync(reduxModules, useYarn);
115+
116+
const templatePath = path.join(ownPath, 'template-redux');
117+
fs.copySync(templatePath, appPath, { overwrite: true });
118+
}
119+
120+
function cleanupFrontierCode(appPath) {}
121+
122+
function installModulesSync(modules, useYarn, saveDev = false) {
123+
const { command, args } = buildInstallCommandAndArgs(useYarn, saveDev);
124+
osUtils.runExternalCommandSync(command, args.concat(modules));
125+
}
126+
127+
function buildInstallCommandAndArgs(useYarn, saveDev = false) {
128+
let command;
129+
let args;
130+
if (useYarn) {
131+
command = 'yarnpkg';
132+
args = ['add'];
133+
if (saveDev) {
134+
args.push('--dev');
135+
}
136+
} else {
137+
command = 'npm';
138+
args = ['install', '--save'];
139+
if (saveDev) {
140+
args[1] = '--save-dev';
141+
}
142+
}
143+
return { command, args };
144+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
const spawn = require('react-dev-utils/crossSpawn');
4+
5+
module.exports = {
6+
runExternalCommandSync,
7+
};
8+
9+
function runExternalCommandSync(command, args) {
10+
const proc = spawn.sync(command, args, { stdio: 'inherit' });
11+
if (proc.status !== 0) {
12+
console.error(`\`${command} ${args.join(' ')}\` failed`);
13+
return;
14+
}
15+
}

packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function verifyTypeScriptSetup() {
9494
suggested: 'es5',
9595
},
9696
allowJs: { suggested: true },
97-
skipLibCheck: { suggested: false },
97+
skipLibCheck: { suggested: true },
9898
esModuleInterop: { suggested: true },
9999
allowSyntheticDefaultImports: { suggested: true },
100100
strict: { suggested: true },

0 commit comments

Comments
 (0)