From ab59edb07b3fdb1a2a25ec8e43edbd006eeba1c1 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Wed, 12 Nov 2025 13:30:54 +0530 Subject: [PATCH] chore: :wastebasket: remove redundant code --- .gitignore | 3 +-- .npmignore | 3 +-- package-lock.json | 1 - package.json | 7 ++----- tsup.config.js | 32 +------------------------------- 5 files changed, 5 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 4887fe2..ba8db37 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,4 @@ coverage .dccache dist/* *.log -.nx/ -regions.json \ No newline at end of file +.nx/ \ No newline at end of file diff --git a/.npmignore b/.npmignore index fce3424..47e14fe 100644 --- a/.npmignore +++ b/.npmignore @@ -19,5 +19,4 @@ src *.tgz .talismanrc tap-html.html -.github -regions.json \ No newline at end of file +.github \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f5eac92..a1c23de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "@contentstack/delivery-sdk", "version": "4.10.3", - "hasInstallScript": true, "license": "MIT", "dependencies": { "@contentstack/core": "^1.3.1", diff --git a/package.json b/package.json index 64d66c7..d626843 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,7 @@ "build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json && node tools/rename-cjs.cjs", "build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json", "build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json", - "husky-check": "npm run build && husky && chmod +x .husky/pre-commit", - "postinstall": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o src/assets/regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'", - "postupdate": "curl -s --max-time 30 --fail https://artifacts.contentstack.com/regions.json -o src/assets/regions.json || echo 'Warning: Failed to download regions.json, using existing file if available'" + "husky-check": "npm run build && husky && chmod +x .husky/pre-commit" }, "dependencies": { "@contentstack/core": "^1.3.1", @@ -45,8 +43,7 @@ "files": [ "dist", "package.json", - "README.md", - "src/assets/regions.json" + "README.md" ], "devDependencies": { "@nrwl/jest": "^17.3.2", diff --git a/tsup.config.js b/tsup.config.js index b2a6de2..1734553 100644 --- a/tsup.config.js +++ b/tsup.config.js @@ -1,8 +1,6 @@ import { defineConfig } from 'tsup' import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions' import packageJson from './package.json' assert { type: "json" }; -import { copyFileSync, existsSync, mkdirSync } from 'fs'; -import { dirname, join } from 'path'; export default defineConfig([ modernConfig({ @@ -32,21 +30,7 @@ function modernConfig(opts) { replace: { '{{VERSION}}': `"${packageJson.version}"`, }, - esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })], - onSuccess: async () => { - // Copy regions.json to dist/modern/assets/ (industry standard structure) - const sourceFile = 'src/assets/regions.json'; - const targetFile = join('dist/modern/assets', 'regions.json'); - - if (existsSync(sourceFile)) { - const targetDir = dirname(targetFile); - if (!existsSync(targetDir)) { - mkdirSync(targetDir, { recursive: true }); - } - copyFileSync(sourceFile, targetFile); - console.log('✓ Copied regions.json to dist/modern/assets'); - } - } + esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })] } } @@ -69,20 +53,6 @@ function legacyConfig(opts) { esbuildOptions(options) { options.jsxImportSource = 'preact'; options.jsx = 'automatic' - }, - onSuccess: async () => { - // Copy regions.json to dist/legacy/assets/ (industry standard structure) - const sourceFile = 'src/assets/regions.json'; - const targetFile = join('dist/legacy/assets', 'regions.json'); - - if (existsSync(sourceFile)) { - const targetDir = dirname(targetFile); - if (!existsSync(targetDir)) { - mkdirSync(targetDir, { recursive: true }); - } - copyFileSync(sourceFile, targetFile); - console.log('✓ Copied regions.json to dist/legacy/assets'); - } } } } \ No newline at end of file