@bigbinary/neeto-audit-frontend 2.1.3 → 2.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-audit-frontend",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Audits neeto frontend codebase for issues and suggests a fix.",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@bigbinary/neeto-cist": "1.0.8",
26
26
  "@bigbinary/neeto-commons-frontend": "3.1.10",
27
- "axios": "1.7.4",
27
+ "axios": "1.8.2",
28
28
  "chalk": "5.3.0",
29
29
  "commander": "11.1.0",
30
30
  "ora": "8.0.1",
@@ -16,3 +16,10 @@ export const NANO_TYPE_MAP = {
16
16
  editor: "frontend",
17
17
  molecules: "frontend",
18
18
  };
19
+
20
+ export const REMOTE_URL_PREFIXES = [
21
+ "git@github.com:bigbinary/",
22
+ "github.com/bigbinary/",
23
+ "git@github.com:neetozone/",
24
+ "github.com/neetozone/",
25
+ ];
@@ -10,7 +10,11 @@ import { identity, last, split } from "ramda";
10
10
  import { simpleGit } from "simple-git";
11
11
  import util from "util";
12
12
 
13
- import { NANO_TYPE_MAP, PACKAGE_JSON_PATH } from "../constants";
13
+ import {
14
+ NANO_TYPE_MAP,
15
+ PACKAGE_JSON_PATH,
16
+ REMOTE_URL_PREFIXES,
17
+ } from "../constants";
14
18
 
15
19
  const run = util.promisify(exec);
16
20
 
@@ -81,7 +85,7 @@ export const getCliOptions = () => {
81
85
 
82
86
  export const getFileContent = async ({
83
87
  relativeFilePath = "",
84
- debug = false
88
+ debug = false,
85
89
  }) => {
86
90
  const resolvedFilePath = path.resolve(relativeFilePath);
87
91
 
@@ -97,7 +101,7 @@ export const createOrReplaceFile = async ({
97
101
  relativeFilePath = "",
98
102
  content = "",
99
103
  debug = false,
100
- options = {}
104
+ options = {},
101
105
  }) => {
102
106
  const resolvedFilePath = path.resolve(relativeFilePath);
103
107
 
@@ -105,7 +109,7 @@ export const createOrReplaceFile = async ({
105
109
  return await writeFile(resolvedFilePath, content, {
106
110
  encoding: "utf8",
107
111
  flag: "w",
108
- ...options
112
+ ...options,
109
113
  });
110
114
  } catch (error) {
111
115
  debug && console.error(error);
@@ -116,7 +120,7 @@ export const createOrReplaceFile = async ({
116
120
  export const identicalFiles = async ({
117
121
  sourceFile = "",
118
122
  destinationFile = "",
119
- debug = false
123
+ debug = false,
120
124
  }) => {
121
125
  try {
122
126
  const sourceFileContent = await readFile(sourceFile);
@@ -134,7 +138,7 @@ export const identicalFiles = async ({
134
138
  export const identicalDirectoryFiles = async ({
135
139
  sourceDirectory,
136
140
  destinationDirectory,
137
- debug
141
+ debug,
138
142
  }) => {
139
143
  try {
140
144
  const files = await promises.readdir(sourceDirectory);
@@ -149,14 +153,14 @@ export const identicalDirectoryFiles = async ({
149
153
  return await identicalFiles({
150
154
  sourceFile,
151
155
  destinationFile,
152
- debug
156
+ debug,
153
157
  });
154
158
  } else {
155
159
  await mkdir(destinationFile, { recursive: true });
156
160
  const identicalFiles = await identicalDirectoryFiles({
157
161
  sourceDirectory: sourceFile,
158
162
  destinationDirectory: destinationFile,
159
- debug
163
+ debug,
160
164
  });
161
165
 
162
166
  const results = await Promise.all(identicalFiles);
@@ -176,7 +180,7 @@ export const createOrReplaceDirectoryFiles = async ({
176
180
  sourceDirectory,
177
181
  destinationDirectory,
178
182
  debug,
179
- options
183
+ options,
180
184
  }) => {
181
185
  try {
182
186
  const files = await promises.readdir(sourceDirectory);
@@ -190,14 +194,14 @@ export const createOrReplaceDirectoryFiles = async ({
190
194
  if (isFile) {
191
195
  const content = await getFileContent({
192
196
  relativeFilePath: sourcePath,
193
- debug
197
+ debug,
194
198
  });
195
199
 
196
200
  await createOrReplaceFile({
197
201
  relativeFilePath: destinationPath,
198
202
  content,
199
203
  debug,
200
- options
204
+ options,
201
205
  });
202
206
  } else {
203
207
  await mkdir(destinationPath, { recursive: true });
@@ -205,7 +209,7 @@ export const createOrReplaceDirectoryFiles = async ({
205
209
  sourceDirectory: sourcePath,
206
210
  destinationDirectory: destinationPath,
207
211
  debug,
208
- options
212
+ options,
209
213
  });
210
214
  }
211
215
  });
@@ -250,22 +254,20 @@ export const getNanoType = async () => {
250
254
  const git = simpleGit();
251
255
  const { value: remoteOriginUrl } = await git.getConfig("remote.origin.url");
252
256
 
253
- const projectGitName =
254
- remoteOriginUrl.split("git@github.com:bigbinary/").at(1) ||
255
- remoteOriginUrl.split("github.com/bigbinary/").at(1);
256
-
257
+ const prefix = REMOTE_URL_PREFIXES.find((p) => remoteOriginUrl.includes(p));
258
+ const projectGitName = remoteOriginUrl.split(prefix).at(1);
257
259
  const projectName = projectGitName.split(".git").at(0);
258
260
 
259
261
  return {
260
262
  type: NANO_TYPE_MAP[last(split("-", projectName))],
261
- repoName: projectName
263
+ repoName: projectName,
262
264
  };
263
265
  };
264
266
 
265
267
  export const getPackageJson = async (debug) => {
266
268
  const packageJsonContent = await getFileContent({
267
269
  relativeFilePath: PACKAGE_JSON_PATH,
268
- debug
270
+ debug,
269
271
  });
270
272
 
271
273
  return JSON.parse(packageJsonContent);
@@ -1,2 +0,0 @@
1
- * @Thejus-Paul
2
- * @ajmaln
@@ -1 +0,0 @@
1
- module.exports = require("@bigbinary/neeto-commons-frontend/configs/nanos/eslint/index.js");
@@ -1,10 +0,0 @@
1
- const { mergeDeepLeft } = require("ramda");
2
- const defaultConfiguration = require("@bigbinary/neeto-commons-frontend/configs/nanos/eslint/index.js");
3
-
4
- module.exports = mergeDeepLeft(
5
- {
6
- globals: { chrome: "readonly" },
7
- rules: { "@bigbinary/neeto/use-webpack-alias": "off" },
8
- },
9
- defaultConfiguration
10
- );
@@ -1 +0,0 @@
1
- module.exports = require("@bigbinary/neeto-commons-frontend/configs/nanos/eslint/index.js");
@@ -1,9 +0,0 @@
1
- const defaultConfigurations = require("@bigbinary/neeto-commons-frontend/configs/nanos/eslint/index.js");
2
- const { mergeDeepLeft } = require("ramda");
3
-
4
- module.exports = mergeDeepLeft(
5
- {
6
- rules: { "@bigbinary/neeto/file-name-and-export-name-standards": "off" },
7
- },
8
- defaultConfigurations
9
- );