Skip to content

Commit 42d4bbf

Browse files
committed
Merge 3.3.0 to Master
2 parents 67c2573 + 41d76d2 commit 42d4bbf

Some content is hidden

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

69 files changed

+4668
-65
lines changed

README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Create React WP Theme <!-- omit in toc -->
22

3-
Dec. 15, 2019
3+
Dec. 24, 2019
44
<br />
5-
[v3.3.0](https://github.com/facebook/create-react-app/releases/tag/v3.3.0) of [Create React App](https://create-react-app.dev/) was released. It's a major change and it's going take me another week to make the changes to `create-react-wptheme`.
6-
7-
But don't let that stop you from creating a new theme now, as updating your theme is quite painless (see [Updating Existing Themes](#updating-existing-themes)) below.
8-
9-
The current release of `create-react-wptheme` is based on [v3.2.0](https://github.com/facebook/create-react-app/releases/tag/v3.2.0) of [Create React App](https://create-react-app.dev/).
5+
Updated to use [Create React App](https://create-react-app.dev/) version [3.3.0](https://github.com/facebook/create-react-app/releases/tag/v3.3.0).
106

117
---
128

lerna.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"packages": [
3+
"packages/*"
4+
],
5+
"version": "0.0.0"
6+
}

package.json

+4-51
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,7 @@
11
{
2-
"name": "@devloco/create-react-wptheme",
3-
"version": "3.2.0-wp.6",
4-
"description": "Create React WP themes with no build configuration.",
5-
"main": "index.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
9-
"repository": {
10-
"type": "git",
11-
"url": "git+https://github.com/devloco/create-react-wptheme.git"
12-
},
13-
"keywords": [
14-
"wordpress",
15-
"create-react-app",
16-
"wordpress-theme",
17-
"wordpress-development",
18-
"wordpress-starter-theme",
19-
"wordpress-api",
20-
"reactjs",
21-
"react",
22-
"react-theme",
23-
"wordpress-server",
24-
"react-tutorial",
25-
"react-wordpress-themes",
26-
"php"
27-
],
28-
"author": "devloco",
29-
"license": "MIT",
30-
"engines": {
31-
"node": ">=8"
32-
},
33-
"bugs": {
34-
"url": "https://github.com/devloco/create-react-wptheme/issues"
35-
},
36-
"files": [
37-
"index.js",
38-
"createReactWpTheme.js"
39-
],
40-
"homepage": "https://github.com/devloco/create-react-wptheme#readme",
41-
"bin": {
42-
"create-react-wptheme": "./index.js"
43-
},
44-
"dependencies": {
45-
"chalk": "2.4.2",
46-
"commander": "2.20.0",
47-
"cross-spawn": "6.0.5",
48-
"envinfo": "7.3.1",
49-
"fs-extra": "7.0.1",
50-
"semver": "6.3.0",
51-
"tmp": "0.0.33",
52-
"validate-npm-package-name": "3.0.0"
2+
"name": "root",
3+
"private": true,
4+
"devDependencies": {
5+
"lerna": "^3.19.0"
536
}
547
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# cra-template-wptheme-typescript
2+
3+
This is the official TypeScript template for [Create React WPTheme](https://github.com/devloco/create-react-wptheme).
4+
5+
To use this template, add `--template typescript` when creating a new wp theme.
6+
7+
For example:
8+
9+
```sh
10+
npx create-react-wptheme my-theme --template typescript
11+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "cra-template-wptheme-typescript",
3+
"version": "3.3.0-wp.1",
4+
"keywords": [
5+
"wordpress",
6+
"create-react-app",
7+
"wordpress-theme",
8+
"wordpress-development",
9+
"wordpress-starter-theme",
10+
"wordpress-api",
11+
"reactjs",
12+
"react",
13+
"react-theme",
14+
"wordpress-server",
15+
"react-tutorial",
16+
"react-wordpress-themes",
17+
"php",
18+
"typescript",
19+
"template"
20+
],
21+
"description": "The TypeScript template for Create React WPTheme.",
22+
"main": "template.json",
23+
"repository": {
24+
"type": "git",
25+
"url": "https://github.com/devloco/create-react-wptheme.git"
26+
},
27+
"license": "MIT",
28+
"engines": {
29+
"node": ">=8"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/devloco/create-react-wptheme/issues"
33+
},
34+
"files": [
35+
"template",
36+
"template.json"
37+
]
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"dependencies": {
3+
"@types/node": "^12.0.0",
4+
"@types/react": "^16.9.0",
5+
"@types/react-dom": "^16.9.0",
6+
"typescript": "~3.7.2"
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `npm start`
8+
9+
Runs the app in the development mode.<br />
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br />
13+
You will also see any lint errors in the console.
14+
15+
### `npm test`
16+
17+
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.
19+
20+
### `npm run build`
21+
22+
Builds the app for production to the `build` folder.<br />
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
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!**
33+
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.
39+
40+
## Learn More
41+
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/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
$_reactSrc = realpath(__DIR__) . "/react-src";
3+
$_publicPath = $_reactSrc . "/public";
4+
$_postInstallerPath = $_publicPath . "/post_installer.php";
5+
6+
if (file_exists($_postInstallerPath)) {
7+
// read the package.json file
8+
$packagePath = $_reactSrc . "/package.json";
9+
$json = json_decode(file_get_contents($packagePath), true);
10+
11+
// set the "homepage" correctly in the JSON
12+
// this ensures all WebPack produced links will work
13+
$templatePath = get_template_directory_uri();
14+
$templatePath = parse_url($templatePath, PHP_URL_PATH);
15+
$json["homepage"] = $templatePath;
16+
// set browserLaunchTo to the site's root
17+
$json["browserLaunchTo"] = site_url();
18+
19+
// rewrite the package.json file with the new value for "homepage"
20+
$fp = fopen($packagePath, "w");
21+
fwrite($fp, json_encode($json, JSON_PRETTY_PRINT));
22+
fclose($fp);
23+
24+
// delete the current index.php page (which is this page you are currently reading)
25+
unlink($_publicPath . "/index.php");
26+
// rename the "post_installer.php" to make it the new index.php file
27+
rename($_postInstallerPath, $_publicPath . "/index.php");
28+
}
29+
?>
30+
31+
Now, back in your command prompt, rerun the "start" script again...
32+
33+
<script>
34+
setTimeout(function() {
35+
window.location.replace(window.location);
36+
}, 3000);
37+
</script>
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
$TEMPLATE_PATH = parse_url(get_template_directory_uri(), PHP_URL_PATH);
3+
?>
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
<head>
7+
<meta charset="utf-8" />
8+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1" />
10+
<meta name="theme-color" content="#000000" />
11+
<meta
12+
name="description"
13+
content="Web site created using create-react-wptheme"
14+
/>
15+
<link rel="apple-touch-icon" href="<?php echo $TEMPLATE_PATH; ?>/logo192.png" />
16+
<!--
17+
manifest.json provides metadata used when your web app is installed on a
18+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
19+
-->
20+
<link rel="manifest" href="<?php echo $TEMPLATE_PATH; ?>/manifest.json" />
21+
<!--
22+
If you're reading this from "view source" in your browser, it might not make sense as
23+
these tokens have already been evaluated and replaced, even in this remark blurb.
24+
25+
Notice the use of "php echo $TEMPLATE_PATH;" and %PUBLIC_URL% in the tags above.
26+
Both will be replaced with the URL of the `public` folder during the build (%PUBLIC_URL%) or
27+
at render time (php echo $TEMPLATE_PATH;)
28+
Only files inside the `public` folder can be referenced like this.
29+
30+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
31+
work correctly both with client-side routing and a non-root public URL.
32+
Learn how to configure a non-root public URL by running `npm run wpbuild`.
33+
-->
34+
<title>React WordPress Theme</title>
35+
</head>
36+
<body>
37+
<noscript>
38+
You need to enable JavaScript to run this app.
39+
</noscript>
40+
<div id="root"></div>
41+
<!--
42+
This PHP file is a template.
43+
If you open it directly in the browser, you will see an empty page.
44+
45+
You can add webfonts, meta tags, or analytics to this file.
46+
The build step will place the bundled scripts into the <body> tag.
47+
48+
To begin the development, run `npm run wpstart` or `yarn wpstart`.
49+
To create a production bundle, use `npm run wpbuild` or `yarn wpbuild`.
50+
-->
51+
</body>
52+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
Theme Name: REPLACE_WITH_THEME_NAME
3+
Author: your-name
4+
Author URI: https://github.com/your-github
5+
Description: Create React WP Themes with no build configuration
6+
Version: 0.1
7+
License: GNU General Public License v2 or later
8+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9+
Tags: starter
10+
Text Domain: your-domain
11+
12+
This theme, like WordPress, is licensed under the GPL.
13+
*/

0 commit comments

Comments
 (0)