Skip to content

Commit

Permalink
feat: export esm build as well as browser build
Browse files Browse the repository at this point in the history
BREAKING CHANGE: You'll probably need to adapt your paths and/or
imports as all exported files are now located inside the dist
folder.
  • Loading branch information
hwbllmnn committed Jun 19, 2024
1 parent 7a8fb16 commit e1a448b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
/coverage

# production
/build
/browser
/dist

# misc
.DS_Store
Expand Down
11 changes: 7 additions & 4 deletions package-lock.json

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

19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"name": "geostyler-geojson-parser",
"version": "1.0.1",
"description": "GeoStyler Data Parser implementation for GeoJSON",
"main": "build/dist/GeoJsonDataParser.js",
"types": "build/dist/GeoJsonDataParser.d.ts",
"main": "dist/GeoJsonDataParser.js",
"module": "dist/GeoJsonDataParser.js",
"types": "dist/GeoJsonDataParser.d.ts",
"browser": "dist/geoJsonDataParser.iife.js",
"type": "module",
"files": [
"build",
"index.d.ts",
"browser"
"dist",
"index.d.ts"
],
"repository": {
"type": "git",
Expand All @@ -29,7 +31,7 @@
"geostyler-data": "^1.0.0"
},
"scripts": {
"build": "tsc -p tsconfig.json && npm run build:browser",
"build": "npm run build:browser && tsc -p tsconfig.json",
"build:browser": "vite build",
"pretest": "npm run lint",
"test": "vitest run --coverage",
Expand All @@ -44,9 +46,12 @@
"coveralls": "^3.1.1",
"np": "^8.0.0",
"tslint": "^6.1.3",
"typescript": "^5.0.4",
"typescript": "^5.4.5",
"vite": "^4.3.5",
"vitest": "^0.34.0"
},
"engines": {
"node": ">=20.6.0"
},
"funding": "https://opencollective.com/geostyler"
}
23 changes: 12 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"outDir": "build/dist",
"module": "commonjs",
"target": "es5",
"lib": ["es6", "dom"],
"sourceMap": true,
"inlineSources": true,
"moduleResolution": "node",
"rootDir": "src",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": true,
"lib": ["ES2022", "dom"],
"module": "Preserve",
"moduleResolution": "Bundler",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"strictNullChecks": true,
"noUnusedLocals": true
"target": "ES2022",
},
"exclude": [
"node_modules",
"build",
"dist",
"scripts",
"acceptance-tests",
"coverage",
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
},
rollupOptions: {
output: {
dir: 'browser',
dir: 'dist',
exports: 'named',
generatedCode: 'es5',
format: 'iife',
Expand Down

0 comments on commit e1a448b

Please sign in to comment.