New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@chatie/semver

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chatie/semver - npm Package Compare versions

Comparing version 0.0.2 to 0.1.1

bin/semver-is-dev.ts

5

package.json
{
"name": "@chatie/semver",
"version": "0.0.2",
"version": "0.1.1",
"description": "The Enhanced Semantic Versioner for NPM",

@@ -17,4 +17,6 @@ "main": "dist/src/index.js",

"@types/semver": "^6.0.0",
"@types/shelljs": "^0.8.5",
"git-scripts": "^0.2.1",
"read-pkg-up": "^6.0.0",
"shelljs": "^0.8.3",
"shx": "^0.3.2",

@@ -35,2 +37,3 @@ "tstest": "^0.3.1"

"bin": {
"semver-is-dev": "dist/bin/semver-is-dev.js",
"semver-is-prod": "dist/bin/semver-is-prod.js"

@@ -37,0 +40,0 @@ },

14

README.md

@@ -1,2 +0,2 @@

# semver
# @chatie/semver

@@ -13,5 +13,9 @@ [![NPM Version](https://badge.fury.io/js/%40chatie%2Fsemver.svg)](https://www.npmjs.com/package/@chatie/semver)

1. Two CLI utils that will identify whether this VERSION is for production(stable) or development(unstable):
1. `semver-is-prod`
1. `semver-id-dev`
1. Added two methods to `SemVer` class:
1. `isProd(version: string): boolean`
1. `isDev(version: string): boolean`
1. TypeScript support. It contains the typing definations already
1. A CLI util `semver-is-prod VERSION` that will identify whether this VERSION is for production(stable)
1. Two API for `SemVer` class: `isProd(version)` and `isDev(version)`

@@ -44,4 +48,4 @@ Please goto the original `semver` GitHub homepage to learn more from [semver](https://github.com/npm/node-semver)

1. Wrap `semver`
1. add new methods: `isProd`
1. add new binary: `semver-is-prod`
1. add new methods: `isProd` & `isDev`
1. add new binary: `semver-is-prod` & `semver-is-dev`

@@ -48,0 +52,0 @@ ## AUTHOR

#!/usr/bin/env ts-node
import { exec } from 'shelljs'
import { test } from 'tstest'
import { SemVer } from '@chatie/semver'
async function main () {
const sv = new SemVer('1.0.0')
if (!sv.isProd) {
throw new Error('not prod?')
const VERSION_PROD_LIST: Array<[string, boolean]> = [
['0.0.0', true],
['0.0.1', true],
['0.1.0', false],
['0.1.1', false],
['0.2.0', true],
['0.2.1', true],
]
test('semver class prod/dev indentification', async (t: test.Test) => {
for (const [version, prod] of VERSION_PROD_LIST) {
const semVer = new SemVer(version)
t.equal(semVer.isProd, prod, `version/prod should match: ${version} -> ${prod}`)
t.equal(semVer.isDev, !prod, `version/dev should match: ${version} -> ${!prod}`)
}
return 0
}
})
main()
.then(process.exit)
.catch(e => {
console.info(e)
process.exit(1)
})
test('semver-is-prod', async (t: test.Test) => {
for (const [version, prod] of VERSION_PROD_LIST) {
const isProd = exec(`npx semver-is-prod ${version} > /dev/null`).code === 0
const isDev = exec(`npx semver-is-dev ${version} > /dev/null`).code === 0
t.equal(isProd, prod, `version/prod should match: ${version} -> ${prod}`)
t.equal(isDev, !prod, `version/dev should match: ${version} -> ${!prod}`)
}
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc