refactor: removes copy-webpack-plugin (#21200)
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
require("dotenv").config({ path: "../../.env" });
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const os = require("os");
|
||||
const englishTranslation = require("./public/static/locales/en/common.json");
|
||||
const { withAxiom } = require("next-axiom");
|
||||
const { withSentryConfig } = require("@sentry/nextjs");
|
||||
@@ -250,27 +248,6 @@ const nextConfig = {
|
||||
})
|
||||
);
|
||||
|
||||
config.plugins.push(
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: "../../packages/app-store/**/static/**",
|
||||
to({ context, absoluteFilename }) {
|
||||
// Adds compatibility for windows path
|
||||
if (os.platform() === "win32") {
|
||||
const absoluteFilenameWin = absoluteFilename.replaceAll("\\", "/");
|
||||
const contextWin = context.replaceAll("\\", "/");
|
||||
const appName = /app-store\/(.*)\/static/.exec(absoluteFilenameWin);
|
||||
return Promise.resolve(`${contextWin}/public/app-store/${appName[1]}/[name][ext]`);
|
||||
}
|
||||
const appName = /app-store\/(.*)\/static/.exec(absoluteFilename);
|
||||
return Promise.resolve(`${context}/public/app-store/${appName[1]}/[name][ext]`);
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
config.plugins.push(new webpack.DefinePlugin({ "process.env.BUILD_ID": JSON.stringify(buildId) }));
|
||||
|
||||
config.resolve.fallback = {
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
"analyze:server": "BUNDLE_ANALYZE=server next build",
|
||||
"analyze:browser": "BUNDLE_ANALYZE=browser next build",
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
|
||||
"dev": "next dev --turbopack",
|
||||
"dev": "yarn copy-static && next dev --turbopack",
|
||||
"dev:cron": "ts-node cron-tester.ts",
|
||||
"dev-https": "NODE_TLS_REJECT_UNAUTHORIZED=0 next dev --experimental-https",
|
||||
"dx": "yarn dev",
|
||||
"test-codegen": "yarn playwright codegen http://localhost:3000",
|
||||
"type-check": "tsc --pretty --noEmit",
|
||||
"type-check:ci": "tsc-absolute --pretty --noEmit",
|
||||
"build": "next build",
|
||||
"copy-static": "node scripts/copy-app-store-static.js",
|
||||
"build": "yarn copy-static && next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint . --ignore-path .gitignore",
|
||||
"lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
|
||||
@@ -179,10 +180,10 @@
|
||||
"@types/stripe": "^8.0.417",
|
||||
"@types/uuid": "8.3.1",
|
||||
"autoprefixer": "^10.4.12",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cron": "^3.1.7",
|
||||
"detect-port": "^1.3.0",
|
||||
"env-cmd": "^10.1.0",
|
||||
"glob": "^10.3.10",
|
||||
"google-auth-library": "^9.15.0",
|
||||
"module-alias": "^2.2.2",
|
||||
"msw": "^0.42.3",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const glob = require("glob");
|
||||
|
||||
const copyAppStoreStatic = () => {
|
||||
// Get all static files from app-store packages
|
||||
const staticFiles = glob.sync("../../packages/app-store/**/static/**/*", { nodir: true });
|
||||
|
||||
staticFiles.forEach((file) => {
|
||||
// Extract app name from path
|
||||
const appNameMatch = file.match(/app-store\/(.*?)\/static/);
|
||||
if (!appNameMatch) return;
|
||||
|
||||
const appName = appNameMatch[1];
|
||||
const fileName = path.basename(file);
|
||||
|
||||
// Create destination directory if it doesn't exist
|
||||
const destDir = path.join(process.cwd(), "public", "app-store", appName);
|
||||
if (!fs.existsSync(destDir)) {
|
||||
fs.mkdirSync(destDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Copy file to destination
|
||||
const destPath = path.join(destDir, fileName);
|
||||
fs.copyFileSync(file, destPath);
|
||||
console.log(`Copied ${file} to ${destPath}`);
|
||||
});
|
||||
};
|
||||
|
||||
// Run the copy function
|
||||
copyAppStoreStatic();
|
||||
@@ -4352,13 +4352,13 @@ __metadata:
|
||||
bcp-47-match: ^2.0.3
|
||||
bcryptjs: ^2.4.3
|
||||
classnames: ^2.3.1
|
||||
copy-webpack-plugin: ^11.0.0
|
||||
cron: ^3.1.7
|
||||
detect-port: ^1.3.0
|
||||
dompurify: ^3.1.7
|
||||
dotenv-cli: ^6.0.0
|
||||
entities: ^4.4.0
|
||||
env-cmd: ^10.1.0
|
||||
glob: ^10.3.10
|
||||
google-auth-library: ^9.15.0
|
||||
gray-matter: ^4.0.3
|
||||
handlebars: ^4.7.7
|
||||
@@ -21442,17 +21442,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ajv-keywords@npm:^5.0.0":
|
||||
version: 5.1.0
|
||||
resolution: "ajv-keywords@npm:5.1.0"
|
||||
dependencies:
|
||||
fast-deep-equal: ^3.1.3
|
||||
peerDependencies:
|
||||
ajv: ^8.8.2
|
||||
checksum: c35193940b853119242c6757787f09ecf89a2c19bcd36d03ed1a615e710d19d450cb448bfda407b939aba54b002368c8bff30529cc50a0536a8e10bcce300421
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ajv@npm:8.12.0, ajv@npm:^8.6.3":
|
||||
version: 8.12.0
|
||||
resolution: "ajv@npm:8.12.0"
|
||||
@@ -21477,7 +21466,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ajv@npm:^8.0.0, ajv@npm:^8.8.0":
|
||||
"ajv@npm:^8.0.0":
|
||||
version: 8.11.0
|
||||
resolution: "ajv@npm:8.11.0"
|
||||
dependencies:
|
||||
@@ -25035,22 +25024,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"copy-webpack-plugin@npm:^11.0.0":
|
||||
version: 11.0.0
|
||||
resolution: "copy-webpack-plugin@npm:11.0.0"
|
||||
dependencies:
|
||||
fast-glob: ^3.2.11
|
||||
glob-parent: ^6.0.1
|
||||
globby: ^13.1.1
|
||||
normalize-path: ^3.0.0
|
||||
schema-utils: ^4.0.0
|
||||
serialize-javascript: ^6.0.0
|
||||
peerDependencies:
|
||||
webpack: ^5.1.0
|
||||
checksum: df4f8743f003a29ee7dd3d9b1789998a3a99051c92afb2ba2203d3dacfa696f4e757b275560fafb8f206e520a0aa78af34b990324a0e36c2326cefdeef3ca82e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"core-js-pure@npm:^3.30.2":
|
||||
version: 3.32.1
|
||||
resolution: "core-js-pure@npm:3.32.1"
|
||||
@@ -30641,7 +30614,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"glob-parent@npm:^6.0.1, glob-parent@npm:^6.0.2":
|
||||
"glob-parent@npm:^6.0.2":
|
||||
version: 6.0.2
|
||||
resolution: "glob-parent@npm:6.0.2"
|
||||
dependencies:
|
||||
@@ -30866,19 +30839,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"globby@npm:^13.1.1":
|
||||
version: 13.1.2
|
||||
resolution: "globby@npm:13.1.2"
|
||||
dependencies:
|
||||
dir-glob: ^3.0.1
|
||||
fast-glob: ^3.2.11
|
||||
ignore: ^5.2.0
|
||||
merge2: ^1.4.1
|
||||
slash: ^4.0.0
|
||||
checksum: c148fcda0c981f00fb434bb94ca258f0a9d23cedbde6fb3f37098e1abde5b065019e2c63fe2aa2fad4daf2b54bf360b4d0423d85fb3a63d09ed75a2837d4de0f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"globby@npm:^13.1.2":
|
||||
version: 13.1.3
|
||||
resolution: "globby@npm:13.1.3"
|
||||
@@ -45352,18 +45312,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"schema-utils@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "schema-utils@npm:4.0.0"
|
||||
dependencies:
|
||||
"@types/json-schema": ^7.0.9
|
||||
ajv: ^8.8.0
|
||||
ajv-formats: ^2.1.1
|
||||
ajv-keywords: ^5.0.0
|
||||
checksum: c843e92fdd1a5c145dbb6ffdae33e501867f9703afac67bdf35a685e49f85b1dcc10ea250033175a64bd9d31f0555bc6785b8359da0c90bcea30cf6dfbb55a8f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"scmp@npm:^2.1.0":
|
||||
version: 2.1.0
|
||||
resolution: "scmp@npm:2.1.0"
|
||||
@@ -45556,15 +45504,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"serialize-javascript@npm:^6.0.0":
|
||||
version: 6.0.0
|
||||
resolution: "serialize-javascript@npm:6.0.0"
|
||||
dependencies:
|
||||
randombytes: ^2.1.0
|
||||
checksum: 56f90b562a1bdc92e55afb3e657c6397c01a902c588c0fe3d4c490efdcc97dcd2a3074ba12df9e94630f33a5ce5b76a74784a7041294628a6f4306e0ec84bf93
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"serialize-javascript@npm:^6.0.1":
|
||||
version: 6.0.1
|
||||
resolution: "serialize-javascript@npm:6.0.1"
|
||||
|
||||
Reference in New Issue
Block a user