@wocker/ws 1.0.8 → 1.0.9

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 (55) hide show
  1. package/bin/ws.js +1 -12
  2. package/lib/AppModule.js +6 -3
  3. package/lib/controllers/DebugController.d.ts +7 -0
  4. package/lib/controllers/DebugController.js +44 -0
  5. package/lib/controllers/PluginController.d.ts +2 -0
  6. package/lib/controllers/PluginController.js +42 -41
  7. package/lib/controllers/PresetController.d.ts +1 -0
  8. package/lib/controllers/PresetController.js +71 -6
  9. package/lib/controllers/ProjectController.d.ts +2 -3
  10. package/lib/controllers/ProjectController.js +36 -60
  11. package/lib/controllers/ProxyController.js +15 -6
  12. package/lib/controllers/index.d.ts +1 -0
  13. package/lib/controllers/index.js +1 -0
  14. package/lib/main.d.ts +1 -1
  15. package/lib/main.js +21 -2
  16. package/lib/makes/FS.d.ts +15 -5
  17. package/lib/makes/FS.js +42 -9
  18. package/lib/makes/Http.d.ts +18 -0
  19. package/lib/makes/Http.js +72 -0
  20. package/lib/makes/Preset.d.ts +2 -2
  21. package/lib/makes/index.d.ts +1 -0
  22. package/lib/makes/index.js +1 -0
  23. package/lib/services/AppConfigService.d.ts +6 -16
  24. package/lib/services/AppConfigService.js +29 -113
  25. package/lib/services/PluginService.d.ts +9 -2
  26. package/lib/services/PluginService.js +85 -3
  27. package/lib/services/PresetService.d.ts +1 -2
  28. package/lib/services/PresetService.js +19 -7
  29. package/lib/services/ProjectService.js +15 -11
  30. package/lib/utils/exec.d.ts +4 -1
  31. package/lib/utils/exec.js +16 -31
  32. package/lib/utils/followProgress.js +49 -45
  33. package/lib/utils/index.d.ts +0 -6
  34. package/lib/utils/index.js +0 -6
  35. package/lib/utils/spawn.d.ts +1 -1
  36. package/lib/utils/spawn.js +20 -12
  37. package/package.json +3 -5
  38. package/presets/php-apache/Dockerfile +1 -1
  39. package/presets/php-apache/config.json +2 -1
  40. package/lib/App.d.ts +0 -11
  41. package/lib/App.js +0 -81
  42. package/lib/index.d.ts +0 -5
  43. package/lib/index.js +0 -22
  44. package/lib/utils/buildOptions.d.ts +0 -1
  45. package/lib/utils/buildOptions.js +0 -9
  46. package/lib/utils/fetch.d.ts +0 -5
  47. package/lib/utils/fetch.js +0 -52
  48. package/lib/utils/get-config.d.ts +0 -2
  49. package/lib/utils/get-config.js +0 -17
  50. package/lib/utils/image-build.d.ts +0 -13
  51. package/lib/utils/image-build.js +0 -46
  52. package/lib/utils/set-config.d.ts +0 -2
  53. package/lib/utils/set-config.js +0 -15
  54. package/lib/utils/tty.d.ts +0 -2
  55. package/lib/utils/tty.js +0 -6
@@ -44,15 +44,15 @@ let ProjectService = class ProjectService {
44
44
  this.dockerService = dockerService;
45
45
  }
46
46
  fromObject(data) {
47
+ const projectService = this;
47
48
  return new class extends core_1.Project {
48
- constructor(projectService, data) {
49
+ constructor(data) {
49
50
  super(data);
50
- this.projectService = projectService;
51
51
  }
52
52
  async save() {
53
- await this.projectService.save(this);
53
+ await projectService.save(this);
54
54
  }
55
- }(this, data);
55
+ }(data);
56
56
  }
57
57
  async getById(id) {
58
58
  const data = await makes_1.FS.readJSON(this.appConfigService.dataPath("projects", id, "config.json"));
@@ -90,6 +90,7 @@ let ProjectService = class ProjectService {
90
90
  if (images.length === 0) {
91
91
  await this.dockerService.buildImage({
92
92
  tag: project.imageName,
93
+ buildArgs: project.buildArgs,
93
94
  context: this.appConfigService.getPWD(),
94
95
  src: project.dockerfile
95
96
  });
@@ -102,11 +103,12 @@ let ProjectService = class ProjectService {
102
103
  await this.dockerService.removeContainer(project.containerName);
103
104
  }
104
105
  if (!container) {
106
+ const config = await this.appConfigService.getConfig();
105
107
  container = await this.dockerService.createContainer({
106
108
  name: project.containerName,
107
109
  image: project.imageName,
108
110
  env: {
109
- ...await this.appConfigService.getAllEnvVariables(),
111
+ ...config.env || {},
110
112
  ...project.env || {}
111
113
  },
112
114
  volumes: (project.volumes || []).map((volume) => {
@@ -143,27 +145,29 @@ let ProjectService = class ProjectService {
143
145
  project.id = project.name;
144
146
  }
145
147
  const projectDirPath = this.appConfigService.dataPath("projects", project.id);
148
+ const config = await this.appConfigService.getConfig();
146
149
  const configPath = this.appConfigService.dataPath("projects", project.id, "config.json");
147
150
  if (!makes_1.FS.existsSync(projectDirPath)) {
148
151
  await makes_1.FS.mkdir(projectDirPath, {
149
152
  recursive: true
150
153
  });
151
154
  }
152
- await this.appConfigService.setProjectConfig(project.id, project.path);
155
+ config.setProject(project.id, project.path);
153
156
  await makes_1.FS.writeJSON(configPath, project);
157
+ await config.save();
154
158
  }
155
159
  async search(params = {}) {
156
160
  const { id, name, path } = params;
157
- const { projects: configs } = await this.appConfigService.getAppConfig();
161
+ const config = await this.appConfigService.getConfig();
158
162
  const projects = [];
159
- for (const config of configs) {
160
- if (id && config.id !== id) {
163
+ for (const projectConfig of config.projects) {
164
+ if (id && projectConfig.id !== id) {
161
165
  continue;
162
166
  }
163
- if (path && config.src !== path) {
167
+ if (path && projectConfig.src !== path) {
164
168
  continue;
165
169
  }
166
- const project = await this.getById(config.id);
170
+ const project = await this.getById(projectConfig.id);
167
171
  if (name && project.name !== name) {
168
172
  continue;
169
173
  }
@@ -1,2 +1,5 @@
1
- declare const exec: (command: string) => Promise<unknown>;
1
+ /// <reference types="node" />
2
+ import { ExecOptions } from "child_process";
3
+ type Options = Omit<ExecOptions, "maxBuffer">;
4
+ declare const exec: (command: string, options?: Options) => Promise<string>;
2
5
  export { exec };
package/lib/utils/exec.js CHANGED
@@ -1,41 +1,26 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.exec = void 0;
7
4
  const child_process_1 = require("child_process");
8
- const chalk_1 = __importDefault(require("chalk"));
9
- const makes_1 = require("../makes");
10
- const exec = async (command) => {
11
- makes_1.Logger.info(` > ${command.trim().replace(/\s+/g, " ")}`);
5
+ const exec = async (command, options) => {
6
+ const worker = (0, child_process_1.exec)(command, {
7
+ ...options || {},
8
+ maxBuffer: Infinity
9
+ });
12
10
  return new Promise((resolve, reject) => {
13
- const worker = (0, child_process_1.exec)(command, {
14
- maxBuffer: Infinity
15
- }, (err, stdout, stderr) => {
16
- if (err) {
17
- return reject(err);
18
- }
19
- return resolve({
20
- stdout,
21
- stderr
22
- });
23
- });
24
- if (worker.stdout) {
25
- worker.stdout.on("data", (data) => {
26
- process.stdout.write(data);
27
- });
28
- }
29
- if (worker.stderr) {
30
- worker.stderr.on("data", (data) => {
31
- process.stderr.write(data);
32
- });
33
- }
34
- worker.on("close", (code) => {
35
- makes_1.Logger.info("close", chalk_1.default.red(code));
11
+ let data = "";
12
+ worker.stdout.on("data", (chunk) => {
13
+ data += chunk.toString();
36
14
  });
37
15
  worker.on("exit", (code) => {
38
- makes_1.Logger.info("exit", chalk_1.default.red(code));
16
+ if (code !== 0) {
17
+ reject(new Error(`Process exited with code ${code}`));
18
+ return;
19
+ }
20
+ resolve(data.replace(/\n$/, ""));
21
+ });
22
+ worker.on("error", (err) => {
23
+ reject(err);
39
24
  });
40
25
  });
41
26
  };
@@ -8,51 +8,6 @@ const followProgress = async (stream) => {
8
8
  const lineStream = new LineConvertStream_1.LineConvertStream(stream);
9
9
  let line = 0;
10
10
  const mapLines = {};
11
- lineStream.on("data", (chunk) => {
12
- const data = JSON.parse(chunk.toString());
13
- const { stream, id, status, progressDetail: { current, total } = {}, aux } = data;
14
- if (stream) {
15
- process.stdout.write(`${stream}`);
16
- line += stream.split("\n").length - 1;
17
- }
18
- else if (id) {
19
- if (typeof mapLines[id] === "undefined") {
20
- mapLines[id] = line;
21
- }
22
- const targetLine = typeof mapLines[id] !== "undefined" ? mapLines[id] : line;
23
- const dy = line - targetLine;
24
- if (dy > 0) {
25
- process.stdout.write("\x1b[s");
26
- process.stdout.write(`\x1b[${dy}A`);
27
- }
28
- process.stdout.write("\x1b[2K");
29
- let str = `${id}: ${status}\n`;
30
- if (status === "Downloading") {
31
- const width = process.stdout.columns;
32
- const sizeWidth = 19, totalWidth = width - id.length - status.length - sizeWidth - 7, currentWidth = Math.floor(totalWidth * (current / total)), formatSize = `${(0, format_size_units_1.formatSizeUnits)(current)}/${(0, format_size_units_1.formatSizeUnits)(total)}`;
33
- str = `${id}: ${status} [${"█".repeat(currentWidth)}${"░".repeat(totalWidth - currentWidth)}] ${formatSize}\n`;
34
- }
35
- process.stdout.write(str);
36
- if (dy > 0) {
37
- process.stdout.write("\x1b[u");
38
- }
39
- else {
40
- line++;
41
- }
42
- }
43
- else if (status) {
44
- process.stdout.write(`${status}\n`);
45
- line += Math.ceil(status.length / process.stdout.columns);
46
- }
47
- else if (aux) {
48
- const str = `auxID: ${aux.ID}`;
49
- process.stdout.write(`${str}\n`);
50
- line += Math.ceil(str.length / process.stdout.columns);
51
- }
52
- else {
53
- makes_1.Logger.warn("followProgress: unexpected data", data);
54
- }
55
- });
56
11
  return new Promise((resolve, reject) => {
57
12
  let isEnded = false;
58
13
  const handleEnd = () => {
@@ -61,6 +16,55 @@ const followProgress = async (stream) => {
61
16
  }
62
17
  isEnded = true;
63
18
  };
19
+ lineStream.on("data", (chunk) => {
20
+ const data = JSON.parse(chunk.toString());
21
+ const { stream, id, status, progressDetail: { current, total } = {}, aux, error, errorDetail } = data;
22
+ if (stream) {
23
+ process.stdout.write(`${stream}`);
24
+ line += stream.split("\n").length - 1;
25
+ }
26
+ else if (id) {
27
+ if (typeof mapLines[id] === "undefined") {
28
+ mapLines[id] = line;
29
+ }
30
+ const targetLine = typeof mapLines[id] !== "undefined" ? mapLines[id] : line;
31
+ const dy = line - targetLine;
32
+ if (dy > 0) {
33
+ process.stdout.write("\x1b[s");
34
+ process.stdout.write(`\x1b[${dy}A`);
35
+ }
36
+ process.stdout.write("\x1b[2K");
37
+ let str = `${id}: ${status}\n`;
38
+ if (status === "Downloading") {
39
+ const width = process.stdout.columns;
40
+ const sizeWidth = 19, totalWidth = width - id.length - status.length - sizeWidth - 7, currentWidth = Math.floor(totalWidth * (current / total)), formatSize = `${(0, format_size_units_1.formatSizeUnits)(current)}/${(0, format_size_units_1.formatSizeUnits)(total)}`;
41
+ str = `${id}: ${status} [${"█".repeat(currentWidth)}${"░".repeat(totalWidth - currentWidth)}] ${formatSize}\n`;
42
+ }
43
+ process.stdout.write(str);
44
+ if (dy > 0) {
45
+ process.stdout.write("\x1b[u");
46
+ }
47
+ else {
48
+ line++;
49
+ }
50
+ }
51
+ else if (status) {
52
+ process.stdout.write(`${status}\n`);
53
+ line += Math.ceil(status.length / process.stdout.columns);
54
+ }
55
+ else if (aux) {
56
+ const str = `auxID: ${aux.ID}`;
57
+ process.stdout.write(`${str}\n`);
58
+ line += Math.ceil(str.length / process.stdout.columns);
59
+ }
60
+ else if (error) {
61
+ reject(new Error(error));
62
+ }
63
+ else {
64
+ makes_1.Logger.warn("followProgress: unexpected data", data);
65
+ reject(new Error(`(followProgress) unexpected data: ${JSON.stringify(data)}`));
66
+ }
67
+ });
64
68
  lineStream.on("end", handleEnd);
65
69
  lineStream.on("close", handleEnd);
66
70
  lineStream.on("error", reject);
@@ -1,16 +1,10 @@
1
- export * from "./buildOptions";
2
1
  export * from "./escapeRegExp";
3
2
  export * from "./exec";
4
- export * from "./fetch";
5
3
  export * from "./followProgress";
6
4
  export * from "./format-size-units";
7
- export * from "./get-config";
8
5
  export * from "./get-cursor-position";
9
- export * from "./image-build";
10
6
  export * from "./injectVariables";
11
7
  export * from "./parse-table";
12
- export * from "./set-config";
13
8
  export * from "./spawn";
14
- export * from "./tty";
15
9
  export * from "./volumeFormat";
16
10
  export * from "./volumeParse";
@@ -14,19 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./buildOptions"), exports);
18
17
  __exportStar(require("./escapeRegExp"), exports);
19
18
  __exportStar(require("./exec"), exports);
20
- __exportStar(require("./fetch"), exports);
21
19
  __exportStar(require("./followProgress"), exports);
22
20
  __exportStar(require("./format-size-units"), exports);
23
- __exportStar(require("./get-config"), exports);
24
21
  __exportStar(require("./get-cursor-position"), exports);
25
- __exportStar(require("./image-build"), exports);
26
22
  __exportStar(require("./injectVariables"), exports);
27
23
  __exportStar(require("./parse-table"), exports);
28
- __exportStar(require("./set-config"), exports);
29
24
  __exportStar(require("./spawn"), exports);
30
- __exportStar(require("./tty"), exports);
31
25
  __exportStar(require("./volumeFormat"), exports);
32
26
  __exportStar(require("./volumeParse"), exports);
@@ -1,2 +1,2 @@
1
- declare const spawn: (command: any) => Promise<void>;
1
+ declare const spawn: (command: string, args: string[]) => Promise<void>;
2
2
  export { spawn };
@@ -2,20 +2,28 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.spawn = void 0;
4
4
  const child_process_1 = require("child_process");
5
- const spawn = async (command) => {
6
- return new Promise((resolve) => {
7
- let [prog, ...options] = command.split(/\s+/);
8
- let worker = (0, child_process_1.spawn)(prog, options);
9
- worker.stdout.on("data", (data) => {
10
- console.log(`stdout: ${data}`);
11
- });
12
- worker.stderr.on("data", (data) => {
13
- console.error(`stderr: ${data}`);
14
- });
15
- worker.on("close", (code) => {
16
- console.log(`child process exited with code ${code}`);
5
+ const spawn = async (command, args) => {
6
+ const abortController = new AbortController();
7
+ const child = (0, child_process_1.spawn)(command, args, {
8
+ signal: abortController.signal,
9
+ stdio: "inherit"
10
+ });
11
+ await new Promise((resolve, reject) => {
12
+ let withError = false;
13
+ child.on("close", (code) => {
14
+ if (withError) {
15
+ return;
16
+ }
17
+ if (code !== 0) {
18
+ reject(new Error(`Process exited with code ${code}`));
19
+ return;
20
+ }
17
21
  resolve(undefined);
18
22
  });
23
+ child.on("error", (err) => {
24
+ withError = true;
25
+ reject(err);
26
+ });
19
27
  });
20
28
  };
21
29
  exports.spawn = spawn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocker/ws",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Docker workspace for web projects",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@kearisp/cli": "^1.0.7",
29
- "@wocker/core": "^1.0.8",
29
+ "@wocker/core": "^1.0.9",
30
30
  "@wocker/utils": "^1.0.3",
31
31
  "async-mutex": "^0.4.0",
32
32
  "axios": "^1.6.7",
@@ -36,7 +36,6 @@
36
36
  "date-fns": "^2.29.3",
37
37
  "dockerode": "^4.0.2",
38
38
  "fs": "^0.0.1-security",
39
- "inquirer": "^7.0.0",
40
39
  "md5": "^2.3.0",
41
40
  "os": "^0.1.2",
42
41
  "path": "^0.12.7",
@@ -45,7 +44,6 @@
45
44
  },
46
45
  "devDependencies": {
47
46
  "@types/dockerode": "3.3.23",
48
- "@types/inquirer": "^7.0.0",
49
47
  "@types/jest": "^29.5.12",
50
48
  "@types/lodash": "^4.14.161",
51
49
  "@types/md5": "^2.3.2",
@@ -58,6 +56,6 @@
58
56
  "eslint-plugin-import": "^2.28.1",
59
57
  "eslint-plugin-node": "^11.1.0",
60
58
  "eslint-webpack-plugin": "^3.1.0",
61
- "typescript": "^5.4.2"
59
+ "typescript": "^5.4.4"
62
60
  }
63
61
  }
@@ -131,7 +131,7 @@ ARG XDEBUG_ENABLE=false
131
131
  RUN if [ "$XDEBUG_ENABLE" = "true" ]; then \
132
132
  pecl install xdebug && \
133
133
  docker-php-ext-enable xdebug; \
134
- fi \
134
+ fi
135
135
 
136
136
  # Gettext
137
137
  ARG GETTEXT_ENABLE=false
@@ -37,7 +37,8 @@
37
37
  },
38
38
  "COMPOSER_ENABLE": {
39
39
  "message": "Install composer?",
40
- "type": "boolean"
40
+ "type": "boolean",
41
+ "default": false
41
42
  },
42
43
  "NODE_VERSION": {
43
44
  "type": "select",
package/lib/App.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Cli } from "@kearisp/cli";
2
- import { AppConfigService } from "./services";
3
- export declare class App {
4
- protected cli: Cli;
5
- protected appConfigService: AppConfigService;
6
- constructor();
7
- install(): void;
8
- use(Constructor: any): void;
9
- setDebug(status: string): Promise<string>;
10
- run(): Promise<string>;
11
- }
package/lib/App.js DELETED
@@ -1,81 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.App = void 0;
27
- const Path = __importStar(require("path"));
28
- const env_1 = require("./env");
29
- const utils_1 = require("./utils");
30
- const makes_1 = require("./makes");
31
- class App {
32
- constructor() { }
33
- install() {
34
- this.cli.command("completion script")
35
- .help(false)
36
- .action(() => this.cli.completionScript());
37
- this.cli.command("log [...items]")
38
- .action((options, items) => {
39
- makes_1.Logger.log(...items);
40
- return "";
41
- });
42
- this.cli.command("debug <status>")
43
- .completion("status", () => ["on", "off"])
44
- .action(async (options, status) => this.setDebug(status));
45
- }
46
- use(Constructor) {
47
- }
48
- async setDebug(status) {
49
- makes_1.Logger.info(`Set debug ${status}`);
50
- await (0, utils_1.setConfig)({
51
- debug: status === "on"
52
- });
53
- return "";
54
- }
55
- async run() {
56
- const mapDir = Path.dirname(env_1.MAP_PATH);
57
- if (!makes_1.FS.existsSync(mapDir)) {
58
- await makes_1.FS.mkdir(mapDir);
59
- }
60
- if (!makes_1.FS.existsSync(env_1.MAP_PATH)) {
61
- await makes_1.FS.writeJSON(env_1.MAP_PATH, {
62
- projects: []
63
- });
64
- }
65
- if (!makes_1.FS.existsSync(`${env_1.DATA_DIR}/projects`)) {
66
- await makes_1.FS.mkdir(`${env_1.DATA_DIR}/projects`);
67
- }
68
- const { plugins = [] } = await this.appConfigService.getAppConfig();
69
- for (const plugin of plugins) {
70
- try {
71
- const { default: Plugin } = await Promise.resolve(`${plugin}`).then(s => __importStar(require(s)));
72
- this.use(Plugin);
73
- }
74
- catch (err) {
75
- makes_1.Logger.error(err.message);
76
- }
77
- }
78
- return this.cli.run(process.argv);
79
- }
80
- }
81
- exports.App = App;
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { App } from "./App";
2
- declare const app: App;
3
- export { app };
4
- export * from "./makes";
5
- export * from "./services";
package/lib/index.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.app = void 0;
18
- const App_1 = require("./App");
19
- const app = new App_1.App();
20
- exports.app = app;
21
- __exportStar(require("./makes"), exports);
22
- __exportStar(require("./services"), exports);
@@ -1 +0,0 @@
1
- export declare const buildOptions: (name: string, options: any) => string;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildOptions = void 0;
4
- const buildOptions = (name, options) => {
5
- return Object.keys(options).map((key) => {
6
- return `--${name} ${key}=${options[key]}`;
7
- }).join(" ");
8
- };
9
- exports.buildOptions = buildOptions;
@@ -1,5 +0,0 @@
1
- type Options = {
2
- method?: "GET" | "POST";
3
- };
4
- export declare const fetch: (url: string, options?: Options) => Promise<unknown>;
5
- export {};
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.fetch = void 0;
27
- const https = __importStar(require("https"));
28
- const fetch = async (url, options) => {
29
- const { method = "GET" } = options || {};
30
- const target = new URL(url);
31
- const params = {
32
- method,
33
- protocol: target.protocol,
34
- hostname: target.hostname,
35
- port: target.port,
36
- path: target.pathname
37
- };
38
- return new Promise((resolve, reject) => {
39
- const req = https.request(params, (res) => {
40
- let body = "";
41
- res.on("data", (data) => {
42
- body += data;
43
- });
44
- res.on("end", () => {
45
- resolve(body);
46
- });
47
- });
48
- req.on("error", reject);
49
- req.end();
50
- });
51
- };
52
- exports.fetch = fetch;
@@ -1,2 +0,0 @@
1
- import { AppConfig } from "@wocker/core";
2
- export declare const getConfig: () => Promise<AppConfig>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfig = void 0;
4
- const env_1 = require("../env");
5
- const FS_1 = require("../makes/FS");
6
- const getConfig = async () => {
7
- return FS_1.FS.readJSON(env_1.MAP_PATH).catch((err) => {
8
- if (err.code === "ENOENT") {
9
- return Promise.resolve({
10
- env: {},
11
- projects: []
12
- });
13
- }
14
- throw err;
15
- });
16
- };
17
- exports.getConfig = getConfig;
@@ -1,13 +0,0 @@
1
- type Options = {
2
- tag: string;
3
- buildArgs?: {
4
- [key: string]: string;
5
- };
6
- labels?: {
7
- [key: string]: string;
8
- };
9
- context: string;
10
- src: string;
11
- };
12
- export declare const imageBuild: (options: Options) => Promise<void>;
13
- export {};