From fc069a3cd22795c23f4b15c194540700113766df Mon Sep 17 00:00:00 2001 From: Ahmad Azizi <91204996+its-aazizi@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:38:58 +0500 Subject: [PATCH] removed demo lib build script that was being used in github workflow for e2e --- extra/create-build-with-demo-lib/index.js | 58 ------------------- extra/create-build-with-demo-lib/package.json | 11 ---- package.json | 1 - 3 files changed, 70 deletions(-) delete mode 100644 extra/create-build-with-demo-lib/index.js delete mode 100644 extra/create-build-with-demo-lib/package.json diff --git a/extra/create-build-with-demo-lib/index.js b/extra/create-build-with-demo-lib/index.js deleted file mode 100644 index 7eaa7d5f..00000000 --- a/extra/create-build-with-demo-lib/index.js +++ /dev/null @@ -1,58 +0,0 @@ -const { exec } = require("child_process"); -const fs = require("fs"); - -const cloneDir = "amazon-location-web-marketing-temp"; -const libDir = "demo-app-lib"; - -function runCommand(command, cwd) { - return new Promise((resolve, reject) => { - exec(command, { cwd }, (error, stdout) => { - if (error) { - reject(error); - } else { - resolve(stdout.trim()); - } - }); - }); -} - -async function main() { - try { - // Run npm install in current directory - console.log(`Running npm install and npm run local-lib in current directory...`); - await runCommand(`npm install && npm run local-lib`); - - // Read the package.json file from demo-app-lib in current directory, delete the prepare script, empty the dependencies and devDependencies - const packageJson = JSON.parse(fs.readFileSync("demo-app-lib/package.json", "utf-8")); - delete packageJson.scripts.prepare; - packageJson.dependencies = {}; - packageJson.devDependencies = {}; - fs.writeFileSync("demo-app-lib/package.json", JSON.stringify(packageJson, null, 2)); - - // Copy .env file from current directory into amazon-location-web-marketing-temp directory - console.log(`Copy .env file from current directory into ${cloneDir} directory...`); - await runCommand(`cp .env ../${cloneDir}`); - - // Copying the library directory to the amazon-location-web-marketing-temp directory in node_modules - console.log( - "Copying the library directory from current directory to the amazon-location-web-marketing-temp directory in node_modules..." - ); - fs.mkdirSync(`../${cloneDir}/node_modules/${libDir}`, { recursive: true, force: true }); - fs.cpSync(`./${libDir}/`, `../${cloneDir}/node_modules/${libDir}/`, { recursive: true, force: true }); - - // Run npm install and npm run build in amazon-location-web-marketing-temp directory - console.log(`Running npm install and npm run build in ${cloneDir} directory...`); - await runCommand(`cd ../${cloneDir} && npm install && npm run build`); - - // Copy the build directory from amazon-location-web-marketing-temp directory to current directory - console.log(`Copying the build directory from ${cloneDir} directory to current directory...`); - fs.mkdirSync(`build`, { recursive: true, force: true }); - fs.cpSync(`../${cloneDir}/build/`, "./build", { recursive: true, force: true }); - - console.log("Done."); - } catch (error) { - console.error(`Error: ${error.message}`); - } -} - -main(); diff --git a/extra/create-build-with-demo-lib/package.json b/extra/create-build-with-demo-lib/package.json deleted file mode 100644 index ade275dd..00000000 --- a/extra/create-build-with-demo-lib/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "create-build-with-demo-lib", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC" -} diff --git a/package.json b/package.json index cd8d2023..7b4e0db9 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "dev": "vite", "lib": "tsc && vite build --config vite.library.ts", "local-lib": "tsc && vite build --config vite.library.ts && node extra/prepare-local-lib/index.js", - "create-build-with-demo-lib": "node extra/create-build-with-demo-lib/index.js", "simple-build": "tsc && vite build && cp -r ./public/.well-known/ ./build/", "build": "node --max-old-space-size=12000 node_modules/vite/bin/vite.js build && cp -r ./public/.well-known/ ./build/", "start-build": "npx serve -s build -l 3000",