@qingtian/qtcli 1.0.2 → 1.0.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.
@@ -36,22 +36,29 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ /* eslint-disable @typescript-eslint/no-require-imports */
39
40
  /* eslint-disable no-async-promise-executor */
40
41
  // import babelDir from '@babel/cli/lib/babel/dir';
41
- var babelDir = require('@babel/cli/lib/babel/dir');
42
- var _a = require('../../utils/childProcess'), execPromise = _a.execPromise, forkPromise = _a.forkPromise;
42
+ var childProcess_1 = require("../../utils/childProcess");
43
+ var babelDir = require('@babel/cli/lib/babel/dir').default;
44
+ // const { execPromise, forkPromise } = require('../../utils/childProcess.js');
43
45
  var path = require('path');
44
46
  var rimraf = require('rimraf').rimraf;
47
+ var fs = require('fs');
45
48
  exports.default = (function () {
46
49
  return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
47
- var rm, err_1;
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
50
+ var tsconfigPath, tsconfig, outDir, rm, err_1;
51
+ var _a;
52
+ return __generator(this, function (_b) {
53
+ switch (_b.label) {
50
54
  case 0:
51
- _a.trys.push([0, 2, , 3]);
55
+ _b.trys.push([0, 2, , 3]);
56
+ tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json');
57
+ tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf8'));
58
+ outDir = ((_a = tsconfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.outDir) || './dist';
52
59
  return [4 /*yield*/, rimraf.rimraf('lib', {})];
53
60
  case 1:
54
- rm = _a.sent();
61
+ rm = _b.sent();
55
62
  if (rm) {
56
63
  console.log('删除lib/成功');
57
64
  }
@@ -61,7 +68,7 @@ exports.default = (function () {
61
68
  babelDir({
62
69
  cliOptions: {
63
70
  filenames: ['src/'],
64
- outDir: 'lib/',
71
+ outDir: "".concat(outDir, "/lib/"),
65
72
  extensions: ['.ts', '.tsx', '.js', '.jsx'],
66
73
  copyFiles: true,
67
74
  },
@@ -107,18 +114,17 @@ exports.default = (function () {
107
114
  ],
108
115
  },
109
116
  });
110
- forkPromise('node_modules/.bin/tsc', ['--outDir', 'lib', '--declaration', '--emitDeclarationOnly', '--listEmittedFiles'], {
117
+ (0, childProcess_1.execPromise)("".concat(path.resolve(__dirname, '../../../node_modules/.bin/tsc'), " --outDir ").concat(outDir, "/lib --declaration --emitDeclarationOnly --listEmittedFiles"), {
111
118
  cwd: path.resolve(process.cwd(), './'),
112
119
  }).then(function () {
113
- console.log('生成.d.ts完成');
114
- execPromise('cp src/global.d.ts lib/');
120
+ // execPromise(`cp src/global.d.ts ${outDir}/lib/`);
115
121
  resolve(true);
116
122
  }, function (err) {
117
123
  reject(err);
118
124
  });
119
125
  return [3 /*break*/, 3];
120
126
  case 2:
121
- err_1 = _a.sent();
127
+ err_1 = _b.sent();
122
128
  reject(err_1);
123
129
  return [3 /*break*/, 3];
124
130
  case 3: return [2 /*return*/];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingtian/qtcli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "QTCli是一款基于node的前端工程化底座",
5
5
  "homepage": "https://gitee.com/fengrengame/qtnode#readme",
6
6
  "bugs": {
@@ -39,7 +39,6 @@
39
39
  "lint": "eslint .",
40
40
  "lint:fix": "eslint --fix .",
41
41
  "prepare": "husky install",
42
- "prepublishOnly": "npm run build",
43
42
  "start": "node --max-old-space-size=8192 ./node_modules/.bin/ts-node ./bin/cli.ts"
44
43
  },
45
44
  "commitlint": {
@@ -198,4 +197,4 @@
198
197
  "jest-watch-typeahead": "^1.0.0"
199
198
  },
200
199
  "email": "296963166@qq.com"
201
- }
200
+ }
package/dist/src/App.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var react_1 = __importDefault(require("react"));
7
- var App = function () {
8
- return react_1.default.createElement('div', null, react_1.default.createElement('h1', null, 'Hello from JSX2!'), react_1.default.createElement('p', null, 'This is a test component'));
9
- };
10
- exports.default = App;
package/dist/src/index.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var jsx_runtime_1 = require("react/jsx-runtime");
7
- var react_1 = __importDefault(require("react"));
8
- var client_1 = require("react-dom/client");
9
- var App_1 = __importDefault(require("./App"));
10
- require("./CompanyType1.scss");
11
- // 创建根节点
12
- var container = document.getElementById('root');
13
- var root = (0, client_1.createRoot)(container);
14
- // 渲染函数
15
- var render = function () {
16
- root.render((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(App_1.default, {}) }));
17
- };
18
- // 初始渲染
19
- render();
20
- // 热更新处理
21
- if (module.hot) {
22
- module.hot.accept('./CompanyType1.scss', function () {
23
- console.log('Styles updated');
24
- });
25
- module.hot.accept('./App', function () {
26
- console.log('App updated');
27
- requestAnimationFrame(render);
28
- });
29
- }