Skip to content

Commit 6bb70ad

Browse files
LTR - inclusive language and tgz ignore (#138)
* update inclusive language * ignore tgz file
1 parent 4e7e792 commit 6bb70ad

6 files changed

Lines changed: 21 additions & 20 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
coverage
33
*.log
4+
*.tgz
45
.vscode

lib/archiver.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,40 @@ const REQUIRED_ENTRIES = [
1111
'node_modules'
1212
];
1313

14-
function getEntries(whitelist) {
15-
if (whitelist.files) {
16-
// Extract the property from the whitelist
17-
const { service, main, files } = whitelist;
18-
const whitelistFromSections = [service];
14+
function getEntries(allowlist) {
15+
if (allowlist.files) {
16+
// Extract the property from the allowlist
17+
const { service, main, files } = allowlist;
18+
const allowlistFromSections = [service];
1919

2020
/*
2121
* It flattens the content of both properties (main and files) in the
22-
* "whitelistFromSections" array.
22+
* "allowlistFromSections" array.
2323
*/
2424
if (main) {
25-
whitelistFromSections.push(main);
25+
allowlistFromSections.push(main);
2626
}
2727

2828
if (files) {
29-
whitelistFromSections.push(...files);
29+
allowlistFromSections.push(...files);
3030
}
3131

32-
if (!whitelistFromSections.length) {
32+
if (!allowlistFromSections.length) {
3333
return;
3434
}
3535

36-
return REQUIRED_ENTRIES.concat(whitelistFromSections);
36+
return REQUIRED_ENTRIES.concat(allowlistFromSections);
3737
}
3838
}
3939

40-
module.exports.compress = async function (source, target, whitelist) {
40+
module.exports.compress = async function (source, target, allowlist) {
4141
const gzip = zlib.createGzip();
4242
const ws = fs.createWriteStream(target);
4343
const rs = tar.pack(source, {
4444
ignore: function (name) {
4545
return IGNORE_REGEX.test(path.relative(source, name));
4646
},
47-
entries: getEntries(whitelist)
47+
entries: getEntries(allowlist)
4848
});
4949

5050
return new Promise((resolve, reject) => {

lib/generate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function relativeToRoot(root, files) {
4040
});
4141
}
4242

43-
function getArchiveWhitelist(pkg, customName) {
43+
function getArchiveAllowlist(pkg, customName) {
4444
return {
4545
service: files.serviceFileName(customName || pkg.name),
4646
main: pkg.main,
@@ -59,9 +59,9 @@ module.exports = async (root, pkg, release, customName) => {
5959

6060
const serviceFile = generateServiceFile(root, customPackage);
6161
const specFile = generateSpecFile(specsDirectory, customPackage, release);
62-
const archiveWhitelist = getArchiveWhitelist(pkg, customName);
62+
const archiveAllowlist = getArchiveAllowlist(pkg, customName);
6363

64-
await archiver.compress(root, sourcesArchive, archiveWhitelist);
64+
await archiver.compress(root, sourcesArchive, archiveAllowlist);
6565

6666
return relativeToRoot(root, [
6767
specFile,

test/archiver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('archiver', () => {
7777
assert.equal(ignore('/tmp/SOURCES/cake/real_file_here'), false);
7878
});
7979

80-
it('archives files on a whitelist if specified alongside required files', async () => {
80+
it('archives files on a allowlist if specified alongside required files', async () => {
8181
const service = 'my-cool-api.service';
8282
const files = [
8383
'lib',
@@ -101,7 +101,7 @@ describe('archiver', () => {
101101
}));
102102
});
103103

104-
it('does not include whitelist if none specified', async () => {
104+
it('does not include allowlist if none specified', async () => {
105105
const service = 'my-cool-api.service';
106106
const result = archiver.compress('/tmp/SOURCES', 'tmp.tar.gz', { service });
107107
writeStream.emit('close');
File renamed without changes.

test/generate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const pkg = require('./fixtures/my-cool-api');
4-
const pkgWithWhitelist = require('./fixtures/my-cool-api-with-whitelist');
4+
const pkgWithAllowlist = require('./fixtures/my-cool-api-with-allowlist');
55
const sandbox = require('sinon').createSandbox();
66
const fs = require('fs');
77
const assert = require('assert');
@@ -118,7 +118,7 @@ describe('generate', () => {
118118
});
119119

120120
it('passes files and main values from the package.json to archiver', async () => {
121-
await generate('/path/to/project', pkgWithWhitelist, null, null);
121+
await generate('/path/to/project', pkgWithAllowlist, null, null);
122122
sandbox.assert.calledWith(
123123
archiver.compress,
124124
'/path/to/project',
@@ -136,7 +136,7 @@ describe('generate', () => {
136136
});
137137

138138
it('creates the service file with a custom name if specified and "files" defined', async () => {
139-
await generate('/path/to/project', pkgWithWhitelist, null, 'penguin');
139+
await generate('/path/to/project', pkgWithAllowlist, null, 'penguin');
140140
sandbox.assert.calledWith(
141141
archiver.compress,
142142
'/path/to/project',

0 commit comments

Comments
 (0)