From c1f8acef8c7d9e6f7ef776e49befde7b28ae0a49 Mon Sep 17 00:00:00 2001 From: dm1sh Date: Wed, 28 Apr 2021 22:43:35 +0500 Subject: [PATCH] Added react, snowpack and typescript to project template --- .gitignore | 3 +++ package.json | 20 ++++++++++++++++++++ public/index.html | 15 +++++++++++++++ snowpack.config.js | 21 +++++++++++++++++++++ src/App.tsx | 1 + src/index.tsx | 15 +++++++++++++++ tsconfig.json | 12 ++++++++++++ 7 files changed, 87 insertions(+) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 public/index.html create mode 100644 snowpack.config.js create mode 100644 src/App.tsx create mode 100644 src/index.tsx create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7d245c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +package-lock.json +build/ \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8e8f93f --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "scripts": { + "dev": "snowpack dev", + "build": "snowpack build", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "devDependencies": { + "@snowpack/plugin-typescript": "^1.2.1", + "@types/node": "^15.0.1", + "@types/react": "^17.0.4", + "@types/react-dom": "^17.0.3", + "@types/snowpack-env": "^2.3.3", + "snowpack": "^3.3.5", + "typescript": "^4.2.4" + }, + "dependencies": { + "react": "^17.0.2", + "react-dom": "^17.0.2" + } +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..db5f1ff --- /dev/null +++ b/public/index.html @@ -0,0 +1,15 @@ + + + + + + + React application + + + +
+ + + + \ No newline at end of file diff --git a/snowpack.config.js b/snowpack.config.js new file mode 100644 index 0000000..178158b --- /dev/null +++ b/snowpack.config.js @@ -0,0 +1,21 @@ +// Snowpack Configuration File +// See all supported options: https://www.snowpack.dev/reference/configuration + +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + plugins: ["@snowpack/plugin-typescript"], + packageOptions: { + polyfillNode: true, + }, + mount: { + public: "/", + src: "/dist", + }, + optimize: { + bundle: true, + }, + devOptions: { + open: "none", + }, + exclude: ["**/node_modules/**/*", "**/*.test.*"], +}; diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..bffe779 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1 @@ +export const App = () =>
Hello, world
; diff --git a/src/index.tsx b/src/index.tsx new file mode 100644 index 0000000..b2e7395 --- /dev/null +++ b/src/index.tsx @@ -0,0 +1,15 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +import { App } from "./App"; + +ReactDOM.render( + + + , + document.getElementById("root") +); + +if (import.meta.hot) { + import.meta.hot.accept(); +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e8b8cfa --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es5", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-jsx", + "lib": ["DOM"], + "module": "ES2020" + } +}