Skip to content

Commit

Permalink
update vite ,
Browse files Browse the repository at this point in the history
  • Loading branch information
louiscklaw committed Nov 24, 2021
1 parent 4fd7e7a commit 5aab392
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 46 deletions.
13 changes: 0 additions & 13 deletions vite-helloworld/src/index.css

This file was deleted.

11 changes: 0 additions & 11 deletions vite-helloworld/src/main.jsx

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"vite": "^1.0.0-rc.1",
"vite-plugin-react": "^3.0.0"
}
}
}
12 changes: 12 additions & 0 deletions vite-helloworld/vite-helloworld/scripts/build_to_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -ex

yarn

yarn build


rm -rf ../docs/react-helloworld-tryout
mkdir -p ../docs/react-helloworld-tryout
rsync -avzh --progress build/ ../docs/react-helloworld-tryout
7 changes: 7 additions & 0 deletions vite-helloworld/vite-helloworld/scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -ex

yarn --dev

yarn dev
7 changes: 7 additions & 0 deletions vite-helloworld/vite-helloworld/scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -ex

yarn

npx eslint --init
9 changes: 9 additions & 0 deletions vite-helloworld/vite-helloworld/scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -ex

# eslint -c ./.eslintrc.js src
eslint -c ./.eslintrc.js src \
--ignore-pattern src/tests \
--ignore-pattern *.test.js \
--max-warnings 5 --fix
7 changes: 7 additions & 0 deletions vite-helloworld/vite-helloworld/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -ex

yarn --dev

yarn test -- --coverage
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React, { useState } from 'react'
import logo from './logo.svg'
import './App.css'
import React, { useState } from 'react';
import logo from './logo.svg';
import './App.css';

function App() {
const [count, setCount] = useState(0)
const [count, setCount] = useState(0);

return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>Hello Vite + React!</p>
<p>
<button onClick={() => setCount(count => count + 1)}>count is: {count}</button>
<button onClick={() => setCount((count) => count + 1)}>
count is: {count}
</button>
</p>
<p>
Edit <code>App.jsx</code> and save to test HMR updates.
Expand All @@ -20,13 +22,12 @@ function App() {
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
rel="noopener noreferrer">
Learn React
</a>
</header>
</div>
)
);
}

export default App
export default App;
13 changes: 13 additions & 0 deletions vite-helloworld/vite-helloworld/src/index.css
Original file line number Diff line number Diff line change
@@ -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;
}
File renamed without changes
11 changes: 11 additions & 0 deletions vite-helloworld/vite-helloworld/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
12 changes: 12 additions & 0 deletions vite-helloworld/vite-helloworld/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-check
const reactPlugin = require('vite-plugin-react');

/**
* @type { import('vite').UserConfig }
*/
const config = {
jsx: 'react',
plugins: [reactPlugin],
};

module.exports = config;
File renamed without changes.
12 changes: 0 additions & 12 deletions vite-helloworld/vite.config.js

This file was deleted.

0 comments on commit 5aab392

Please sign in to comment.