Skip to content

Commit

Permalink
Migrate @polar/plugin-geo-location to the new rollup setup
Browse files Browse the repository at this point in the history
Also, import the styles from the package in all clients.
  • Loading branch information
dopenguin committed Feb 21, 2024
1 parent b7e7632 commit ba1cb00
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
23 changes: 21 additions & 2 deletions packages/plugins/GeoLocation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,32 @@
"license": "EUPL-1.2",
"type": "module",
"author": "Dataport AöR <[email protected]>",
"main": "src/index.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.js"
},
"./styles.css": {
"import": "./dist/index.css",
"require": "./dist/index.css"
}
},
"repository": {
"type": "git",
"url": "https://github.com/Dataport/polar.git",
"directory": "packages/plugins/GeoLocation"
},
"files": [
"src/**/*",
"dist/**",
"CHANGELOG.md"
],
"scripts": {
"bundle": "tsc --declaration --emitDeclarationOnly && rollup -c",
"preversion": "npm run bundle"
},
"peerDependencies": {
"@repositoryname/vuex-generators": "^1.1.2",
"ol": "^7.1.0",
Expand All @@ -28,5 +44,8 @@
"devDependencies": {
"@polar/lib-custom-types": "^1.0.0",
"@polar/lib-test-mount-parameters": "^1.0.0"
},
"nx": {
"includedScripts": ["bundle"]
}
}
40 changes: 40 additions & 0 deletions packages/plugins/GeoLocation/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import scss from 'rollup-plugin-scss'
import svg from 'rollup-plugin-svg'
import terser from '@rollup/plugin-terser'
import typescript from 'rollup-plugin-typescript2'
import vue from 'rollup-plugin-vue'
import { createFilter } from '@rollup/pluginutils'

const external = createFilter(
['@polar/**', '@repositoryname/vuex-generators', 'ol/**', 'vue', 'vuex'],
null,
{ resolve: false }
)

export default {
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
name: '@polar/plugin-geo-location',
format: 'es',
sourcemap: 'inline',
},
],
external,
plugins: [
vue({
defaultLang: { script: 'ts', style: 'scss' },
css: false,
}),
scss({ fileName: 'index.css', sourceMap: true }),
// Types are not checked as typechecking does not work for vue-files with the current version, might be fixable with an upgrade of vue and vuex; see https://github.com/vuejs/vuex/pull/1121.
typescript({ check: false }),
commonjs(),
resolve(),
svg(),
terser(),
],
}
8 changes: 7 additions & 1 deletion packages/plugins/GeoLocation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "../../../tsconfig.json"
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
},
"include": [
"src/**/*"
]
}

0 comments on commit ba1cb00

Please sign in to comment.