Skip to content

Commit b9f40d1

Browse files
authored
Merge pull request #68 from fs-webdev/moreUpdates
More updates
2 parents f0eb746 + 0955223 commit b9f40d1

File tree

7 files changed

+874
-83
lines changed

7 files changed

+874
-83
lines changed

packages/react-scripts/scripts/init.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ module.exports = async function(appPath, appName, verbose, originalDirectory, te
108108
JSON.stringify(appPackage, null, 2) + os.EOL
109109
);
110110

111-
frontierInit.packageJsonWritten();
112-
113111
const readmeExists = fs.existsSync(path.join(appPath, 'README.md'));
114112
if (readmeExists) {
115113
fs.renameSync(path.join(appPath, 'README.md'), path.join(appPath, 'README.old.md'));
@@ -179,7 +177,7 @@ module.exports = async function(appPath, appName, verbose, originalDirectory, te
179177
}
180178
}
181179

182-
frontierInit.installFrontierDependencies(appPath, answers, ownPath);
180+
frontierInit.installFrontierDependencies(appPath, appName, answers, ownPath);
183181

184182
if (useTypeScript) {
185183
verifyTypeScriptSetup();

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const osUtils = require('./osUtils');
1010
module.exports = {
1111
installFrontierDependencies,
1212
promptForConfig,
13-
packageJsonWritten,
1413
};
1514

1615
const polymerFromCDNCode = `
@@ -48,9 +47,7 @@ async function promptForConfig() {
4847
return answers;
4948
}
5049

51-
function packageJsonWritten() {}
52-
53-
function installFrontierDependencies(appPath, answers, ownPath) {
50+
function installFrontierDependencies(appPath, appName, answers, ownPath) {
5451
const { additionalFeatures } = answers;
5552
const usePolymer = additionalFeatures.includes('polymer');
5653
const useEF = additionalFeatures.includes('electric-flow');
@@ -106,18 +103,21 @@ function installFrontierDependencies(appPath, answers, ownPath) {
106103
});
107104
installModulesSync(depsToInstall);
108105
installModulesSync(devDepsToInstall, true);
106+
107+
replaceStringInFile(appPath, './README.md', /\{GITHUB_ORG\}\/\{GITHUB_REPO\}/g, `fs-webdev/${appName}`)
109108
}
110109

111110
function handlePolymerCodeAndComments(appPath, usePolymer, useHF) {
111+
const polymerComment = '<!-- FRONTIER WEBCOMPONENT LOADER CODE FRONTIER -->'
112112
let filePath = 'public/index.html';
113113
if (useHF) {
114114
filePath = 'views/index.ejs';
115115
}
116116

117117
if (usePolymer) {
118-
replaceComment(appPath, filePath, polymerFromCDNCode);
118+
replaceStringInFile(appPath, filePath, polymerComment, polymerFromCDNCode);
119119
} else {
120-
replaceComment(appPath, filePath, '');
120+
replaceStringInFile(appPath, filePath, polymerComment, '');
121121
}
122122
}
123123

@@ -130,14 +130,11 @@ function alterPackageJsonFile(appPath, extendFunction) {
130130
);
131131
}
132132

133-
function replaceComment(appPath, fileToInjectIntoPath, stringToInject) {
133+
function replaceStringInFile(appPath, fileToInjectIntoPath, stringToReplace, stringToInject) {
134134
const indexPath = path.join(appPath, fileToInjectIntoPath);
135135
let indexCode = fs.readFileSync(indexPath, 'UTF8');
136136

137-
indexCode = indexCode.replace(
138-
'<!--FRONTIER WEBCOMPONENT LOADER CODE FRONTIER -->',
139-
stringToInject
140-
);
137+
indexCode = indexCode.replace(stringToReplace, stringToInject);
141138
fs.writeFileSync(indexPath, indexCode);
142139
}
143140

packages/react-scripts/template-hf/views/index.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
page.showHelper = true;
66
%>
77
<div id='root'></div>
8-
<!--FRONTIER WEBCOMPONENT LOADER CODE FRONTIER -->
8+
<!-- FRONTIER WEBCOMPONENT LOADER CODE FRONTIER -->
99
<%- include(indexPath) %>
Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
1+
[![Build Status](https://travis-ci.org/{GITHUB_ORG}/{GITHUB_REPO}.svg?branch=master)](https://travis-ci.org/{GITHUB_ORG}/{GITHUB_REPO})
22

3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
34
## Available Scripts
45

56
In the project directory, you can run:
@@ -15,54 +16,16 @@ You will also see any lint errors in the console.
1516
### `npm test`
1617

1718
Launches the test runner in the interactive watch mode.<br>
18-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
1919

2020
### `npm run build`
2121

2222
Builds the app for production to the `build` folder.<br>
2323
It correctly bundles React in production mode and optimizes the build for the best performance.
2424

2525
The build is minified and the filenames include the hashes.<br>
26-
Your app is ready to be deployed!
27-
28-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29-
30-
### `npm run eject`
31-
32-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
3326

34-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35-
36-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37-
38-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
27+
See the section about [deployment](https://www.familysearch.org/frontier/docs/#/develop/deploy) for more information.
3928

4029
## Learn More
4130

42-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43-
44-
To learn React, check out the [React documentation](https://reactjs.org/).
45-
46-
### Code Splitting
47-
48-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49-
50-
### Analyzing the Bundle Size
51-
52-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53-
54-
### Making a Progressive Web App
55-
56-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57-
58-
### Advanced Configuration
59-
60-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61-
62-
### Deployment
63-
64-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65-
66-
### `npm run build` fails to minify
67-
68-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
31+
You can learn more in the [Frontier Documentation](https://www.familysearch.org/frontier/docs/#/).

packages/react-scripts/template/public/index.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
77
<meta name="theme-color" content="#000000" />
8+
89
<!--
9-
manifest.json provides metadata used when your web app is installed on a
10-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
11-
-->
12-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
13-
<!--
14-
Notice the use of %PUBLIC_URL% in the tags above.
10+
Notice the use of %PUBLIC_URL% in the tag above.
1511
It will be replaced with the URL of the `public` folder during the build.
1612
Only files inside the `public` folder can be referenced from the HTML.
1713

packages/react-scripts/template/public/manifest.json

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

0 commit comments

Comments
 (0)