release-checker
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -27,4 +27,5 @@ import { Checker } from '../common/checker-interface'; | ||
export declare function readSensitiveDataIn(directory: string): AllSensitiveDataPatterns; | ||
export declare function file(filepath: string): { | ||
export declare function packagedFile(filepath: string): { | ||
isSensitiveData(allSensitiveDataPatterns: AllSensitiveDataPatterns): boolean; | ||
}; | ||
export declare function ejectSensitiveData(): void; |
@@ -38,3 +38,3 @@ "use strict"; | ||
.map(function (fileInfo) { return fileInfo.path; }) | ||
.filter(function (path) { return file(path).isSensitiveData(allSensitiveDataPatterns); }) | ||
.filter(function (path) { return packagedFile(path).isSensitiveData(allSensitiveDataPatterns); }) | ||
.forEach(function (path) { | ||
@@ -106,3 +106,3 @@ validationErrorsAndWarnings.push({ | ||
exports.readSensitiveDataIn = readSensitiveDataIn; | ||
function file(filepath) { | ||
function packagedFile(filepath) { | ||
return { | ||
@@ -132,2 +132,11 @@ isSensitiveData: function (allSensitiveDataPatterns) { | ||
} | ||
exports.file = file; | ||
exports.packagedFile = packagedFile; | ||
function ejectSensitiveData() { | ||
if (fs_2.file('.sensitivedata').existsInDirectory(process.cwd())) { | ||
return; | ||
} | ||
fs_2.copyFile('.sensitivedata') | ||
.fromDirectory(__dirname) | ||
.toDirectory(process.cwd()); | ||
} | ||
exports.ejectSensitiveData = ejectSensitiveData; |
export interface ReleaseCheckerOptions { | ||
[index: string]: string | boolean; | ||
'--customize-sensitivedata': boolean; | ||
'--help': boolean; | ||
@@ -4,0 +5,0 @@ '--package.json': boolean; |
@@ -10,2 +10,3 @@ "use strict"; | ||
var options = { | ||
'--customize-sensitivedata': args['customize-sensitivedata'] || false, | ||
'--help': args.help || args.h || false, | ||
@@ -22,3 +23,6 @@ '--package.json': true, | ||
hasBeenSet: function () { | ||
return options['--help'] === false && options['--test'] === false && options['--sensitivedata'] === false; | ||
return (options['--help'] === false && | ||
options['--test'] === false && | ||
options['--sensitivedata'] === false && | ||
options['--customize-sensitivedata'] === false); | ||
}, | ||
@@ -25,0 +29,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
export declare const usage = "\nUsage: release-checker [options]\n\nOptions:\n --help, -h Show help\n --sensitivedata, -s Ensure there is no sensitive or useless data in the npm package\n --test, -t Ensure that command 'npm test' is successfull\n"; | ||
export declare const usage = "\nUsage: release-checker [options]\n\nOptions:\n --customize-sensitivedata Customize the sensitive or useless data checker\n This will create a .sensitivedata file that you can customize \n \n --help, -h Show help\n --sensitivedata, -s Ensure there is no sensitive or useless data in the npm package\n --test, -t Ensure that command 'npm test' is successfull\n"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.usage = "\nUsage: release-checker [options]\n\nOptions:\n --help, -h Show help\n --sensitivedata, -s Ensure there is no sensitive or useless data in the npm package\n --test, -t Ensure that command 'npm test' is successfull\n"; | ||
exports.usage = "\nUsage: release-checker [options]\n\nOptions:\n --customize-sensitivedata Customize the sensitive or useless data checker\n This will create a .sensitivedata file that you can customize \n \n --help, -h Show help\n --sensitivedata, -s Ensure there is no sensitive or useless data in the npm package\n --test, -t Ensure that command 'npm test' is successfull\n"; |
@@ -5,21 +5,26 @@ "use strict"; | ||
var utils_1 = require("./checkers/common/utils"); | ||
var index_1 = require("./checkers/sensitive-data-checker/index"); | ||
var cli_options_parser_1 = require("./cli-options/cli-options-parser"); | ||
var index_1 = require("./reporters/ci-reporter/index"); | ||
var index_2 = require("./reporters/ci-reporter/index"); | ||
function run() { | ||
var options = cli_options_parser_1.getCliOptions(); | ||
if (options['--help']) { | ||
index_1.ciReporter.reportUsage(); | ||
index_2.ciReporter.reportUsage(); | ||
return; | ||
} | ||
index_1.ciReporter.reportIntro(); | ||
if (options['--customize-sensitivedata']) { | ||
index_1.ejectSensitiveData(); | ||
return; | ||
} | ||
index_2.ciReporter.reportIntro(); | ||
var checkersToRun = utils_1.filter(checkers_1.checkers).from(options); | ||
checkersToRun.forEach(utils_1.runChecker); | ||
if (utils_1.all(checkersToRun).hasPassed()) { | ||
index_1.ciReporter.reportValidationWarningsOf(checkersToRun); | ||
index_2.ciReporter.reportValidationWarningsOf(checkersToRun); | ||
return; | ||
} | ||
index_1.ciReporter.reportValidationWarningsOf(checkersToRun); | ||
index_1.ciReporter.reportValidationErrorsOf(checkersToRun); | ||
index_2.ciReporter.reportValidationWarningsOf(checkersToRun); | ||
index_2.ciReporter.reportValidationErrorsOf(checkersToRun); | ||
process.exit(1); | ||
} | ||
exports.run = run; |
export declare function removeFile(filename: string): { | ||
fromDirectory(directory: string): void; | ||
}; | ||
export declare function copyFile(filename: string): { | ||
fromDirectory(sourceDirectory: string): { | ||
toDirectory(targetDirectory: string): void; | ||
}; | ||
}; | ||
export declare function file(filename: string): { | ||
existsInDirectory(directory: string): boolean; | ||
}; |
@@ -9,4 +9,4 @@ "use strict"; | ||
try { | ||
var file = path_1.join(directory, filename); | ||
fs_1.unlinkSync(file); | ||
var sourceFile = path_1.join(directory, filename); | ||
fs_1.unlinkSync(sourceFile); | ||
} | ||
@@ -23,1 +23,28 @@ catch (error) { | ||
exports.removeFile = removeFile; | ||
function copyFile(filename) { | ||
return { | ||
fromDirectory: function (sourceDirectory) { | ||
return { | ||
toDirectory: function (targetDirectory) { | ||
var sourceFile = path_1.join(sourceDirectory, filename); | ||
var targetFile = path_1.join(targetDirectory, filename); | ||
if (typeof fs_1.copyFileSync === 'function') { | ||
fs_1.copyFileSync(sourceFile, targetFile); | ||
return; | ||
} | ||
fs_1.writeFileSync(targetFile, fs_1.readFileSync(sourceFile)); | ||
}, | ||
}; | ||
}, | ||
}; | ||
} | ||
exports.copyFile = copyFile; | ||
function file(filename) { | ||
return { | ||
existsInDirectory: function (directory) { | ||
var sourceFile = path_1.join(directory, filename); | ||
return fs_1.existsSync(sourceFile); | ||
}, | ||
}; | ||
} | ||
exports.file = file; |
@@ -8,2 +8,8 @@ # Changelog | ||
## [0.5.0] - 2019-01-17 | ||
### Added | ||
- be able to customize the sensitive and non essential data checker | ||
## [0.4.1] - 2019-01-16 | ||
@@ -10,0 +16,0 @@ |
{ | ||
"name": "release-checker", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "Check your release before publishing", | ||
@@ -5,0 +5,0 @@ "main": "build/lib/index.js", |
@@ -14,4 +14,4 @@ # Release Checker (alpha) | ||
- tests pass | ||
- there is no sensitive data embedded in the package that will be send to the registry | ||
- there is no useless files (like tests files) embedded in the package that will be send to the registry | ||
- there is no sensitive data embedded in the package that will be sent to the registry | ||
- there is no useless files (like tests files) embedded in the package that will be sent to the registry | ||
- there is no vulnerable dependencies (unreleased) | ||
@@ -77,2 +77,11 @@ - there are no uncommitted changes in the working tree (unreleased) | ||
### --customize-sensitivedata | ||
Customize the sensitive or useless data checker. | ||
This will create, in the current directory, a `.sensitivedata` file that you can customize to fit your needs. | ||
```sh | ||
npx release-checker --customize-sensitivedata | ||
``` | ||
### -h, --help | ||
@@ -102,2 +111,39 @@ | ||
## Sensitive or useless data Checker | ||
This Checker checks there is no sensitive and no useless files inside the to-be-published package. This check performs only if npm version is 5.9.0 or above. | ||
- it will detect the following files: | ||
- Benchmark files | ||
- Configuration files | ||
- CI | ||
- eslint | ||
- GitHub | ||
- JetBrains | ||
- Visual Studio Code | ||
- Coverage files | ||
- Demo files | ||
- Dependency directories | ||
- Doc files | ||
- Example files | ||
- Log files | ||
- Private SSH key | ||
- Script files | ||
- Secret files | ||
- Source files | ||
- Temp files | ||
- Test files | ||
- Zip files | ||
- Output of 'npm pack' | ||
- these files are defined inside this built-in [.sensitivedata](lib/checkers/sensitive-data-checker/.sensitivedata) file. | ||
- you may completely override this file by creating a `.sensitivedata` file in the root of your project so that this checker fits your needs. | ||
- to create this file, just run the command: | ||
```sh | ||
npx release-checker --customize-sensitivedata | ||
``` | ||
- if you create your own `.sensitivedata` file, and the `package.json` file has no `files` section, consider adding `.sensitivedata` to the `.npmignore` file. | ||
## Authors | ||
@@ -104,0 +150,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43795
901
152