@bprotsyk/aso-core 2.0.20 → 2.0.22

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,35 @@
1
+ server {
2
+ server_name {{domain}};
3
+ listen 80;
4
+
5
+ return 301 https://{{domain}}$request_uri;
6
+ }
7
+
8
+ server {
9
+ listen 443 ssl;
10
+
11
+ ssl_certificate "/etc/letsencrypt/live/{{domain}}/fullchain.pem";
12
+ ssl_certificate_key "/etc/letsencrypt/live/{{domain}}/privkey.pem";
13
+ ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
14
+ ssl_prefer_server_ciphers on;
15
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
16
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
17
+ ssl_stapling on;
18
+
19
+ error_log /var/log/nginx/{{domain}}.error.log error;
20
+
21
+ root {{rootPath}}{{domain}};
22
+ error_page 404 /policy/index.html;
23
+
24
+ server_name www.{{domain}} {{domain}};
25
+
26
+ location / {
27
+ root {{rootPath}}{{domain}};
28
+ add_header 'Access-Control-Allow-Origin' '*';
29
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
30
+ add_header 'Access-Control-Allow-Headers' 'Origin, Authorization, Accept, Content-Type, X-Requested-With';
31
+ if ($request_method = 'OPTIONS') {
32
+ return 204;
33
+ }
34
+ }
35
+ }
@@ -9,7 +9,6 @@ const child_process_1 = __importDefault(require("child_process"));
9
9
  const ssh2_sftp_client_1 = __importDefault(require("ssh2-sftp-client"));
10
10
  const fs_1 = __importDefault(require("fs"));
11
11
  const mustache_1 = __importDefault(require("mustache"));
12
- const path_1 = __importDefault(require("path"));
13
12
  const { promisify } = require("util");
14
13
  const execPromise = promisify(child_process_1.default.exec);
15
14
  exports.IP = "185.123.53.227";
@@ -181,8 +180,7 @@ class ServerUtil {
181
180
  }
182
181
  }
183
182
  async generateNginxConfig(domain, rootPath) {
184
- const templatePath = path_1.default.join(__dirname, 'templates', 'nginx-template.conf');
185
- const template = fs_1.default.readFileSync(templatePath, "utf8");
183
+ const template = fs_1.default.readFileSync("templates/nginx-template.conf", "utf8");
186
184
  const config = mustache_1.default.render(template, { domain, rootPath });
187
185
  return config;
188
186
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
7
- "prod": "tsc -p ./tsconfig.json && git add . && git commit -m \"Stub\" && git push origin master && npm version patch && npm publish",
7
+ "prod": "tsc -p ./tsconfig.json && copyfiles -u 1 src/templates/**/* lib/templates && git add . && git commit -m \"Зміни до версії\" && git push origin master && npm version patch && npm publish",
8
8
  "build": "tsc",
9
9
  "test": "echo \"Error: no test specified\" && exit 1",
10
10
  "keitaro": "tsc; node lib/utils/keitaro-utils.js",
@@ -45,6 +45,7 @@
45
45
  "@types/react": "^18.2.14",
46
46
  "@types/react-dom": "^18.3.0",
47
47
  "@types/ssh2-sftp-client": "^9.0.4",
48
+ "copyfiles": "^2.4.1",
48
49
  "typedoc": "^0.23.28",
49
50
  "typescript": "^4.9.5"
50
51
  }
@@ -3,7 +3,6 @@ import ChildProcess from "child_process";
3
3
  import Client from "ssh2-sftp-client";
4
4
  import fs from "fs";
5
5
  import mustache from "mustache";
6
- import path from "path";
7
6
  const { promisify } = require("util");
8
7
  const execPromise = promisify(ChildProcess.exec);
9
8
 
@@ -220,8 +219,7 @@ export class ServerUtil {
220
219
  }
221
220
 
222
221
  async generateNginxConfig(domain: string, rootPath: string): Promise<string> {
223
- const templatePath = path.join(__dirname, 'templates', 'nginx-template.conf');
224
- const template = fs.readFileSync(templatePath, "utf8");
222
+ const template = fs.readFileSync("templates/nginx-template.conf", "utf8");
225
223
  const config = mustache.render(template, { domain, rootPath });
226
224
  return config;
227
225
  }
package/tsconfig.json CHANGED
@@ -15,6 +15,6 @@
15
15
 
16
16
 
17
17
  },
18
- "include": ["src"],
18
+ "include": ["src", "templates/**/*"],
19
19
  "exclude": ["node_modules", "**/__tests__/*"]
20
20
  }