1
0
Fork 0

🔧 Changed export for components

This commit is contained in:
Joost De Cock 2019-05-27 07:52:34 +02:00
parent 3c31cc779f
commit 4d24dfe998
8 changed files with 66 additions and 51 deletions

View file

@ -16,8 +16,7 @@
"main": "dist/index.js",
"scripts": {
"clean": "rimraf dist",
"nodebuild": "BABEL_ENV=production rollup -c -o dist/index.js -f cjs",
"build": "npm run clean && npm run nodebuild",
"build": "npm run clean && rollup -c",
"test": "echo \"components: No tests configured. Perhaps you'd like to do this?\" && exit 0",
"pubtest": "npm publish --registry http://localhost:6662",
"pubforce": "npm publish",

View file

@ -4,10 +4,15 @@ import json from "rollup-plugin-json";
import minify from "rollup-plugin-babel-minify";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import { name, version, description, author, license } from "./package.json";
import components from "./src/index.js";
export default {
input: "src/index.js",
const createConfig = (component, module) => {
console.log(component);
return {
input: `./src/${component}/index.js`,
output: {
file: `dist/${component}/index` + (module ? ".mjs" : ".js"),
format: module ? "es" : "cjs",
sourcemap: true
},
plugins: [
@ -21,7 +26,16 @@ export default {
minify({
comments: false,
sourceMap: true,
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
banner: `/**\n * ${name}/${component} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
})
]
};
};
const config = [];
for (let component of components) {
config.push(createConfig(component, false));
config.push(createConfig(component, true));
}
console.log(JSON.stringify(config, null, 2));
export default config;

View file

@ -102,14 +102,14 @@ const DraftSettings = props => {
className={open ? "expanded" : "collapsed"}
key={group + "-ghead"}
>
<h3 onClick={() => toggleGroup(group)}>
<h5 onClick={() => toggleGroup(group)}>
<DownIcon
className={
"icon-col-exp " + (open ? "expanded" : "collapsed")
}
/>
<FormattedMessage id={"optiongroups." + group} />
</h3>
</h5>
</li>
{children}
</React.Fragment>

View file

@ -35,12 +35,12 @@ const PatternOptions = props => {
);
output.push(
<li className={open ? "expanded" : "collapsed"} key={group + "-ghead"}>
<h3 onClick={() => toggleGroup(group)}>
<h5 onClick={() => toggleGroup(group)}>
<DownIcon
className={"icon-col-exp " + (open ? "expanded" : "collapsed")}
/>
<FormattedMessage id={"optiongroups." + group} />
</h3>
</h5>
{children}
</li>
);

View file

@ -10,9 +10,9 @@ const DraftConfigurator = props => {
return (
<ul className="nav l1">
<li>
<h2>
<h4>
<FormattedMessage id="app.patternOptions" />
</h2>
</h4>
<PatternOptions
noDocs={props.noDocs}
config={props.config}
@ -25,9 +25,9 @@ const DraftConfigurator = props => {
/>
</li>
<li>
<h2>
<h4>
<FormattedMessage id="app.draftSettings" />
</h2>
</h4>
<DraftSettings
noDocs={props.noDocs}
config={props.config}

View file

@ -6,7 +6,7 @@ import { FormattedMessage } from "react-intl";
import useMediaQuery from "@material-ui/core/useMediaQuery";
const Navbar = props => {
const mobile = useMediaQuery.unstable_useMediaQuery("(max-width:599px)");
const mobile = useMediaQuery("(max-width:599px)");
if (mobile) return null;

View file

@ -48,9 +48,9 @@ const SampleConfigurator = props => {
return (
<ul className="links">
<li className="nodot">
<h2>
<h4>
<FormattedMessage id="app.patternOptions" />
</h2>
</h4>
<PatternOptions
config={props.config}
gist={props.gist}
@ -58,9 +58,9 @@ const SampleConfigurator = props => {
/>
</li>
<li className="nodot">
<h2>
<h4>
<FormattedMessage id="app.measurements" />
</h2>
</h4>
<ul style={{ paddingLeft: "1rem" }}>
{props.config.measurements.map(m => (
<li key={m}>
@ -72,9 +72,9 @@ const SampleConfigurator = props => {
</ul>
</li>
<li className="nodot">
<h2>
<h4>
<FormattedMessage id="app.models" />
</h2>
</h4>
<ul style={{ paddingLeft: "1rem" }}>
<li>
<a href="#logo" onClick={() => sampleModels(models)}>

View file

@ -1,15 +1,17 @@
export { default as Blockquote } from "./Blockquote";
export { default as Draft } from "./Draft";
export { default as DraftConfigurator } from "./DraftConfigurator";
export { default as Emblem } from "./Emblem";
export { default as Example } from "./Example";
export { default as Footer } from "./Footer";
export { default as Icon } from "./Icon";
export { default as Logo } from "./Logo";
export { default as Navbar } from "./Navbar";
export { default as Ogol } from "./Ogol";
export { default as Robot } from "./Robot";
export { default as SampleConfigurator } from "./SampleConfigurator";
export { default as withGist } from "./withGist";
export { default as withLanguage } from "./withLanguage";
export { default as Workbench } from "./Workbench";
export default [
"Blockquote",
"Draft",
"DraftConfigurator",
"Emblem",
"Example",
"Footer",
"Icon",
"Logo",
"Navbar",
"Ogol",
"Robot",
"SampleConfigurator",
"withGist",
"withLanguage",
"Workbench"
];