@10stars/config 11.0.4 → 11.0.6

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
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "name": "@10stars/config",
7
- "version": "11.0.4",
7
+ "version": "11.0.6",
8
8
  "author": "10stars.dev <web@alexandrov.co> (https://alexandrov.co)",
9
9
  "license": "MIT",
10
10
  "bin": {
package/src/index.ts CHANGED
@@ -21,9 +21,9 @@ const getConfig = async (): Promise<Config> =>
21
21
  )
22
22
  })
23
23
 
24
- const getESLintPaths = async () => {
24
+ const getESLintCommonCmd = async () => {
25
25
  const isMonorepo = await checkIsMonorepo(cwd)
26
- return isMonorepo ? `*/src */*.ts` : `src *.ts`
26
+ return `--ext .ts,.tsx --no-error-on-unmatched-pattern ${isMonorepo ? `*/src */*.ts` : `src *.ts`}`
27
27
  }
28
28
 
29
29
  const typecheck = () => exec("tsc --project ./tsconfig.json --watch --noEmit")
@@ -62,13 +62,11 @@ const actions = {
62
62
  },
63
63
  lint: {
64
64
  info: "Lint code (in watch mode)",
65
- action: async () =>
66
- exec(`esw --watch --ext .ts,.tsx ${await getESLintPaths()}`),
65
+ action: async () => exec(`esw --watch ${await getESLintCommonCmd()}`),
67
66
  },
68
67
  lintOnce: {
69
68
  info: "Lint code (once)",
70
- action: async () =>
71
- exec(`eslint --fix --ext .ts,.tsx ${await getESLintPaths()}`),
69
+ action: async () => exec(`eslint --fix ${await getESLintCommonCmd()}`),
72
70
  },
73
71
  } satisfies Record<string, { info: string; action: () => void | Promise<void> }>
74
72
 
@@ -41,35 +41,35 @@ export const linkPackages = async (cwd: string, packagesToLink: string[]) => {
41
41
  const promises: Promise<unknown>[] = []
42
42
  for (const relativePath of packagesToLink) {
43
43
  const pathPkg = path.join(cwd, relativePath)
44
- const promise = checkIsMonorepo(pathPkg).then(async (isMonorepo) => {
45
- if (!isMonorepo) return linkPackage(pathPkg)
46
-
47
- const files = await fs
48
- .readdir(relativePath, { withFileTypes: true })
49
- .catch(() => null)
50
- if (!files) return
51
-
52
- const directories = files
53
- .filter((v) => v.isDirectory())
54
- .map((v) => v.name)
55
- const packages = (
56
- await Promise.all(
57
- directories.map(async (v) => {
58
- const pathPkg = path.join(cwd, relativePath, v)
59
- const pkgJson: TF.PackageJson = await import(
60
- path.join(pathPkg, `package.json`)
61
- ).catch(() => null)
62
- if (pkgJson) return v
63
- }),
64
- )
65
- ).filter(Boolean)
66
- for (const pkg of packages) {
67
- const relativePathToPkg = path.join(cwd, relativePath, pkg!)
68
- promises.push(linkPackage(relativePathToPkg))
69
- }
70
- })
71
-
72
- promises.push(promise)
44
+ checkIsMonorepo(pathPkg)
45
+ .catch(() => null) // relative path might point to a non-existing directory for a particular developer; skip linking a particular package in that case
46
+ .then(async (isMonorepo) => {
47
+ if (!isMonorepo) return promises.push(linkPackage(pathPkg))
48
+
49
+ const files = await fs
50
+ .readdir(relativePath, { withFileTypes: true })
51
+ .catch(() => null)
52
+ if (!files) return
53
+
54
+ const directories = files
55
+ .filter((v) => v.isDirectory())
56
+ .map((v) => v.name)
57
+ const packages = (
58
+ await Promise.all(
59
+ directories.map(async (v) => {
60
+ const pathPkg = path.join(cwd, relativePath, v)
61
+ const pkgJson: TF.PackageJson = await import(
62
+ path.join(pathPkg, `package.json`)
63
+ ).catch(() => null)
64
+ if (pkgJson) return v
65
+ }),
66
+ )
67
+ ).filter(Boolean)
68
+ for (const pkg of packages) {
69
+ const relativePathToPkg = path.join(cwd, relativePath, pkg!)
70
+ promises.push(linkPackage(relativePathToPkg))
71
+ }
72
+ })
73
73
  }
74
74
 
75
75
  await Promise.all(promises)