@rife/cli 0.0.6-beta.15 → 0.0.6-beta.17

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 (57) hide show
  1. package/dist/cjs/index.cjs +9 -0
  2. package/dist/cjs/plugin/commander.cjs +5 -5
  3. package/dist/cjs/plugin/config.cjs +4 -4
  4. package/dist/cjs/plugin/package.cjs +2 -2
  5. package/dist/cjs/plugin/release.cjs +16 -16
  6. package/dist/cjs/runner.cjs +5 -5
  7. package/dist/cjs/sync.cjs +1 -1
  8. package/dist/cjs/util.cjs +13 -3
  9. package/dist/cli.js +22 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/esm/index.mjs +1 -0
  12. package/dist/esm/plugin/commander.mjs +5 -5
  13. package/dist/esm/plugin/config.mjs +4 -4
  14. package/dist/esm/plugin/package.mjs +2 -2
  15. package/dist/esm/plugin/release.mjs +16 -16
  16. package/dist/esm/runner.mjs +5 -5
  17. package/dist/esm/sync.mjs +1 -1
  18. package/dist/esm/util.mjs +5 -2
  19. package/dist/index.js +10 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/logger.js +18 -0
  22. package/dist/logger.js.map +1 -0
  23. package/dist/plugin/commander.js +47 -0
  24. package/dist/plugin/commander.js.map +1 -0
  25. package/dist/plugin/compiler/compiler.js +166 -0
  26. package/dist/plugin/compiler/compiler.js.map +1 -0
  27. package/dist/plugin/compiler/index.js +87 -0
  28. package/dist/plugin/compiler/index.js.map +1 -0
  29. package/dist/plugin/compiler/swc.js +48 -0
  30. package/dist/plugin/compiler/swc.js.map +1 -0
  31. package/dist/plugin/compiler/tsc.js +75 -0
  32. package/dist/plugin/compiler/tsc.js.map +1 -0
  33. package/dist/plugin/config.js +77 -0
  34. package/dist/plugin/config.js.map +1 -0
  35. package/dist/plugin/index.js +9 -0
  36. package/dist/plugin/index.js.map +1 -0
  37. package/dist/plugin/package.js +32 -0
  38. package/dist/plugin/package.js.map +1 -0
  39. package/dist/plugin/release.js +102 -0
  40. package/dist/plugin/release.js.map +1 -0
  41. package/dist/runner.js +82 -0
  42. package/dist/runner.js.map +1 -0
  43. package/dist/sync.js +60 -0
  44. package/dist/sync.js.map +1 -0
  45. package/dist/tsconfig.tsbuildinfo +1 -0
  46. package/dist/util.js +14 -0
  47. package/dist/util.js.map +1 -0
  48. package/package.json +9 -9
  49. package/src/cli.ts +23 -23
  50. package/src/index.ts +4 -3
  51. package/src/logger.ts +17 -17
  52. package/src/plugin/commander.ts +49 -49
  53. package/src/plugin/config.ts +78 -78
  54. package/src/plugin/release.ts +113 -113
  55. package/src/runner.ts +132 -132
  56. package/src/sync.ts +63 -63
  57. package/src/util.ts +14 -9
package/src/sync.ts CHANGED
@@ -1,63 +1,63 @@
1
- async function sync(name: string) {
2
- const res = await fetch(`https://registry-direct.npmmirror.com/-/package/${name}/syncs`, {
3
- headers: {
4
- accept: '*/*',
5
- 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
6
- 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
7
- 'sec-ch-ua-mobile': '?0',
8
- 'sec-ch-ua-platform': '"Windows"',
9
- 'sec-fetch-dest': 'empty',
10
- 'sec-fetch-mode': 'cors',
11
- 'sec-fetch-site': 'same-site',
12
- Referer: 'https://npmmirror.com/',
13
- 'Referrer-Policy': 'strict-origin-when-cross-origin',
14
- },
15
- body: null,
16
- method: 'PUT',
17
- });
18
- const body = await res.json();
19
- if (body.ok === true) {
20
- console.log(`同步 ${name} 成功`);
21
- }
22
- return body;
23
- }
24
-
25
- const list = [
26
- '@rife/config', //
27
- '@rife/cli', //
28
- // '@rife/infra',
29
- // '@rife/logger',
30
- // '@rife/react',
31
- // '@rife/next',
32
- // '@rife/nest',
33
- // '@rife/plugin-deploy',
34
- // '@rife/fast',
35
- ];
36
-
37
- async function main() {
38
- for (const item of list) {
39
- // https://registry.npmmirror.com/-/package/@rife/infra/syncs/65a255a2afa293666acf6655/log
40
- await sync(item);
41
- }
42
-
43
- poll();
44
- }
45
-
46
- main();
47
-
48
- async function get(name: string) {
49
- try {
50
- const res = await fetch(`https://r.cnpmjs.org/${name}?t=${Date.now()}&cache=0`);
51
- const data = await res.json();
52
- return `${name} ${data?.['dist-tags']?.['latest']}`;
53
- } catch (e) {
54
- return `${name} error`;
55
- }
56
- }
57
-
58
- async function poll() {
59
- const res = await Promise.all(list.map(get));
60
- console.log(`${res.join('\n')}\n`);
61
-
62
- setTimeout(poll, 1000);
63
- }
1
+ async function sync(name: string) {
2
+ const res = await fetch(`https://registry-direct.npmmirror.com/-/package/${name}/syncs`, {
3
+ headers: {
4
+ accept: '*/*',
5
+ 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
6
+ 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
7
+ 'sec-ch-ua-mobile': '?0',
8
+ 'sec-ch-ua-platform': '"Windows"',
9
+ 'sec-fetch-dest': 'empty',
10
+ 'sec-fetch-mode': 'cors',
11
+ 'sec-fetch-site': 'same-site',
12
+ Referer: 'https://npmmirror.com/',
13
+ 'Referrer-Policy': 'strict-origin-when-cross-origin',
14
+ },
15
+ body: null,
16
+ method: 'PUT',
17
+ });
18
+ const body = await res.json();
19
+ if (body.ok === true) {
20
+ console.log(`同步 ${name} 成功`);
21
+ }
22
+ return body;
23
+ }
24
+
25
+ const list = [
26
+ '@rife/config', //
27
+ '@rife/cli', //
28
+ // '@rife/infra',
29
+ // '@rife/logger',
30
+ // '@rife/react',
31
+ // '@rife/next',
32
+ // '@rife/nest',
33
+ // '@rife/plugin-deploy',
34
+ // '@rife/fast',
35
+ ];
36
+
37
+ async function main() {
38
+ for (const item of list) {
39
+ // https://registry.npmmirror.com/-/package/@rife/infra/syncs/65a255a2afa293666acf6655/log
40
+ await sync(item);
41
+ }
42
+
43
+ poll();
44
+ }
45
+
46
+ main();
47
+
48
+ async function get(name: string) {
49
+ try {
50
+ const res = await fetch(`https://r.cnpmjs.org/${name}?t=${Date.now()}&cache=0`);
51
+ const data = await res.json();
52
+ return `${name} ${data?.['dist-tags']?.['latest']}`;
53
+ } catch (e) {
54
+ return `${name} error`;
55
+ }
56
+ }
57
+
58
+ async function poll() {
59
+ const res = await Promise.all(list.map(get));
60
+ console.log(`${res.join('\n')}\n`);
61
+
62
+ setTimeout(poll, 1000);
63
+ }
package/src/util.ts CHANGED
@@ -1,9 +1,14 @@
1
- import fs from 'fs-extra';
2
- import * as glob from 'glob';
3
-
4
- export { fs, glob };
5
-
6
- export const getDuration = (perfStart: number) => {
7
- const duration = ((performance.now() - perfStart) / 1000).toFixed(3);
8
- return `耗时 ${duration} s`;
9
- };
1
+ import { fileURLToPath } from 'node:url';
2
+ import path from 'path';
3
+
4
+ import fs from 'fs-extra';
5
+ import * as glob from 'glob';
6
+
7
+ export { fs, glob };
8
+
9
+ export const getDuration = (perfStart: number) => {
10
+ const duration = ((performance.now() - perfStart) / 1000).toFixed(3);
11
+ return `耗时 ${duration} s`;
12
+ };
13
+
14
+ export const resolve = (...args: string[]) => path.resolve(path.dirname(fileURLToPath(import.meta.url)), ...args);