1
0
Quellcode durchsuchen

Merge branch 'new-build-system' of termina1/chad-music into master

Innocenty Enikeev vor 4 Jahren
Ursprung
Commit
0f7b53729b
6 geänderte Dateien mit 61 neuen und 33 gelöschten Zeilen
  1. 5 3
      web/config-overrides.js
  2. 4 2
      web/package.json
  3. 5 26
      web/public/index.html
  4. 43 0
      web/public/index_old.html
  5. 2 0
      web/react-shim.js
  6. 2 2
      web/src/create-router.js

+ 5 - 3
web/config-overrides.js

@@ -3,9 +3,11 @@ const DirectoryNamedWebpackPlugin = require("directory-named-webpack-plugin");
 const path = require('path');
 
 module.exports = function override(config, env) {
-    config.plugins.push(
-      new BundleAnalyzerPlugin()
-    );
+    // config.plugins.push(
+    //   new BundleAnalyzerPlugin()
+    // );
+    config.plugins[0].options.template = path.join(__dirname, 'public/index_old.html');
+    debugger
     config.resolve.plugins.push(
       new DirectoryNamedWebpackPlugin()
     );

+ 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.5 | 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": [

+ 5 - 26
web/public/index.html

@@ -2,42 +2,21 @@
 <html lang="en">
   <head>
     <meta charset="utf-8" />
-    <link rel="icon" href="%PUBLIC_URL%/logo256.png" />
+    <link rel="icon" href="{{ copy "./logo256.png" }}" />
     <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%/logo256.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" }}" />
+    {{ livereload }}
     <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>

+ 43 - 0
web/public/index_old.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <link rel="icon" href="%PUBLIC_URL%/logo256.png" />
+    <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`.
+    -->
+    <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`.
+    -->
+  </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'