Skip to content

Commit c1cef7a

Browse files
authored
Merge pull request #264 from contentstack/enh/set-region-using-getContentstackEndpoint
chore: 🗑️ remove redundant code
2 parents 329b2a2 + ab59edb commit c1cef7a

File tree

5 files changed

+5
-41
lines changed

5 files changed

+5
-41
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ coverage
1414
.dccache
1515
dist/*
1616
*.log
17-
.nx/
18-
regions.json
17+
.nx/

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ src
1919
*.tgz
2020
.talismanrc
2121
tap-html.html
22-
.github
23-
regions.json
22+
.github

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
"build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json && node tools/rename-cjs.cjs",
3333
"build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
3434
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
35-
"husky-check": "npm run build && husky && chmod +x .husky/pre-commit",
36-
"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'",
37-
"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'"
35+
"husky-check": "npm run build && husky && chmod +x .husky/pre-commit"
3836
},
3937
"dependencies": {
4038
"@contentstack/core": "^1.3.1",
@@ -45,8 +43,7 @@
4543
"files": [
4644
"dist",
4745
"package.json",
48-
"README.md",
49-
"src/assets/regions.json"
46+
"README.md"
5047
],
5148
"devDependencies": {
5249
"@nrwl/jest": "^17.3.2",

tsup.config.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { defineConfig } from 'tsup'
22
import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions'
33
import packageJson from './package.json' assert { type: "json" };
4-
import { copyFileSync, existsSync, mkdirSync } from 'fs';
5-
import { dirname, join } from 'path';
64

75
export default defineConfig([
86
modernConfig({
@@ -32,21 +30,7 @@ function modernConfig(opts) {
3230
replace: {
3331
'{{VERSION}}': `"${packageJson.version}"`,
3432
},
35-
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
36-
onSuccess: async () => {
37-
// Copy regions.json to dist/modern/assets/ (industry standard structure)
38-
const sourceFile = 'src/assets/regions.json';
39-
const targetFile = join('dist/modern/assets', 'regions.json');
40-
41-
if (existsSync(sourceFile)) {
42-
const targetDir = dirname(targetFile);
43-
if (!existsSync(targetDir)) {
44-
mkdirSync(targetDir, { recursive: true });
45-
}
46-
copyFileSync(sourceFile, targetFile);
47-
console.log('✓ Copied regions.json to dist/modern/assets');
48-
}
49-
}
33+
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })]
5034
}
5135
}
5236

@@ -69,20 +53,6 @@ function legacyConfig(opts) {
6953
esbuildOptions(options) {
7054
options.jsxImportSource = 'preact';
7155
options.jsx = 'automatic'
72-
},
73-
onSuccess: async () => {
74-
// Copy regions.json to dist/legacy/assets/ (industry standard structure)
75-
const sourceFile = 'src/assets/regions.json';
76-
const targetFile = join('dist/legacy/assets', 'regions.json');
77-
78-
if (existsSync(sourceFile)) {
79-
const targetDir = dirname(targetFile);
80-
if (!existsSync(targetDir)) {
81-
mkdirSync(targetDir, { recursive: true });
82-
}
83-
copyFileSync(sourceFile, targetFile);
84-
console.log('✓ Copied regions.json to dist/legacy/assets');
85-
}
8656
}
8757
}
8858
}

0 commit comments

Comments
 (0)