@xjs_cocos/cocos-tool 1.0.0

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.
@@ -0,0 +1,8 @@
1
+ import { Component, Node, Vec3 } from 'cc';
2
+ export default class MyCustomComponent extends Component {
3
+ targetNode: Node | null;
4
+ start(): void;
5
+ moveToPosition(pos: Vec3): void;
6
+ }
7
+ export declare function add(a: number, b: number): number;
8
+ export { MyCustomComponent };
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Component, _decorator, Node } from 'cc';
8
+ const { ccclass, property } = _decorator;
9
+ let MyCustomComponent = class MyCustomComponent extends Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.targetNode = null;
13
+ }
14
+ start() {
15
+ console.log('MyCustomComponent 已启动!');
16
+ }
17
+ moveToPosition(pos) {
18
+ if (this.targetNode) {
19
+ this.targetNode.position = pos;
20
+ }
21
+ }
22
+ };
23
+ __decorate([
24
+ property(Node)
25
+ ], MyCustomComponent.prototype, "targetNode", void 0);
26
+ MyCustomComponent = __decorate([
27
+ ccclass('MyCustomComponent')
28
+ ], MyCustomComponent);
29
+ export default MyCustomComponent;
30
+ // 导出工具函数示例
31
+ export function add(a, b) {
32
+ return a + b;
33
+ }
34
+ export { MyCustomComponent };
@@ -0,0 +1,8 @@
1
+ import { Component, Node, Vec3 } from 'cc';
2
+ export default class MyCustomComponent extends Component {
3
+ targetNode: Node | null;
4
+ start(): void;
5
+ moveToPosition(pos: Vec3): void;
6
+ }
7
+ export declare function add(a: number, b: number): number;
8
+ export { MyCustomComponent };
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Component, _decorator, Node } from 'cc';
8
+ const { ccclass, property } = _decorator;
9
+ let MyCustomComponent = class MyCustomComponent extends Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.targetNode = null;
13
+ }
14
+ start() {
15
+ console.log('MyCustomComponent 已启动!');
16
+ }
17
+ moveToPosition(pos) {
18
+ if (this.targetNode) {
19
+ this.targetNode.position = pos;
20
+ }
21
+ }
22
+ };
23
+ __decorate([
24
+ property(Node)
25
+ ], MyCustomComponent.prototype, "targetNode", void 0);
26
+ MyCustomComponent = __decorate([
27
+ ccclass('MyCustomComponent')
28
+ ], MyCustomComponent);
29
+ export default MyCustomComponent;
30
+ // 导出工具函数示例
31
+ export function add(a, b) {
32
+ return a + b;
33
+ }
34
+ export { MyCustomComponent };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ //清理旧的构建文件 rm -rf dist
3
+ // # 修改代码后
4
+ // npm run build
5
+ // # 升级版本(推荐方式)
6
+ // npm version patch # 1.0.0 → 1.0.1
7
+ // # 或 npm version minor # 1.0.0 → 1.1.0
8
+ // # 或 npm version major # 1.0.0 → 2.0.0
9
+ // npm publish --access public
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@xjs_cocos/cocos-tool",
3
+ "version": "1.0.0",
4
+ "description": "Cocos Creator 3.8.6 可复用组件库",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": ["dist"],
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "build:watch": "tsc -w"
11
+ },
12
+ "peerDependencies": {
13
+ "cc": "^3.8.6"
14
+ },
15
+ "devDependencies": {
16
+ "@cocos/creator-types": "^3.8.6",
17
+ "typescript": "^5.0.0"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ }
22
+ }