Skip to content

Commit

Permalink
[Feature] Submit the definition files for version 3.8.1 (#1)
Browse files Browse the repository at this point in the history
* [Init] Submit the definition files for version 3.8.1

* review code

* review code

* review code
  • Loading branch information
VisualSJ authored Nov 1, 2023
1 parent 6338222 commit a179f2c
Show file tree
Hide file tree
Showing 852 changed files with 111,477 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''
---

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Additional context**

Add any other context about the problem here.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: 问题反馈
about: 创建报告以帮助我们改进
title: ''
labels: 'bug'
assignees: ''
---

**描述错误**

对 bug 的简要概述。

**复现**

再现行为的步骤:
1. 转到“…”
2. 单击“….”
3. 向下滚动至“….”
4. 参见错误

**预期行为**

对你期望发生的事情进行清晰且简要的概述。

**屏幕截图**

如果可以,请添加屏幕截图以帮助解释您的问题。

**桌面(请填写以下信息):**

- 操作系统:[例如iOS]
- 系统版本:[例如windows11]
- 浏览器:[例如chrome、safari]
- 浏览器版本:[例如100]

**附加上下文**

在此处添加有关该问题的任何其他上下文。
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Please do not remove the comments; make a copy when needed -->
## PR Type

- [ ] Bug fix
- [ ] Optimization
- [ ] New feature
- [ ] Test case

<!-- Provide a detailed description of the background and reasons for this change -->
## PR Description

<!-- Please describe what specific changes have been made and why -->
### Changes Made
1.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push: {}
merge_group:
pull_request:
types:
- opened
- synchronize
- ready_for_review
paths:
- 'source/**.ts'
- 'source/scripts/*.js'
- '.github/workfows/ci.yaml'

permissions:
contents: read

jobs:
check-tests:
runs-on: self-hosts
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Run CI
run: npm run ci
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 忽略操作系统生成的文件
.DS_Store
Thumbs.db

# 忽略 Node.js 生成的文件夹
node_modules/
npm-debug.log
yarn-error.log

# 忽略本地配置文件(例如,配置文件包含敏感信息)
config.js
.env

# 忽略依赖管理文件(可以用于避免冲突)
package-lock.json
yarn.lock

# 忽略构建输出和临时文件
dist/
build/
.tmp/
.cache/

# 忽略日志文件
logs/
*.log
npm-debug.log*

# 忽略测试结果
/test/*.js

# 忽略编辑器生成的文件
.vscode/
.idea/
*.swp
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 使用 .gitignore 中的规则排除不需要包含在 npm 包中的文件
/source
/test
/script

# 如果需要在 npm 包中包含特定文件,请在下面取消注释并添加文件路径
!/build
!/dist
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
# creator-types
# creator-types

[![CI Status](https://github.com/cocos/creator-types/actions/workflows/ci.yaml/badge.svg)](https://github.com/cocos/creator-types/actions/workflows/ci.yaml)
![Typescript](https://img.shields.io/badge/Language-Typescript-blue.svg)

Definitions of engine and editor within Creator

**Please note that this repository is for definition purposes only. Run your code in an appropriate environment.**

## Install

To install the latest version of the definitions:

```bash
npm install @cocos/creator-types
```

In typical scenarios, we need to install definitions for a specific version, for example, when we are using Creator 3.8.0, you can install the definition files as follows:

```bash
npm install @cocos/[email protected]
```

## Usage

In the tsconfig.json within the project where it's needed, locate compilerOptions.types and add two declarations:

```json
{
"compilerOptions": {
"types": [
"@cocos/creator-types/engine",
"@cocos/creator-types/editor",
]
}
}
```

After declaring `@cocos/creator-types/engine`, the `cc` module can be recognized correctly in the code:

```ts
import { Node } from 'cc';
```

After declaring `@cocos/creator-types/editor`, the `Editor` object can be recognized correctly in the code.

```ts
Editor.Dialog;
```

For more detailed information, please refer to:

[Engine API](https://docs.cocos.com/creator/api/en/)

[Extension Doc](https://docs.cocos.com/creator/manual/en/editor/extension/readme.html)
1 change: 1 addition & 0 deletions editor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path="./editor/index.d.ts"/>
Loading

0 comments on commit a179f2c

Please sign in to comment.