@cloud-cli/le 1.0.0 → 1.0.1

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export interface Certificate {
3
2
  rootDomain: string;
4
3
  certificate: string;
@@ -14,7 +13,7 @@ export interface CreateCertificateOptions extends CertificateOptions {
14
13
  export declare class CertificateManager {
15
14
  private readonly domainPattern;
16
15
  certificateExists({ domain }: CertificateOptions): boolean;
17
- createCertificate({ domain, useWildcard, additionalOptions }: CreateCertificateOptions): "OK" | import("child_process").SpawnSyncReturns<string>;
16
+ createCertificate({ domain, useWildcard, additionalOptions }: CreateCertificateOptions): "OK" | Promise<string>;
18
17
  removeCertificate({ domain }: CertificateOptions): void;
19
18
  getCertificateList(): string[];
20
19
  private isValidDomain;
@@ -23,7 +23,11 @@ export class CertificateManager {
23
23
  const domains = [domain, useWildcard ? '*.' + domain : ''].filter(Boolean);
24
24
  const domainsWithPrefix = domains.map((domain) => `-d${domain}`);
25
25
  additionalOptions = (additionalOptions || []).map((option) => `--'${option}'`);
26
- return sh('certbot', ['certonly', ...additionalOptions, ...domainsWithPrefix]);
26
+ const out = sh('certbot', ['certonly', ...additionalOptions, ...domainsWithPrefix]);
27
+ const stdout = String(out.stdout || '');
28
+ const stderr = String(out.stderr || '').split('\n').map(s => '! ' + s).join('\n');
29
+ const logs = stdout + '\n\n' + stderr;
30
+ return out.status !== 0 ? Promise.reject(logs) : Promise.resolve(logs);
27
31
  }
28
32
  removeCertificate({ domain }) {
29
33
  const path = join(certificatesFolder, domain);
package/dist/index.d.ts CHANGED
@@ -1,11 +1,6 @@
1
- /// <reference types="node" />
2
1
  import { CertificateOptions, CreateCertificateOptions } from './certificate-manager.js';
3
- export interface LetsEncryptConfiguration {
4
- host?: string;
5
- port: number;
6
- }
7
2
  declare const _default: {
8
- createCertificate(certificate: CreateCertificateOptions): "OK" | import("child_process").SpawnSyncReturns<string>;
3
+ createCertificate(certificate: CreateCertificateOptions): "OK" | Promise<string>;
9
4
  removeCertificate(options: CertificateOptions): void;
10
5
  listCertificates(): string[];
11
6
  certificateExists(options: CertificateOptions): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/le",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Reverse Proxy API/module",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",