Skip to content

Commit

Permalink
fix: postinstall issue
Browse files Browse the repository at this point in the history
Update example
  • Loading branch information
jorisre authored Mar 28, 2021
2 parents df2bb58 + 790f6df commit 6467583
Show file tree
Hide file tree
Showing 16 changed files with 420 additions and 1,242 deletions.
5 changes: 5 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
6 changes: 2 additions & 4 deletions example/public/index.html → example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@
rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔒</text></svg>"
/>
<link rel="preload" as="script" href="/index.tsx" crossorigin />
<link rel="stylesheet" href="/styles/style.css" />
<link rel="stylesheet" href="/styles/switch.css" />
</head>
<body>
<script type="module" src="/index.tsx"></script>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
30 changes: 14 additions & 16 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
{
"name": "react-screen-wake-lock_example",
"license": "MIT",
"version": "0.0.0",
"scripts": {
"start": "wmr",
"build": "wmr build",
"serve": "wmr serve"
},
"eslintConfig": {
"root": true,
"extends": "preact"
},
"alias": {
"react": "preact/compat",
"react-dom": "preact/compat"
"dev": "vite",
"build": "tsc && vite build",
"serve": "vite preview"
},
"dependencies": {
"preact-iso": "^0.2.0",
"react-screen-wake-lock": "^1.1.5"
"react-screen-wake-lock": "1.1.5"
},
"devDependencies": {
"eslint": "^7.15.0",
"eslint-config-preact": "^1.1.3",
"wmr": "^1.0.0"
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react-refresh": "^1.3.1",
"typescript": "^4.1.2",
"vite": "^2.1.3"
},
"alias": {
"react": "../node_modules/react",
"react-dom": "../node_modules/react-dom/profiling"
}
}
10 changes: 2 additions & 8 deletions example/public/index.tsx → example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import hydrate from 'preact-iso/hydrate';
import { useState } from 'react';
import React, { useState } from 'react';
import { useWakeLock } from 'react-screen-wake-lock';
import Switch from './components/Switch';
import Supported from './components/Supported';
Expand Down Expand Up @@ -65,9 +64,4 @@ const App = () => {
);
};

hydrate(<App />);

export async function prerender(data: any) {
const { default: prerender } = await import('preact-iso/prerender');
return await prerender(<App {...data} />);
}
export default App;
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

const NotSupported = () => (
<span className="support">
<svg
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

const Supported = () => (
<span className="support">
<svg
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

interface Props {
disabled?: boolean;
checked?: boolean;
Expand Down
File renamed without changes
File renamed without changes
12 changes: 12 additions & 0 deletions example/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './styles/style.css';
import './styles/switch.css';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
File renamed without changes.
File renamed without changes.
35 changes: 18 additions & 17 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"compileOnSave": false,
"compilerOptions": {
"jsx": "preserve",
"allowJs": true,
"checkJs": true,
// "strict": true,
"noEmit": true,
"moduleResolution": "node",
"target": "ESNext",
"module": "esnext",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true
},
"typeAcquisition": {
"enable": true
}
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["./src"]
}
13 changes: 13 additions & 0 deletions example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh()],
resolve: {
alias: {
'react-screen-wake-lock': resolve(__dirname, '..'),
},
},
});
Loading

1 comment on commit 6467583

@vercel
Copy link

@vercel vercel bot commented on 6467583 Mar 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.