@explorable-viz/fluid 0.7.85 → 0.7.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ const express = require('express');
3
+ const serve = require('express-static');
4
+ require('http-shutdown').extend();
5
+
6
+ const app = express();
7
+
8
+ const root = process.cwd() + '/dist/' + process.argv[2];
9
+ app.use(serve(root));
10
+
11
+ const server = app.listen(8080, function() {
12
+ console.log("Serving content from " + root);
13
+ }).withShutdown();
14
+
15
+ (async () => {
16
+ try {
17
+ if (process.argv.length == 4) {
18
+ module = process.cwd() + process.argv[3];
19
+ } else {
20
+ module = root + '/test.mjs';
21
+ }
22
+ console.log('Loading Puppeteer test module:', module);
23
+ import(module).then(({ main }) => {
24
+ main().then(serverDown);
25
+ }).catch(err => {
26
+ console.error("Failed to load PureScript output:", err);
27
+ });
28
+ } catch (error) {
29
+ console.error('Error:', error);
30
+ }
31
+ })();
32
+
33
+ function serverDown() {
34
+ console.log('Shutting down server')
35
+ server.shutdown(function(err) {
36
+ if (err) {
37
+ return console.log('shutdown failed', err.message);
38
+ }
39
+ console.log('Everything is cleanly shut down.');
40
+ });
41
+ }