Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tools dependencies and improve their readmes #350

Merged
merged 2 commits into from
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We have three kind of packages, separated as:

- core: the main packages for the project
- plugins: plugins created for Verdaccio
- tools: our own packages for tools like ESLint or Babel
- [tools](tools): our own packages for tools like ESLint or Babel

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion core/file-locking/src/lockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { lockfile, statDir, statfile } from './utils';
* @param name
* @param callback
*/
const lockFile = function(name: string, callback: Callback): void {
const lockFile = function (name: string, callback: Callback): void {
Promise.resolve()
.then(() => {
return statDir(name);
Expand Down
10 changes: 5 additions & 5 deletions core/file-locking/src/readFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ function readFile(name: string, options: ReadFileOptions = {}, callback: Callbac
options.lock = options.lock || false;
options.parse = options.parse || false;

const lock = function(options: ReadFileOptions): Promise<null | NodeJS.ErrnoException> {
const lock = function (options: ReadFileOptions): Promise<null | NodeJS.ErrnoException> {
return new Promise((resolve, reject): void => {
if (!options.lock) {
return resolve(null);
}

lockFile(name, function(err: NodeJS.ErrnoException | null) {
lockFile(name, function (err: NodeJS.ErrnoException | null) {
if (err) {
return reject(err);
}
Expand All @@ -43,9 +43,9 @@ function readFile(name: string, options: ReadFileOptions = {}, callback: Callbac
});
};

const read = function(): Promise<NodeJS.ErrnoException | string> {
const read = function (): Promise<NodeJS.ErrnoException | string> {
return new Promise((resolve, reject): void => {
fs.readFile(name, 'utf8', function(err, contents) {
fs.readFile(name, 'utf8', function (err, contents) {
if (err) {
return reject(err);
}
Expand All @@ -55,7 +55,7 @@ function readFile(name: string, options: ReadFileOptions = {}, callback: Callbac
});
};

const parseJSON = function(contents: string): Promise<unknown> {
const parseJSON = function (contents: string): Promise<unknown> {
return new Promise((resolve, reject): void => {
if (!options.parse) {
return resolve(contents);
Expand Down
2 changes: 1 addition & 1 deletion core/file-locking/src/unclock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Callback } from '@verdaccio/types';
// unlocks file by removing existing lock file
export function unlockFile(name: string, next: Callback): void {
const lockFileName = `${name}.lock`;
locker.unlock(lockFileName, function() {
locker.unlock(lockFileName, function () {
return next(null);
});
}
4 changes: 2 additions & 2 deletions core/file-locking/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const statDir = (name: string): Promise<Error | null> => {
return new Promise((resolve, reject): void => {
// test to see if the directory exists
const dirPath = path.dirname(name);
fs.stat(dirPath, function(err, stats) {
fs.stat(dirPath, function (err, stats) {
if (err) {
return reject(err);
} else if (!stats.isDirectory()) {
Expand All @@ -22,7 +22,7 @@ export const statDir = (name: string): Promise<Error | null> => {
export const statfile = (name: string): Promise<Error | null> => {
return new Promise((resolve, reject): void => {
// test to see if the directory exists
fs.stat(name, function(err, stats) {
fs.stat(name, function (err, stats) {
if (err) {
return reject(err);
} else if (!stats.isFile()) {
Expand Down
6 changes: 3 additions & 3 deletions core/streams/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class UploadTarball extends PassThrough implements IUploadTarball {
function addAbstractMethods(self: any, name: any): void {
self._called_methods = self._called_methods || {};

self.__defineGetter__(name, function() {
return function(): void {
self.__defineGetter__(name, function () {
return function (): void {
self._called_methods[name] = true;
};
});

self.__defineSetter__(name, function(fn: any) {
self.__defineSetter__(name, function (fn: any) {
delete self[name];

self[name] = fn;
Expand Down
12 changes: 6 additions & 6 deletions core/streams/test/mystreams.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ describe('mystreams', () => {
test('should delay events on ReadTarball abort', cb => {
const readTballStream = new ReadTarball({});
readTballStream.abort();
setTimeout(function() {
readTballStream.abort = function(): void {
setTimeout(function () {
readTballStream.abort = function (): void {
cb();
};
readTballStream.abort = function(): never {
readTballStream.abort = function (): never {
throw Error('fail');
};
}, 10);
Expand All @@ -17,11 +17,11 @@ describe('mystreams', () => {
test('should delay events on UploadTarball abort', cb => {
const uploadTballStream = new UploadTarball({});
uploadTballStream.abort();
setTimeout(function() {
uploadTballStream.abort = function(): void {
setTimeout(function () {
uploadTballStream.abort = function (): void {
cb();
};
uploadTballStream.abort = function(): never {
uploadTballStream.abort = function (): never {
throw Error('fail');
};
}, 10);
Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-lerna-scopes": "^8.3.4",
"@types/express": "^4.17.2",
"@types/express": "^4.17.3",
"@types/http-errors": "^1.6.3",
"@types/jest": "^25.1.3",
"@types/jest": "^25.1.4",
"@types/lodash": "^4.14.149",
"@types/memory-fs": "^0.3.2",
"@types/node": "^13.1.1",
"@types/node": "^13.9.5",
"@types/request": "^2.48.4",
"babel-eslint": "^10.1.0",
"codecov": "^3.6.1",
"codecov": "^3.6.5",
"eslint": "^6.8.0",
"husky": "^3.1.0",
"jest": "^25.1.0",
"husky": "^4.2.3",
"jest": "^25.2.3",
"lerna": "^3.20.2",
"lint-staged": "^9.5.0",
"lint-staged": "^10.0.9",
"lodash": "^4.17.15",
"prettier": "^1.19.1",
"snyk": "^1.297.1",
"prettier": "^2.0.2",
"snyk": "^1.305.0",
"typescript": "^3.8.3"
},
"scripts": {
Expand All @@ -51,8 +51,7 @@
},
"lint-staged": {
"**/*.{js,ts}": [
"eslint --fix",
"git add"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we remove "git add" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main breaking change lint-staged added in v10

"eslint --fix"
]
},
"commitlint": {
Expand Down
Loading