deboa 1.0.1 → 1.1.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 (45) hide show
  1. package/dist/cjs/classes/Deboa.js +17 -11
  2. package/dist/cjs/types/Priority.js +4 -0
  3. package/dist/cjs/{classes → types/classes}/Deboa.d.ts +0 -1
  4. package/dist/cjs/{classes → types/classes}/DeboaFromFile.d.ts +0 -0
  5. package/dist/cjs/types/index.d.ts +4 -9
  6. package/dist/cjs/types/index.js +1 -0
  7. package/dist/cjs/types/{IAddTarEntriesParams.d.ts → types/IAddTarEntriesParams.d.ts} +0 -0
  8. package/dist/cjs/types/{IControlFileOptions.d.ts → types/IControlFileOptions.d.ts} +2 -1
  9. package/dist/cjs/types/{IDeboa.d.ts → types/IDeboa.d.ts} +11 -1
  10. package/dist/cjs/types/{IDeboaFromFile.d.ts → types/IDeboaFromFile.d.ts} +0 -0
  11. package/dist/cjs/types/{INormalizeOptionsLength.d.ts → types/INormalizeOptionsLength.d.ts} +0 -0
  12. package/dist/cjs/types/{IWriteFileFromLinesArgs.d.ts → types/IWriteFileFromLinesArgs.d.ts} +0 -0
  13. package/dist/cjs/types/{IWriteToArchive.d.ts → types/IWriteToArchive.d.ts} +0 -0
  14. package/dist/cjs/types/{MaintainerScript.d.ts → types/MaintainerScript.d.ts} +0 -0
  15. package/dist/cjs/types/types/Priority.d.ts +1 -0
  16. package/dist/cjs/types/{Section.d.ts → types/Section.d.ts} +0 -0
  17. package/dist/cjs/types/types/index.d.ts +10 -0
  18. package/dist/cjs/{utils → types/utils}/addTarEntries.d.ts +0 -0
  19. package/dist/cjs/{utils → types/utils}/createFileHeader.d.ts +0 -0
  20. package/dist/cjs/{utils → types/utils}/writeFileFromLines.d.ts +0 -0
  21. package/dist/cjs/{utils → types/utils}/writeToArchive.d.ts +0 -0
  22. package/dist/esm/classes/Deboa.js +14 -2
  23. package/dist/esm/types/Priority.js +1 -0
  24. package/dist/esm/{classes → types/classes}/Deboa.d.ts +0 -1
  25. package/dist/esm/{classes → types/classes}/DeboaFromFile.d.ts +0 -0
  26. package/dist/esm/types/index.d.ts +4 -9
  27. package/dist/esm/types/index.js +1 -0
  28. package/dist/esm/types/{IAddTarEntriesParams.d.ts → types/IAddTarEntriesParams.d.ts} +0 -0
  29. package/dist/esm/types/{IControlFileOptions.d.ts → types/IControlFileOptions.d.ts} +2 -1
  30. package/dist/esm/types/{IDeboa.d.ts → types/IDeboa.d.ts} +11 -1
  31. package/dist/esm/types/{IDeboaFromFile.d.ts → types/IDeboaFromFile.d.ts} +0 -0
  32. package/dist/esm/types/{INormalizeOptionsLength.d.ts → types/INormalizeOptionsLength.d.ts} +0 -0
  33. package/dist/esm/types/{IWriteFileFromLinesArgs.d.ts → types/IWriteFileFromLinesArgs.d.ts} +0 -0
  34. package/dist/esm/types/{IWriteToArchive.d.ts → types/IWriteToArchive.d.ts} +0 -0
  35. package/dist/esm/types/{MaintainerScript.d.ts → types/MaintainerScript.d.ts} +0 -0
  36. package/dist/esm/types/types/Priority.d.ts +1 -0
  37. package/dist/esm/types/{Section.d.ts → types/Section.d.ts} +0 -0
  38. package/dist/esm/types/types/index.d.ts +10 -0
  39. package/dist/esm/{utils → types/utils}/addTarEntries.d.ts +0 -0
  40. package/dist/esm/{utils → types/utils}/createFileHeader.d.ts +0 -0
  41. package/dist/esm/{utils → types/utils}/writeFileFromLines.d.ts +0 -0
  42. package/dist/esm/{utils → types/utils}/writeToArchive.d.ts +0 -0
  43. package/package.json +1 -1
  44. package/dist/cjs/index.d.ts +0 -4
  45. package/dist/esm/index.d.ts +0 -4
@@ -2,15 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- default: ()=>_default,
13
- Deboa: ()=>Deboa
5
+ Object.defineProperty(exports, "Deboa", {
6
+ enumerable: true,
7
+ get: ()=>Deboa
14
8
  });
15
9
  const _events = require("events");
16
10
  const _os = /*#__PURE__*/ _interopRequireDefault(require("os"));
@@ -156,7 +150,13 @@ function _interopRequireWildcard(obj, nodeInterop) {
156
150
  this.#outputFile = _path.default.join(this.targetDir, `${packageName}_${version}_${architecture}.deb`);
157
151
  this.#controlFolderDestination = _path.default.join(this.#tempDir, 'control');
158
152
  this.#dataFolderDestination = _path.default.join(this.#tempDir, 'data');
159
- this.#appFolderDestination = _path.default.join(this.#dataFolderDestination, 'usr', 'lib', packageName);
153
+ this.#appFolderDestination = _path.default.join(this.#dataFolderDestination, ...options.installationRoot ? [
154
+ options.installationRoot
155
+ ] : [
156
+ 'usr',
157
+ 'lib',
158
+ packageName
159
+ ]);
160
160
  }
161
161
  /**
162
162
  * Ensures that all required options are present and that the `packageName`
@@ -272,6 +272,13 @@ function _interopRequireWildcard(obj, nodeInterop) {
272
272
  const controlFileWriteStream = _fs.default.createWriteStream(controlFileLocation);
273
273
  _tarFs.default.pack(this.#dataFolderDestination, {
274
274
  map: (header)=>{
275
+ // Why: while undocumented, this header accepts options for the header passed to tar-stream's pack function
276
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
277
+ // @ts-ignore
278
+ header.gname = 'root';
279
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
280
+ // @ts-ignore
281
+ header.uname = 'root';
275
282
  // sensible defaults for Windows users
276
283
  if (process.platform === 'win32') {
277
284
  const defaultFilePermission = parseInt('0644', 8);
@@ -494,4 +501,3 @@ function _interopRequireWildcard(obj, nodeInterop) {
494
501
  }
495
502
  }
496
503
  }
497
- var _default = Deboa;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -42,4 +42,3 @@ declare class Deboa implements IDeboa {
42
42
  loadHooks(): Promise<void>;
43
43
  }
44
44
  export { Deboa };
45
- export default Deboa;
@@ -1,9 +1,4 @@
1
- export * from './IAddTarEntriesParams';
2
- export * from './IControlFileOptions';
3
- export * from './IDeboa';
4
- export * from './IDeboaFromFile';
5
- export * from './INormalizeOptionsLength';
6
- export * from './IWriteFileFromLinesArgs';
7
- export * from './IWriteToArchive';
8
- export * from './MaintainerScript';
9
- export * from './Section';
1
+ import { Deboa } from './classes/Deboa';
2
+ import { DeboaFromFile } from './classes/DeboaFromFile';
3
+ export { Deboa, DeboaFromFile };
4
+ export * from './types';
@@ -10,6 +10,7 @@ _exportStar(require("./INormalizeOptionsLength"), exports);
10
10
  _exportStar(require("./IWriteFileFromLinesArgs"), exports);
11
11
  _exportStar(require("./IWriteToArchive"), exports);
12
12
  _exportStar(require("./MaintainerScript"), exports);
13
+ _exportStar(require("./Priority"), exports);
13
14
  _exportStar(require("./Section"), exports);
14
15
  function _exportStar(from, to) {
15
16
  Object.keys(from).forEach(function(k) {
@@ -1,4 +1,5 @@
1
1
  import { MaintainerScript } from './MaintainerScript';
2
+ import { Priority } from './Priority';
2
3
  import { Section } from './Section';
3
4
  /**
4
5
  * The descriptions are mostly just shameless copies from the following docs:
@@ -90,7 +91,7 @@ export interface IControlFileOptions {
90
91
  *
91
92
  * {@link https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-priority}
92
93
  */
93
- priority?: 'required' | 'important' | 'standard' | 'optional';
94
+ priority?: Priority;
94
95
  /**
95
96
  * {@link https://www.debian.org/doc/debian-policy/ch-relationships.html}
96
97
  */
@@ -1,6 +1,7 @@
1
- import type { Headers as TarFSHeader } from 'tar-fs';
1
+ import type { Headers as OriginalTarFSHeader } from 'tar-fs';
2
2
  import type { Headers as TarStreamHeader } from 'tar-stream';
3
3
  import { IControlFileOptions } from './IControlFileOptions';
4
+ declare type TarFSHeader = OriginalTarFSHeader & Pick<TarStreamHeader, 'uname' | 'gname'>;
4
5
  /**
5
6
  * @property {IDeboa["additionalTarEntries"]} [additionalTarEntries] -
6
7
  * Additional entries to be added to the .tar archive. This is useful for
@@ -33,6 +34,10 @@ import { IControlFileOptions } from './IControlFileOptions';
33
34
  * /usr/share/pixmaps. Optional.
34
35
  *
35
36
  *
37
+ * @property {IDeboa["installationRoot"]} [installationRoot] -
38
+ * Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
39
+ *
40
+ *
36
41
  * @property {IDeboa["modifyTarHeader"]} [modifyTarHeader] -
37
42
  * This callback makes it possible to modify file headers before they're
38
43
  * written to the .tar archive, which is useful for setting permissions.
@@ -92,6 +97,10 @@ export interface IDeboa {
92
97
  * /usr/share/pixmaps. Optional.
93
98
  */
94
99
  icon?: string;
100
+ /**
101
+ * Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
102
+ */
103
+ installationRoot?: string;
95
104
  /**
96
105
  * This callback makes it possible to modify file headers before they're
97
106
  * written to the .tar archive, which is useful for setting permissions.
@@ -121,3 +130,4 @@ export interface IDeboa {
121
130
  */
122
131
  targetDir: string;
123
132
  }
133
+ export {};
@@ -0,0 +1 @@
1
+ export declare type Priority = 'required' | 'important' | 'standard' | 'optional';
@@ -0,0 +1,10 @@
1
+ export * from './IAddTarEntriesParams';
2
+ export * from './IControlFileOptions';
3
+ export * from './IDeboa';
4
+ export * from './IDeboaFromFile';
5
+ export * from './INormalizeOptionsLength';
6
+ export * from './IWriteFileFromLinesArgs';
7
+ export * from './IWriteToArchive';
8
+ export * from './MaintainerScript';
9
+ export * from './Priority';
10
+ export * from './Section';
@@ -98,7 +98,13 @@ import { addTarEntries } from '../utils/addTarEntries';
98
98
  this.#outputFile = path.join(this.targetDir, `${packageName}_${version}_${architecture}.deb`);
99
99
  this.#controlFolderDestination = path.join(this.#tempDir, 'control');
100
100
  this.#dataFolderDestination = path.join(this.#tempDir, 'data');
101
- this.#appFolderDestination = path.join(this.#dataFolderDestination, 'usr', 'lib', packageName);
101
+ this.#appFolderDestination = path.join(this.#dataFolderDestination, ...options.installationRoot ? [
102
+ options.installationRoot
103
+ ] : [
104
+ 'usr',
105
+ 'lib',
106
+ packageName
107
+ ]);
102
108
  }
103
109
  /**
104
110
  * Ensures that all required options are present and that the `packageName`
@@ -214,6 +220,13 @@ import { addTarEntries } from '../utils/addTarEntries';
214
220
  const controlFileWriteStream = fs.createWriteStream(controlFileLocation);
215
221
  tar.pack(this.#dataFolderDestination, {
216
222
  map: (header)=>{
223
+ // Why: while undocumented, this header accepts options for the header passed to tar-stream's pack function
224
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
225
+ // @ts-ignore
226
+ header.gname = 'root';
227
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
228
+ // @ts-ignore
229
+ header.uname = 'root';
217
230
  // sensible defaults for Windows users
218
231
  if (process.platform === 'win32') {
219
232
  const defaultFilePermission = parseInt('0644', 8);
@@ -437,4 +450,3 @@ import { addTarEntries } from '../utils/addTarEntries';
437
450
  }
438
451
  }
439
452
  export { Deboa };
440
- export default Deboa;
@@ -0,0 +1 @@
1
+ export { };
@@ -42,4 +42,3 @@ declare class Deboa implements IDeboa {
42
42
  loadHooks(): Promise<void>;
43
43
  }
44
44
  export { Deboa };
45
- export default Deboa;
@@ -1,9 +1,4 @@
1
- export * from './IAddTarEntriesParams';
2
- export * from './IControlFileOptions';
3
- export * from './IDeboa';
4
- export * from './IDeboaFromFile';
5
- export * from './INormalizeOptionsLength';
6
- export * from './IWriteFileFromLinesArgs';
7
- export * from './IWriteToArchive';
8
- export * from './MaintainerScript';
9
- export * from './Section';
1
+ import { Deboa } from './classes/Deboa';
2
+ import { DeboaFromFile } from './classes/DeboaFromFile';
3
+ export { Deboa, DeboaFromFile };
4
+ export * from './types';
@@ -6,4 +6,5 @@ export * from './INormalizeOptionsLength';
6
6
  export * from './IWriteFileFromLinesArgs';
7
7
  export * from './IWriteToArchive';
8
8
  export * from './MaintainerScript';
9
+ export * from './Priority';
9
10
  export * from './Section';
@@ -1,4 +1,5 @@
1
1
  import { MaintainerScript } from './MaintainerScript';
2
+ import { Priority } from './Priority';
2
3
  import { Section } from './Section';
3
4
  /**
4
5
  * The descriptions are mostly just shameless copies from the following docs:
@@ -90,7 +91,7 @@ export interface IControlFileOptions {
90
91
  *
91
92
  * {@link https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-priority}
92
93
  */
93
- priority?: 'required' | 'important' | 'standard' | 'optional';
94
+ priority?: Priority;
94
95
  /**
95
96
  * {@link https://www.debian.org/doc/debian-policy/ch-relationships.html}
96
97
  */
@@ -1,6 +1,7 @@
1
- import type { Headers as TarFSHeader } from 'tar-fs';
1
+ import type { Headers as OriginalTarFSHeader } from 'tar-fs';
2
2
  import type { Headers as TarStreamHeader } from 'tar-stream';
3
3
  import { IControlFileOptions } from './IControlFileOptions';
4
+ declare type TarFSHeader = OriginalTarFSHeader & Pick<TarStreamHeader, 'uname' | 'gname'>;
4
5
  /**
5
6
  * @property {IDeboa["additionalTarEntries"]} [additionalTarEntries] -
6
7
  * Additional entries to be added to the .tar archive. This is useful for
@@ -33,6 +34,10 @@ import { IControlFileOptions } from './IControlFileOptions';
33
34
  * /usr/share/pixmaps. Optional.
34
35
  *
35
36
  *
37
+ * @property {IDeboa["installationRoot"]} [installationRoot] -
38
+ * Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
39
+ *
40
+ *
36
41
  * @property {IDeboa["modifyTarHeader"]} [modifyTarHeader] -
37
42
  * This callback makes it possible to modify file headers before they're
38
43
  * written to the .tar archive, which is useful for setting permissions.
@@ -92,6 +97,10 @@ export interface IDeboa {
92
97
  * /usr/share/pixmaps. Optional.
93
98
  */
94
99
  icon?: string;
100
+ /**
101
+ * Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
102
+ */
103
+ installationRoot?: string;
95
104
  /**
96
105
  * This callback makes it possible to modify file headers before they're
97
106
  * written to the .tar archive, which is useful for setting permissions.
@@ -121,3 +130,4 @@ export interface IDeboa {
121
130
  */
122
131
  targetDir: string;
123
132
  }
133
+ export {};
@@ -0,0 +1 @@
1
+ export declare type Priority = 'required' | 'important' | 'standard' | 'optional';
@@ -0,0 +1,10 @@
1
+ export * from './IAddTarEntriesParams';
2
+ export * from './IControlFileOptions';
3
+ export * from './IDeboa';
4
+ export * from './IDeboaFromFile';
5
+ export * from './INormalizeOptionsLength';
6
+ export * from './IWriteFileFromLinesArgs';
7
+ export * from './IWriteToArchive';
8
+ export * from './MaintainerScript';
9
+ export * from './Priority';
10
+ export * from './Section';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "deboa",
3
3
  "author": "Erik Moura <erikian@erikian.dev>",
4
- "version": "1.0.1",
4
+ "version": "1.1.0",
5
5
  "description": "Create .deb files in any platform with Node.js",
6
6
  "main": "./dist/cjs/index.js",
7
7
  "module": "./dist/esm/index.js",
@@ -1,4 +0,0 @@
1
- import { Deboa } from './classes/Deboa';
2
- import { DeboaFromFile } from './classes/DeboaFromFile';
3
- export { Deboa, DeboaFromFile };
4
- export * from './types';
@@ -1,4 +0,0 @@
1
- import { Deboa } from './classes/Deboa';
2
- import { DeboaFromFile } from './classes/DeboaFromFile';
3
- export { Deboa, DeboaFromFile };
4
- export * from './types';