Set up a basic typescript build

This commit is contained in:
Savanni D'Gerinel 2021-12-26 13:33:01 -05:00
parent e8d77699a9
commit 2483d8d0d9
9 changed files with 2957 additions and 26 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
**/target
node_modules
target

2934
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,16 +12,17 @@
"license": "AGPL-3.0-or-later",
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.5.2"
"react-dom": "^17.0.2"
},
"devDependencies": {
"@snowpack/plugin-typescript": "^1.2.1",
"@types/react": "^17.0.35",
"@types/react-dom": "^17.0.11",
"eslint": "^8.2.0",
"jest": "^27.4.5",
"plugin-typescript": "^8.0.0",
"snowpack": "^3.8.8",
"ts-jest": "^27.0.7"
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
}
}

View File

@ -1,9 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="root">Placeholder data</div>
<script src="/src/main.js"></script>
<script type="module" src="/dist/index.js"></script>
</body>
</html>

View File

@ -4,7 +4,8 @@
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
/* ... */
public: { url: '/', static: true },
src: { url: '/dist' },
},
plugins: [
/* ... */

16
client/src/index.tsx Normal file
View File

@ -0,0 +1,16 @@
import React from "react"
import ReactDOM from "react-dom"
const Main = () => <>
<h1>Numenera Datasphere</h1>
<div>Campaign Settings</div>
<div>Player Characters</div>
<div>Cyphers and Artifacts</div>
</>;
const main = () => {
ReactDOM.render(<Main />, document.getElementById('root'))
}
console.log(document.getElementById('root'))
main()

View File

@ -1,11 +0,0 @@
import React from "react"
import ReactDOM from "react-dom"
const Hello = () => <div>Hello</div>;
const main = () => {
ReactDOM.render(<Hello />, document.getElementById('root'))
}
console.log(document.getElementById('root'))
main()

View File

@ -7,6 +7,9 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"noEmit": true,
"types": ["snowpack-env"],
"forceConsistentCasingInFileNames": true
}
}

View File

@ -12,6 +12,7 @@ in pkgs.mkShell {
nativeBuildInputs = [
rust
unstable.rust-analyzer
pkgs.nodejs
];
shellHook = ''