Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ coverage
.dccache
dist/*
*.log
.nx/
regions.json
.nx/
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ src
*.tgz
.talismanrc
tap-html.html
.github
regions.json
.github
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -45,8 +43,7 @@
"files": [
"dist",
"package.json",
"README.md",
"src/assets/regions.json"
"README.md"
],
"devDependencies": {
"@nrwl/jest": "^17.3.2",
Expand Down
32 changes: 1 addition & 31 deletions tsup.config.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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' })]
}
}

Expand All @@ -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');
}
}
}
}
Loading