Bladeren bron

chad indie fontend pack

v.shebanov 4 jaren geleden
bovenliggende
commit
d87716809c
4 gewijzigde bestanden met toevoegingen van 12 en 30 verwijderingen
  1. 4 2
      web/package.json
  2. 4 26
      web/public/index.html
  3. 2 0
      web/react-shim.js
  4. 2 2
      web/src/create-router.js

+ 4 - 2
web/package.json

@@ -7,7 +7,6 @@
     "@testing-library/react": "^11.2.5",
     "@testing-library/user-event": "^12.8.3",
     "immer": "^8.0.3",
-    "path-parser": "^6.1.0",
     "react": "^17.0.1",
     "react-dom": "^17.0.1",
     "react-infinite-scroller": "^1.2.4",
@@ -26,7 +25,10 @@
     "start": "react-app-rewired start",
     "build": "react-app-rewired build",
     "test": "react-app-rewired test",
-    "eject": "react-scripts eject"
+    "eject": "react-scripts eject",
+    "postinstall": "curl https://gobinaries.com/Termina1/sorvor@v0.4.4 | PREFIX=./node_modules/.bin sh ",
+    "chadpack": "sorvor --serve ./public/index.html --loader:.js=jsx  --loader:.png=file --loader:.svg=file --inject:./react-shim.js --port=3000 --outdir=./build",
+    "chadpack-prod": "sorvor ./public/index.html --loader:.js=jsx  --loader:.png=file --loader:.svg=file --inject:./react-shim.js --outdir=./build"
   },
   "eslintConfig": {
     "extends": [

+ 4 - 26
web/public/index.html

@@ -2,42 +2,20 @@
 <html lang="en">
   <head>
     <meta charset="utf-8" />
-    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <link rel="icon" href="{{ copy "./favicon.ico" }}" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <meta name="theme-color" content="#000000" />
     <meta
       name="description"
       content="Chad music streaming service"
     />
-    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
-    <!--
-      manifest.json provides metadata used when your web app is installed on a
-      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-    -->
-    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
-    <!--
-      Notice the use of %PUBLIC_URL% in the tags above.
-      It will be replaced with the URL of the `public` folder during the build.
-      Only files inside the `public` folder can be referenced from the HTML.
-
-      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
-      work correctly both with client-side routing and a non-root public URL.
-      Learn how to configure a non-root public URL by running `npm run build`.
-    -->
+    <link rel="apple-touch-icon" href="{{ copy "./logo192.png" }}" />
+    <link rel="manifest" href="{{ copy "./manifest.json" }}" />
     <title>Chad music</title>
   </head>
   <body>
     <noscript>You need to enable JavaScript to run this app.</noscript>
     <div id="root"></div>
-    <!--
-      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`.
-    -->
+    {{ esbuild "../src/index.js" true}}
   </body>
 </html>

+ 2 - 0
web/react-shim.js

@@ -0,0 +1,2 @@
+import * as React from 'react'
+export { React }

+ 2 - 2
web/src/create-router.js

@@ -1,10 +1,10 @@
-import createRouter from 'router5'
 import loggerPlugin from 'router5-plugin-logger'
 import browserPlugin from 'router5-plugin-browser'
 import routes from './routes'
+const r5 = require('router5')
 
 export default function configureRouter() {
-  const router = createRouter(routes, {
+  const router = r5.createRouter(routes, {
     defaultRoute: 'browser',
     caseSensitive: true,
     urlParamsEncoding: 'uri'