Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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: /^(.(?
validator: v => semverRegex().test(v),
message: `The version name must be a valid SemVer string.`,
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',
const exactVersion = version => {
const match = version.match(semverRegex());
assert(match, `${version} must be valid semver`);
return match[0];
};
const getPublishedVersion = memoize((packageName, logger) => (
process.on('close', () => {
try {
response = semverRegex().exec(response)
response = `v${response[0]}`
def.resolve(response)
} catch (err) {
def.resolve()
}
})
} catch (err) {
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 }],
function findCLIVersionInMessage(cliMessage: string): string | void {
return regexMatch(semverRegex(), cliMessage)
}
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 {