Skip to content

Commit ba1cb00

Browse files
committed
Migrate @polar/plugin-geo-location to the new rollup setup
Also, import the styles from the package in all clients.
1 parent b7e7632 commit ba1cb00

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

packages/plugins/GeoLocation/package.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,32 @@
55
"license": "EUPL-1.2",
66
"type": "module",
77
"author": "Dataport AöR <[email protected]>",
8-
"main": "src/index.ts",
8+
"main": "dist/index.js",
9+
"types": "dist/index.d.ts",
10+
"module": "dist/index.js",
11+
"exports": {
12+
".": {
13+
"import": "./dist/index.js",
14+
"require": "./dist/index.js"
15+
},
16+
"./styles.css": {
17+
"import": "./dist/index.css",
18+
"require": "./dist/index.css"
19+
}
20+
},
921
"repository": {
1022
"type": "git",
1123
"url": "https://github.com/Dataport/polar.git",
1224
"directory": "packages/plugins/GeoLocation"
1325
},
1426
"files": [
15-
"src/**/*",
27+
"dist/**",
1628
"CHANGELOG.md"
1729
],
30+
"scripts": {
31+
"bundle": "tsc --declaration --emitDeclarationOnly && rollup -c",
32+
"preversion": "npm run bundle"
33+
},
1834
"peerDependencies": {
1935
"@repositoryname/vuex-generators": "^1.1.2",
2036
"ol": "^7.1.0",
@@ -28,5 +44,8 @@
2844
"devDependencies": {
2945
"@polar/lib-custom-types": "^1.0.0",
3046
"@polar/lib-test-mount-parameters": "^1.0.0"
47+
},
48+
"nx": {
49+
"includedScripts": ["bundle"]
3150
}
3251
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import commonjs from '@rollup/plugin-commonjs'
2+
import resolve from '@rollup/plugin-node-resolve'
3+
import scss from 'rollup-plugin-scss'
4+
import svg from 'rollup-plugin-svg'
5+
import terser from '@rollup/plugin-terser'
6+
import typescript from 'rollup-plugin-typescript2'
7+
import vue from 'rollup-plugin-vue'
8+
import { createFilter } from '@rollup/pluginutils'
9+
10+
const external = createFilter(
11+
['@polar/**', '@repositoryname/vuex-generators', 'ol/**', 'vue', 'vuex'],
12+
null,
13+
{ resolve: false }
14+
)
15+
16+
export default {
17+
input: 'src/index.ts',
18+
output: [
19+
{
20+
file: 'dist/index.js',
21+
name: '@polar/plugin-geo-location',
22+
format: 'es',
23+
sourcemap: 'inline',
24+
},
25+
],
26+
external,
27+
plugins: [
28+
vue({
29+
defaultLang: { script: 'ts', style: 'scss' },
30+
css: false,
31+
}),
32+
scss({ fileName: 'index.css', sourceMap: true }),
33+
// 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.
34+
typescript({ check: false }),
35+
commonjs(),
36+
resolve(),
37+
svg(),
38+
terser(),
39+
],
40+
}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
{
2-
"extends": "../../../tsconfig.json"
2+
"extends": "../../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
},
6+
"include": [
7+
"src/**/*"
8+
]
39
}

0 commit comments

Comments
 (0)