@bigbinary/neeto-commons-frontend 4.13.60 → 4.13.61

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.
@@ -1,6 +1,6 @@
1
- const fs = require("fs");
2
1
  const path = require("path");
3
2
 
3
+ const globby = require("globby");
4
4
  const copy = require("rollup-plugin-copy");
5
5
 
6
6
  const emitReadyFile = destination => ({
@@ -15,51 +15,46 @@ const emitReadyFile = destination => ({
15
15
  },
16
16
  });
17
17
 
18
- const watchTranslations = currentDir => ({
18
+ const watchPaths = customWatchPaths => ({
19
19
  name: "watch-translations",
20
- buildStart() {
21
- const possiblePaths = [
22
- path.resolve(currentDir, "app/javascript/src/translations"),
23
- path.resolve(currentDir, "src/translations"),
24
- ];
20
+ async buildStart() {
21
+ const paths = await globby([
22
+ "src/translations",
23
+ "app/javascript/src/translations",
24
+ "types/**/*",
25
+ "*.d.ts",
26
+ ...customWatchPaths,
27
+ ]);
25
28
 
26
- const translationsPath = possiblePaths.find(fs.existsSync);
27
-
28
- if (translationsPath) {
29
- this.addWatchFile(translationsPath);
30
- }
29
+ paths.forEach(p => this.addWatchFile(p));
31
30
  },
32
31
  });
33
32
 
34
- const copyFiles = (destination, customCopyPaths) => {
35
- const targets = [
36
- { src: "package.json", dest: destination },
37
- { src: "*.d.ts", dest: destination },
38
- { src: "types/", dest: destination },
39
- { src: "LICENSE.md", dest: destination },
40
- { src: "src/translations", dest: path.join(destination, "src") },
41
- {
42
- src: "app/javascript/src/translations",
43
- dest: path.join(destination, "app/javascript/src"),
44
- },
45
- ...customCopyPaths.map(p => ({
46
- src: p.src,
47
- dest: path.join(destination, p.dest),
48
- })),
49
- ];
50
-
51
- const safeTargets = targets.filter(t => {
52
- try {
53
- return fs.existsSync(t.src);
54
- } catch {
55
- return false;
56
- }
33
+ const copyFiles = (destination, customCopyPaths) =>
34
+ copy({
35
+ targets: [
36
+ { src: "package.json", dest: destination },
37
+ { src: "*.d.ts", dest: destination },
38
+ { src: "types/", dest: destination },
39
+ { src: "LICENSE.md", dest: destination },
40
+ { src: "src/translations", dest: path.join(destination, "src") },
41
+ {
42
+ src: "app/javascript/src/translations",
43
+ dest: path.join(destination, "app/javascript/src"),
44
+ },
45
+ ...customCopyPaths.map(p => ({
46
+ src: p.src,
47
+ dest: path.join(destination, p.dest),
48
+ })),
49
+ ],
57
50
  });
58
51
 
59
- return copy({ targets: safeTargets });
60
- };
61
-
62
- const buildWatchConfig = ({ currentDir, args, customCopyPaths = [] }) => {
52
+ const buildWatchConfig = ({
53
+ currentDir,
54
+ args,
55
+ customCopyPaths = [],
56
+ customWatchPaths = [],
57
+ }) => {
63
58
  if (!args.app) return { watchPlugins: [], appPath: null };
64
59
 
65
60
  const packageJson = require(path.resolve(currentDir, "package.json"));
@@ -72,7 +67,7 @@ const buildWatchConfig = ({ currentDir, args, customCopyPaths = [] }) => {
72
67
  );
73
68
 
74
69
  const plugins = [
75
- watchTranslations(currentDir),
70
+ watchPaths(customWatchPaths),
76
71
  copyFiles(appPath, customCopyPaths),
77
72
  emitReadyFile(appPath),
78
73
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "4.13.60",
3
+ "version": "4.13.61",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -167,6 +167,7 @@
167
167
  "framer-motion": "11.11.11",
168
168
  "glob": "^10.3.10",
169
169
  "globals": "^16.0.0",
170
+ "globby": "^14.1.0",
170
171
  "husky": "7.0.4",
171
172
  "i18next": "22.5.1",
172
173
  "i18next-browser-languagedetector": "^7.1.0",