-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from devloco/3.4.0
3.4.0
- Loading branch information
Showing
18 changed files
with
788 additions
and
724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 17 additions & 22 deletions
39
packages/cra-template-wptheme-typescript/template/src/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
import React from 'react'; | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import React from "react"; | ||
import logo from "./logo.svg"; | ||
import "./App.css"; | ||
|
||
const App = () => { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>react-src/src/App.tsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>react-src/src/App.tsx</code> and save to reload. | ||
</p> | ||
<a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer"> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
14 changes: 7 additions & 7 deletions
14
packages/cra-template-wptheme-typescript/template/src/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './index.css'; | ||
import App from './App'; | ||
// import * as serviceWorker from './serviceWorker'; | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import "./index.css"; | ||
import App from "./App"; | ||
import * as serviceWorker from "./serviceWorker"; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
ReactDOM.render(<App />, document.getElementById("root")); | ||
|
||
// If you want your app to work offline and load faster, you can change | ||
// unregister() to register() below. Note this comes with some pitfalls. | ||
// Learn more about service workers: https://bit.ly/CRA-PWA | ||
// serviceWorker.unregister(); | ||
serviceWorker.unregister(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
import React from 'react'; | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import React from "react"; | ||
import logo from "./logo.svg"; | ||
import "./App.css"; | ||
|
||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>react-src/src/App.js</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>react-src/src/App.js</code> and save to reload. | ||
</p> | ||
<a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer"> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './index.css'; | ||
import App from './App'; | ||
// import * as serviceWorker from './serviceWorker'; | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import "./index.css"; | ||
import App from "./App"; | ||
import * as serviceWorker from "./serviceWorker"; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
ReactDOM.render(<App />, document.getElementById("root")); | ||
|
||
// If you want your app to work offline and load faster, you can change | ||
// unregister() to register() below. Note this comes with some pitfalls. | ||
// Learn more about service workers: https://bit.ly/CRA-PWA | ||
// serviceWorker.unregister(); | ||
serviceWorker.unregister(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
const { URL } = require("url"); | ||
|
||
module.exports = getPublicUrlOrPath; | ||
|
||
/** | ||
* Returns a URL or a path with slash at the end | ||
* In production can be URL, abolute path, relative path | ||
* In development always will be an absolute path | ||
* In development can use `path` module functions for operations | ||
* | ||
* @param {boolean} craIsEnvDevelopment; unused | ||
* @param {(string|undefined)} homepage a valid url or pathname | ||
* @param {(string|undefined)} envPublicUrl a valid url or pathname | ||
* @returns {string} | ||
*/ | ||
function getPublicUrlOrPath(craIsEnvDevelopment, homepage, envPublicUrl) { | ||
const isEnvDevelopment = false; // create-react-wptheme always uses PROD paths. | ||
const stubDomain = "https://create-react-wptheme.dev"; | ||
|
||
if (envPublicUrl) { | ||
// ensure last slash exists | ||
envPublicUrl = envPublicUrl.endsWith("/") ? envPublicUrl : envPublicUrl + "/"; | ||
|
||
// validate if `envPublicUrl` is a URL or path like | ||
// `stubDomain` is ignored if `envPublicUrl` contains a domain | ||
const validPublicUrl = new URL(envPublicUrl, stubDomain); | ||
|
||
return isEnvDevelopment | ||
? envPublicUrl.startsWith(".") | ||
? "/" | ||
: validPublicUrl.pathname | ||
: // Some apps do not use client-side routing with pushState. | ||
// For these, "homepage" can be set to "." to enable relative asset paths. | ||
envPublicUrl; | ||
} | ||
|
||
if (homepage) { | ||
// strip last slash if exists | ||
homepage = homepage.endsWith("/") ? homepage : homepage + "/"; | ||
|
||
// validate if `homepage` is a URL or path like and use just pathname | ||
const validHomepagePathname = new URL(homepage, stubDomain).pathname; | ||
return isEnvDevelopment | ||
? homepage.startsWith(".") | ||
? "/" | ||
: validHomepagePathname | ||
: // Some apps do not use client-side routing with pushState. | ||
// For these, "homepage" can be set to "." to enable relative asset paths. | ||
homepage.startsWith(".") | ||
? homepage | ||
: validHomepagePathname; | ||
} | ||
|
||
return "/"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.