@giteeteam/apps-cli 0.2.3 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +19 -21
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
31
31
  var child_process__default = /*#__PURE__*/_interopDefaultLegacy(child_process);
32
32
  var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar);
33
33
 
34
- var version = "0.2.3";
34
+ var version = "0.2.4";
35
35
 
36
36
  const packageApp = async ({ outputDir, manifest, copyFiles }) => {
37
37
  const { resources } = manifest;
@@ -420,26 +420,24 @@ const watchFiles = async (options) => {
420
420
  const { inputDir, outputDir } = options;
421
421
  const manifest = await getManifest();
422
422
  const functionFiles = manifest.getFunctionFiles();
423
- for (const fileName of functionFiles) {
424
- appsBundler.bundle({
425
- inputDir,
426
- outputDir,
427
- fileName,
428
- mode: appsBundler.MODE.DEV,
429
- });
430
- const filePath = path__default["default"].join(inputDir, `${fileName}.ts`);
431
- console.log(`watch file path: ${filePath}`);
432
- const watcher = chokidar__default["default"].watch(filePath);
433
- watcher.on('change', () => {
434
- console.log(`File ${filePath} has been changed`);
435
- appsBundler.bundle({
436
- inputDir,
437
- outputDir,
438
- fileName,
439
- mode: appsBundler.MODE.DEV,
440
- });
441
- });
442
- }
423
+ let timer;
424
+ // 监听整个文件夹,有一个文件改动,则全部重新build
425
+ // TODO 解析出文件之间的依赖关系,提升构建速度
426
+ const watcher = chokidar__default["default"].watch(inputDir);
427
+ watcher.on('change', () => {
428
+ clearTimeout(timer);
429
+ timer = setTimeout(() => {
430
+ console.log(`build ${inputDir}`);
431
+ for (const fileName of functionFiles) {
432
+ appsBundler.bundle({
433
+ inputDir,
434
+ outputDir,
435
+ fileName,
436
+ mode: appsBundler.MODE.DEV,
437
+ });
438
+ }
439
+ }, 1000);
440
+ });
443
441
  };
444
442
 
445
443
  var _a, _b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Giteeteam Apps cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -58,5 +58,6 @@
58
58
  "@types/fs-extra": "^9.0.13",
59
59
  "@types/inquirer": "^8.2.1",
60
60
  "@types/uuid": "^8.3.4"
61
- }
61
+ },
62
+ "gitHead": "8f986a59969dc6e5902a17b1d608b2f27d46b559"
62
63
  }