This repository has been archived by the owner on Mar 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
784ba73
commit e3de2a2
Showing
9 changed files
with
4,205 additions
and
5,643 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,42 +1,26 @@ | ||
import React from 'react'; | ||
import React, { useState } from 'react'; | ||
import { | ||
BrowserRouter as Router, | ||
Switch, | ||
Route, | ||
Redirect, | ||
} from 'react-router-dom'; | ||
import { asyncComponent } from 'react-async-component'; | ||
|
||
const AsyncLoadPages = promise => | ||
asyncComponent({ | ||
resolve: () => promise, | ||
LoadingComponent: () => <div>Loading</div>, | ||
ErrorComponent: ({ error }) => ( | ||
<div>There is an error. {error.message} </div> | ||
), | ||
}); | ||
const HackyLoader = ({ promise }) => { | ||
const [Comp, setComp] = useState(null); | ||
promise.then(res => setComp(res)); | ||
if (Comp) return <Comp.default />; | ||
return <div>Loading</div>; | ||
}; | ||
|
||
export default () => ( | ||
<Router> | ||
<Switch> | ||
<Route exact path="/" component={AsyncLoadPages(import('./pages'))} /> | ||
<Route | ||
path="/healthcheck" | ||
component={AsyncLoadPages(import('./pages/healthcheck.tsx'))} | ||
exact | ||
path="/" | ||
component={() => <HackyLoader promise={import('./pages')} />} | ||
/> | ||
<Route | ||
path="/index" | ||
component={AsyncLoadPages(import('./pages/index.tsx'))} | ||
/> | ||
<Route | ||
path="/packages" | ||
component={AsyncLoadPages(import('./pages/packages.tsx'))} | ||
/> | ||
<Route | ||
path="/readme" | ||
component={AsyncLoadPages(import('./pages/readme.js'))} | ||
/> | ||
<Redirect to="/" /> | ||
</Switch> | ||
</Router> | ||
); |
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,28 +1,44 @@ | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
|
||
async function linkParcel() { | ||
function linkParcel() { | ||
const parcelHome = process.argv[2]; | ||
|
||
if (!parcelHome) { | ||
console.warn('no parcel home provided'); | ||
return; | ||
} | ||
const nodeModulesParcel = path.resolve(__dirname, '../node_modules/@parcel'); | ||
|
||
try { | ||
await fs.remove(nodeModulesParcel); | ||
await fs.ensureSymlink( | ||
path.resolve(parcelHome, 'node_modules/@parcel'), | ||
nodeModulesParcel, | ||
); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
|
||
console.log( | ||
'symlink to parcel should have been successful. Good luck deving!', | ||
const parcelCore = path.resolve(parcelHome, 'packages', 'core', 'core'); | ||
const parcelConfig = path.resolve( | ||
parcelHome, | ||
'packages', | ||
'configs', | ||
'default', | ||
); | ||
const nodeCore = path.resolve( | ||
process.cwd(), | ||
'node_modules', | ||
'@parcel', | ||
'core', | ||
); | ||
const nodeConfig = path.resolve( | ||
process.cwd(), | ||
'node_modules', | ||
'@parcel', | ||
'config-default', | ||
); | ||
|
||
Promise.all([ | ||
fs.ensureSymlink(parcelCore, nodeCore), | ||
fs.ensureSymlink(parcelConfig, nodeConfig), | ||
]) | ||
.then(() => { | ||
console.log( | ||
'symlink to parcel should have been successful. Good luck deving!', | ||
); | ||
}) | ||
.catch(e => console.error(e)); | ||
} | ||
|
||
linkParcel(); |
Oops, something went wrong.