Skip to content

Commit

Permalink
feat: refactor types and typescript 4 (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpicado committed Jun 13, 2022
1 parent f9d5a4b commit b5cfaf6
Show file tree
Hide file tree
Showing 28 changed files with 1,154 additions and 801 deletions.
10 changes: 10 additions & 0 deletions .changeset/stupid-rocks-fry.md
@@ -0,0 +1,10 @@
---
'@verdaccio/file-locking': minor
'@verdaccio/types': minor
'verdaccio-aws-s3-storage': minor
'verdaccio-google-cloud': minor
'@verdaccio/local-storage': minor
'verdaccio-memory': minor
---

feat: refactor types and typescript 4
6 changes: 3 additions & 3 deletions core/file-locking/src/utils.ts
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 Expand Up @@ -50,7 +50,7 @@ export const lockfile = (name: string): Promise<unknown> => {
};
const lockFileName = `${name}.lock`;
locker.lock(lockFileName, lockOpts, () => {
resolve();
resolve(undefined);
});
});
};
2 changes: 2 additions & 0 deletions core/types/.gitignore
@@ -0,0 +1,2 @@
docs/
lib/
11 changes: 6 additions & 5 deletions core/types/README.md
@@ -1,8 +1,9 @@
# Typescript types for Verdaccio
# Typescript types

Typescript definitions for verdaccio plugins and internal code

# Typescript
## Usage

For usage with the library, the `tsconfig.json` should looks like this.

```
Expand All @@ -29,9 +30,9 @@ For usage with the library, the `tsconfig.json` should looks like this.
}
```

### Imports
### Example

```
```typescript
import type {ILocalData, LocalStorage, Logger, Config} from '@verdaccio/types';

class LocalData implements ILocalData {
Expand All @@ -45,4 +46,4 @@ import type {ILocalData, LocalStorage, Logger, Config} from '@verdaccio/types';
}
```


#### Plugins

0 comments on commit b5cfaf6

Please sign in to comment.