How to use semver-regex - 8 common examples

To help you get started, we’ve selected a few semver-regex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Nexusoft / NexusInterface / app / nxs_modules / api / modules.js View on Github external
// Schema for nxs_package.json
const nxsPackageSchema = {
  additionalProperties: false,
  required: ['name', 'displayName', 'version', 'apiVersion', 'type', 'files'],
  properties: {
    name: {
      type: 'string',
      // Allows lowercase letters, digits, underscore and dash, but must have at least one lowercase letter
      pattern: '^[0-9a-z_-]*[a-z][0-9a-z_-]*$',
    },
    // A user-friendly name to be displayed on the GUI
    displayName: { type: 'string' },
    version: {
      type: 'string',
      pattern: semverRegex().source,
    },
    // Nexus Module API version that this module was built on
    apiVersion: {
      type: 'string',
      pattern: semverRegex().source,
    },
    description: { type: 'string' },
    type: { type: 'string', enum: ['page', 'page-panel'] },
    // Relative path to the entry file
    // Main file could be html or js depending on module's type
    // If not specified, app will look for index.html or index.js depending on module type
    entry: {
      type: 'string',
      // Allows empty strings, disallows ../ and ..\
      pattern: /^(.(?
github Electra-project / translectra / src / models / Version.js View on Github external
      validator: v => semverRegex().test(v),
      message: `The version name must be a valid SemVer string.`,
github tinper-uba / uba-gui / webpack / main.base.config.babel.js View on Github external
import { resolve } from 'path';
import semverRegex from 'semver-regex';
import { devDependencies } from './../package.json';

const electronVersion = semverRegex().exec(devDependencies.electron)[0];

export default {
  context: resolve(__dirname, '..'),
  entry: {
    main: './src/main/index.js'
  },
  module: {
    rules: [{
      test: /\.js$/,
      include: resolve(__dirname, '../src'),
      loader: 'babel-loader',
      options: {
        babelrc: false,
        presets: [
          ['env', { targets: { electron: electronVersion }, modules: false }],
          'stage-2',
github porchdotcom / up-to-code / src / pkg.js View on Github external
const exactVersion = version => {
    const match = version.match(semverRegex());
    assert(match, `${version} must be valid semver`);
    return match[0];
};
const getPublishedVersion = memoize((packageName, logger) => (
github dreamnettech / dreamtime / src / electron / src / modules / tools / power.js View on Github external
process.on('close', () => {
      try {
        response = semverRegex().exec(response)
        response = `v${response[0]}`
        def.resolve(response)
      } catch (err) {
        def.resolve()
      }
    })
  } catch (err) {
github tinper-uba / uba-gui / webpack / renderer.base.config.babel.js View on Github external
import { resolve } from 'path';
import semverRegex from 'semver-regex';
import { devDependencies } from './../package.json';

const electronVersion = semverRegex().exec(devDependencies.electron)[0];

export default {
  context: resolve(__dirname, '..'),
  entry: {
    renderer: './src/renderer/index.jsx'
  },
  module: {
    rules: [
      {
        test: /\.js[x]?$/,
        include: resolve(__dirname, '../src'),
        loader: 'babel-loader',
        options: {
          babelrc: false,
          presets: [
            ['env', { targets: { electron: electronVersion }, modules: false }],
github GeekyAnts / vue-native-cli / src / core / process.ts View on Github external
function findCLIVersionInMessage(cliMessage: string): string | void {
  return regexMatch(semverRegex(), cliMessage)
}
github strvcom / dep-manager-web / src / components / Widgets / LibraryActualityWidget.tsx View on Github external
const outDatedDependents = dependents.reduce((acc1, dependent) => {
        const dependentVersion = semverRegex().exec(dependent.version)![0]
        const diff = semverDiff(dependentVersion, libraryVersion)
        return diff === 'major' ? acc1 + 1 : acc1
      }, 0)
      return {

semver-regex

Regular expression for matching semver versions

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular semver-regex functions