Skip to content

Commit

Permalink
Merge pull request #306 from PrestaShopCorp/fix-rollup-config
Browse files Browse the repository at this point in the history
Fix rollup config
  • Loading branch information
mattgoud authored Feb 1, 2024
2 parents 7015698 + f1ea72b commit 8dd9a88
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 40 deletions.
1 change: 0 additions & 1 deletion build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"devDependencies": {
"@esbuild-kit/cjs-loader": "^2.4.2",
"@pnpm/types": "^9.0.0",
"@rollup/plugin-json": "^6.1.0",
"@types/rollup-plugin-css-only": "^3.1.0",
"unbuild": "^1.2.0",
"vue": "^3.2.47"
Expand Down
3 changes: 0 additions & 3 deletions build/src/tasks/full-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import esbuild from 'rollup-plugin-esbuild'
import { parallel } from 'gulp'
import glob from 'fast-glob'
import { camelCase, upperFirst } from 'lodash-unified'
import json from '@rollup/plugin-json'
import { version } from '../../../packages/puik/version'
import { PuikAlias } from '../plugins/puik-alias'
import {
Expand Down Expand Up @@ -49,7 +48,6 @@ async function buildFullEntry(minify: boolean) {
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
json(),
],
external: await generateExternal({ full: true }),
})
Expand Down Expand Up @@ -99,7 +97,6 @@ async function buildFullLocale(minify: boolean) {
sourceMap: minify,
target,
}),
json(),
],
})
await writeBundles(bundle, [
Expand Down
2 changes: 0 additions & 2 deletions build/src/tasks/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import esbuild from 'rollup-plugin-esbuild'
import glob from 'fast-glob'
import json from '@rollup/plugin-json'
import {
puikRoot,
pkgRoot,
Expand Down Expand Up @@ -45,7 +44,6 @@ export const buildModules = async () => {
'.vue': 'ts',
},
}),
json(),
],
external: await generateExternal({ full: false }),
treeshake: false,
Expand Down
10 changes: 4 additions & 6 deletions packages/components/icon/src/icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
class="puik-icon"
:style="style"
:data-test="dataTest"
:class="{
'puik-icon--disabled': isDisabled,
}"
>
{{ icon }}
</component>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import resolveConfig from 'tailwindcss/resolveConfig'
import tailwindConfig from '@puik/tailwind-preset/theme'
import { iconProps } from './icon'
defineOptions({
name: 'PuikIcon',
})
const fullConf = resolveConfig(tailwindConfig)
const props = defineProps(iconProps)
const fontSize = computed(() => {
Expand All @@ -32,9 +32,7 @@ const fontSize = computed(() => {
const style = computed(() => {
return {
fontSize: fontSize.value,
color: props.isDisabled
? fullConf.extend?.colors?.primary['500']
: props.color,
color: props.color,
}
})
</script>
5 changes: 1 addition & 4 deletions packages/components/icon/test/icon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Icon tests', () => {
isDisabled: true,
})

expect(findIcon().element.style.color).toBe('rgb(187, 187, 187)')
expect(findIcon().classes()).toContain('puik-icon--disabled')
})

it('should set the color', async () => {
Expand Down Expand Up @@ -84,6 +84,3 @@ describe('Icon tests', () => {
expect(findIcon().attributes('data-test')).toBe('test')
})
})
function resolveConfig(tailwindConfig: any) {
throw new Error('Function not implemented.')
}
6 changes: 0 additions & 6 deletions packages/puik/tsconfig.json

This file was deleted.

7 changes: 3 additions & 4 deletions packages/tailwind-preset/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
// const Puiktheme = require('./theme')
import PuikTheme from './theme'
const Puiktheme = require('./theme')

export default {
theme: PuikTheme,
module.exports = {
theme: Puiktheme,
}
3 changes: 1 addition & 2 deletions packages/tailwind-preset/theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @type {import('tailwindcss').Config} */
export default {
module.exports = {
extend: {
colors: {
primary: {
Expand Down
3 changes: 3 additions & 0 deletions packages/theme/src/icon.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.puik-icon {
@apply font-materialIcons leading-none;
}
.puik-icon--disabled {
color: theme('colors.primary.500') !important;
}
4 changes: 1 addition & 3 deletions packages/theme/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import tailwindConfig from '@puik/tailwind-preset'

/* eslint-disable @typescript-eslint/no-var-requires */
module.exports = {
presets: [tailwindConfig],
presets: [require('@puik/tailwind-preset')],
content: ['./src/**/*.scss'],
plugins: [require('tailwind-scrollbar')({ nocompatible: true })],
darkMode: 'class', // To remove if we wanna use the css' prefers-color-scheme feature (dark mode based on OS/browser preference)
Expand Down
5 changes: 5 additions & 0 deletions packages/theme/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true
}
}
3 changes: 3 additions & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# views directory
views
52 changes: 43 additions & 9 deletions pnpm-lock.yaml

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

0 comments on commit 8dd9a88

Please sign in to comment.