commit
e16d8b734c
18 changed files with 8933 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||||
|
.snowpack |
||||
|
build |
||||
|
node_modules |
||||
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"singleQuote": true, |
||||
|
"trailingComma": "all" |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
# New Project |
||||
|
|
||||
|
> ✨ Bootstrapped with Create Snowpack App (CSA). |
||||
|
|
||||
|
## Available Scripts |
||||
|
|
||||
|
### npm start |
||||
|
|
||||
|
Runs the app in the development mode. |
||||
|
Open http://localhost:8080 to view it in the browser. |
||||
|
|
||||
|
The page will reload if you make edits. |
||||
|
You will also see any lint errors in the console. |
||||
|
|
||||
|
### npm run build |
||||
|
|
||||
|
Builds a static copy of your site to the `build/` folder. |
||||
|
Your app is ready to be deployed! |
||||
|
|
||||
|
**For the best production performance:** Add a build bundler plugin like "@snowpack/plugin-webpack" to your `snowpack.config.js` config file. |
||||
|
|
||||
|
### npm test |
||||
|
|
||||
|
Launches the application test runner. |
||||
|
Run with the `--watch` flag (`npm test -- --watch`) to run in interactive watch mode. |
||||
File diff suppressed because it is too large
@ -0,0 +1,30 @@ |
|||||
|
{ |
||||
|
"scripts": { |
||||
|
"start": "snowpack dev", |
||||
|
"build": "snowpack build", |
||||
|
"test": "web-test-runner \"src/**/*.test.tsx\"", |
||||
|
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"", |
||||
|
"lint": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"" |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"react": "^17.0.0", |
||||
|
"react-dom": "^17.0.0" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"@snowpack/plugin-dotenv": "^2.0.5", |
||||
|
"@snowpack/plugin-react-refresh": "^2.4.0", |
||||
|
"@snowpack/plugin-typescript": "^1.2.0", |
||||
|
"@snowpack/web-test-runner-plugin": "^0.2.0", |
||||
|
"@testing-library/react": "^11.0.0", |
||||
|
"@types/chai": "^4.2.13", |
||||
|
"@types/mocha": "^8.2.0", |
||||
|
"@types/react": "^17.0.0", |
||||
|
"@types/react-dom": "^17.0.0", |
||||
|
"@types/snowpack-env": "^2.3.2", |
||||
|
"@web/test-runner": "^0.12.0", |
||||
|
"chai": "^4.2.0", |
||||
|
"prettier": "^2.0.5", |
||||
|
"snowpack": "^3.0.1", |
||||
|
"typescript": "^4.0.0" |
||||
|
} |
||||
|
} |
||||
|
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,25 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="utf-8" /> |
||||
|
<link rel="icon" href="/favicon.ico" /> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
||||
|
<meta name="description" content="Web site created using create-snowpack-app" /> |
||||
|
<title>Snowpack App</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="root"></div> |
||||
|
<noscript>You need to enable JavaScript to run this app.</noscript> |
||||
|
<script type="module" src="/dist/index.js"></script> |
||||
|
<!-- |
||||
|
This HTML file is a template. |
||||
|
If you open it directly in the browser, you will see an empty page. |
||||
|
|
||||
|
You can add webfonts, meta tags, or analytics to this file. |
||||
|
The build step will place the bundled scripts into the <body> tag. |
||||
|
|
||||
|
To begin the development, run `npm start` or `yarn start`. |
||||
|
To create a production bundle, use `npm run build` or `yarn build`. |
||||
|
--> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,3 @@ |
|||||
|
# https://www.robotstxt.org/robotstxt.html |
||||
|
User-agent: * |
||||
|
Disallow: |
||||
@ -0,0 +1,35 @@ |
|||||
|
/** @type {import("snowpack").SnowpackUserConfig } */ |
||||
|
module.exports = { |
||||
|
mount: { |
||||
|
public: { url: '/', static: true }, |
||||
|
src: { url: '/dist' }, |
||||
|
}, |
||||
|
plugins: [ |
||||
|
'@snowpack/plugin-react-refresh', |
||||
|
'@snowpack/plugin-dotenv', |
||||
|
[ |
||||
|
'@snowpack/plugin-typescript', |
||||
|
{ |
||||
|
/* Yarn PnP workaround: see https://www.npmjs.com/package/@snowpack/plugin-typescript */ |
||||
|
...(process.versions.pnp ? { tsc: 'yarn pnpify tsc' } : {}), |
||||
|
}, |
||||
|
], |
||||
|
], |
||||
|
routes: [ |
||||
|
/* Enable an SPA Fallback in development: */ |
||||
|
// {"match": "routes", "src": ".*", "dest": "/index.html"},
|
||||
|
], |
||||
|
optimize: { |
||||
|
/* Example: Bundle your final build: */ |
||||
|
// "bundle": true,
|
||||
|
}, |
||||
|
packageOptions: { |
||||
|
/* ... */ |
||||
|
}, |
||||
|
devOptions: { |
||||
|
/* ... */ |
||||
|
}, |
||||
|
buildOptions: { |
||||
|
/* ... */ |
||||
|
}, |
||||
|
}; |
||||
@ -0,0 +1,46 @@ |
|||||
|
.App { |
||||
|
text-align: center; |
||||
|
} |
||||
|
.App code { |
||||
|
background: #FFF3; |
||||
|
padding: 4px 8px; |
||||
|
border-radius: 4px; |
||||
|
} |
||||
|
.App p { |
||||
|
margin: 0.4rem; |
||||
|
} |
||||
|
|
||||
|
.App-logo { |
||||
|
height: 40vmin; |
||||
|
pointer-events: none; |
||||
|
} |
||||
|
|
||||
|
@media (prefers-reduced-motion: no-preference) { |
||||
|
.App-logo { |
||||
|
animation: App-logo-spin infinite 20s linear; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.App-header { |
||||
|
background-color: #282c34; |
||||
|
min-height: 100vh; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
font-size: calc(10px + 2vmin); |
||||
|
color: white; |
||||
|
} |
||||
|
|
||||
|
.App-link { |
||||
|
color: #61dafb; |
||||
|
} |
||||
|
|
||||
|
@keyframes App-logo-spin { |
||||
|
from { |
||||
|
transform: rotate(0deg); |
||||
|
} |
||||
|
to { |
||||
|
transform: rotate(360deg); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
import * as React from 'react'; |
||||
|
import { render } from '@testing-library/react'; |
||||
|
import { expect } from 'chai'; |
||||
|
import App from './App'; |
||||
|
|
||||
|
describe('<App>', () => { |
||||
|
it('renders learn react link', () => { |
||||
|
const { getByText } = render(<App />); |
||||
|
const linkElement = getByText(/learn react/i); |
||||
|
expect(document.body.contains(linkElement)); |
||||
|
}); |
||||
|
}); |
||||
@ -0,0 +1,41 @@ |
|||||
|
import React, { useState, useEffect } from 'react'; |
||||
|
import logo from './logo.svg'; |
||||
|
import './App.css'; |
||||
|
|
||||
|
interface AppProps {} |
||||
|
|
||||
|
function App({}: AppProps) { |
||||
|
// Create the count state.
|
||||
|
const [count, setCount] = useState(0); |
||||
|
// Create the counter (+1 every second).
|
||||
|
useEffect(() => { |
||||
|
const timer = setTimeout(() => setCount(count + 1), 1000); |
||||
|
return () => clearTimeout(timer); |
||||
|
}, [count, setCount]); |
||||
|
// Return the App component.
|
||||
|
return ( |
||||
|
<div className="App"> |
||||
|
<header className="App-header"> |
||||
|
<img src={logo} className="App-logo" alt="logo" /> |
||||
|
<p> |
||||
|
Edit <code>src/App.tsx</code> and save to reload. |
||||
|
</p> |
||||
|
<p> |
||||
|
Page has been open for <code>{count}</code> seconds. |
||||
|
</p> |
||||
|
<p> |
||||
|
<a |
||||
|
className="App-link" |
||||
|
href="https://reactjs.org" |
||||
|
target="_blank" |
||||
|
rel="noopener noreferrer" |
||||
|
> |
||||
|
Learn React |
||||
|
</a> |
||||
|
</p> |
||||
|
</header> |
||||
|
</div> |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
export default App; |
||||
@ -0,0 +1,13 @@ |
|||||
|
body { |
||||
|
margin: 0; |
||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", |
||||
|
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", |
||||
|
sans-serif; |
||||
|
-webkit-font-smoothing: antialiased; |
||||
|
-moz-osx-font-smoothing: grayscale; |
||||
|
} |
||||
|
|
||||
|
code { |
||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", |
||||
|
monospace; |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
import React from 'react'; |
||||
|
import ReactDOM from 'react-dom'; |
||||
|
import App from './App'; |
||||
|
import './index.css'; |
||||
|
|
||||
|
ReactDOM.render( |
||||
|
<React.StrictMode> |
||||
|
<App /> |
||||
|
</React.StrictMode>, |
||||
|
document.getElementById('root'), |
||||
|
); |
||||
|
|
||||
|
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
|
||||
|
// Learn more: https://snowpack.dev/concepts/hot-module-replacement
|
||||
|
if (import.meta.hot) { |
||||
|
import.meta.hot.accept(); |
||||
|
} |
||||
|
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,26 @@ |
|||||
|
{ |
||||
|
"include": ["src", "types"], |
||||
|
"compilerOptions": { |
||||
|
"module": "esnext", |
||||
|
"target": "esnext", |
||||
|
"moduleResolution": "node", |
||||
|
"jsx": "preserve", |
||||
|
"baseUrl": "./", |
||||
|
/* paths - import rewriting/resolving */ |
||||
|
"paths": { |
||||
|
// If you configured any Snowpack aliases, add them here. |
||||
|
// Add this line to get types for streaming imports (packageOptions.source="remote"): |
||||
|
// "*": [".snowpack/types/*"] |
||||
|
// More info: https://www.snowpack.dev/guides/streaming-imports |
||||
|
}, |
||||
|
/* noEmit - Snowpack builds (emits) files, not tsc. */ |
||||
|
"noEmit": true, |
||||
|
/* Additional Options */ |
||||
|
"strict": true, |
||||
|
"skipLibCheck": true, |
||||
|
"forceConsistentCasingInFileNames": true, |
||||
|
"resolveJsonModule": true, |
||||
|
"allowSyntheticDefaultImports": true, |
||||
|
"importsNotUsedAsValues": "error" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
/* Use this file to declare any custom file extensions for importing */ |
||||
|
/* Use this folder to also add/extend a package d.ts file, if needed. */ |
||||
|
|
||||
|
/* CSS MODULES */ |
||||
|
declare module '*.module.css' { |
||||
|
const classes: { [key: string]: string }; |
||||
|
export default classes; |
||||
|
} |
||||
|
declare module '*.module.scss' { |
||||
|
const classes: { [key: string]: string }; |
||||
|
export default classes; |
||||
|
} |
||||
|
declare module '*.module.sass' { |
||||
|
const classes: { [key: string]: string }; |
||||
|
export default classes; |
||||
|
} |
||||
|
declare module '*.module.less' { |
||||
|
const classes: { [key: string]: string }; |
||||
|
export default classes; |
||||
|
} |
||||
|
declare module '*.module.styl' { |
||||
|
const classes: { [key: string]: string }; |
||||
|
export default classes; |
||||
|
} |
||||
|
|
||||
|
/* CSS */ |
||||
|
declare module '*.css'; |
||||
|
declare module '*.scss'; |
||||
|
declare module '*.sass'; |
||||
|
declare module '*.less'; |
||||
|
declare module '*.styl'; |
||||
|
|
||||
|
/* IMAGES */ |
||||
|
declare module '*.svg' { |
||||
|
const ref: string; |
||||
|
export default ref; |
||||
|
} |
||||
|
declare module '*.bmp' { |
||||
|
const ref: string; |
||||
|
export default ref; |
||||
|
} |
||||
|
declare module '*.gif' { |
||||
|
const ref: string; |
||||
|
export default ref; |
||||
|
} |
||||
|
declare module '*.jpg' { |
||||
|
const ref: string; |
||||
|
export default ref; |
||||
|
} |
||||
|
declare module '*.jpeg' { |
||||
|
const ref: string; |
||||
|
export default ref; |
||||
|
} |
||||
|
declare module '*.png' { |
||||
|
const ref: string; |
||||
|
export default ref; |
||||
|
} |
||||
|
|
||||
|
/* CUSTOM: ADD YOUR OWN HERE */ |
||||
@ -0,0 +1,6 @@ |
|||||
|
// NODE_ENV=test - Needed by "@snowpack/web-test-runner-plugin"
|
||||
|
process.env.NODE_ENV = 'test'; |
||||
|
|
||||
|
module.exports = { |
||||
|
plugins: [require('@snowpack/web-test-runner-plugin')()], |
||||
|
}; |
||||
Loading…
Reference in new issue