contensis-cli 1.0.0-beta.9 → 1.0.0-beta.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +1146 -78
  2. package/cli.js +3 -0
  3. package/dist/commands/connect.js +3 -3
  4. package/dist/commands/connect.js.map +2 -2
  5. package/dist/commands/create.js +45 -10
  6. package/dist/commands/create.js.map +2 -2
  7. package/dist/commands/dev.js +75 -0
  8. package/dist/commands/dev.js.map +7 -0
  9. package/dist/commands/diff.js +57 -0
  10. package/dist/commands/diff.js.map +7 -0
  11. package/dist/commands/execute.js +103 -0
  12. package/dist/commands/execute.js.map +7 -0
  13. package/dist/commands/get.js +169 -32
  14. package/dist/commands/get.js.map +3 -3
  15. package/dist/commands/globalOptions.js +37 -12
  16. package/dist/commands/globalOptions.js.map +2 -2
  17. package/dist/commands/import.js +47 -12
  18. package/dist/commands/import.js.map +2 -2
  19. package/dist/commands/index.js +22 -2
  20. package/dist/commands/index.js.map +2 -2
  21. package/dist/commands/list.js +53 -10
  22. package/dist/commands/list.js.map +2 -2
  23. package/dist/commands/login.js +2 -2
  24. package/dist/commands/login.js.map +2 -2
  25. package/dist/commands/push.js +17 -13
  26. package/dist/commands/push.js.map +2 -2
  27. package/dist/commands/remove.js +51 -8
  28. package/dist/commands/remove.js.map +2 -2
  29. package/dist/commands/set.js +139 -12
  30. package/dist/commands/set.js.map +2 -2
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.map +2 -2
  33. package/dist/localisation/en-GB.js +259 -49
  34. package/dist/localisation/en-GB.js.map +2 -2
  35. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +56 -0
  36. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +7 -0
  37. package/dist/mappers/DevInit-to-CIWorkflow.js +127 -0
  38. package/dist/mappers/DevInit-to-CIWorkflow.js.map +7 -0
  39. package/dist/mappers/DevInit-to-RolePermissions.js +54 -0
  40. package/dist/mappers/DevInit-to-RolePermissions.js.map +7 -0
  41. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js +56 -0
  42. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js.map +7 -0
  43. package/dist/models/CliService.d.js +17 -0
  44. package/dist/models/CliService.d.js.map +7 -0
  45. package/dist/models/DevService.d.js +17 -0
  46. package/dist/models/DevService.d.js.map +7 -0
  47. package/dist/providers/CredentialProvider.js +46 -14
  48. package/dist/providers/CredentialProvider.js.map +3 -3
  49. package/dist/providers/SessionCacheProvider.js +21 -1
  50. package/dist/providers/SessionCacheProvider.js.map +2 -2
  51. package/dist/providers/file-provider.js +12 -6
  52. package/dist/providers/file-provider.js.map +3 -3
  53. package/dist/services/ContensisCliService.js +1148 -421
  54. package/dist/services/ContensisCliService.js.map +3 -3
  55. package/dist/services/ContensisDevService.js +309 -0
  56. package/dist/services/ContensisDevService.js.map +7 -0
  57. package/dist/services/ContensisRoleService.js +87 -0
  58. package/dist/services/ContensisRoleService.js.map +7 -0
  59. package/dist/shell.js +58 -18
  60. package/dist/shell.js.map +3 -3
  61. package/dist/util/console.printer.js +171 -55
  62. package/dist/util/console.printer.js.map +2 -2
  63. package/dist/util/diff.js +102 -0
  64. package/dist/util/diff.js.map +7 -0
  65. package/dist/util/dotenv.js +57 -0
  66. package/dist/util/dotenv.js.map +7 -0
  67. package/dist/util/find.js +31 -0
  68. package/dist/util/find.js.map +7 -0
  69. package/dist/util/git.js +126 -0
  70. package/dist/util/git.js.map +7 -0
  71. package/dist/util/index.js +8 -2
  72. package/dist/util/index.js.map +3 -3
  73. package/dist/util/logger.js +90 -29
  74. package/dist/util/logger.js.map +3 -3
  75. package/dist/util/os.js +39 -0
  76. package/dist/util/os.js.map +7 -0
  77. package/dist/util/timers.js +49 -0
  78. package/dist/util/timers.js.map +7 -0
  79. package/dist/util/yaml.js +45 -0
  80. package/dist/util/yaml.js.map +7 -0
  81. package/dist/version.js +1 -1
  82. package/dist/version.js.map +1 -1
  83. package/esbuild.config.js +3 -1
  84. package/package.json +12 -3
  85. package/src/commands/connect.ts +3 -2
  86. package/src/commands/create.ts +61 -8
  87. package/src/commands/dev.ts +69 -0
  88. package/src/commands/diff.ts +41 -0
  89. package/src/commands/execute.ts +117 -0
  90. package/src/commands/get.ts +242 -28
  91. package/src/commands/globalOptions.ts +42 -12
  92. package/src/commands/import.ts +58 -8
  93. package/src/commands/index.ts +22 -1
  94. package/src/commands/list.ts +85 -11
  95. package/src/commands/login.ts +2 -1
  96. package/src/commands/push.ts +18 -11
  97. package/src/commands/remove.ts +66 -4
  98. package/src/commands/set.ts +189 -9
  99. package/src/index.ts +1 -4
  100. package/src/localisation/en-GB.ts +374 -66
  101. package/src/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.ts +44 -0
  102. package/src/mappers/DevInit-to-CIWorkflow.ts +150 -0
  103. package/src/mappers/DevInit-to-RolePermissions.ts +33 -0
  104. package/src/mappers/DevRequests-to-RequestHanderSiteConfigYaml.ts +44 -0
  105. package/src/models/CliService.d.ts +36 -0
  106. package/src/models/DevService.d.ts +5 -0
  107. package/src/models/JsModules.d.ts +1 -0
  108. package/src/providers/CredentialProvider.ts +51 -18
  109. package/src/providers/SessionCacheProvider.ts +29 -2
  110. package/src/providers/file-provider.ts +17 -6
  111. package/src/services/ContensisCliService.ts +1458 -518
  112. package/src/services/ContensisDevService.ts +365 -0
  113. package/src/services/ContensisRoleService.ts +76 -0
  114. package/src/shell.ts +68 -18
  115. package/src/util/console.printer.ts +240 -78
  116. package/src/util/diff.ts +113 -0
  117. package/src/util/dotenv.ts +37 -0
  118. package/src/util/find.ts +8 -0
  119. package/src/util/git.ts +130 -0
  120. package/src/util/index.ts +16 -7
  121. package/src/util/logger.ts +145 -31
  122. package/src/util/os.ts +7 -0
  123. package/src/util/timers.ts +24 -0
  124. package/src/util/yaml.ts +13 -0
  125. package/src/version.ts +1 -1
@@ -0,0 +1,150 @@
1
+ import { JSONPath, JSONPathOptions } from 'jsonpath-plus';
2
+ import { readFile } from '~/providers/file-provider';
3
+ import ContensisDev from '~/services/ContensisDevService';
4
+ import { diffFileContent } from '~/util/diff';
5
+ import { GitHelper } from '~/util/git';
6
+ import { logError } from '~/util/logger';
7
+ import { parseYamlDocument, validateWorkflowYaml } from '~/util/yaml';
8
+
9
+ type MappedWorkflowOutput = {
10
+ existingWorkflow: string;
11
+ newWorkflow: string;
12
+ diff: string;
13
+ };
14
+
15
+ export const mapCIWorkflowContent = (
16
+ cli: ContensisDev,
17
+ git: GitHelper
18
+ ): MappedWorkflowOutput | undefined => {
19
+ // get existing workflow file
20
+ const workflowFile = readFile(git.ciFilePath);
21
+ if (!workflowFile) return undefined;
22
+
23
+ const blockId = git.name;
24
+ if (git.type === 'github') {
25
+ const addGitHubActionJobStep = {
26
+ name: 'Push block to Contensis',
27
+ id: 'push-block',
28
+ uses: 'contensis/block-push@v1',
29
+ with: {
30
+ 'block-id': blockId,
31
+ // 'image-uri': '${{ steps.build.outputs.image-uri }}',
32
+ alias: cli.currentEnv,
33
+ 'project-id': cli.currentProject,
34
+ 'client-id': '${{ secrets.CONTENSIS_CLIENT_ID }}',
35
+ 'shared-secret': '${{ secrets.CONTENSIS_SHARED_SECRET }}',
36
+ },
37
+ };
38
+
39
+ // parse yaml to js
40
+ const workflowDoc = parseYamlDocument(workflowFile);
41
+ const workflow = workflowDoc.toJS();
42
+ const setWorkflowElement = (path: string | any[], value: any) => {
43
+ const findPath =
44
+ typeof path === 'string' && path.includes('.')
45
+ ? path
46
+ .split('.')
47
+ .map(p => (Number(p) || Number(p) !== 0 ? p : Number(p)))
48
+ : path;
49
+
50
+ if (workflowDoc.hasIn(findPath)) {
51
+ workflowDoc.setIn(findPath, value);
52
+ } else {
53
+ workflowDoc.addIn(findPath, value);
54
+ // }
55
+ }
56
+ };
57
+ const findExistingJobSteps = (
58
+ resultType: JSONPathOptions['resultType']
59
+ ) => {
60
+ // look for line in job
61
+ // jobs.x.steps[uses: contensis/block-push]
62
+ const path =
63
+ git.type === 'github'
64
+ ? '$.jobs..steps.*[?(@property === "uses" && @.match(/^contensis\\/block-push/i))]^'
65
+ : // TODO: add jsonpath for gitlab file
66
+ '';
67
+
68
+ const existingJobStep = JSONPath({
69
+ path,
70
+ json: workflow,
71
+ resultType: resultType,
72
+ });
73
+
74
+ return existingJobStep;
75
+ };
76
+
77
+ const existingJobStep = findExistingJobSteps('all');
78
+
79
+ // update job step
80
+ if (existingJobStep.length) {
81
+ //cli.log.json(existingJobStep);
82
+
83
+ // The [0] index means we're only looking at updating the first instance in the file
84
+ const step = existingJobStep[0];
85
+
86
+ // Path looks like this "$['jobs']['build']['steps'][3]"
87
+ // We want it to look like this "jobs.build.steps.3"
88
+ const stepPath = step.path
89
+ .replace('$[', '')
90
+ .replaceAll('][', '.')
91
+ .replace(']', '')
92
+ .replaceAll("'", '');
93
+
94
+ cli.log.info(
95
+ `Found existing Job step: ${stepPath}
96
+ - name: ${step.value.name}
97
+ id: ${step.value.id}\n`
98
+ );
99
+
100
+ setWorkflowElement(`${stepPath}.with.alias`, cli.currentEnv);
101
+ setWorkflowElement(`${stepPath}.with.project-id`, cli.currentProject);
102
+ setWorkflowElement(`${stepPath}.with.block-id`, blockId);
103
+ setWorkflowElement(
104
+ `${stepPath}.with.client-id`,
105
+ '${{ secrets.CONTENSIS_CLIENT_ID }}'
106
+ );
107
+ setWorkflowElement(
108
+ `${stepPath}.with.shared-secret`,
109
+ '${{ secrets.CONTENSIS_SHARED_SECRET }}'
110
+ );
111
+ } else {
112
+ // create job with push step
113
+ workflowDoc.addIn(['jobs'], {
114
+ key: 'deploy',
115
+ value: {
116
+ name: 'Push image to Contensis',
117
+ 'runs-on': 'ubuntu-latest',
118
+ steps: [addGitHubActionJobStep],
119
+ },
120
+ });
121
+ }
122
+
123
+ // Workflow validation provided by @action-validator/core package
124
+ const workflowIsValid = validateWorkflowYaml(workflowDoc.toString());
125
+
126
+ if (workflowIsValid === true) {
127
+ cli.log.debug(
128
+ `New file content to write to ${git.ciFilePath}\n\n${workflowDoc}`
129
+ );
130
+ } else if (Array.isArray(workflowIsValid)) {
131
+ // Errors
132
+ logError(
133
+ [
134
+ ...workflowIsValid.map(
135
+ res => new Error(`${res.code}: ${res.detail || res.title}`)
136
+ ),
137
+ workflowDoc.toString(),
138
+ ],
139
+ `GitHub workflow YAML did not pass validation check`
140
+ );
141
+ }
142
+ const newWorkflow = workflowDoc.toString({ lineWidth: 0 });
143
+
144
+ return {
145
+ existingWorkflow: workflowFile,
146
+ newWorkflow,
147
+ diff: diffFileContent(workflowFile, newWorkflow),
148
+ };
149
+ }
150
+ };
@@ -0,0 +1,33 @@
1
+ import { Role } from 'contensis-management-api/lib/models';
2
+
3
+ export const devKeyPermissions = { blocks: [] } as Partial<Role['permissions']>;
4
+
5
+ export const deployKeyPermissions = { blocks: ['push', 'release'] } as Partial<
6
+ Role['permissions']
7
+ >;
8
+
9
+ export const devKeyRole = (
10
+ keyName: string,
11
+ description: string
12
+ ): Partial<Role> => ({
13
+ name: keyName,
14
+ description,
15
+ assignments: {
16
+ apiKeys: [keyName],
17
+ },
18
+ permissions: devKeyPermissions,
19
+ enabled: true,
20
+ });
21
+
22
+ export const deployKeyRole = (
23
+ keyName: string,
24
+ description: string
25
+ ): Partial<Role> => ({
26
+ name: keyName,
27
+ description,
28
+ assignments: {
29
+ apiKeys: [keyName],
30
+ },
31
+ permissions: deployKeyPermissions,
32
+ enabled: true,
33
+ });
@@ -0,0 +1,44 @@
1
+ import ContensisCli from '~/services/ContensisCliService';
2
+
3
+ interface ISiteConfigYaml {
4
+ alias: string;
5
+ projectId: string;
6
+ accessToken: string;
7
+ clientId: string;
8
+ sharedSecret: string;
9
+ blocks: {
10
+ id: string;
11
+ baseUri: string;
12
+ }[];
13
+ }
14
+
15
+ export const mapSiteConfigYaml = async (cli: ContensisCli) => {
16
+ const credentials = await cli.GetCredentials(cli.env.lastUserId);
17
+
18
+ const blocks = [];
19
+ const blocksRaw = await cli.PrintBlocks();
20
+
21
+ for (const block of blocksRaw || []) {
22
+ const versions = await cli.PrintBlockVersions(
23
+ block.id,
24
+ 'default',
25
+ 'latest'
26
+ );
27
+ if (versions?.[0]) {
28
+ blocks.push({
29
+ id: versions[0].id,
30
+ baseUri: versions[0].previewUrl,
31
+ });
32
+ }
33
+ }
34
+
35
+ const siteConfig: ISiteConfigYaml = {
36
+ alias: cli.currentEnv,
37
+ projectId: cli.currentProject,
38
+ accessToken: '',
39
+ clientId: credentials?.current?.account || '',
40
+ sharedSecret: credentials?.current?.password || '',
41
+ blocks,
42
+ };
43
+ return siteConfig;
44
+ };
@@ -0,0 +1,36 @@
1
+
2
+ export type OutputFormat = 'json' | 'csv' | 'xml';
3
+
4
+ export type OutputOptions = {
5
+ format?: OutputFormat;
6
+ output?: string;
7
+ };
8
+
9
+ export interface IConnectOptions extends IAuthOptions {
10
+ alias?: string;
11
+ projectId?: string;
12
+ }
13
+
14
+ export interface IAuthOptions {
15
+ user?: string;
16
+ password?: string;
17
+ clientId?: string;
18
+ sharedSecret?: string;
19
+ }
20
+
21
+ export interface IImportOptions {
22
+ sourceAlias?: string;
23
+ sourceProjectId?: string;
24
+ }
25
+
26
+ export type OutputOptionsConstructorArg = OutputOptions &
27
+ IConnectOptions &
28
+ IImportOptions;
29
+
30
+ export interface ContensisCliConstructor {
31
+ new (
32
+ args: string[],
33
+ outputOpts?: OutputOptionsConstructorArg,
34
+ contensisOpts?: Partial<MigrateRequest>
35
+ ): ContensisCli;
36
+ }
@@ -0,0 +1,5 @@
1
+ export type EnvContentsToAdd = {
2
+ ALIAS: string;
3
+ PROJECT: string;
4
+ ACCESS_TOKEN?: string;
5
+ }
@@ -1 +1,2 @@
1
+ declare module 'giturl';
1
2
  declare module 'inquirer-command-prompt';
@@ -10,6 +10,7 @@ interface Remarks {
10
10
 
11
11
  class CredentialProvider {
12
12
  private serviceId: string;
13
+ private keytar!: typeof keytar;
13
14
  private userId: string = '';
14
15
  private passwordFallback?: string;
15
16
 
@@ -29,36 +30,61 @@ class CredentialProvider {
29
30
  this.passwordFallback = passwordFallback;
30
31
  }
31
32
 
33
+ Import = async () => {
34
+ try {
35
+ this.keytar = (await import('keytar')).default;
36
+ } catch (ex) {
37
+ this.keytar = {
38
+ findCredentials: async () => {
39
+ throw ex;
40
+ },
41
+ getPassword: async () => {
42
+ throw ex;
43
+ },
44
+ findPassword: async () => {
45
+ throw ex;
46
+ },
47
+ setPassword: async () => {
48
+ throw ex;
49
+ },
50
+ deletePassword: async () => {
51
+ throw ex;
52
+ },
53
+ };
54
+ }
55
+ };
56
+
32
57
  Init = async (): Promise<[Error, CredentialProvider]> => {
58
+ await this.Import();
59
+
33
60
  const [err, stored] = (await to(
34
- keytar.findCredentials(this.serviceId)
35
- )) as [
36
- Error,
37
- {
38
- account: string;
39
- password: string;
40
- }[]
41
- ];
61
+ this.keytar.getPassword(this.serviceId, this.userId)
62
+ )) as [Error, string];
63
+
42
64
  if (err && this.passwordFallback) {
43
- this.current = { account: this.userId, password: this.passwordFallback };
44
- // this.remarks = { secure: false };
65
+ this.current = {
66
+ account: this.userId,
67
+ password: this.passwordFallback,
68
+ };
45
69
  }
46
70
  if (!err) {
47
71
  this.remarks = { secure: true };
48
- this.current =
49
- stored?.find(
50
- u => u?.account?.toLowerCase() === this.userId.toLowerCase()
51
- ) || null;
72
+ if (stored) this.current = { account: this.userId, password: stored };
73
+
74
+ if (!this.current && this.passwordFallback) {
75
+ await this.Save(this.passwordFallback);
76
+ return await this.Init();
77
+ }
52
78
  }
53
79
  return [err, this];
54
80
  };
55
81
 
56
82
  Save = async (password: string) => {
57
83
  const [err] = await to(
58
- keytar.setPassword(this.serviceId, this.userId, password)
84
+ this.keytar.setPassword(this.serviceId, this.userId, password)
59
85
  );
60
86
 
61
- if (!err) Logger.info(`${this.serviceId} - credentials saved`);
87
+ // if (!err) Logger.info(`${this.serviceId} - credentials saved`);
62
88
  return err && !this.passwordFallback ? err : true;
63
89
  };
64
90
 
@@ -68,10 +94,17 @@ class CredentialProvider {
68
94
  return true;
69
95
  } else {
70
96
  const [err] = await to(
71
- keytar.deletePassword(this.serviceId, this.userId)
97
+ this.keytar.deletePassword(this.serviceId, this.userId)
72
98
  );
73
99
 
74
- Logger.warning(`${this.serviceId} - invalid credentials removed`);
100
+ if (err)
101
+ Logger.warning(
102
+ `${this.serviceId} - could not remove invalid credentials for ${this.userId}`
103
+ );
104
+ else
105
+ Logger.warning(
106
+ `${this.serviceId} - invalid credentials removed for ${this.userId}`
107
+ );
75
108
  return err || true;
76
109
  }
77
110
  };
@@ -3,7 +3,8 @@ import path from 'path';
3
3
  import clone from 'lodash/cloneDeep';
4
4
  import mergeWith from 'lodash/mergeWith';
5
5
  import unionBy from 'lodash/unionBy';
6
- import { isJson, tryParse, tryStringify } from '~/util';
6
+ import { appRootDir } from './file-provider';
7
+ import { isJson, tryParse } from '~/util';
7
8
  import { Logger } from '~/util/logger';
8
9
 
9
10
  class SessionCacheProvider {
@@ -11,7 +12,7 @@ class SessionCacheProvider {
11
12
  private cache = {} as SessionCache;
12
13
 
13
14
  constructor() {
14
- this.localFilePath = path.join(__dirname, '../../environments.json');
15
+ this.localFilePath = path.join(appRootDir, 'environments.json');
15
16
  this.cache = {
16
17
  currentTimestamp: new Date().toISOString(),
17
18
  environments: {},
@@ -69,6 +70,32 @@ class SessionCacheProvider {
69
70
  }
70
71
  return this.Get();
71
72
  };
73
+
74
+ UpdateEnv = (
75
+ updateContent: Partial<EnvironmentCache>,
76
+ env = this.cache.currentEnvironment,
77
+ setCurrentEnv = true
78
+ ) => {
79
+ try {
80
+ const environment = this.cache.environments[env || ''];
81
+
82
+ this.cache.environments[env || ''] = {
83
+ ...environment,
84
+ ...updateContent,
85
+ };
86
+ this.Update({
87
+ currentEnvironment: setCurrentEnv ? env : this.cache.currentEnvironment,
88
+ environments: this.cache.environments,
89
+ });
90
+ } catch (ex: any) {
91
+ // Problem merging cache data for update
92
+ Logger.error(
93
+ `Problem updating environment "${env}" in environments.json`
94
+ );
95
+ Logger.error(ex);
96
+ }
97
+ return this.Get();
98
+ };
72
99
  }
73
100
 
74
101
  export default SessionCacheProvider;
@@ -1,8 +1,15 @@
1
1
  import fs from 'fs';
2
+ import { homedir } from 'os';
2
3
  import path from 'path';
3
- import { path as appRoot } from 'app-root-path';
4
4
  import { tryParse } from '~/util';
5
5
 
6
+ const userHomeDir = homedir();
7
+
8
+ export const appRootDir =
9
+ process.env.CONTAINER_CONTEXT === 'true'
10
+ ? process.cwd()
11
+ : path.join(userHomeDir, '.contensis/');
12
+
6
13
  export const readJsonFile = <T>(filePath: string) => {
7
14
  const file = readFile(filePath);
8
15
  if (file) return tryParse(file) as T | string;
@@ -18,14 +25,17 @@ export const readFile = (filePath: string) => {
18
25
  }
19
26
  };
20
27
 
21
- export const readFiles = (directory: string) => {
28
+ export const readFiles = (directory: string, createDirectory = true) => {
22
29
  const directoryPath = localPath(directory);
23
30
  if (fs.existsSync(directoryPath)) {
24
31
  const files = fs.readdirSync(directoryPath);
25
32
  return files;
26
- } else {
33
+ } else if (createDirectory) {
27
34
  fs.mkdirSync(directoryPath, { recursive: true });
28
35
  return [];
36
+ } else {
37
+ throw new Error(`ENOENT: Directory does not exist ${directoryPath}`);
38
+ // return undefined;
29
39
  }
30
40
  };
31
41
 
@@ -42,8 +52,8 @@ export const removeFile = (filePath: string) => {
42
52
  };
43
53
 
44
54
  export const moveFile = (file: string, fromPath: string, toPath: string) => {
45
- const from = path.join(appRoot, `${fromPath}${file}`);
46
- const to = path.join(appRoot, `${toPath}${file}`);
55
+ const from = path.join(appRootDir, `${fromPath}${file}`);
56
+ const to = path.join(appRootDir, `${toPath}${file}`);
47
57
  if (fs.existsSync(from)) {
48
58
  checkDir(toPath);
49
59
  // if (!fs.existsSync(toPath)) fs.mkdirSync(toPath, { recursive: true });
@@ -69,4 +79,5 @@ export const checkDir = (filePath: string) => {
69
79
  fs.mkdirSync(directoryPath, { recursive: true });
70
80
  };
71
81
 
72
- export const localPath = (filePath: string) => path.join(appRoot, filePath);
82
+ export const localPath = (filePath: string) =>
83
+ path.isAbsolute(filePath) ? filePath : path.join(appRootDir, filePath);