Skip to content

Commit

Permalink
Migrate @polar/plugin-layer-chooser 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 cc958cb commit f511178
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
23 changes: 21 additions & 2 deletions packages/plugins/LayerChooser/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/LayerChooser"
},
"files": [
"src/**/*",
"dist/**",
"CHANGELOG.md"
],
"scripts": {
"bundle": "tsc --declaration --emitDeclarationOnly && rollup -c",
"preversion": "npm run bundle"
},
"peerDependencies": {
"@masterportal/masterportalapi": "2.8.0",
"@repositoryname/vuex-generators": "^1.1.2",
Expand All @@ -25,5 +41,8 @@
"devDependencies": {
"@polar/lib-custom-types": "^1.0.0",
"@polar/lib-test-mount-parameters": "^1.0.0"
},
"nx": {
"includedScripts": ["bundle"]
}
}
46 changes: 46 additions & 0 deletions packages/plugins/LayerChooser/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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(
[
'@masterportal/masterportalapi/**',
'@repositoryname/vuex-generators',
'ol/**',
'vue',
'vuex',
],
null,
{ resolve: false }
)

export default {
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
name: '@polar/plugin-layer-chooser',
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/LayerChooser/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 f511178

Please sign in to comment.