[![Build Status](https://travis-ci.org/microsoft/types-publisher.svg?branch=master)](https://travis-ci.org/microsoft/types-publisher)
# About
This is the source code for the types-publisher service, which publishes the contents of [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) to npm.
# Disclaimer
If there's functionality from the project you'd like to use, please file an issue detailing that. The script isn't intended for public consumption (i.e. we will break the API whenever convenient for us).
# Filing issues
If you've noticed a problem with the way a package is published, file an issue here.
If you don't like the contents of a given definition, file an issue (or pull request) on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) instead.
# Manually running
Normally, types-publisher is run on a loop every 2,000 seconds (33 minutes), but to test it out you can do it yourself.
You will need to see the [Environment variables](#environment-variables) section first.
```
cat settings.json
```
Make sure your settings are correct.
```
npm run build
npm run full
```
*or*
```
npm run build
npm run clean
npm run parse
npm run calculate-versions
npm run generate
npm run publish-packages
npm run upload-blobs
```
and optionally (in production, these run once a week):
```
npm run publish-registry
npm run validate
```
You can run tests with
```
npm run test
```
# Overview
To update the types packages, the following steps must be performed:
* Parse the definitions
* Calculate versions
* Generate packages on disk
* Publish packages on disk
Importantly, each of these steps is *idempotent*.
Running the entire sequence twice should not have any different results unless one of the inputs has changed.
# Parse the definitions
First, obtain a local copy of the DefinitelyTyped repo. For running
locally, the script assumes that it is at `../DefinitelyTyped` and
checks to make sure that it has no outstanding changes. It does *not*
check that it has master checked out. For running in the cloud, the script
downloads a gzipped copy and unzips it into memory. This saves a lot
of time if the filesystem is very slow.
You can manually run this step locally with `npm run get-definitely-typed`.
Pass `--dry` to download the DefinitelyTyped copy and unzip it into memory.
> `npm run parse`
This generates the data file `data/definitions.json`.
All future steps depend on this file.
One can also pass `--single=package_name` to test this on a single package.
## Contents of `data/definitions.json`
This file is a key/value mapping used by other steps in the process.
### Example entry
```json
{
"jquery": {
"3.3": {
"libraryName": "jquery",
"typingsPackageName": "jquery",
"projectName": "https://jquery.com",
"contributors": [
{
"name": "Boris Yankov",
"url": "https://github.com/borisyankov",
"githubUsername": "borisyankov"
}
],
"libraryMajorVersion": 3,
"libraryMinorVersion": 3,
"minTsVersion": "2.3",
"typesVersions": [],
"files": [
"JQuery.d.ts",
"JQueryStatic.d.ts",
"dist/jquery.slim.d.ts",
"index.d.ts",
"legacy.d.ts",
"misc.d.ts"
],
"license": "MIT",
"dependencies": {
"sizzle": "*"
},
"testDependencies": [],
"pathMappings": [],
"packageJsonDependencies": [],
"contentHash": "6f3ac74aa9f284b3450b4dcbcabc842bfc2a70fa2d92e745851044d2bb78e94b",
"globals": [
"$",
"Symbol",
"jQuery"
],
"declaredModules": [
"jquery",
"jquery/dist/jquery.slim"
]
}
}
}
```
### Fields in `data/definitions.json`
A key of the root object represents the name of the *folder* of a definition package, as it exists in the source repo. Its corresponding value holds a
an object that represents the versions of the package for which definitions are provided in parallel. Each version entry holds data about the package;
refer to [the `TypingsDataRaw` interface declaration](./src/lib/packages.ts) for details on this data.
## Contents of `logs/parser-log-summary.md`
This log file contains a summary of the outcome of each declaration, as well as a set of warnings.
### Failure States
Currently, the only error condition is if there are multiple .d.ts files in the declaration folder and none of them are the obvious entry point.
These will be listed in the *warnings* section of `parser-log-summary.md`; search for "Found either zero or more" in this file.
### Warnings
The following warnings may be present.
Some warnings block package creation and should be addressed sooner.
#### Too Many Files
> Found either zero or more than one .d.ts file and none of google-apps-script.d.ts or index.d.ts
This warning means the script could not determine what the entry point .d.ts file was.
Fix this by renaming some .d.ts file to the containing folder name, or index.d.ts.
This warning blocks package creation.
#### Incorrect Declared Module
> Declared module `howler` is in folder with incorrect name `howlerjs`
This warning means that a module declaration's name does not match the containing folder's name.
Determine which is correct and rename the folder or the module declaration appropriately.
#### Casing
> Package name joData should be strictly lowercase
Nearly all package names should be lowercased to conform with NPM naming standards.
This warning might not be appropriate; consider logging an issue.
# Calculate versions
This generates `versions.json` based on the last uploaded `versions.json` and by the content hashes computed during parsing.
## Arguments to `calculate-versions`
The `--forceUpdate` argument will cause a build version bump even if the `contentHash` of the originating types folder has not changed.
This argument may be needed during development, but should not be used during routine usage.
# Generate packages on disk
> `npm run generate`
This step writes all type packages to disk.
The output folder is specified in `settings.json` (see section "Settings").
## Arguments to `generate`
Use the `--tgz` option to create `.tgz` archives as well. These should represent what is actually uploaded to NPM.
## Outputs of `generate`
### Package Folders
The package generation step creates a folder for each package under the output folder.
The following files are produced automatically:
* `package.json`
* `README.md`
* `metadata.json`: This is the entry from `definitions.json`, excluding the `root` property
* All declaration files are transformed and copied over
### Definition File Transforms
The following changes occur when a file is transformed:
* `/// <reference path=` directives are changed to corresponding `/// <reference types=` directives
* The file is saved in UTF-8 format
### `logs/package-generator.md`
This file is currently uninteresting.
# Publish packages on disk
> `npm run publish`
This step publishes the files to the NPM registry.
Several keys in `settings.json` affect this step; be sure to read this section.
Before publishing, the script checks the NPM registry to see if a package with the same version number has already been published.
If so, the publishing is skipped.
## Outputs of `publish`
### `logs/publishing.md`
This log file indicates which packages were published and which were skipped.
It also indicates any errors that may have occurred during publishing.
Note that unlike other steps, this log file output is *not* idempotent.
Scripts should save this log under a unique filename so any errors may be reviewed.
# Publish registry
> `npm run publish -- [--dry]
没有合适的资源?快使用搜索试试~ 我知道了~
DefinitelyTyped的基础设施___下载.zip
共355个文件
ts:184个
json:68个
md:37个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 156 浏览量
2023-04-19
00:49:41
上传
评论
收藏 493KB ZIP 举报
温馨提示
DefinitelyTyped的基础设施___下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
DefinitelyTyped的基础设施___下载.zip (355个子文件)
CODEOWNERS 31B
CODEOWNERS 26B
CODEOWNERS 11B
.editorconfig 147B
.eslintignore 53B
.funcignore 52B
.gitignore 1007B
.gitignore 94B
.gitignore 83B
.gitignore 42B
.gitignore 38B
.gitignore 23B
jest.config.js 369B
webpackPropertyNames.js 316B
index.js 75B
missingJsProperty.js 68B
missingExportEquals.js 56B
missingDtsProperty.js 48B
missingJsSignatureExportEquals.js 44B
missingDtsSignature.js 40B
noErrors.js 40B
dts-critic.js 31B
missingDefault.js 31B
missingJsSignatureNoExportEquals.js 26B
abbrev.packageBenchmark.json 9KB
dtslint.json 4KB
.eslintrc.json 3KB
package.json 3KB
package.json 2KB
package.json 1KB
package.json 1KB
package.json 1KB
package.json 1KB
launch.json 1KB
package.json 1KB
package.json 1005B
package.json 914B
package.json 878B
tslint.json 811B
package.json 643B
launch.json 579B
tslint.json 523B
tsconfig.test.json 503B
extensions.json 495B
launch.json 488B
tsconfig.json 471B
tsconfig.base.json 465B
tsconfig.json 439B
launch.json 438B
tsconfig.json 427B
tsconfig.json 352B
tsconfig.json 352B
tsconfig.json 352B
tsconfig.json 352B
tsconfig.json 347B
tsconfig.json 345B
function.json 324B
host.json 322B
tsconfig.json 268B
tsconfig.json 256B
tsconfig.json 252B
tsconfig.json 247B
tsconfig.json 228B
tsconfig.json 224B
tsconfig.json 209B
tsconfig.json 201B
function.json 196B
tsconfig.json 192B
tsconfig.json 192B
tsconfig.json 192B
tslint.json 182B
tsconfig.no-declare-current-package.json 171B
tsconfig.no-declare-current-package2.json 168B
tsconfig.no-import-default-of-export-equals.json 162B
dt.json 156B
tsconfig.json 140B
tsconfig.json 137B
tslint.json 135B
lerna.json 120B
tsconfig.no-self-import.json 114B
tslint.json 107B
tslint.json 102B
tslint.json 100B
tslint.json 95B
tslint.json 87B
dtslint-expect-only.json 86B
tslint.json 86B
tslint.json 82B
settings.json 58B
.prettierrc.json 40B
tsconfig.json 2B
tsconfig.json 2B
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
testModuleAutoExport.d.ts.lint 1KB
expectType.ts.lint 1KB
index.d.ts.lint 1000B
testModule.d.ts.lint 960B
共 355 条
- 1
- 2
- 3
- 4
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功