import {Config} from '@stencil/core';
import {sass} from '@stencil/sass';
import {postcss} from '@stencil/postcss';
import autoprefixer from 'autoprefixer';
import postcssimport from 'postcss-import';
import {reactOutputTarget} from '@stencil/react-output-target';

export const config: Config = {
  namespace: 'huds-lib',
  globalStyle: 'src/global/styles.scss',
  plugins: [
    sass({
      injectGlobalPaths: ['src/global/styles.scss']
    }),
    postcss({
      plugins: [
        postcssimport,
        autoprefixer({
          cascade: false
        })
      ]
    })
  ],
  outputTargets: [
    reactOutputTarget({
      componentCorePackage: '@itcenteratunihelsinki/huds-lib',
      proxiesFile: '../react-huds-wrapper/src/components.ts'
    }),
    {
      type: 'dist',
      copy: [{src: 'fonts', dest: '../fonts'}]
    },
    {
      type: 'docs-readme',
      footer: 'Helsinki University Design System'
    },
    {
      type: 'www',
      serviceWorker: null, // disable service workers
      copy: [{src: 'fonts'}]
    }
  ]
};