@giteeteam/apps-cli 0.2.2 → 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.
- package/dist/index.js +23 -22
- package/package.json +2 -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.
|
|
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
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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;
|
|
@@ -449,7 +447,8 @@ const image = {
|
|
|
449
447
|
};
|
|
450
448
|
const containerPort = Number((_b = process.env.CONTAINER_PORT) !== null && _b !== void 0 ? _b : 8455);
|
|
451
449
|
const containerName = 'cli-dev-apps-runtime-server';
|
|
452
|
-
const
|
|
450
|
+
const tempApp = '/app/production/1.0';
|
|
451
|
+
const tempAppDir = `${tempApp}/server-side`;
|
|
453
452
|
const containerEnv = {
|
|
454
453
|
PORT: containerPort,
|
|
455
454
|
APPS_DIR: '/usr/src/app/apps',
|
|
@@ -488,6 +487,8 @@ var run = async (options) => {
|
|
|
488
487
|
});
|
|
489
488
|
await copyManifest(appDir);
|
|
490
489
|
await watchFiles({ inputDir, outputDir: appDir });
|
|
490
|
+
console.log('You can use this url for test:');
|
|
491
|
+
console.log(`POST http://localhost:${containerPort}/v1/apps${tempApp}/functions/:key`);
|
|
491
492
|
};
|
|
492
493
|
|
|
493
494
|
var dev = async (options) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giteeteam/apps-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Giteeteam Apps cli",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"@types/inquirer": "^8.2.1",
|
|
60
60
|
"@types/uuid": "^8.3.4"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "8f986a59969dc6e5902a17b1d608b2f27d46b559"
|
|
63
63
|
}
|