Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/builder #95

Merged
merged 2 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 95 additions & 219 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/library/components/cta/src/cta-component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MuonElement, css, html, unsafeCSS, classMap, ScopedElementsMixin, literal, staticHTML, ifDefined } from '@muons/library';
import { MuonElement, html, classMap, ScopedElementsMixin, literal, staticHTML, ifDefined } from '@muons/library';
import { Icon } from '@muons/library/components/icon';
import {
CTA_TYPE,
Expand Down Expand Up @@ -37,7 +37,7 @@ export class Cta extends ScopedElementsMixin(MuonElement) {
}

static get styles() {
return css`${unsafeCSS(styles)}`;
return styles;
}

constructor() {
Expand Down
4 changes: 2 additions & 2 deletions packages/library/components/icon/src/icon-component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MuonElement, css, html, unsafeCSS, ifDefined, classMap, styleMap } from '@muons/library';
import { MuonElement, html, ifDefined, classMap, styleMap } from '@muons/library';
import { svgLoader } from '@muons/library/directives/svg-loader';
import {
ICON_TYPE,
Expand Down Expand Up @@ -30,7 +30,7 @@ export class Icon extends MuonElement {
}

static get styles() {
return css`${unsafeCSS(styles)}`;
return styles;
}

constructor() {
Expand Down
4 changes: 2 additions & 2 deletions packages/library/components/image/src/image-component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MuonElement, css, html, unsafeCSS, styleMap, classMap } from '@muons/library';
import { MuonElement, html, styleMap, classMap } from '@muons/library';
import { imageInlineLoader, imageBackgroundLoader } from '@muons/library/directives/image-loader';
import {
IMAGE_TYPE,
Expand Down Expand Up @@ -32,7 +32,7 @@ export class Image extends MuonElement {
}

static get styles() {
return css`${unsafeCSS(styles)}`;
return styles;
}

constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css, html, MuonElement, unsafeCSS, classMap } from '@muons/library';
import { html, MuonElement, classMap } from '@muons/library';
import {
INPUTTER_TYPE
} from '@muons/library/build/tokens/es6/muon-tokens';
Expand All @@ -24,7 +24,7 @@ export class Inputter extends ValidationMixin(MuonElement) {
}

static get styles() {
return css`${unsafeCSS(styles)}`;
return styles;
}

constructor() {
Expand Down
1 change: 1 addition & 0 deletions packages/library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"postcss-import": "^14.0.1",
"postcss-preset-env": "^7.0.1",
"postcss-simple-vars": "^6.0.3",
"rollup-plugin-lit-css": "^3.2.1",
"rollup-plugin-styles": "^3.14.1",
"style-dictionary": "^3.0.1",
"web-component-analyzer": "^1.1.6"
Expand Down
6 changes: 3 additions & 3 deletions packages/library/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import merge from 'deepmerge';
import plugins from '@muons/library/scripts/rollup-plugins.mjs';
import { rollupPlugins } from '@muons/library/scripts/rollup-plugins.mjs';

import { createBasicConfig } from '@open-wc/building-rollup';

Expand All @@ -12,13 +12,13 @@ export default merge(config, {
input,
treeshake: false,
plugins: [
...plugins
...rollupPlugins
],
output: {
...config.output,
dir: undefined,
file: 'dist/index.js',
sourcemap: false,
inlineDynamicImports: true
},
}
});
65 changes: 40 additions & 25 deletions packages/library/scripts/rollup-plugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,49 @@ import autoprefixer from 'autoprefixer';
import postcssPreset from 'postcss-preset-env';
import postcssImport from 'postcss-import';
import postcssVariables from 'postcss-simple-vars';
import litcssPlugin from 'rollup-plugin-lit-css';
import * as variables from '../build/tokens/es6/muon-tokens.mjs';

const styles = fromRollup(stylesPlugin);
const replace = fromRollup(replacePlugin);
const litcss = fromRollup(litcssPlugin);

export default [
replace({
preventAssignment: true,
values: {
'process.env.MUON_PREFIX': JSON.stringify('muon')
}
}),
styles({
plugins: [
postcssVariables({
variables,
unknown(node) {
node.remove(); // removing unknown or unset tokens
}
}),
postcssImport(),
postcssPreset({
stage: 0,
features: {
'logical-properties-and-values': false /* allowing start end values */
}
}),
autoprefixer({ grid: true })
]
})
const styleConfig = {
mode: 'emit',
minimize: true,
plugins: [
postcssVariables({
variables,
unknown(node) {
node.remove(); // removing unknown or unset tokens
}
}),
postcssImport(),
postcssPreset({
stage: 0,
features: {
'logical-properties-and-values': false /* allowing start end values */
}
}),
autoprefixer({ grid: true })
]
};

const replaceConfig = {
preventAssignment: true,
values: {
'process.env.MUON_PREFIX': JSON.stringify('muon')
}
};

export const serverPlugins = [
replace(replaceConfig),
styles(styleConfig),
litcss()
];

export const rollupPlugins = [
replacePlugin(replaceConfig),
stylesPlugin(styleConfig),
litcssPlugin()
];
4 changes: 2 additions & 2 deletions packages/library/storybook/server.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { storybookPlugin } from '@web/dev-server-storybook';
import plugins from '@muons/library/scripts/rollup-plugins.mjs';
import { serverPlugins } from '@muons/library/scripts/rollup-plugins.mjs';

// process.env.MUON_PREFIX = 'testing';

Expand All @@ -10,7 +10,7 @@ export default {
'**/*.css': 'js'
},
plugins: [
...plugins,
...serverPlugins,
storybookPlugin({ type: 'web-components' })
]
};
4 changes: 2 additions & 2 deletions packages/library/web-test-runner.browserstack.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { browserstackLauncher } from '@web/test-runner-browserstack';

import plugins from '@muons/library/scripts/rollup-plugins.mjs';
import { serverPlugins } from '@muons/library/scripts/rollup-plugins.mjs';

// options shared between all browsers
const sharedCapabilities = {
Expand All @@ -23,7 +23,7 @@ export default {
'**/*.css': 'js'
},
plugins: [
...plugins
...serverPlugins
],
// how many browsers to run concurrently in browserstack. increasing this significantly
// reduces testing time, but your subscription might limit concurrent connections
Expand Down
4 changes: 2 additions & 2 deletions packages/library/web-test-runner.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { playwrightLauncher } from '@web/test-runner-playwright';
import plugins from '@muons/library/scripts/rollup-plugins.mjs';
import { serverPlugins } from '@muons/library/scripts/rollup-plugins.mjs';

// process.env.MUON_PREFIX = 'testing';

Expand All @@ -17,7 +17,7 @@ export default {
testsStartTimeout: 20000, // default 10000
testsFinishTimeout: 60000, // default 20000
plugins: [
...plugins
...serverPlugins
],
coverageConfig: {
threshold: {
Expand Down