Skip to content

Commit 84d8031

Browse files
committed
add parcel package example
1 parent 72b3a7e commit 84d8031

File tree

11 files changed

+212
-0
lines changed

11 files changed

+212
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is a simple monorepo template with some specific design goals:
99
* ESM and CJS work (with distinct build outputs)
1010
* Vanilla TS and React packages work
1111
* Create React App works* (with hot module reloading of the entire workspace)
12+
* Parcel works (with HMR)
1213

1314
\* Create React App, which uses Webpack 5, can't resolve ES modules without .mjs file extensions by default, so [react-app-rewired](https://github.com/timarney/react-app-rewired) is minimally used to [configure Webpack](packages/app/create-react-app/config-overrides.js) to do this.
1415

packages/app/parcel/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.parcel-cache
2+
dist

packages/app/parcel/README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
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.
37+
38+
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.
39+
40+
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.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).

packages/app/parcel/package.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"private": true,
3+
"name": "typescript-monorepo-parcel",
4+
"version": "0.1.0",
5+
"author": "Solana Maintainers <[email protected]>",
6+
"repository": "https://github.com/solana-labs/wallet-standard",
7+
"license": "Apache-2.0",
8+
"scripts": {
9+
"clean": "shx mkdir -p dist .parcel-cache && shx rm -rf dist .parcel-cache",
10+
"prebuild": "pnpm run clean",
11+
"start": "parcel src/index.html",
12+
"build": "parcel build src/index.html"
13+
},
14+
"dependencies": {
15+
"react": "^18.0.0",
16+
"react-dom": "^18.0.0",
17+
"typescript-monorepo-react": "workspace:^"
18+
},
19+
"devDependencies": {
20+
"@types/react": "^18.0.0",
21+
"@types/react-dom": "^18.0.0",
22+
"parcel": "^2.3.2",
23+
"process": "^0.11.10",
24+
"shx": "^0.3.4"
25+
}
26+
}

packages/app/parcel/src/App.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import { HelloWorld } from 'typescript-monorepo-react';
3+
4+
function App() {
5+
return <HelloWorld />;
6+
}
7+
8+
export default App;

packages/app/parcel/src/index.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@import './reset.css';
2+
3+
html, body {
4+
background-color: #303030;
5+
color: #FFFFFF;
6+
}
7+
8+
#app {
9+
min-height: 100vh;
10+
display: flex;
11+
justify-content: center;
12+
align-items: center;
13+
}

packages/app/parcel/src/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Wallet Standard React</title>
7+
<link rel="stylesheet" href="index.css" />
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="index.tsx"></script>
12+
</body>
13+
</html>

packages/app/parcel/src/index.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React, { StrictMode } from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App';
4+
5+
ReactDOM.render(
6+
<StrictMode>
7+
<App />
8+
</StrictMode>,
9+
document.getElementById('app')
10+
);

packages/app/parcel/src/reset.css

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* Box sizing rules */
2+
*,
3+
*::before,
4+
*::after {
5+
box-sizing: border-box;
6+
}
7+
8+
/* Remove default margin */
9+
body,
10+
h1,
11+
h2,
12+
h3,
13+
h4,
14+
p,
15+
figure,
16+
blockquote,
17+
dl,
18+
dd {
19+
margin: 0;
20+
}
21+
22+
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
23+
ul[role='list'],
24+
ol[role='list'] {
25+
list-style: none;
26+
}
27+
28+
/* Set core root defaults */
29+
html:focus-within {
30+
scroll-behavior: smooth;
31+
}
32+
33+
/* Set core body defaults */
34+
body {
35+
min-height: 100vh;
36+
text-rendering: optimizeSpeed;
37+
line-height: 1.5;
38+
}
39+
40+
/* A elements that don't have a class get default styles */
41+
a:not([class]) {
42+
text-decoration-skip-ink: auto;
43+
}
44+
45+
/* Make images easier to work with */
46+
img,
47+
picture {
48+
max-width: 100%;
49+
display: block;
50+
}
51+
52+
/* Inherit fonts for inputs and buttons */
53+
input,
54+
button,
55+
textarea,
56+
select {
57+
font: inherit;
58+
}
59+
60+
/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
61+
@media (prefers-reduced-motion: reduce) {
62+
html:focus-within {
63+
scroll-behavior: auto;
64+
}
65+
66+
*,
67+
*::before,
68+
*::after {
69+
animation-duration: 0.01ms !important;
70+
animation-iteration-count: 1 !important;
71+
transition-duration: 0.01ms !important;
72+
scroll-behavior: auto !important;
73+
}
74+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../../tsconfig.base.json",
3+
"include": ["src"],
4+
"compilerOptions": {
5+
"noEmit": true,
6+
"jsx": "react"
7+
}
8+
}

packages/app/parcel/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../../tsconfig.root.json",
3+
"references": [
4+
{
5+
"path": "../../ui/react"
6+
},
7+
{
8+
"path": "./tsconfig.base.json"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)