esa-cli 1.0.2-beta.1 → 1.0.3-beta.1

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,10 +1,8 @@
1
- import worker from '$userPath';
2
1
  import Cache from './mock/cache.js';
3
2
  import mockKV from './mock/kv.js';
3
+ import worker from '$userPath';
4
4
 
5
- var mock_cache = new Cache($userPort);
6
- globalThis.mockCache = mock_cache;
5
+ Cache.port = $userPort;
7
6
  mockKV.port = $userPort;
8
- globalThis.mockKV = mockKV;
9
7
 
10
8
  export default worker;
@@ -1,7 +1,7 @@
1
1
  class MockCache {
2
- constructor(port) {
3
- this.port = port;
4
- }
2
+ static port = 0;
3
+
4
+ constructor() {}
5
5
 
6
6
  async put(reqOrUrl, response) {
7
7
  if (arguments.length < 2) {
@@ -30,7 +30,7 @@ class MockCache {
30
30
 
31
31
  const key = this.normalizeKey(reqOrUrl);
32
32
  const fetchRes = await fetch(
33
- `http://localhost:${this.port}/mock_cache/put`,
33
+ `http://localhost:${MockCache.port}/mock_cache/put`,
34
34
  {
35
35
  method: 'POST',
36
36
  headers: { 'Content-Type': 'application/json' },
@@ -58,7 +58,7 @@ class MockCache {
58
58
  async get(reqOrUrl) {
59
59
  const key = this.normalizeKey(reqOrUrl);
60
60
  const fetchRes = await fetch(
61
- `http://localhost:${this.port}/mock_cache/get`,
61
+ `http://localhost:${MockCache.port}/mock_cache/get`,
62
62
  {
63
63
  method: 'POST',
64
64
  headers: { 'Content-Type': 'application/json' },
@@ -85,7 +85,7 @@ class MockCache {
85
85
  async delete(reqOrUrl) {
86
86
  const key = this.normalizeKey(reqOrUrl);
87
87
  const fetchRes = await fetch(
88
- `http://localhost:${this.port}/mock_cache/delete`,
88
+ `http://localhost:${MockCache.port}/mock_cache/delete`,
89
89
  {
90
90
  method: 'POST',
91
91
  headers: { 'Content-Type': 'application/json' },
@@ -113,4 +113,7 @@ class MockCache {
113
113
  }
114
114
  }
115
115
 
116
+ var mock_cache = new MockCache();
117
+ globalThis.mockCache = mock_cache;
118
+
116
119
  export default MockCache;
@@ -163,4 +163,6 @@ class EdgeKV {
163
163
  }
164
164
  }
165
165
 
166
+ globalThis.mockKV = EdgeKV;
167
+
166
168
  export default EdgeKV;
@@ -17,8 +17,8 @@ import { isInstalledGit } from '../libs/git/index.js';
17
17
  import logger from '../libs/logger.js';
18
18
  import { getRoot } from '../utils/fileUtils/base.js';
19
19
  import { getCliConfig, projectConfigPath } from '../utils/fileUtils/index.js';
20
- import { getRoutineDetails } from './common/utils.js';
21
20
  import { validateCredentials } from '../utils/validateCredentials.js';
21
+ import { getRoutineDetails } from './common/utils.js';
22
22
  export const checkDirectory = (isCheckGit = false) => {
23
23
  const root = getRoot();
24
24
  if (fs.existsSync(projectConfigPath)) {
@@ -132,7 +132,7 @@ export const getAllSites = () => __awaiter(void 0, void 0, void 0, function* ()
132
132
  return res.map((site) => {
133
133
  return {
134
134
  label: site.SiteName,
135
- value: site.SiteId
135
+ value: site.SiteId.toString()
136
136
  };
137
137
  });
138
138
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esa-cli",
3
- "version": "1.0.2-beta.1",
3
+ "version": "1.0.3-beta.1",
4
4
  "description": "A CLI for operating Alibaba Cloud ESA Functions and Pages.",
5
5
  "main": "bin/enter.cjs",
6
6
  "type": "module",