@stackbit/dev 0.0.10 → 0.0.11
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.
|
@@ -5,15 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.watchDir = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
10
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
9
11
|
function watchDir(dir, onFileChange, throttleDelay = 1000) {
|
|
12
|
+
const fullDir = path_1.default.resolve(process.cwd(), dir);
|
|
13
|
+
logger_1.default.debug('Watch dir for changes: ' + fullDir);
|
|
10
14
|
const watcher = chokidar_1.default.watch('.', {
|
|
11
|
-
cwd:
|
|
12
|
-
ignored: (filePath) =>
|
|
13
|
-
filePath.includes(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
cwd: fullDir,
|
|
16
|
+
ignored: (filePath) => {
|
|
17
|
+
return (filePath.includes(`/.git/`) ||
|
|
18
|
+
filePath.includes(`/.next/`) ||
|
|
19
|
+
filePath.includes(`/.cache/`) ||
|
|
20
|
+
filePath.includes(`/node_modules/`) ||
|
|
21
|
+
(filePath.includes(`/.`) && !filePath.includes(`/.stackbit/`)));
|
|
22
|
+
},
|
|
17
23
|
persistent: true,
|
|
18
24
|
ignoreInitial: true
|
|
19
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../../src/services/file-watcher.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,wDAAgC;
|
|
1
|
+
{"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../../src/services/file-watcher.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,gDAAwB;AAC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CAAC,CAAC;IACF,OAAO;SACF,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC;SAC3B,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9B,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9B,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9B,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC;AACnB,CAAC;AAtCD,4BAsCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackbit/dev",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "stackbit-dev",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"author": "Stackbit Inc.",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@stackbit/cms-core": "^0.0.
|
|
26
|
-
"@stackbit/dev-common": "^0.0.
|
|
25
|
+
"@stackbit/cms-core": "^0.0.8",
|
|
26
|
+
"@stackbit/dev-common": "^0.0.11",
|
|
27
27
|
"@stackbit/sdk": "^0.2.22",
|
|
28
28
|
"axios": "^0.25.0",
|
|
29
29
|
"chalk": "^4.1.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"ts-jest": "^27.1.3",
|
|
55
55
|
"typescript": "^4.5.4"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "1dbb4af4333d2250548fe97eb03867e3cbd27785"
|
|
58
58
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import path from 'path';
|
|
2
3
|
import chokidar from 'chokidar';
|
|
4
|
+
import logger from './logger';
|
|
3
5
|
|
|
4
6
|
export function watchDir(dir: string, onFileChange: (filePaths: string[]) => void, throttleDelay = 1000) {
|
|
7
|
+
const fullDir = path.resolve(process.cwd(), dir);
|
|
8
|
+
logger.debug('Watch dir for changes: ' + fullDir);
|
|
5
9
|
const watcher = chokidar.watch('.', {
|
|
6
|
-
cwd:
|
|
7
|
-
ignored: (filePath) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
cwd: fullDir,
|
|
11
|
+
ignored: (filePath) => {
|
|
12
|
+
return (
|
|
13
|
+
filePath.includes(`/.git/`) ||
|
|
14
|
+
filePath.includes(`/.next/`) ||
|
|
15
|
+
filePath.includes(`/.cache/`) ||
|
|
16
|
+
filePath.includes(`/node_modules/`) ||
|
|
17
|
+
(filePath.includes(`/.`) && !filePath.includes(`/.stackbit/`))
|
|
18
|
+
);
|
|
19
|
+
},
|
|
13
20
|
persistent: true,
|
|
14
21
|
ignoreInitial: true
|
|
15
22
|
});
|