changeset 0:a9bc14e22e36

start
author drewp@localhost
date Tue, 03 Dec 2019 21:27:52 -0800
parents
children 5381c2a551d5
files index.html package.json tasks.py tsconfig.json webpack-dev.config.ts webpack.config.ts
diffstat 6 files changed, 130 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.html	Tue Dec 03 21:27:52 2019 -0800
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <h1>streamed-graph demo</h1>
+
+        <script src="./build/streamed-graph.bundle.js"></script>
+        <streamed-graph url="something"></streamed-graph>
+    </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package.json	Tue Dec 03 21:27:52 2019 -0800
@@ -0,0 +1,31 @@
+{
+  "name": "streamed-graph",
+  "dependencies": {
+    "@polymer/decorators": "^3.0.0",
+    "@polymer/polymer": "^3.3.1",
+    "@types/async": "^3.0.3",
+    "@types/eventsource": "^1.1.2",
+    "@types/jsonld": "^1.5.0",
+    "@webcomponents/webcomponentsjs": "^2.4.0",
+    "async": "^3.1.0",
+    "jsonld": "^1.8.1",
+    "lit-html": "^1.1.2"
+  },
+  "devDependencies": {
+    "@types/node": "^12.12.14",
+    "@types/webpack": "^4.41.0",
+    "@types/webpack-dev-server": "^3.9.0",
+    "css-loader": "^3.2.1",
+    "file-loader": "^5.0.2",
+    "style-loader": "^1.0.1",
+    "ts-loader": "^6.2.1",
+    "ts-node": "^8.5.4",
+    "typescript": "^3.7.2",
+    "webpack": "^4.41.2",
+    "webpack-cli": "^3.3.10",
+    "webpack-serve": "^3.2.0"
+  },
+  "scripts": {
+    "build": "webpack"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tasks.py	Tue Dec 03 21:27:52 2019 -0800
@@ -0,0 +1,16 @@
+from invoke import task  # pytype: disable=import-error
+
+
+@task
+def setup_npm(ctx):
+    ctx.run('npm install')
+
+@task
+def serve_demo(ctx):
+    ctx.run('node_modules/webpack-serve/bin/webpack-serve --config webpack-dev.config.ts --port 8082')
+
+@task
+def build(ctx):
+    ctx.run(f'npm run build')
+    ctx.run(f'cp build/streamed-graph.bundle.js /my/site/homepage/www/rdf/streamed-graph.bundle.js')
+    ctx.run(f'cp streamed-graph.css /my/site/homepage/www/rdf/streamed-graph.css')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsconfig.json	Tue Dec 03 21:27:52 2019 -0800
@@ -0,0 +1,15 @@
+{
+    "compilerOptions": {
+        "module": "commonjs",
+        "experimentalDecorators": true,
+        "target": "es6",
+        "rootDirs": [
+            "node_modules",
+        ],
+        "esModuleInterop": true,
+        "allowSyntheticDefaultImports": true
+    },
+    "files": [
+        "./src/streamed-graph.ts",
+    ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webpack-dev.config.ts	Tue Dec 03 21:27:52 2019 -0800
@@ -0,0 +1,41 @@
+import path from "path";
+import webpack from 'webpack';
+
+const config: webpack.Configuration = {
+    mode: "development",
+    entry: [
+        './src/streamed-graph.ts',
+        './src/streamed-graph.css'   // doesn't emit anything
+    ],
+    output: {
+        filename: 'streamed-graph.bundle.js',
+        path: path.resolve(__dirname, 'build')
+    },
+    resolve: {
+        alias: {
+            'webpack-plugin-serve/client': './node_modules/webpack-plugin-serve/client.js',
+        },
+    },
+    module: {
+        rules: [
+            { test: /\.ts$/, use: 'ts-loader', exclude: /node_modules/ },
+            { test: /\.css$/i, use: ['file-loader'] },
+        ],
+
+    },
+    devServer: {
+        port: 8082,
+        hot: false,
+        liveReload: true, // doesn't work
+        overlay: true,
+        watchContentBase: true,
+        // proxy: {
+        //     '/rdf': {
+        //         target: 'https://bigasterisk.com/',
+        //         //pathRewrite: {'^/api' : ''}  
+        //     }
+        // },
+    }
+};
+
+export default config;
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webpack.config.ts	Tue Dec 03 21:27:52 2019 -0800
@@ -0,0 +1,18 @@
+import path from "path";
+import webpack from 'webpack';
+
+const config: webpack.Configuration = {
+    mode: "production",
+    entry: './src/streamed-graph.ts',
+    output: {
+        filename: 'streamed-graph.bundle.js',
+        path: path.resolve(__dirname, 'build')
+    }, 
+    module: {
+        rules: [
+            { test: /\.ts$/, use: 'ts-loader', exclude: /node_modules/ },
+        ]
+    }
+};
+
+export default config;
\ No newline at end of file