• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

electrode-io / electrode-native / 7528

24 Oct 2025 12:58AM UTC coverage: 56.546% (-3.5%) from 60.065%
7528

push

Azure Pipelines

r0h0gg6
Merge pull request #1918 from electrode-io/cuid2-fix-2

Update yarn.lock

3566 of 7725 branches covered (46.16%)

Branch coverage included in aggregate %.

2 of 5 new or added lines in 1 file covered. (40.0%)

568 existing lines in 37 files now uncovered.

9396 of 15198 relevant lines covered (61.82%)

524.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.16
/ern-api-gen/src/normalizeConfig.ts
1
import { PackagePath } from 'ern-core';
2

3
// Generate a configuration. This looks in the apigen schema
4
// and the things passed in.
5
//
6
// Options :
7
// - name : Name of the api [REQUIRED]
8
// - bridgeVersion : The version of the bridge to use to generate API [REQUIRED]
9
// - reactNativeVersion : Version of react native to use [REQUIRED]
10
// - targetDependencies : List of target dependencies [default: empty]
11
// - apiVersion : Version of the api [default: 1.0.0]
12
// - apiDescription : Description of the API [default: ERN Generated API for {name}]
13
// - apiAuthor : Author of the API [Default: EMAIL or USER env variable]
14
// - namespace : Namespace to use for messages [Default: com.{npmscope}.{name}.ern]
15
// - npmScope: Npm scope to use for the module [Default: no scope]
16
// - apiSchemaPath : Path to the file holding the api schema [Default: schema.json]
17
// - moduleName : Name of the generated module
18
// - artifactId : The artifact id
19
// - packageName : npm package name of the module
20
export default function normalizeConfig({
2✔
21
  name /* REQUIRED */,
22
  bridgeVersion /* REQUIRED */,
23
  reactNativeVersion /* REQUIRED */,
24
  targetDependencies,
25
  apiVersion,
26
  apiDescription,
27
  apiAuthor,
28
  namespace,
29
  npmScope,
30
  apiSchemaPath = 'schema.json',
4✔
31
  moduleName,
32
  artifactId,
33
  packageName,
34
  ...rest
35
}: {
36
  name: string;
37
  bridgeVersion: string;
38
  reactNativeVersion: string;
39
  targetDependencies?: PackagePath[];
40
  apiVersion?: string;
41
  apiDescription?: string;
42
  apiAuthor?: string;
43
  namespace?: string;
44
  npmScope?: string;
45
  apiSchemaPath?: string;
46
  moduleName?: string;
47
  artifactId?: string;
48
  packageName?: string;
49
  rest?: any;
50
}) {
51
  const config: any = {};
4✔
52

53
  let simpleName = name.toLowerCase();
4✔
54
  let scope;
55
  const results = /^@(.+?)\/(?:react-native-)?(.+?)(?:-api)?$/.exec(simpleName);
4✔
56
  if (results) {
4✔
57
    scope = results![1];
2✔
58
    simpleName = results![2];
2✔
59
  }
60
  simpleName = simpleName.replace(/^react-native-|-api$|[^a-z0-9]/g, '');
4✔
61
  if (npmScope) {
4✔
62
    config.npmScope = npmScope;
1✔
63
  } else if (scope) {
3✔
64
    config.npmScope = scope;
2✔
65
  }
66
  config.namespace = namespace
4✔
67
    ? namespace
4!
68
    : config.npmScope
69
    ? `com.${config.npmScope}.${simpleName}.ern`
4✔
70
    : `com.${simpleName}.ern`;
71
  config.moduleName = moduleName || simpleName;
4✔
72
  config.apiAuthor = apiAuthor || process.env.EMAIL || process.env.USER;
4✔
73
  config.apiVersion = apiVersion || '1.0.0';
4✔
74
  config.apiDescription =
4✔
75
    apiDescription || `ERN Generated API for ${config.moduleName}`;
7✔
76
  if (bridgeVersion) {
4!
77
    config.bridgeVersion = bridgeVersion;
4✔
78
  }
79
  if (reactNativeVersion) {
4!
80
    config.reactNativeVersion = reactNativeVersion;
4✔
81
  }
82
  if (apiSchemaPath) {
4!
83
    config.apiSchemaPath = apiSchemaPath;
4✔
84
  }
85
  config.artifactId = artifactId || `react-native-${simpleName}-api`;
4✔
86
  if (targetDependencies) {
4✔
87
    config.targetDependencies = targetDependencies;
1✔
88
  }
89
  if (packageName) {
4!
UNCOV
90
    config.packageName = packageName;
×
91
  }
92
  return config;
4✔
93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc