Skip to content

Commit

Permalink
merge: v2.2.0 (#50)
Browse files Browse the repository at this point in the history
issues:
* merge: v2.2.0 (#49)

commits:
* docs: update readme (#36) (631ca6b)
* docs: update readme (#38) (7e8ba60)
* chore: upgrade devdependencies (#40) (444074f)
* test: update unit tests (#42) (99d1816)
* docs: update readme (#44) (827438a)
* chore: update eslint (#46) (99cae75)
* feat: use read-stacked-json (#48) (6b05c68)
  • Loading branch information
gitops-merge committed Jun 20, 2024
2 parents 0213454 + 6b05c68 commit b848b16
Show file tree
Hide file tree
Showing 41 changed files with 4,642 additions and 4,495 deletions.
4 changes: 1 addition & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"ignoreUrls": true,
"ignoreTemplateLiterals": true,
"ignoreStrings": true
}],
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off"
}]
}
}
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Using `CommonJS`:
const { readPackage, readPackageSync } = require('@mnrendra/read-package')

// Asynchronously
readPackage().then(({ name, version }) => {
console.log('asynchronously:', name, version)
})
readPackage()
.then(({ name, version }) => {
console.log('asynchronously:', name, version)
})

// Synchronously
const { name, version } = readPackageSync()
Expand All @@ -27,9 +28,10 @@ Using `ES Module`:
import { readPackage, readPackageSync } from '@mnrendra/read-package'

// Asynchronously
readPackage().then(({ name, version }) => {
console.log('asynchronously:', name, version)
})
readPackage()
.then(({ name, version }) => {
console.log('asynchronously:', name, version)
})

// Synchronously
const { name, version } = readPackageSync()
Expand All @@ -52,7 +54,7 @@ Here are some examples:<br/>

##### • Read from `~/project-name/src/index.js`:
```javascript
const { readPackage } = require('@mnrendra/read-package')
const { readPackageSync } = require('@mnrendra/read-package')

// Synchronously
const { name, version } = readPackageSync()
Expand All @@ -61,12 +63,13 @@ console.log('synchronously:', name, version) // Output: synchronously: project-n

##### • Read from `~/project-name/src/any-directory/index.mjs`:
```javascript
import { readPackageSync } from '@mnrendra/read-package'
import { readPackage } from '@mnrendra/read-package'

// Asynchronously
readPackage().then(({ name, version }) => {
console.log('asynchronously:', name, version) // Output: asynchronously: project-name 1.0.0
})
readPackage()
.then(({ name, version }) => {
console.log('asynchronously:', name, version) // Output: asynchronously: project-name 1.0.0
})
```

#### 2. Read the `package.json` file in your published module:
Expand All @@ -84,7 +87,7 @@ Here are some examples:<br/>
##### • Read from `/consumer/node_modules/module-name/dist/index.js`:
```javascript
"use strict";
const { readPackage } = require('@mnrendra/read-package');
const { readPackageSync } = require('@mnrendra/read-package');

// Synchronously
const { name, version } = readPackageSync();
Expand All @@ -97,21 +100,24 @@ console.log('synchronously:', name, version); // Output: synchronously: module-n
const { readPackage } = require('@mnrendra/read-package');

// Asynchronously
readPackage().then(({ name, version }) => {
console.log('asynchronously:', name, version); // Output: asynchronously: module-name 1.0.0
});
readPackage()
.then(({ name, version }) => {
console.log('asynchronously:', name, version); // Output: asynchronously: module-name 1.0.0
});
```

# Types
```typescript
import type {
Package // @mnrendra/types-package
Package, // @mnrendra/types-package
Options
} from '@mnrendra/read-package'
```
### • Package: [@mnrendra/read-package](https://www.npmjs.com/package/@mnrendra/types-package)
### [Package](https://www.npmjs.com/package/@mnrendra/types-package)
### [Options](https://github.com/mnrendra/read-package/blob/main/src/types/Options.ts)

## License
[MIT](https://github.com/mnrendra/read-packag/blob/HEAD/LICENSE)
[MIT](https://github.com/mnrendra/read-package/blob/HEAD/LICENSE)

## Author
[@mnrendra](https://github.com/mnrendra)
Loading

0 comments on commit b848b16

Please sign in to comment.