deboa 1.0.0 → 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.
package/README.md CHANGED
@@ -29,6 +29,16 @@ any number of metadata/file contents pairs.
29
29
  - the `data` file, which contains the actual software
30
30
 
31
31
 
32
+ # Installation
33
+
34
+ ```shell
35
+ # Yarn
36
+ yarn add --dev deboa
37
+
38
+ # npm
39
+ npm i -D deboa
40
+ ```
41
+
32
42
  # API
33
43
 
34
44
  ## Creating a .deb from scratch
@@ -150,7 +150,13 @@ function _interopRequireWildcard(obj, nodeInterop) {
150
150
  this.#outputFile = _path.default.join(this.targetDir, `${packageName}_${version}_${architecture}.deb`);
151
151
  this.#controlFolderDestination = _path.default.join(this.#tempDir, 'control');
152
152
  this.#dataFolderDestination = _path.default.join(this.#tempDir, 'data');
153
- 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
+ ]);
154
160
  }
155
161
  /**
156
162
  * Ensures that all required options are present and that the `packageName`
@@ -266,6 +272,13 @@ function _interopRequireWildcard(obj, nodeInterop) {
266
272
  const controlFileWriteStream = _fs.default.createWriteStream(controlFileLocation);
267
273
  _tarFs.default.pack(this.#dataFolderDestination, {
268
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';
269
282
  // sensible defaults for Windows users
270
283
  if (process.platform === 'win32') {
271
284
  const defaultFilePermission = parseInt('0644', 8);
@@ -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 {};
@@ -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);
@@ -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 {};
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.0",
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",