@rife/cli 0.0.6-beta.11 → 0.0.6-beta.12

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 (66) hide show
  1. package/dist/cjs/cli.cjs +25 -0
  2. package/dist/cjs/index.cjs +110 -0
  3. package/dist/cjs/logger.cjs +46 -0
  4. package/dist/cjs/plugin/commander.cjs +66 -0
  5. package/dist/cjs/plugin/compiler/compiler.cjs +207 -0
  6. package/dist/cjs/plugin/compiler/index.cjs +126 -0
  7. package/dist/cjs/plugin/compiler/swc.cjs +107 -0
  8. package/dist/cjs/plugin/compiler/tsc.cjs +115 -0
  9. package/dist/cjs/plugin/config.cjs +107 -0
  10. package/dist/cjs/plugin/index.cjs +96 -0
  11. package/dist/cjs/plugin/package.cjs +71 -0
  12. package/dist/cjs/plugin/release.cjs +129 -0
  13. package/dist/cjs/runner.cjs +137 -0
  14. package/dist/{sync.js → cjs/sync.cjs} +12 -23
  15. package/dist/cjs/util.cjs +57 -0
  16. package/dist/{1.mjs → esm/cli.mjs} +4 -3
  17. package/dist/esm/index.mjs +8 -0
  18. package/dist/esm/logger.mjs +14 -0
  19. package/dist/esm/plugin/commander.mjs +34 -0
  20. package/dist/esm/plugin/compiler/compiler.mjs +160 -0
  21. package/dist/esm/plugin/compiler/index.mjs +94 -0
  22. package/dist/esm/plugin/compiler/swc.mjs +75 -0
  23. package/dist/esm/plugin/compiler/tsc.mjs +73 -0
  24. package/dist/esm/plugin/config.mjs +65 -0
  25. package/dist/esm/plugin/index.mjs +7 -0
  26. package/dist/{plugin/package.js → esm/plugin/package.mjs} +11 -14
  27. package/dist/{plugin/release.js → esm/plugin/release.mjs} +33 -38
  28. package/dist/esm/runner.mjs +92 -0
  29. package/dist/esm/sync.mjs +46 -0
  30. package/dist/esm/util.mjs +9 -0
  31. package/package.json +12 -6
  32. package/dist/1.js +0 -24
  33. package/dist/cjs/1.js +0 -24
  34. package/dist/cli.js +0 -22
  35. package/dist/cli.js.map +0 -1
  36. package/dist/esm/1.mjs +0 -20
  37. package/dist/index.js +0 -11
  38. package/dist/index.js.map +0 -1
  39. package/dist/logger.js +0 -18
  40. package/dist/logger.js.map +0 -1
  41. package/dist/plugin/commander.js +0 -47
  42. package/dist/plugin/commander.js.map +0 -1
  43. package/dist/plugin/compiler/compiler.js +0 -166
  44. package/dist/plugin/compiler/compiler.js.map +0 -1
  45. package/dist/plugin/compiler/index.js +0 -88
  46. package/dist/plugin/compiler/index.js.map +0 -1
  47. package/dist/plugin/compiler/swc.js +0 -48
  48. package/dist/plugin/compiler/swc.js.map +0 -1
  49. package/dist/plugin/compiler/swc2.js +0 -65
  50. package/dist/plugin/compiler/swc2.js.map +0 -1
  51. package/dist/plugin/compiler/tsc.js +0 -75
  52. package/dist/plugin/compiler/tsc.js.map +0 -1
  53. package/dist/plugin/config.js +0 -77
  54. package/dist/plugin/config.js.map +0 -1
  55. package/dist/plugin/index.js +0 -9
  56. package/dist/plugin/index.js.map +0 -1
  57. package/dist/plugin/package copy.js +0 -32
  58. package/dist/plugin/package copy.js.map +0 -1
  59. package/dist/plugin/package.js.map +0 -1
  60. package/dist/plugin/release.js.map +0 -1
  61. package/dist/runner.js +0 -81
  62. package/dist/runner.js.map +0 -1
  63. package/dist/sync.js.map +0 -1
  64. package/dist/tsconfig.tsbuildinfo +0 -1
  65. package/dist/util.js +0 -14
  66. package/dist/util.js.map +0 -1
@@ -0,0 +1,73 @@
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE_typescript__ from "typescript";
4
+ import external_path_default from "path";
5
+ var __webpack_modules__ = {
6
+ typescript: function(module) {
7
+ module.exports = __WEBPACK_EXTERNAL_MODULE_typescript__;
8
+ }
9
+ };
10
+ var __webpack_module_cache__ = {};
11
+ function __webpack_require__(moduleId) {
12
+ var cachedModule = __webpack_module_cache__[moduleId];
13
+ if (void 0 !== cachedModule) return cachedModule.exports;
14
+ var module = __webpack_module_cache__[moduleId] = {
15
+ exports: {}
16
+ };
17
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
18
+ return module.exports;
19
+ }
20
+ function tsc(config) {
21
+ const ts = __webpack_require__("typescript");
22
+ const rootDir = config.rootDir || '.';
23
+ const formatHost = {
24
+ getCanonicalFileName: (path)=>path,
25
+ getCurrentDirectory: ts.sys.getCurrentDirectory,
26
+ getNewLine: ()=>ts.sys.newLine
27
+ };
28
+ function reportDiagnostic(diagnostic) {
29
+ config.onReportDiagnostic?.({
30
+ diagnostic
31
+ });
32
+ }
33
+ function reportWatchStatusChanged(diagnostic) {
34
+ const message = `${ts.formatDiagnostic(diagnostic, formatHost)}`.trimEnd();
35
+ let status = '';
36
+ if (message.includes('message TS6031: Starting compilation in watch mode')) status = 'startWatch';
37
+ else if (message.includes('message TS6032: File change detected')) status = 'reCompile';
38
+ else if (message.includes('Found 0 errors')) status = 'success';
39
+ else if (/Found \d+ error/.test(message)) status = 'error';
40
+ config.onWatchStatusChanged?.({
41
+ status,
42
+ message
43
+ });
44
+ }
45
+ const configPath = ts.findConfigFile(rootDir, ts.sys.fileExists, 'tsconfig.json');
46
+ if (!configPath) throw new Error("\u627E\u4E0D\u5230tsconfig.json");
47
+ const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
48
+ if (config.watch) {
49
+ const host = ts.createWatchCompilerHost(configPath, {
50
+ ...config.options,
51
+ outDir: config.outDir,
52
+ noEmit: false,
53
+ incremental: true
54
+ }, ts.sys, createProgram, reportDiagnostic, reportWatchStatusChanged);
55
+ ts.createWatchProgram(host);
56
+ } else {
57
+ const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
58
+ const compilerOptions = ts.parseJsonConfigFileContent(configFile.config, ts.sys, external_path_default.dirname(configPath), {
59
+ ...config.options,
60
+ outDir: config.outDir,
61
+ noEmit: false,
62
+ incremental: false
63
+ });
64
+ const host = ts.createCompilerHost(compilerOptions.options);
65
+ const program = ts.createProgram(compilerOptions.fileNames, compilerOptions.options, host);
66
+ const emitResult = program.emit();
67
+ const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
68
+ config.onEmitDiagnostics?.({
69
+ diagnostics
70
+ });
71
+ }
72
+ }
73
+ export { tsc };
@@ -0,0 +1,65 @@
1
+ import __rslib_shim_module__ from 'module';
2
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
+ import external_path_default from "path";
4
+ function pluginConfig() {
5
+ const plugin = {
6
+ name: pluginConfig.name,
7
+ apply: (runner)=>{
8
+ const { logger, hook, config, command, fs, z } = runner;
9
+ const log = logger.withTag(pluginConfig.name);
10
+ hook.loadConfig.tapPromise(pluginConfig.name, async ()=>{
11
+ let filePath = '';
12
+ const mjs = 'app.mjs';
13
+ const fileNames = [
14
+ 'app.js',
15
+ 'app.cjs',
16
+ mjs
17
+ ];
18
+ let isEsm = false;
19
+ for (const fileName of fileNames)if (await fs.exists(fileName)) {
20
+ filePath = external_path_default.posix.resolve(fileName);
21
+ isEsm = fileName === mjs;
22
+ break;
23
+ }
24
+ log.debug("filePath %s", filePath);
25
+ if (!filePath) {
26
+ log.error(`\u{627E}\u{4E0D}\u{5230}\u{914D}\u{7F6E}\u{6587}\u{4EF6} app.(c|m)?js`);
27
+ process.exit(1);
28
+ }
29
+ let all = [];
30
+ all = isEsm ? (await import(filePath)).default : require(filePath);
31
+ runner.config.all = all;
32
+ });
33
+ hook.validateConfig.tapPromise(pluginConfig.name, async ()=>{
34
+ const validation = z.array(z.object({
35
+ name: z.string().trim().min(1)
36
+ })).min(1).safeParse(config.all);
37
+ if (!validation.success) {
38
+ log.error(validation.error.message);
39
+ process.exit(1);
40
+ }
41
+ });
42
+ hook.applyConfig.tapPromise(pluginConfig.name, async ()=>{
43
+ const result = z.object({
44
+ name: z.string().trim().default('')
45
+ }).default({}).safeParse(command.opts());
46
+ const name = result.data?.name;
47
+ if (name) {
48
+ log.debug(`\u{6307}\u{5B9A} --name ${name}`);
49
+ const find = config.all.find((t)=>t.name === name);
50
+ if (!find) {
51
+ log.error(`\u{672A}\u{627E}\u{5230} name '%s'`, name);
52
+ process.exit(1);
53
+ }
54
+ config.current = find;
55
+ } else {
56
+ log.debug("\u6CA1\u6709\u6307\u5B9A --name\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u5217\u8868\u7B2C\u4E00\u4E2A");
57
+ config.current = config.all[0];
58
+ }
59
+ config.current.plugins.forEach((plugin)=>plugin.apply(runner));
60
+ });
61
+ }
62
+ };
63
+ return plugin;
64
+ }
65
+ export { pluginConfig };
@@ -0,0 +1,7 @@
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ export * from "./config.mjs";
4
+ export * from "./package.mjs";
5
+ export * from "./commander.mjs";
6
+ export * from "./compiler/index.mjs";
7
+ export * from "./release.mjs";
@@ -1,32 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pluginPackage = pluginPackage;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
1
+ import __rslib_shim_module__ from 'module';
2
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
+ import external_path_default from "path";
6
4
  function pluginPackage() {
7
5
  const plugin = {
8
6
  name: pluginPackage.name,
9
- apply: runner => {
7
+ apply: (runner)=>{
10
8
  const { logger, hook, fs } = runner;
11
9
  const log = logger.withTag(pluginPackage.name);
12
- hook.loadPackage.tapPromise(pluginPackage.name, async () => {
10
+ hook.loadPackage.tapPromise(pluginPackage.name, async ()=>{
13
11
  const fileName = 'package.json';
14
- const filePath = path_1.default.resolve(fileName);
12
+ const filePath = external_path_default.resolve(fileName);
15
13
  if (!fs.existsSync(filePath)) {
16
- log.error(`找不到文件 ${fileName}`);
14
+ log.error(`\u{627E}\u{4E0D}\u{5230}\u{6587}\u{4EF6} ${fileName}`);
17
15
  process.exit(1);
18
16
  }
19
17
  try {
20
18
  const data = require(filePath);
21
19
  runner.package = data;
22
- }
23
- catch (e) {
24
- log.error(`读取文件失败`, e.message);
20
+ } catch (e) {
21
+ log.error(`\u{8BFB}\u{53D6}\u{6587}\u{4EF6}\u{5931}\u{8D25}`, e.message);
25
22
  process.exit(1);
26
23
  }
27
24
  });
28
- },
25
+ }
29
26
  };
30
27
  return plugin;
31
28
  }
32
- //# sourceMappingURL=package.js.map
29
+ export { pluginPackage };
@@ -1,78 +1,73 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pluginRelease = pluginRelease;
4
- const child_process_1 = require("child_process");
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { execSync } from "child_process";
5
4
  function pluginRelease() {
6
5
  const plugin = {
7
6
  name: pluginRelease.name,
8
- apply: runner => {
7
+ apply: (runner)=>{
9
8
  const { logger, hook, fs } = runner;
10
9
  const log = logger.withTag(pluginRelease.name);
11
- hook.release.tapPromise(pluginRelease.name, async () => {
10
+ hook.release.tapPromise(pluginRelease.name, async ()=>{
12
11
  runner.clear();
13
12
  await hook.build.promise();
14
- log.start('开始发布');
13
+ log.start("\u5F00\u59CB\u53D1\u5E03");
15
14
  const packageVersion = runner.package.version;
16
15
  const packageName = runner.package.name;
17
16
  const url = `https://registry.npmjs.org/${packageName}`;
18
17
  let nextVersion = packageVersion;
19
- log.debug(`查询版本号 ${packageVersion} 是否存在`);
18
+ log.debug(`\u{67E5}\u{8BE2}\u{7248}\u{672C}\u{53F7} ${packageVersion} \u{662F}\u{5426}\u{5B58}\u{5728}`);
20
19
  const res = await (await fetch(url)).json();
21
20
  const exist = res?.versions?.[packageVersion];
22
21
  if (exist) {
23
22
  const split = packageVersion.split('.');
24
23
  split[split.length - 1] = Number(split[split.length - 1]) + 1;
25
24
  nextVersion = split.join('.');
26
- log.debug(`版本号 ${packageVersion} 存在,更新版本号为 ${nextVersion}`);
25
+ log.debug(`\u{7248}\u{672C}\u{53F7} ${packageVersion} \u{5B58}\u{5728}\u{FF0C}\u{66F4}\u{65B0}\u{7248}\u{672C}\u{53F7}\u{4E3A} ${nextVersion}`);
27
26
  const text = fs.readFileSync('./package.json').toString();
28
27
  const nextText = text.replace(new RegExp(`"version":\\s*"${packageVersion}"`), `"version": "${nextVersion}"`);
29
28
  fs.writeFileSync('./package.json', nextText);
30
29
  }
31
- log.debug(`版本号 ${packageVersion} 不存在`);
32
- log.info(`版本号为 ${nextVersion}`);
33
- const tempDir = `./node_modules/.rife/release/`;
34
- log.info(`清空目录 ${tempDir}`);
30
+ log.debug(`\u{7248}\u{672C}\u{53F7} ${packageVersion} \u{4E0D}\u{5B58}\u{5728}`);
31
+ log.info(`\u{7248}\u{672C}\u{53F7}\u{4E3A} ${nextVersion}`);
32
+ const tempDir = "./node_modules/.rife/release/";
33
+ log.info(`\u{6E05}\u{7A7A}\u{76EE}\u{5F55} ${tempDir}`);
35
34
  fs.emptyDirSync(tempDir);
36
35
  const pack = `pnpm pack --pack-destination ${tempDir} --json`;
37
- log.info(`打包文件 ${pack}`);
38
- const packOutput = JSON.parse((0, child_process_1.execSync)(pack).toString());
36
+ log.info(`\u{6253}\u{5305}\u{6587}\u{4EF6} ${pack}`);
37
+ const packOutput = JSON.parse(execSync(pack).toString());
39
38
  const filename = packOutput.filename;
40
- for (const item of packOutput.files) {
41
- log.debug(item.path);
42
- }
39
+ for (const item of packOutput.files)log.debug(item.path);
43
40
  const debug = false;
44
41
  const publish = `pnpm publish ${filename} --registry https://registry.npmjs.org --no-git-checks ${debug ? '--dry-run' : ''}`;
45
- log.info(`发布文件 ${publish}`);
46
- (0, child_process_1.execSync)(publish, { stdio: 'inherit' });
47
- log.success(`发布成功,${runner.duration}`);
48
- log.info('同步版本');
42
+ log.info(`\u{53D1}\u{5E03}\u{6587}\u{4EF6} ${publish}`);
43
+ execSync(publish, {
44
+ stdio: 'inherit'
45
+ });
46
+ log.success(`\u{53D1}\u{5E03}\u{6210}\u{529F}\u{FF0C}${runner.duration}`);
47
+ log.info("\u540C\u6B65\u7248\u672C");
49
48
  let hasSync = false;
50
- while (true) {
49
+ while(true){
51
50
  const res = await queryVersion(packageName);
52
51
  const nextManifest = res?.versions?.[nextVersion];
53
52
  const exist = Boolean(nextManifest);
54
53
  const latest = res?.['dist-tags']?.latest;
55
54
  if (exist) {
56
- log.debug(`同步版本存在`);
55
+ log.debug(`\u{540C}\u{6B65}\u{7248}\u{672C}\u{5B58}\u{5728}`);
57
56
  break;
58
57
  }
59
- log.info(`检查版本 ${nextVersion} 不存在,最新版本为 ${latest}`);
58
+ log.info(`\u{68C0}\u{67E5}\u{7248}\u{672C} ${nextVersion} \u{4E0D}\u{5B58}\u{5728}\u{FF0C}\u{6700}\u{65B0}\u{7248}\u{672C}\u{4E3A} ${latest}`);
60
59
  if (!hasSync) {
61
60
  hasSync = true;
62
- log.start(`开始同步`);
61
+ log.start(`\u{5F00}\u{59CB}\u{540C}\u{6B65}`);
63
62
  const sync = await syncVersion(packageName);
64
- if (sync.ok === true) {
65
- log.info(`调用同步接口成功,日志 https://registry.npmmirror.com/-/package/${packageName}/syncs/${sync.id}/log`);
66
- }
67
- else {
68
- log.debug(`调用同步接口失败,%j`, sync);
69
- }
63
+ if (true === sync.ok) log.info(`\u{8C03}\u{7528}\u{540C}\u{6B65}\u{63A5}\u{53E3}\u{6210}\u{529F}\u{FF0C}\u{65E5}\u{5FD7} https://registry.npmmirror.com/-/package/${packageName}/syncs/${sync.id}/log`);
64
+ else log.debug(`\u{8C03}\u{7528}\u{540C}\u{6B65}\u{63A5}\u{53E3}\u{5931}\u{8D25}\u{FF0C}%j`, sync);
70
65
  }
71
- await new Promise(resolve => setTimeout(resolve, 2000));
66
+ await new Promise((resolve)=>setTimeout(resolve, 2000));
72
67
  }
73
- log.success(`同步成功,${runner.duration}`);
68
+ log.success(`\u{540C}\u{6B65}\u{6210}\u{529F}\u{FF0C}${runner.duration}`);
74
69
  });
75
- },
70
+ }
76
71
  };
77
72
  return plugin;
78
73
  }
@@ -92,11 +87,11 @@ async function syncVersion(packageName) {
92
87
  'sec-fetch-mode': 'cors',
93
88
  'sec-fetch-site': 'same-site',
94
89
  Referer: 'https://npmmirror.com/',
95
- 'Referrer-Policy': 'strict-origin-when-cross-origin',
90
+ 'Referrer-Policy': 'strict-origin-when-cross-origin'
96
91
  },
97
92
  body: null,
98
- method: 'PUT',
93
+ method: 'PUT'
99
94
  })).json();
100
95
  return sync;
101
96
  }
102
- //# sourceMappingURL=release.js.map
97
+ export { pluginRelease };
@@ -0,0 +1,92 @@
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE_commander__ from "commander";
4
+ import { colors } from "consola/utils";
5
+ import { AsyncSeriesHook } from "tapable";
6
+ import external_zod_default from "zod";
7
+ import { createLogger } from "./logger.mjs";
8
+ import { fs, glob } from "./util.mjs";
9
+ var __webpack_modules__ = {
10
+ commander: function(module) {
11
+ module.exports = __WEBPACK_EXTERNAL_MODULE_commander__;
12
+ }
13
+ };
14
+ var __webpack_module_cache__ = {};
15
+ function __webpack_require__(moduleId) {
16
+ var cachedModule = __webpack_module_cache__[moduleId];
17
+ if (void 0 !== cachedModule) return cachedModule.exports;
18
+ var module = __webpack_module_cache__[moduleId] = {
19
+ exports: {}
20
+ };
21
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
22
+ return module.exports;
23
+ }
24
+ if (void 0 === Promise.withResolvers) Promise.withResolvers = ()=>{
25
+ let resolve;
26
+ let reject;
27
+ const promise = new Promise((res, rej)=>{
28
+ resolve = res;
29
+ reject = rej;
30
+ });
31
+ return {
32
+ promise,
33
+ resolve: resolve,
34
+ reject: reject
35
+ };
36
+ };
37
+ function createRunner() {
38
+ const perfStart = performance.now();
39
+ const { Command } = __webpack_require__("commander");
40
+ const command = new Command();
41
+ command.option('--debug', "\u6253\u5F00\u8C03\u8BD5\u65E5\u5FD7");
42
+ command.option('-n, --name <string>', "\u6267\u884C\u6307\u5B9A\u914D\u7F6E");
43
+ command.option('-h, --help', "\u5E2E\u52A9");
44
+ command.parse();
45
+ const args = external_zod_default.object({
46
+ debug: external_zod_default.boolean().default(false)
47
+ }).default({}).safeParse(command.opts());
48
+ const runner = {
49
+ env: 'prod',
50
+ hook: {
51
+ loadPackage: new AsyncSeriesHook([]),
52
+ loadConfig: new AsyncSeriesHook([]),
53
+ validateConfig: new AsyncSeriesHook([]),
54
+ applyConfig: new AsyncSeriesHook([]),
55
+ validatePlugin: new AsyncSeriesHook([]),
56
+ registerCommand: new AsyncSeriesHook([]),
57
+ startCommand: new AsyncSeriesHook([]),
58
+ finishCommand: new AsyncSeriesHook([]),
59
+ dev: new AsyncSeriesHook([]),
60
+ build: new AsyncSeriesHook([]),
61
+ test: new AsyncSeriesHook([]),
62
+ release: new AsyncSeriesHook([]),
63
+ deploy: new AsyncSeriesHook([]),
64
+ lint: new AsyncSeriesHook([])
65
+ },
66
+ logger: createLogger(args.data),
67
+ command,
68
+ config: {
69
+ all: [],
70
+ current: void 0
71
+ },
72
+ package: {},
73
+ z: external_zod_default,
74
+ fs: fs,
75
+ glob: glob.glob,
76
+ get duration () {
77
+ const duration = ((performance.now() - perfStart) / 1000).toFixed(3);
78
+ return `\u{8017}\u{65F6} ${duration} s`;
79
+ },
80
+ tempDir: './node_modules/.temp/',
81
+ clear: ()=>{
82
+ console.clear();
83
+ process.stdout.write('\x1b[3J');
84
+ console.log(`${colors.bgBlue(" \u9879\u76EE\u540D\u79F0 ")} ${runner.package.name} \n`);
85
+ }
86
+ };
87
+ return runner;
88
+ }
89
+ function defineConfig(all) {
90
+ return all;
91
+ }
92
+ export { createRunner, defineConfig };
@@ -0,0 +1,46 @@
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ async function sync(name) {
4
+ const res = await fetch(`https://registry-direct.npmmirror.com/-/package/${name}/syncs`, {
5
+ headers: {
6
+ accept: '*/*',
7
+ 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
8
+ 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
9
+ 'sec-ch-ua-mobile': '?0',
10
+ 'sec-ch-ua-platform': '"Windows"',
11
+ 'sec-fetch-dest': 'empty',
12
+ 'sec-fetch-mode': 'cors',
13
+ 'sec-fetch-site': 'same-site',
14
+ Referer: 'https://npmmirror.com/',
15
+ 'Referrer-Policy': 'strict-origin-when-cross-origin'
16
+ },
17
+ body: null,
18
+ method: 'PUT'
19
+ });
20
+ const body = await res.json();
21
+ if (true === body.ok) console.log(`\u{540C}\u{6B65} ${name} \u{6210}\u{529F}`);
22
+ return body;
23
+ }
24
+ const list = [
25
+ '@rife/config',
26
+ '@rife/cli'
27
+ ];
28
+ async function main() {
29
+ for (const item of list)await sync(item);
30
+ poll();
31
+ }
32
+ main();
33
+ async function get(name) {
34
+ try {
35
+ const res = await fetch(`https://r.cnpmjs.org/${name}?t=${Date.now()}&cache=0`);
36
+ const data = await res.json();
37
+ return `${name} ${data?.['dist-tags']?.['latest']}`;
38
+ } catch (e) {
39
+ return `${name} error`;
40
+ }
41
+ }
42
+ async function poll() {
43
+ const res = await Promise.all(list.map(get));
44
+ console.log(`${res.join('\n')}\n`);
45
+ setTimeout(poll, 1000);
46
+ }
@@ -0,0 +1,9 @@
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import external_fs_extra_default from "fs-extra";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_glob__ from "glob";
5
+ const getDuration = (perfStart)=>{
6
+ const duration = ((performance.now() - perfStart) / 1000).toFixed(3);
7
+ return `\u{8017}\u{65F6} ${duration} s`;
8
+ };
9
+ export { external_fs_extra_default as fs, getDuration, __WEBPACK_EXTERNAL_MODULE_glob__ as glob };
package/package.json CHANGED
@@ -1,11 +1,17 @@
1
1
  {
2
2
  "name": "@rife/cli",
3
- "version": "0.0.6-beta.11",
3
+ "version": "0.0.6-beta.12",
4
4
  "description": "",
5
- "main": "./dist/index.js",
6
- "types": "./src/index.ts",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "require": "./dist/cjs/index.cjs",
9
+ "import": "./dist/esm/index.mjs",
10
+ "types": "./src/index.ts"
11
+ }
12
+ },
7
13
  "bin": {
8
- "rife": "./dist/cli.js"
14
+ "rife": "./dist/esm/cli.mjs"
9
15
  },
10
16
  "files": [
11
17
  "dist/**/*",
@@ -46,8 +52,8 @@
46
52
  }
47
53
  },
48
54
  "scripts": {
49
- "dev": "tsc --watch",
50
- "build": "tsc",
55
+ "dev": "rslib build --watch",
56
+ "build": "rslib build",
51
57
  "test": "vitest",
52
58
  "release": "pnpm publish --registry https://registry.npmjs.org --no-git-checks",
53
59
  "lint": "eslint"
package/dist/1.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _plugin = require("./plugin");
6
- const _release = require("./plugin/release");
7
- const _runner = require("./runner");
8
- const plugins = [
9
- (0, _plugin.pluginPackage)(),
10
- (0, _plugin.pluginConfig)(),
11
- (0, _plugin.pluginCommander)(),
12
- (0, _release.pluginRelease)()
13
- ];
14
- const runner = (0, _runner.createRunner)();
15
- plugins.forEach((plugin)=>plugin.apply(runner));
16
- (async ()=>{
17
- await runner.hook.loadPackage.promise();
18
- await runner.hook.loadConfig.promise();
19
- await runner.hook.validateConfig.promise();
20
- await runner.hook.applyConfig.promise();
21
- await runner.hook.validatePlugin.promise();
22
- await runner.hook.registerCommand.promise();
23
- await runner.hook.startCommand.promise();
24
- })();
package/dist/cjs/1.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _plugin = require("./plugin");
6
- const _release = require("./plugin/release");
7
- const _runner = require("./runner");
8
- const plugins = [
9
- (0, _plugin.pluginPackage)(),
10
- (0, _plugin.pluginConfig)(),
11
- (0, _plugin.pluginCommander)(),
12
- (0, _release.pluginRelease)()
13
- ];
14
- const runner = (0, _runner.createRunner)();
15
- plugins.forEach((plugin)=>plugin.apply(runner));
16
- (async ()=>{
17
- await runner.hook.loadPackage.promise();
18
- await runner.hook.loadConfig.promise();
19
- await runner.hook.validateConfig.promise();
20
- await runner.hook.applyConfig.promise();
21
- await runner.hook.validatePlugin.promise();
22
- await runner.hook.registerCommand.promise();
23
- await runner.hook.startCommand.promise();
24
- })();
package/dist/cli.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const plugin_1 = require("./plugin");
4
- const runner_1 = require("./runner");
5
- const plugins = [
6
- (0, plugin_1.pluginPackage)(), //
7
- (0, plugin_1.pluginConfig)(),
8
- (0, plugin_1.pluginCommander)(),
9
- (0, plugin_1.pluginRelease)(),
10
- ];
11
- const runner = (0, runner_1.createRunner)();
12
- plugins.forEach(plugin => plugin.apply(runner));
13
- (async () => {
14
- await runner.hook.loadPackage.promise();
15
- await runner.hook.loadConfig.promise();
16
- await runner.hook.validateConfig.promise();
17
- await runner.hook.applyConfig.promise();
18
- await runner.hook.validatePlugin.promise();
19
- await runner.hook.registerCommand.promise();
20
- await runner.hook.startCommand.promise();
21
- })();
22
- //# sourceMappingURL=cli.js.map
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAAA,qCAAuF;AACvF,qCAAgD;AAEhD,MAAM,OAAO,GAAa;IACtB,IAAA,sBAAa,GAAE,EAAE,EAAE;IACnB,IAAA,qBAAY,GAAE;IACd,IAAA,wBAAe,GAAE;IACjB,IAAA,sBAAa,GAAE;CAClB,CAAC;AAEF,MAAM,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAC;AAE9B,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhD,CAAC,KAAK,IAAI,EAAE;IACR,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACxC,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACvC,MAAM,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAC3C,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACxC,MAAM,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAC3C,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;IAC5C,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;AAC7C,CAAC,CAAC,EAAE,CAAC"}
package/dist/esm/1.mjs DELETED
@@ -1,20 +0,0 @@
1
- import { pluginCommander, pluginConfig, pluginPackage } from './plugin';
2
- import { pluginRelease } from './plugin/release';
3
- import { createRunner } from './runner';
4
- const plugins = [
5
- pluginPackage(),
6
- pluginConfig(),
7
- pluginCommander(),
8
- pluginRelease()
9
- ];
10
- const runner = createRunner();
11
- plugins.forEach((plugin)=>plugin.apply(runner));
12
- (async ()=>{
13
- await runner.hook.loadPackage.promise();
14
- await runner.hook.loadConfig.promise();
15
- await runner.hook.validateConfig.promise();
16
- await runner.hook.applyConfig.promise();
17
- await runner.hook.validatePlugin.promise();
18
- await runner.hook.registerCommand.promise();
19
- await runner.hook.startCommand.promise();
20
- })();
package/dist/index.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fs = void 0;
4
- const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./runner"), exports);
6
- tslib_1.__exportStar(require("./plugin"), exports);
7
- tslib_1.__exportStar(require("./logger"), exports);
8
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
9
- exports.fs = fs_extra_1.default;
10
- tslib_1.__exportStar(require("tapable"), exports);
11
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mDAAyB;AACzB,mDAAyB;AACzB,mDAAyB;AAQzB,gEAA0B;AAEjB,aAFF,kBAAE,CAEE;AAEX,kDAAwB"}
package/dist/logger.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLogger = createLogger;
4
- const consola_1 = require("consola");
5
- function createLogger(options) {
6
- const instance = (0, consola_1.createConsola)({
7
- level: options?.debug ? 4 : 3,
8
- // fancy: false,
9
- formatOptions: {
10
- // columns: 80,
11
- // colors: false,
12
- compact: false,
13
- date: false,
14
- },
15
- });
16
- return instance;
17
- }
18
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;AAEA,oCAaC;AAfD,qCAAwC;AAExC,SAAgB,YAAY,CAAC,OAA6B;IACtD,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC;QAC3B,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,gBAAgB;QAChB,aAAa,EAAE;YACX,eAAe;YACf,iBAAiB;YACjB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,KAAK;SACd;KACJ,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC"}