@webqit/webflo 0.8.49 → 0.8.53-0

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.
Files changed (41) hide show
  1. package/docker/Dockerfile +4 -3
  2. package/docker/README.md +11 -3
  3. package/package.json +3 -6
  4. package/src/{cmd/client.js → build/client/index.js} +24 -11
  5. package/src/build/index.js +5 -0
  6. package/src/index.js +47 -45
  7. package/src/{modules → runtime}/Router.js +0 -0
  8. package/src/{modules → runtime}/_FormData.js +0 -0
  9. package/src/{modules → runtime}/_Headers.js +0 -0
  10. package/src/{modules → runtime}/_MessageStream.js +0 -0
  11. package/src/{modules → runtime}/_NavigationEvent.js +0 -0
  12. package/src/{modules → runtime}/_Request.js +0 -0
  13. package/src/{modules → runtime}/_RequestHeaders.js +0 -0
  14. package/src/{modules → runtime}/_Response.js +0 -0
  15. package/src/{modules → runtime}/_ResponseHeaders.js +0 -0
  16. package/src/{modules → runtime}/_URL.js +0 -0
  17. package/src/{modules → runtime}/client/Cache.js +0 -0
  18. package/src/{modules → runtime}/client/Http.js +1 -1
  19. package/src/{modules → runtime}/client/NavigationEvent.js +0 -0
  20. package/src/{modules → runtime}/client/Router.js +0 -0
  21. package/src/{modules/client/Client.js → runtime/client/Runtime.js} +1 -1
  22. package/src/{modules → runtime}/client/StdRequest.js +0 -0
  23. package/src/{modules → runtime}/client/Storage.js +0 -0
  24. package/src/{modules → runtime}/client/Url.js +0 -0
  25. package/src/{modules → runtime}/client/Worker.js +0 -0
  26. package/src/{modules → runtime}/client/WorkerClient.js +0 -0
  27. package/src/{modules → runtime}/client/WorkerComm.js +0 -0
  28. package/src/{modules → runtime}/client/effects/sounds.js +0 -0
  29. package/src/runtime/index.js +5 -0
  30. package/src/{modules → runtime}/server/NavigationEvent.js +0 -0
  31. package/src/{modules → runtime}/server/Router.js +0 -0
  32. package/src/{modules/server/Server.js → runtime/server/Runtime.js} +3 -3
  33. package/src/{cmd/server.js → runtime/server/index.js} +9 -9
  34. package/src/{modules/server/start.mjs → runtime/server/index.mjs} +2 -2
  35. package/src/{modules → runtime}/util.js +0 -0
  36. package/src/{modules → services}/certbot/http-auth-hook.js +0 -0
  37. package/src/{modules → services}/certbot/http-cleanup-hook.js +0 -0
  38. package/src/{cmd/certbot.js → services/certbot/index.js} +2 -3
  39. package/src/services/index.js +6 -0
  40. package/src/{cmd/origins.js → services/origins/index.js} +6 -3
  41. package/src/cmd/index.js +0 -8
package/docker/Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # Base installations
2
2
  FROM node:12-alpine
3
- RUN apk --no-cache add git
3
+ RUN apk add git
4
4
 
5
5
  # We'll install npm packages at one-level higher than
6
6
  # actuall app root, so that we can bind-mount host system's app root
@@ -12,9 +12,10 @@ RUN npm install @webqit/playui-cli -g
12
12
 
13
13
  # Move one-level in, for the reasons above
14
14
  WORKDIR /home/www/app
15
+ ENV NODE_OPTIONS=--openssl-legacy-provider
15
16
 
16
17
  # To auto-start app (flags optional), we would add...
17
- # CMD ["webflo", "start", "--env=dev", "--http-only"]
18
+ # CMD ["webflo", "start", "--env=dev", "--watch", "--http-only"]
18
19
 
19
20
  # To build the image locally...
20
21
  # docker build --no-cache -t webflo ./docker
@@ -22,4 +23,4 @@ WORKDIR /home/www/app
22
23
  # To publish to docker hub...
23
24
  # docker login -u webqit
24
25
  # docker tag webflo webqit/webflo
25
- # docker push webqit/webflo
26
+ # docker push webqit/webflo
package/docker/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Webflo Container
2
+
2
3
  This is simply a node.js container with the `@webqit/webflo` framework installed. Once started, any webflo app can be deployed into the container from any git repository.
3
4
 
4
5
  ## Usage
6
+
5
7
  This container image lives on Docker Hub and can be pulled to a local machine or a remote Virtual Machine (VM) on any cloud platform.
6
8
 
7
9
  + [To Use Locally](#to-use-locally)
@@ -9,6 +11,7 @@ This container image lives on Docker Hub and can be pulled to a local machine or
9
11
  * [To Deploy An App From Any Repo](#to-deploy-an-app-from-any-repo)
10
12
 
11
13
  ### To Use Locally
14
+
12
15
  Ensure you have docker installed on your computer and run the following command from any location on your terminal:
13
16
 
14
17
  ```shell
@@ -20,6 +23,7 @@ The above command pulls the `webqit/webflo` image to your local machine. (But th
20
23
  Next is to use the following commands to start the container and the Webflo runtime. In each case, the first part of the command starts the container, while the second part (from `webflo start`) starts the application.
21
24
 
22
25
  #### To Start
26
+
23
27
  Start the container using `docker run`; map a port (e.g `80`) of your host machine to `3000` of the container (unless changed webflo expects to run on port `3000`); optionally, give your container a name; reference `webqit/webflo` as the image to use; and lastly, start webflo using `webflo start`.
24
28
 
25
29
  ```shell
@@ -29,22 +33,25 @@ docker run -d -p 80:3000 --name my-app webqit/webflo webflo start
29
33
  Visit [localhost](http://localhost) to view your app.
30
34
 
31
35
  #### To Start In Dev Mode
32
- Webflo's *dev* mode is the perfect mode for developing locally. All you do is append the `--env=dev` flag to your webflo commands. [(Learn more)](#)
36
+
37
+ Webflo's *dev* mode is the perfect mode for developing locally. All you do is append the `--env=dev --watch` flags to your webflo commands. [(Learn more)](#)
33
38
 
34
39
  ```shell
35
- docker run -d -p 80:3000 --name my-app webqit/webflo webflo start --env=dev
40
+ docker run -d -p 80:3000 --name my-app webqit/webflo webflo start --env=dev --watch
36
41
  ```
37
42
 
38
43
  In *dev* mode, webflo automatically restarts as you make changes to your codebase. Since webflo now lives inside a container, you'll need to *bind* the directory of your source code on your host machine to the `/home/www/app` directory of the container.
39
44
 
40
45
  ```shell
41
- docker run -d -v /Users/me/my-app:/home/www/app -p 80:3000 --name my-app webqit/webflo webflo start --env=dev
46
+ docker run -d -v /Users/me/my-app:/home/www/app -p 80:3000 --name my-app webqit/webflo webflo start --env=dev --watch
42
47
  ```
43
48
 
44
49
  ### To Use In the Cloud
50
+
45
51
  TODO
46
52
 
47
53
  ### To Deploy An App From Any Repo
54
+
48
55
  Whether running locally or in the cloud, webflo can easily take your application from any git repo. This follows webflo's normal `deploy` command.
49
56
 
50
57
  Simply point docker at your container (using `docker exec [container-name]`) and execute the `webflo deploy` command.
@@ -66,4 +73,5 @@ docker exec my-app webflo restart
66
73
  ```
67
74
 
68
75
  ## Extending this Build
76
+
69
77
  TODO
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.8.49",
15
+ "version": "0.8.53-0",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "bin": {
31
31
  "webflo": "src/index.js",
32
- "webflo-certbot-http-auth-hook": "src/modules/certbot/http-auth-hook.js",
33
- "webflo-certbot-http-cleanup-hook": "src/modules/certbot/http-cleanup-hook.js"
32
+ "webflo-certbot-http-auth-hook": "src/services/certbot/http-auth-hook.js",
33
+ "webflo-certbot-http-cleanup-hook": "src/services/certbot/http-cleanup-hook.js"
34
34
  },
35
35
  "dependencies": {
36
36
  "@octokit/auth-basic": "^1.4.6",
@@ -58,9 +58,6 @@
58
58
  "uuid": "^8.3.2",
59
59
  "webpack": "^5.50.0"
60
60
  },
61
- "devDependencies": {
62
- "nodemon": "^2.0.7"
63
- },
64
61
  "author": "Oxford Harrison <oxharris.dev@gmail.com>",
65
62
  "maintainers": [
66
63
  "Oxford Harrison <oxharris.dev@gmail.com>"
@@ -9,7 +9,7 @@ import Webpack from 'webpack';
9
9
  import { _beforeLast } from '@webqit/util/str/index.js';
10
10
  import { _isObject, _isArray, _isEmpty } from '@webqit/util/js/index.js';
11
11
  import * as DotJs from '@webqit/backpack/src/dotfiles/DotJs.js';
12
- import * as client from '../config/client.js'
12
+ import * as client from '../../config/client.js'
13
13
 
14
14
 
15
15
  /**
@@ -27,7 +27,7 @@ export async function build(Ui, flags = {}, layout = {}) {
27
27
  const config = await client.read(flags, layout);
28
28
  // Consistent forward slashing
29
29
  const forwardSlash = str => str.replace(/\\/g, '/');
30
- var modulesDir = forwardSlash(Url.fileURLToPath(Path.join(import.meta.url, '../../modules/client')));
30
+ var modulesDir = forwardSlash(Url.fileURLToPath(Path.join(import.meta.url, '../../../runtime/client')));
31
31
 
32
32
  var workerDirSplit = Path.resolve(layout.WORKER_DIR).replace(/\\/g, '/').split('/');
33
33
  var workerParams = config.worker || {};
@@ -85,17 +85,17 @@ export async function build(Ui, flags = {}, layout = {}) {
85
85
  Ui.title(`CLIENT BUILD`);
86
86
 
87
87
  const clientBuild = { imports: {}, code: [], };
88
- clientBuild.imports[modulesDir + '/Client.js'] = 'Client';
88
+ clientBuild.imports[modulesDir + '/Runtime.js'] = 'Runtime';
89
89
 
90
90
  // ------------------
91
91
  // >> Routes mapping
92
92
  buildRoutes(clientBuild, Ui, Path.resolve(layout.CLIENT_DIR), 'Client-Side Routing:');
93
93
  clientBuild.code.push(``);
94
- clientBuild.code.push(`// >> Client Params`);
94
+ clientBuild.code.push(`// >> Runtime Params`);
95
95
  buildParams(clientBuild, clientParams, 'params');
96
96
  clientBuild.code.push(``);
97
- clientBuild.code.push(`// >> Client Instantiation`);
98
- clientBuild.code.push(`Client.call(null, layout, params);`);
97
+ clientBuild.code.push(`// >> Runtime Instantiation`);
98
+ clientBuild.code.push(`Runtime.call(null, layout, params);`);
99
99
  // ------------------
100
100
 
101
101
  // ------------------
@@ -107,9 +107,9 @@ export async function build(Ui, flags = {}, layout = {}) {
107
107
  };
108
108
  waiting = Ui.waiting(`Writing the client entry file: ${clientBundlingConfig.intermediate}`);
109
109
  waiting.start();
110
- DotJs.write(clientBuild, clientBundlingConfig.intermediate, 'Client Build File');
110
+ DotJs.write(clientBuild, clientBundlingConfig.intermediate, 'Runtime Build File');
111
111
  waiting.stop();
112
- Ui.info(Ui.f`Client Build file: ${clientBundlingConfig.intermediate}`);
112
+ Ui.info(Ui.f`Runtime Build file: ${clientBundlingConfig.intermediate}`);
113
113
  // ------------------
114
114
 
115
115
  // -------------------
@@ -124,10 +124,23 @@ export async function build(Ui, flags = {}, layout = {}) {
124
124
  await createBundle(Ui, workerBundlingConfig, 'Bundling the Service Worker Build file');
125
125
  }
126
126
  if (clientParams.bundling !== false) {
127
- await createBundle(Ui, clientBundlingConfig, 'Bundling the Client Build file');
127
+ clientBundlingConfig.experiments = clientBundlingConfig.experiments || {};
128
+ if (!('outputModule' in clientBundlingConfig.experiments)) {
129
+ clientBundlingConfig.experiments.outputModule = true;
130
+ clientBundlingConfig.externalsType = 'module';
131
+ }
132
+ if (clientBundlingConfig.experiments.outputModule !== false) {
133
+ clientBundlingConfig.output = clientBundlingConfig.output || {};
134
+ clientBundlingConfig.output.environment = clientBundlingConfig.output.environment || {};
135
+ if (!('module' in clientBundlingConfig.output)) {
136
+ clientBundlingConfig.output.module = true;
137
+ clientBundlingConfig.output.environment.module = true;
138
+ }
139
+ }
140
+ await createBundle(Ui, clientBundlingConfig, 'Bundling the Runtime Build file');
128
141
  }
129
142
 
130
- };
143
+ }
131
144
 
132
145
  /**
133
146
  * Creates a bundle using webpack
@@ -245,4 +258,4 @@ const buildParams = (build, params, varName = null, indentation = 0) => {
245
258
  }
246
259
  });
247
260
  if (varName) build.code.push(`};`);
248
- }
261
+ };
@@ -0,0 +1,5 @@
1
+
2
+ /**
3
+ * exports
4
+ */
5
+ export * as client from './client/index.js';
package/src/index.js CHANGED
@@ -9,16 +9,18 @@ import parseArgs from '@webqit/backpack/src/cli/parseArgs.js';
9
9
  import Ui from '@webqit/backpack/src/cli/Ui.js';
10
10
  import * as DotJson from '@webqit/backpack/src/dotfiles/DotJson.js';
11
11
  import { Promptx } from '@webqit/backpack/src/cli/Promptx.js';
12
+ import * as build from './build/index.js';
12
13
  import * as config from './config/index.js';
13
- import * as cmd from './cmd/index.js';
14
+ import * as runtime from './runtime/index.js';
15
+ import * as services from './services/index.js';
14
16
 
15
17
  // ------------------------------------------
16
18
 
17
19
  const commands = {
18
20
  config: 'Starts a configuration process.',
19
- build: cmd.client.desc.build,
20
- deploy: cmd.origins.desc.deploy,
21
- ...cmd.server.desc,
21
+ build: build.client.desc.build,
22
+ deploy: services.origins.desc.deploy,
23
+ ...runtime.server.desc,
22
24
  };
23
25
 
24
26
  // ------------------------------------------
@@ -37,60 +39,60 @@ console.log('');
37
39
  // --------------------------
38
40
 
39
41
  case 'build':
40
- cmd.client.build(Ui, flags, layout);
42
+ build.client.build(Ui, flags, layout);
41
43
  break;
42
44
 
43
45
  // --------------------------
44
46
 
45
- case 'deploy':
46
- var origin = Object.keys(keywords)[0],
47
- options;
47
+ case 'config':
48
+
49
+ var domain = Object.keys(keywords)[0];
48
50
  // ----------------
49
- if (!origin && ellipsis) {
50
- if (!(options = (await config.origins.read(flags, layout)).REPOS) || _isEmpty(options)) {
51
- Ui.log(Ui.f`Please configure an origin (${'webflo config ...'}) to use the ${'deploy'} command.`);
52
- return;
53
- }
54
- origin = await Promptx({
55
- name: 'origin',
51
+ if (!domain && ellipsis) {
52
+ domain = await Promptx({
53
+ name: 'domain',
56
54
  type: 'select',
57
- choices: options.map(r => ({value: r.TAG})),
58
- message: 'Please select a origin',
59
- }).then(d => d.origin);
55
+ choices: Object.keys(config).map(c => ({value: c})),
56
+ message: 'Please select a configuration domain',
57
+ }).then(d => d.domain);
60
58
  }
61
- if (!origin) {
62
- Ui.log(Ui.f`Please add an origin name to the ${command} command. For options, use the ellipsis ${'...'}`);
59
+ if (!domain || !config[domain]) {
60
+ Ui.log(Ui.f`Please add a configuration domain to the ${command} command. For options, use the ellipsis ${'...'}`);
63
61
  return;
64
62
  }
65
63
  // ----------------
66
- cmd.origins.deploy(Ui, origin, flags, layout);
64
+ const data = await config[domain].read(flags, layout);
65
+ Promptx(await config[domain].questions(data, {}, layout)).then(async _data => {
66
+ await config[domain].write(_merge(data, _data), flags, layout);
67
+ });
68
+
67
69
  break;
68
70
 
69
71
  // --------------------------
70
72
 
71
73
  case 'start':
72
- cmd.server.start(Ui, flags, layout);
74
+ runtime.server.start(Ui, flags, layout);
73
75
  break;
74
76
 
75
77
  case 'stop':
76
78
  case 'restart':
77
- var runtime = Object.keys(keywords)[0];
79
+ var _runtime = Object.keys(keywords)[0];
78
80
  // ----------------
79
- if (!runtime && ellipsis) {
80
- runtime = await Promptx({
81
+ if (!_runtime && ellipsis) {
82
+ _runtime = await Promptx({
81
83
  name: 'runtime',
82
84
  type: 'select',
83
- choices: (await cmd.server.processes(Ui)).map(r => ({title: r.name, description: r.status, value: r.name})).concat({description: 'All of the above', value: 'all'}),
85
+ choices: (await runtime.server.processes(Ui)).map(r => ({title: r.name, description: r.status, value: r.name})).concat({description: 'All of the above', value: 'all'}),
84
86
  message: 'Please select a runtime name',
85
87
  }).then(d => d.runtime);
86
88
  }
87
89
  // ----------------
88
- await cmd.server[command](Ui, runtime || 'all', flags);
90
+ await runtime.server[command](Ui, _runtime || 'all', flags);
89
91
  process.exit();
90
92
  break;
91
93
 
92
94
  case 'processes':
93
- const processes = await cmd.server.processes(Ui, flags);
95
+ const processes = await runtime.server.processes(Ui, flags);
94
96
  Ui.title(`SERVERS`);
95
97
  if (processes.length) {
96
98
  processes.forEach(service => {
@@ -104,35 +106,35 @@ console.log('');
104
106
 
105
107
  // --------------------------
106
108
 
107
- case 'config':
108
-
109
- var domain = Object.keys(keywords)[0];
109
+ case 'deploy':
110
+ var origin = Object.keys(keywords)[0],
111
+ options;
110
112
  // ----------------
111
- if (!domain && ellipsis) {
112
- domain = await Promptx({
113
- name: 'domain',
113
+ if (!origin && ellipsis) {
114
+ if (!(options = (await config.origins.read(flags, layout)).REPOS) || _isEmpty(options)) {
115
+ Ui.log(Ui.f`Please configure an origin (${'webflo config ...'}) to use the ${'deploy'} command.`);
116
+ return;
117
+ }
118
+ origin = await Promptx({
119
+ name: 'origin',
114
120
  type: 'select',
115
- choices: Object.keys(config).map(c => ({value: c})),
116
- message: 'Please select a configuration domain',
117
- }).then(d => d.domain);
121
+ choices: options.map(r => ({value: r.TAG})),
122
+ message: 'Please select a origin',
123
+ }).then(d => d.origin);
118
124
  }
119
- if (!domain || !config[domain]) {
120
- Ui.log(Ui.f`Please add a configuration domain to the ${command} command. For options, use the ellipsis ${'...'}`);
125
+ if (!origin) {
126
+ Ui.log(Ui.f`Please add an origin name to the ${command} command. For options, use the ellipsis ${'...'}`);
121
127
  return;
122
128
  }
123
129
  // ----------------
124
- const data = await config[domain].read(flags, layout);
125
- Promptx(await config[domain].questions(data, {}, layout)).then(async _data => {
126
- await config[domain].write(_merge(data, _data), flags, layout);
127
- });
128
-
130
+ services.origins.deploy(Ui, origin, flags, layout);
129
131
  break;
130
132
 
131
133
  // --------------------------
132
134
 
133
135
  case 'cert':
134
136
  var domains = Object.keys(keywords);
135
- cmd.certbot.generate(Ui, domains, flags, layout);
137
+ services.certbot.generate(Ui, domains, flags, layout);
136
138
  break;
137
139
 
138
140
  case 'help':
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -172,7 +172,7 @@ export default class Http {
172
172
  instance.history.pushState(instance.history.state, '', instance.location.href);
173
173
  } catch(e) {}
174
174
  }
175
- }, {diff: true});
175
+ }, { diff: true });
176
176
 
177
177
  // ----------------------------------
178
178
  const createRequest = (url, referrer, e = {}) => {
File without changes
@@ -152,7 +152,7 @@ export default function(layout, params) {
152
152
  // Render...
153
153
  // --------
154
154
 
155
- if (!document.activeElement && event && _isObject(event.detail) && (event.detail.src instanceof Element) && /* do only on url path change */ _before(event.value, '?') !== _before(event.oldValue, '?')) {
155
+ if (/*document.activeElement === document.body && */event && _isObject(event.detail) && (event.detail.src instanceof Element) && /* do only on url path change */ _before(event.value, '?') !== _before(event.oldValue, '?')) {
156
156
  setTimeout(() => {
157
157
  var urlTarget;
158
158
  if (clientNavigationEvent.url.hash && (urlTarget = document.querySelector(clientNavigationEvent.url.hash))) {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+
2
+ /**
3
+ * exports
4
+ */
5
+ export * as server from './server/index.js';
File without changes
@@ -19,7 +19,7 @@ import _delay from '@webqit/util/js/delay.js';
19
19
  import { slice as _streamSlice } from 'stream-slice';
20
20
  import { v4 as uuidv4, v5 as uuidv5 } from 'uuid';
21
21
  import * as config from '../../config/index.js';
22
- import * as cmd from '../../cmd/index.js';
22
+ import * as services from '../../services/index.js';
23
23
  import NavigationEvent from './NavigationEvent.js';
24
24
  import Router from './Router.js';
25
25
 
@@ -321,8 +321,8 @@ export async function run(instanceSetup, hostSetup, request, response, Ui, flags
321
321
  // --------
322
322
  // ROUTE FOR DEPLOY
323
323
  // --------
324
- if (cmd.origins) {
325
- await cmd.origins.hook(Ui, serverNavigationEvent, async (payload, defaultPeployFn) => {
324
+ if (services.origins) {
325
+ await services.origins.hook(Ui, serverNavigationEvent, async (payload, defaultPeployFn) => {
326
326
  var exitCode = await router.route('deploy', serverNavigationEvent, payload, function(event, _payload) {
327
327
  return defaultPeployFn(_payload);
328
328
  });
@@ -7,8 +7,8 @@ import Path from 'path';
7
7
  import Pm2 from 'pm2';
8
8
  import _promise from '@webqit/util/js/promise.js';
9
9
  import * as DotJson from '@webqit/backpack/src/dotfiles/DotJson.js';
10
- import * as server from '../config/server.js'
11
- import Server from '../modules/server/Server.js';
10
+ import * as server from '../../config/server.js'
11
+ import Runtime from './Runtime.js';
12
12
 
13
13
  /**
14
14
  * @description
@@ -26,7 +26,7 @@ export const desc = {
26
26
  export async function start(Ui, flags = {}, layout = {}) {
27
27
  const config = await server.read(flags, layout);
28
28
  const currentDir = Path.dirname(Url.fileURLToPath(import.meta.url));
29
- const script = Path.resolve(currentDir, '../modules/server/start.mjs');
29
+ const script = Path.resolve(currentDir, './index.mjs');
30
30
  // -------------------
31
31
  // Splash screen
32
32
  // -------------------
@@ -34,7 +34,7 @@ export async function start(Ui, flags = {}, layout = {}) {
34
34
  // -------------------
35
35
  // Splash screen
36
36
  // -------------------
37
- const WEBFLO = DotJson.read(Path.join(currentDir, '../../package.json'));
37
+ const WEBFLO = DotJson.read(Path.join(currentDir, '../../../package.json'));
38
38
  Ui.banner(WEBFLO.title, WEBFLO.version);
39
39
  Ui.log('');
40
40
  Ui.log(Ui.f`${'-------------------------------'}`);
@@ -51,7 +51,7 @@ export async function start(Ui, flags = {}, layout = {}) {
51
51
  Ui.log(Ui.f`${'-------------------------------'}`);
52
52
  Ui.log('');
53
53
  if (processName) {
54
- Ui.success(`Server running in ${Ui.style.keyword('production')}; ${(processAutoRestart ? 'will' : 'wo\'nt')} autorestart on crash!`);
54
+ Ui.success(`Runtime running in ${Ui.style.keyword('production')}; ${(processAutoRestart ? 'will' : 'wo\'nt')} autorestart on crash!`);
55
55
  Ui.info(Ui.f`Process name: ${processName}`);
56
56
  Ui.log('');
57
57
  }
@@ -61,7 +61,7 @@ export async function start(Ui, flags = {}, layout = {}) {
61
61
  if (flags.env !== 'prod' && flags.watch) {
62
62
  var nodemon, ecpt;
63
63
  try {
64
- nodemon = await import('nodemon');
64
+ nodemon = await import(Path.resolve('./node_modules/nodemon/lib/nodemon.js'));
65
65
  } catch(e) {
66
66
  ecpt = e;
67
67
  }
@@ -109,7 +109,7 @@ export async function start(Ui, flags = {}, layout = {}) {
109
109
  });
110
110
  });
111
111
  }
112
- await Server.call(null, Ui, flags);
112
+ await Runtime.call(null, Ui, flags);
113
113
  showRunning();
114
114
  };
115
115
 
@@ -124,7 +124,7 @@ export function stop(Ui, name, flags = {}) {
124
124
  if (err) {
125
125
  Ui.error(err);
126
126
  } else {
127
- Ui.success(Ui.f`Server ${flags.kill ? 'killed' : 'stopped'}: ${name}`);
127
+ Ui.success(Ui.f`Runtime ${flags.kill ? 'killed' : 'stopped'}: ${name}`);
128
128
  }
129
129
  resolve();
130
130
  };
@@ -148,7 +148,7 @@ export function restart(Ui, name, flags = {}) {
148
148
  if (err) {
149
149
  Ui.error(err);
150
150
  } else {
151
- Ui.success(Ui.f`Server restarted: ${name}`);
151
+ Ui.success(Ui.f`Runtime restarted: ${name}`);
152
152
  }
153
153
  resolve();
154
154
  });
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import parseArgs from '@webqit/backpack/src/cli/parseArgs.js';
6
6
  import Ui from '@webqit/backpack/src/cli/Ui.js';
7
- import Server from './Server.js';
7
+ import Runtime from './Runtime.js';
8
8
 
9
9
  const { flags } = parseArgs(process.argv);
10
- Server.call(null, Ui, flags);
10
+ Runtime.call(null, Ui, flags);
File without changes
@@ -3,10 +3,9 @@
3
3
  * imports
4
4
  */
5
5
  import Fs from 'fs';
6
- import Readline from 'readline';
7
6
  import { spawn } from 'child_process';
8
7
  import _arrFrom from '@webqit/util/arr/from.js';
9
- import * as _server from '../config/server.js';
8
+ import * as _server from '../../config/server.js';
10
9
 
11
10
  /**
12
11
  * @description
@@ -72,4 +71,4 @@ export async function generate(Ui, allDomains, flags = {}, layout = {}) {
72
71
  }
73
72
  process.exit();
74
73
  });
75
- };
74
+ }
@@ -0,0 +1,6 @@
1
+
2
+ /**
3
+ * exports
4
+ */
5
+ export * as certbot from './certbot/index.js';
6
+ export * as origins from './origins/index.js';
@@ -10,7 +10,7 @@ import _beforeLast from '@webqit/util/str/beforeLast.js';
10
10
  import _isObject from '@webqit/util/js/isObject.js';
11
11
  import SimpleGit from 'simple-git';
12
12
  import Webhooks from '@octokit/webhooks';
13
- import * as origins from '../config/origins.js'
13
+ import * as origins from '../../config/origins.js';
14
14
 
15
15
  /**
16
16
  * @description
@@ -133,7 +133,7 @@ export async function deploy(Ui, origin, flags = {}, layout = {}) {
133
133
  return pull();
134
134
  }
135
135
  });
136
- };
136
+ }
137
137
 
138
138
  /**
139
139
  * @hook
@@ -141,8 +141,11 @@ export async function deploy(Ui, origin, flags = {}, layout = {}) {
141
141
  export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
142
142
  const eventHandler = Webhooks.createEventHandler();
143
143
  if (event.request.headers['user-agent'] && event.request.headers['user-agent'].startsWith('GitHub-Hookshot/')) {
144
+ console.log('-------------------------111111111111111111')
144
145
  const submits = await event.request.parse();
146
+ console.log('-------------------------submits', submits)
145
147
  const matches = (await origins.match(submits.payload.repository.full_name, flags, layout)).filter(o => o.autodeploy);
148
+ console.log('-------------------------matches', matches)
146
149
  var deployParams;
147
150
  if (!(deployParams = matches[0])) {
148
151
  return;
@@ -183,4 +186,4 @@ export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
183
186
  payload: submits.payload /* JSON object */,
184
187
  });
185
188
  }
186
- };
189
+ }
package/src/cmd/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- /**
3
- * exports
4
- */
5
- export * as certbot from './certbot.js';
6
- export * as client from './client.js';
7
- export * as origins from './origins.js';
8
- export * as server from './server.js';