Skip to content

Commit

Permalink
AUDIO WORKS!
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandanzl committed Feb 2, 2025
1 parent 84649af commit 4c3dbca
Show file tree
Hide file tree
Showing 7 changed files with 1,147 additions and 332 deletions.
9 changes: 7 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ tasks:
- task: yarn_install
- task: go_mod_tidy

# Universal tasks
yarn_dev:
dir: assets
cmds:
- yarn dev

yarn_build:
dir: assets
cmds:
Expand Down Expand Up @@ -82,7 +86,8 @@ tasks:

finished:
cmds:
- messagebox "Finished task!"
# - messagebox "Finished task!"
- echo "Finish"

rclone:
cmds:
Expand Down
168 changes: 84 additions & 84 deletions assets/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = (algorithm) =>
crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
const postcssNormalize = require('postcss-normalize');

const appPackageJson = require(paths.appPackageJson);
Expand All @@ -57,7 +57,7 @@ const sassModuleRegex = /\.module\.(scss|sass)$/;

// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function(webpackEnv) {
module.exports = function (webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';

Expand Down Expand Up @@ -165,7 +165,7 @@ module.exports = function(webpackEnv) {
// require.resolve('webpack-dev-server/client') + '?/',
// require.resolve('webpack/hot/dev-server'),
isEnvDevelopment &&
require.resolve('react-dev-utils/webpackHotDevClient'),
require.resolve('react-dev-utils/webpackHotDevClient'),
// Finally, this is your app's code:
paths.appIndexJs,
// We include the app code last so that if there is a runtime error during
Expand Down Expand Up @@ -194,11 +194,11 @@ module.exports = function(webpackEnv) {
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: isEnvProduction
? info =>
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/')
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/')
: isEnvDevelopment &&
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
// Prevents conflicts when multiple Webpack runtimes (from different apps)
// are used on the same page.
jsonpFunction: `webpackJsonp${appPackageJson.name}`,
Expand Down Expand Up @@ -263,13 +263,13 @@ module.exports = function(webpackEnv) {
parser: safePostCssParser,
map: shouldUseSourceMap
? {
// `inline: false` forces the sourcemap to be output into a
// separate file
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true,
}
// `inline: false` forces the sourcemap to be output into a
// separate file
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true,
}
: false,
},
}),
Expand Down Expand Up @@ -397,7 +397,7 @@ module.exports = function(webpackEnv) {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
),

plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
Expand Down Expand Up @@ -439,7 +439,7 @@ module.exports = function(webpackEnv) {
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,

// If an error happens in a package, it's possible to be
// because it was compiled. Thus, we don't want the browser
// debugger to show the original code. Instead, the code
Expand Down Expand Up @@ -537,7 +537,7 @@ module.exports = function(webpackEnv) {
// Monaco 代码编辑器
new MonacoWebpackPlugin({
// available options are documented at https://github.com/Microsoft/monaco-editor-webpack-plugin#options
languages: ['json',"php","bat","cpp","csharp","css","dockerfile","go","html","ini","java","javascript","less","lua","shell","sql","xml","yaml","python"]
languages: ['json', "php", "bat", "cpp", "csharp", "css", "dockerfile", "go", "html", "ini", "java", "javascript", "less", "lua", "shell", "sql", "xml", "yaml", "python"]
}),
// 写入版本文件
new CopyPlugin([
Expand All @@ -547,8 +547,8 @@ module.exports = function(webpackEnv) {
transform(content, path) {
let contentJson = JSON.parse(content);
return JSON.stringify({
version:contentJson.version,
name:contentJson.name,
version: contentJson.version,
name: contentJson.name,
})
},
},
Expand All @@ -564,28 +564,28 @@ module.exports = function(webpackEnv) {
},
isEnvProduction
? {
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}
: undefined
)
),
// Inlines the webpack runtime script. This script is too small to warrant
// a network request.
// https://github.com/facebook/create-react-app/issues/5358
isEnvProduction &&
shouldInlineRuntimeChunk &&
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
shouldInlineRuntimeChunk &&
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
Expand Down Expand Up @@ -613,14 +613,14 @@ module.exports = function(webpackEnv) {
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebook/create-react-app/issues/186
isEnvDevelopment &&
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
isEnvProduction &&
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
}),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
}),
// Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding
// output file so that tools can pick it up without having to parse
Expand Down Expand Up @@ -654,58 +654,58 @@ module.exports = function(webpackEnv) {

new webpack.DefinePlugin({
ASSETS_VERSION: JSON.stringify(
require("../package.json").version
require("../package.json").version
),
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the Webpack build.
isEnvProduction &&
new WorkboxWebpackPlugin.GenerateSW({
clientsClaim: true,
exclude: [/\.map$/, /asset-manifest\.json$/,/\.ttf$/,/version\.json$/,/\.worker\.js$/],
importWorkboxFrom: 'cdn',
new WorkboxWebpackPlugin.GenerateSW({
clientsClaim: true,
exclude: [/\.map$/, /asset-manifest\.json$/, /\.ttf$/, /version\.json$/, /\.worker\.js$/],
importWorkboxFrom: 'cdn',
// excludeChunks:["monaco-editor-common","pdf"], //"react-pdf" ,"pdf",
navigateFallback: publicUrl + '/index.html',
navigateFallbackBlacklist: [
// Exclude URLs starting with /_, as they're likely an API call
new RegExp('^/_'),
// Exclude any URLs whose last part seems to be a file extension
// as they're likely a resource and not a SPA route.
// URLs containing a "?" character won't be blacklisted as they're likely
// a route with query params (e.g. auth callbacks).
new RegExp('/[^/?]+\\.[^/]+$'),
new RegExp(/^\/api/),
new RegExp(/^\/f\//),
new RegExp(/^\/custom/),
],
}),
navigateFallback: publicUrl + '/index.html',
navigateFallbackBlacklist: [
// Exclude URLs starting with /_, as they're likely an API call
new RegExp('^/_'),
// Exclude any URLs whose last part seems to be a file extension
// as they're likely a resource and not a SPA route.
// URLs containing a "?" character won't be blacklisted as they're likely
// a route with query params (e.g. auth callbacks).
new RegExp('/[^/?]+\\.[^/]+$'),
new RegExp(/^\/api/),
new RegExp(/^\/f\//),
new RegExp(/^\/custom/),
],
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
async: isEnvDevelopment,
useTypescriptIncrementalApi: true,
checkSyntacticErrors: true,
resolveModuleNameModule: process.versions.pnp
? `${__dirname}/pnpTs.js`
: undefined,
resolveTypeReferenceDirectiveModule: process.versions.pnp
? `${__dirname}/pnpTs.js`
: undefined,
tsconfig: paths.appTsConfig,
reportFiles: [
'**',
'!**/__tests__/**',
'!**/?(*.)(spec|test).*',
'!**/src/setupProxy.*',
'!**/src/setupTests.*',
],
silent: true,
// The formatter is invoked directly in WebpackDevServerUtils during development
formatter: isEnvProduction ? typescriptFormatter : undefined,
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
async: isEnvDevelopment,
useTypescriptIncrementalApi: true,
checkSyntacticErrors: true,
resolveModuleNameModule: process.versions.pnp
? `${__dirname}/pnpTs.js`
: undefined,
resolveTypeReferenceDirectiveModule: process.versions.pnp
? `${__dirname}/pnpTs.js`
: undefined,
tsconfig: paths.appTsConfig,
reportFiles: [
'**',
'!**/__tests__/**',
'!**/?(*.)(spec|test).*',
'!**/src/setupProxy.*',
'!**/src/setupTests.*',
],
silent: true,
// The formatter is invoked directly in WebpackDevServerUtils during development
formatter: isEnvProduction ? typescriptFormatter : undefined,
}),
].filter(Boolean),
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
Expand Down
Loading

0 comments on commit 4c3dbca

Please sign in to comment.