chore: 🤖 add ability to run demo

This commit is contained in:
streamich 2018-10-26 23:44:36 +02:00
parent d66af2e3c1
commit 10ac91affd
7 changed files with 5071 additions and 6 deletions

3
.gitignore vendored
View File

@ -66,3 +66,6 @@ lib/
.DS_Store
src/parser.ts
.cache/
.puppet-master/

View File

@ -10,11 +10,14 @@
"author": "@streamich",
"license": "Unlicense",
"dependencies": {
"tslib": "^1.9.3"
"@types/react": "^16.4.18",
"@types/react-dom": "^16.0.9"
},
"devDependencies": {
"react": "16.7.0-alpha.0",
"react-dom": "16.7.0-alpha.0",
"typescript": "^3.1.3"
"typescript": "^3.1.3",
"ts-node": "^7.0.1",
"puppet-master": "^1.2.0"
}
}

13
src/demo/chrome.ts Normal file
View File

@ -0,0 +1,13 @@
import * as React from 'react';
import {render} from 'react-dom';
export {
React,
};
export const demo = (element: React.ReactElement<any>) => {
const div = document.createElement('div');
document.body.appendChild(div);
render(element, div);
};

10
src/demo/useMedia.tsx Normal file
View File

@ -0,0 +1,10 @@
const {execute} = require('puppet-master');
execute({
func: ({React, demo}: any) => {
demo(<div>hello</div>);
},
debug: true,
args: [],
module: __dirname + '/chrome.ts',
}).catch(console.error);

3
src/useMedia.ts Normal file
View File

@ -0,0 +1,3 @@
const useMedia = () => {};
export default useMedia;

View File

@ -14,7 +14,6 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"outDir": "lib",
"noEmitHelpers": true,
"lib": ["es2018", "dom"]
}
}

5040
yarn.lock

File diff suppressed because it is too large Load Diff