From a8a82bb163388c2177d931fdc6ec1dbde8584d10 Mon Sep 17 00:00:00 2001 From: adrians5j Date: Fri, 20 Dec 2024 17:14:27 +0100 Subject: [PATCH] wip --- .../bundling/function/buildHandler.js | 40 ------------------- .../{ => bundlers/webpack}/babelrc.js | 0 .../{ => bundlers/webpack}/webpack.config.js | 2 +- 3 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 packages/project-utils/bundling/function/buildHandler.js rename packages/project-utils/bundling/function/{ => bundlers/webpack}/babelrc.js (100%) rename packages/project-utils/bundling/function/{ => bundlers/webpack}/webpack.config.js (98%) diff --git a/packages/project-utils/bundling/function/buildHandler.js b/packages/project-utils/bundling/function/buildHandler.js deleted file mode 100644 index 57743d31533..00000000000 --- a/packages/project-utils/bundling/function/buildHandler.js +++ /dev/null @@ -1,40 +0,0 @@ -const createBuildFunction = require("./createBuildFunction"); -const fs = require("fs"); -const rimraf = require("rimraf"); -const { join } = require("path"); - -module.exports = async options => { - const start = new Date(); - - const { cwd } = options; - - options.logs !== false && console.log("Deleting existing build files..."); - rimraf.sync(join(cwd, "./dist")); - rimraf.sync(join(cwd, "*.tsbuildinfo"), { glob: true }); - - await createBuildFunction({ - ...options, - overrides: { - output: { filename: "handler.js", path: join(cwd, "dist") } - } - })(); - - options.logs !== false && console.log("Copying meta files..."); - copyToDist("package.json", options); - copyToDist("LICENSE", options); - copyToDist("README.md", options); - - const duration = (new Date() - start) / 1000; - options.logs !== false && console.log(`Done! Build finished in ${duration + "s"}.`); - - return { duration }; -}; - -const copyToDist = (path, { cwd, logs }) => { - const from = join(cwd, path); - const to = join(cwd, "dist", path); - if (fs.existsSync(from)) { - fs.copyFileSync(from, to); - logs !== false && console.log(`Copied ${path}.`); - } -}; diff --git a/packages/project-utils/bundling/function/babelrc.js b/packages/project-utils/bundling/function/bundlers/webpack/babelrc.js similarity index 100% rename from packages/project-utils/bundling/function/babelrc.js rename to packages/project-utils/bundling/function/bundlers/webpack/babelrc.js diff --git a/packages/project-utils/bundling/function/webpack.config.js b/packages/project-utils/bundling/function/bundlers/webpack/webpack.config.js similarity index 98% rename from packages/project-utils/bundling/function/webpack.config.js rename to packages/project-utils/bundling/function/bundlers/webpack/webpack.config.js index 79935a6ee22..47e2ab40714 100644 --- a/packages/project-utils/bundling/function/webpack.config.js +++ b/packages/project-utils/bundling/function/bundlers/webpack/webpack.config.js @@ -2,7 +2,7 @@ const path = require("path"); const webpack = require("webpack"); const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); const { version } = require("@webiny/project-utils/package.json"); -const { getOutput, getEntry } = require("./utils"); +const { getOutput, getEntry } = require("../../utils"); const WebpackBar = require("webpackbar"); module.exports = options => {