Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Commit

Permalink
Fix #27
Browse files Browse the repository at this point in the history
  • Loading branch information
Silind committed Dec 29, 2019
1 parent 06e62a8 commit 83ff812
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/cli.ts
Expand Up @@ -26,7 +26,7 @@ export const cli = () => {
});

program.description(chalk.magenta(headline));

program.version(showVersion(), '-v, --version', 'Show the current version');
program.helpOption('-h, --help', 'Show how to use direflow-cli');

Expand Down
3 changes: 1 addition & 2 deletions cli/messages.ts
Expand Up @@ -38,8 +38,7 @@ Read more on ${chalk.blueBright('https://direflow.io/get-started#multiple-web-co

export const showVersion = () => {
const packageJson = require('../package.json');
return `
Current version of direflow-cli:
return `Current version of direflow-cli:
${packageJson.version}
`;
};
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "direflow-cli",
"version": "2.2.1",
"version": "2.2.2",
"description": "Official CLI for Direflow",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/direflow-component/package.json
@@ -1,6 +1,6 @@
{
"name": "direflow-component",
"version": "2.2.1",
"version": "2.2.2",
"description": "Create Web Components using React",
"main": "dist/index.js",
"author": "Silind Software",
Expand Down
9 changes: 7 additions & 2 deletions packages/direflow-component/src/services/proxyRoot.tsx
Expand Up @@ -15,15 +15,20 @@ interface IComponentOptions {
mode: 'open' | 'closed';
}

let shadowedRoot: ShadowRoot | undefined;

const ShadowContent: FC<IShadowContent> = (props) => {
const root = props.root as any;
return createPortal(props.children, root);
};

const createProxyComponent = (options: IComponentOptions) => {
const ShadowRoot: FC<IShadowComponent> = (props) => {
const root = options.root.attachShadow({ mode: options.mode });
return <ShadowContent root={root}>{props.children}</ShadowContent>;
if (!shadowedRoot) {
shadowedRoot = options.root.attachShadow({ mode: options.mode });
}

return <ShadowContent root={shadowedRoot}>{props.children}</ShadowContent>;
};

return ShadowRoot;
Expand Down
2 changes: 1 addition & 1 deletion templates/js/package.json
Expand Up @@ -12,7 +12,7 @@
"react": "16.10.2",
"react-dom": "16.10.2",
"react-scripts": "3.2.0",
"direflow-component": "2.2.1"
"direflow-component": "2.2.2"
},
"devDependencies": {
"jest-environment-jsdom-fourteen": "0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/ts/package.json
Expand Up @@ -12,7 +12,7 @@
"@types/node": "12.7.8",
"@types/react": "16.9.3",
"@types/react-dom": "16.9.1",
"direflow-component": "2.2.1",
"direflow-component": "2.2.2",
"react": "16.10.1",
"react-dom": "16.10.1",
"react-scripts": "3.1.2"
Expand Down

0 comments on commit 83ff812

Please sign in to comment.