@ts-type/package-dts 2.0.5 → 2.0.6
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.
- package/CHANGELOG.md +28 -0
- package/eslintrc-json.d.ts +3 -3
- package/lerna-json.d.ts +2 -2
- package/lib/lerna-json/types.d.ts +1 -1
- package/lib/package-json/exports.d.ts +33 -0
- package/lib/package-json/exports.js +3 -0
- package/lib/package-json/exports.js.map +1 -0
- package/lib/package-json/types.d.ts +5 -5
- package/lib/package-json/types.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/types.js.map +1 -1
- package/package-json.d.ts +5 -4
- package/package-json.js.map +1 -1
- package/package.json +10 -12
- package/schema/travis.json +1 -0
- package/script/index.d.ts +4 -0
- package/script/index.js +130 -0
- package/script/index.js.map +1 -0
- package/script/util.d.ts +17 -0
- package/script/util.js +72 -0
- package/script/util.js.map +1 -0
- package/travis-json.d.ts +2 -2
- package/tsconfig-json.d.ts +2 -2
- package/types/travis.json.d.ts +1 -0
- package/types/tsconfig.json.d.ts +5 -0
- package/schema/tsconfig.json +0 -1232
- package/tsconfig.check.json +0 -15
- package/tsconfig.check.tsbuildinfo +0 -1
- package/tsconfig.tsbuildinfo +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.6](https://github.com/bluelovers/ws-ts-type/compare/@ts-type/package-dts@2.0.5...@ts-type/package-dts@2.0.6) (2022-10-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ✨ Features
|
|
11
|
+
|
|
12
|
+
* update `exports` ([1b6d0af](https://github.com/bluelovers/ws-ts-type/commit/1b6d0affeb98d3a4ee32ab605481022a9fdd4a03))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🛠 Build System
|
|
16
|
+
|
|
17
|
+
* update typescript ([eb59d89](https://github.com/bluelovers/ws-ts-type/commit/eb59d897c2888c7a45406ffcad4b9033608b0b66))
|
|
18
|
+
* **schema:** update schema ([4c2bea8](https://github.com/bluelovers/ws-ts-type/commit/4c2bea8b2c52d3602d8fbbc20fae8d6fd8dfed4f))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### 📌 Dependencies
|
|
22
|
+
|
|
23
|
+
* update deps ([ab5f3e4](https://github.com/bluelovers/ws-ts-type/commit/ab5f3e48da1f10ddd4445ba6dda9a0a68c5f656f))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 🔖 Miscellaneous
|
|
27
|
+
|
|
28
|
+
* . ([6f3d921](https://github.com/bluelovers/ws-ts-type/commit/6f3d92130961bd99365dc297c7cf4644e32d3c7d))
|
|
29
|
+
* . ([ed63e32](https://github.com/bluelovers/ws-ts-type/commit/ed63e326e593f2aac0258db1c6cf15db3d73d943))
|
|
30
|
+
* . ([9219017](https://github.com/bluelovers/ws-ts-type/commit/92190178fcf30f881c1d0d36fb141a3394ab3b38))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
6
34
|
## [2.0.5](https://github.com/bluelovers/ws-ts-type/compare/@ts-type/package-dts@2.0.4...@ts-type/package-dts@2.0.5) (2022-08-10)
|
|
7
35
|
|
|
8
36
|
**Note:** Version bump only for package @ts-type/package-dts
|
package/eslintrc-json.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Created by user on 2019/5/19.
|
|
3
3
|
*/
|
|
4
4
|
import { JSONSchemaForESLintConfigurationFiles, Rule } from './types/eslintrc.json';
|
|
5
|
-
export
|
|
5
|
+
export type ILibEslint = typeof import('./types/eslintrc.json');
|
|
6
6
|
export declare const enum EnumRule {
|
|
7
7
|
off = "off",
|
|
8
8
|
warn = "warn",
|
|
9
9
|
error = "error"
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type IRule = Rule | EnumRule;
|
|
12
|
+
export type IEslintrcJson = JSONSchemaForESLintConfigurationFiles & {
|
|
13
13
|
parser?: string | '@typescript-eslint/parser';
|
|
14
14
|
extends?: (string | 'plugin:@typescript-eslint/recommended' | 'bluelovers')[];
|
|
15
15
|
parserOptions?: JSONSchemaForESLintConfigurationFiles["parserOptions"] & {
|
package/lerna-json.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export * from './lib/lerna-json/types';
|
|
|
8
8
|
import { INpmClient } from './lib/lerna-json/types';
|
|
9
9
|
import { IBranch } from './lib/types';
|
|
10
10
|
export type { IReleaseType };
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
type _Command = AJSONSchemaForLernaJsonFiles["command"];
|
|
12
|
+
type _MergeCommand<T extends Record<string, Record<string, any>>> = {
|
|
13
13
|
[P in keyof (T & _Command)]?: (P extends keyof _Command ? P extends keyof T ? ITSMergeBoth<_Command[P], T[P]> : _Command[P] : T[P]);
|
|
14
14
|
};
|
|
15
15
|
export interface ILernaJsonCommand extends _MergeCommand<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type INpmClient = string | 'npm' | 'yarn' | 'lerna';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PackageExportsEntry, PackageExportsEntryObject, PackageExportsFallback, JSONSchemaForNPMPackageJsonFiles2 as CoreProperties } from '../../types/package.json';
|
|
2
|
+
import { ITSPartialRecord } from 'ts-type/lib/type/record/partial';
|
|
3
|
+
declare module '../../types/package.json' {
|
|
4
|
+
interface PackageExportsEntryObject {
|
|
5
|
+
types?: PackageExportsEntry | PackageExportsFallback;
|
|
6
|
+
[k: string]: PackageExportsEntry | PackageExportsFallback;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export interface IPackageExportsEntryObject extends PackageExportsEntryObject {
|
|
10
|
+
types?: PackageExportsEntry | PackageExportsFallback;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The module path prefix that is resolved when the module specifier starts with "name/", set to "./*" to allow external modules to import any subpath.
|
|
14
|
+
*
|
|
15
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
16
|
+
* via the `patternProperty` "^\./.+".
|
|
17
|
+
*/
|
|
18
|
+
export interface IPackageJsonExportsEntryObjectRoot extends ITSPartialRecord<'default' | './package.json' | `./${string}`, PackageExportsEntry | PackageExportsFallback | IPackageExportsEntryObject> {
|
|
19
|
+
/**
|
|
20
|
+
* The module path that is resolved when the module specifier matches "name", shadows the "main" field.
|
|
21
|
+
*/
|
|
22
|
+
"."?: PackageExportsEntry | PackageExportsFallback | IPackageExportsEntryObject;
|
|
23
|
+
/**
|
|
24
|
+
* The module path prefix that is resolved when the module specifier starts with "name/", set to "./*" to allow external modules to import any subpath.
|
|
25
|
+
*
|
|
26
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
27
|
+
* via the `patternProperty` "^\./.+".
|
|
28
|
+
*/
|
|
29
|
+
[k: string]: PackageExportsEntry | PackageExportsFallback | IPackageExportsEntryObject;
|
|
30
|
+
}
|
|
31
|
+
export interface IPackageJsonExports {
|
|
32
|
+
exports?: IPackageJsonExportsEntryObjectRoot | CoreProperties["exports"];
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["exports.ts"],"names":[],"mappings":"","sourcesContent":["import { PackageExportsEntry, PackageExportsEntryObject, PackageExportsFallback,\n\tJSONSchemaForNPMPackageJsonFiles2 as CoreProperties } from '../../types/package.json';\nimport { ITSPartialRecord } from 'ts-type/lib/type/record/partial';\n\ndeclare module '../../types/package.json'\n{\n\tinterface PackageExportsEntryObject\n\t{\n\t\ttypes?: PackageExportsEntry | PackageExportsFallback;\n\n\t\t[k: string]: PackageExportsEntry | PackageExportsFallback;\n\t}\n}\n\nexport interface IPackageExportsEntryObject extends PackageExportsEntryObject\n{\n\ttypes?: PackageExportsEntry | PackageExportsFallback;\n}\n\n/**\n * The module path prefix that is resolved when the module specifier starts with \"name/\", set to \"./*\" to allow external modules to import any subpath.\n *\n * This interface was referenced by `undefined`'s JSON-Schema definition\n * via the `patternProperty` \"^\\./.+\".\n */\nexport interface IPackageJsonExportsEntryObjectRoot extends ITSPartialRecord<'default' | './package.json' | `./${string}`, PackageExportsEntry | PackageExportsFallback | IPackageExportsEntryObject>\n{\n\t/**\n\t * The module path that is resolved when the module specifier matches \"name\", shadows the \"main\" field.\n\t */\n\t\".\"?: PackageExportsEntry | PackageExportsFallback | IPackageExportsEntryObject;\n\n\t/**\n\t * The module path prefix that is resolved when the module specifier starts with \"name/\", set to \"./*\" to allow external modules to import any subpath.\n\t *\n\t * This interface was referenced by `undefined`'s JSON-Schema definition\n\t * via the `patternProperty` \"^\\./.+\".\n\t */\n\t[k: string]: PackageExportsEntry | PackageExportsFallback | IPackageExportsEntryObject;\n}\n\nexport interface IPackageJsonExports\n{\n\texports?: IPackageJsonExportsEntryObjectRoot | CoreProperties[\"exports\"]\n}\n"]}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
import type { ReleaseType as IReleaseType } from 'semver';
|
|
5
5
|
import { EnumPublishConfigRegistry } from './publishConfig';
|
|
6
6
|
import { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';
|
|
7
|
-
import {
|
|
7
|
+
import { ITSValueOf, ITSValueOfArray } from 'ts-type/lib/helper/key-value';
|
|
8
8
|
import { ITSTypeAndStringLiteral } from 'ts-type/lib/helper/string';
|
|
9
|
-
export
|
|
9
|
+
export type IDependency<T extends ITSArrayListMaybeReadonly<string> | string = string[]> = Record<T extends string ? T : T extends ITSArrayListMaybeReadonly<string> ? ITSValueOfArray<T> : never, IVersionValue>;
|
|
10
10
|
export type { IDependency as IPackageMap };
|
|
11
11
|
export type { IDependency as IDependencies };
|
|
12
|
-
export
|
|
12
|
+
export type IVersionValue = ITSTypeAndStringLiteral<EnumVersionValue.latest> | ITSTypeAndStringLiteral<EnumVersionValue2> | string;
|
|
13
13
|
export declare enum EnumVersionValue {
|
|
14
14
|
'major' = "major",
|
|
15
15
|
'minor' = "minor",
|
|
@@ -26,7 +26,7 @@ export declare const enum EnumVersionValue2 {
|
|
|
26
26
|
stable = "stable",
|
|
27
27
|
dev = "dev"
|
|
28
28
|
}
|
|
29
|
-
export
|
|
29
|
+
export type IPackageJsonDependenciesField = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
|
|
30
30
|
declare const packageJsonDependenciesFields: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
31
31
|
export { packageJsonDependenciesFields };
|
|
32
32
|
/**
|
|
@@ -44,5 +44,5 @@ export interface IPackageJsonPublishConfig {
|
|
|
44
44
|
tag?: IPackageJsonTag;
|
|
45
45
|
[k: string]: any;
|
|
46
46
|
}
|
|
47
|
-
export
|
|
47
|
+
export type IPackageJsonTag = string | ITSTypeAndStringLiteral<Exclude<ITSValueOf<typeof EnumVersionValue2>, EnumVersionValue2.any>>;
|
|
48
48
|
export type { IReleaseType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAgBA,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAE3B,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,yCAAuB,CAAA;IACvB,qCAAmB,CAAA;AACpB,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAO3B;AAED,IAAkB,iBAUjB;AAVD,WAAkB,iBAAiB;IAElC,8BAAS,CAAA;IAET,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,kCAAa,CAAA;IACb,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;IACjB,gCAAW,CAAA;AACZ,CAAC,EAViB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAUlC;AASD,MAAM,6BAA6B,GAAG;IACrC,cAAuB;IACvB,iBAA0B;IAC1B,kBAA2B;IAC3B,sBAA+B;CACtB,CAAA;AAED,sEAA6B","sourcesContent":["/**\n * Created by user on 2020/6/12.\n */\nimport type { ReleaseType as IReleaseType } from 'semver';\nimport { EnumPublishConfigRegistry } from './publishConfig';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\nimport {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAgBA,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAE3B,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,yCAAuB,CAAA;IACvB,qCAAmB,CAAA;AACpB,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAO3B;AAED,IAAkB,iBAUjB;AAVD,WAAkB,iBAAiB;IAElC,8BAAS,CAAA;IAET,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,kCAAa,CAAA;IACb,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;IACjB,gCAAW,CAAA;AACZ,CAAC,EAViB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAUlC;AASD,MAAM,6BAA6B,GAAG;IACrC,cAAuB;IACvB,iBAA0B;IAC1B,kBAA2B;IAC3B,sBAA+B;CACtB,CAAA;AAED,sEAA6B","sourcesContent":["/**\n * Created by user on 2020/6/12.\n */\nimport type { ReleaseType as IReleaseType } from 'semver';\nimport { EnumPublishConfigRegistry } from './publishConfig';\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\nimport { ITSValueOf, ITSValueOfArray } from 'ts-type/lib/helper/key-value';\nimport { ITSTypeAndStringLiteral } from 'ts-type/lib/helper/string';\n\nexport type IDependency<T extends ITSArrayListMaybeReadonly<string> | string = string[]> = Record<T extends string ? T : T extends ITSArrayListMaybeReadonly<string> ? ITSValueOfArray<T> : never, IVersionValue>;\n\nexport type { IDependency as IPackageMap }\nexport type { IDependency as IDependencies }\n\nexport type IVersionValue = ITSTypeAndStringLiteral<EnumVersionValue.latest> | ITSTypeAndStringLiteral<EnumVersionValue2> | string;\n\nexport enum EnumVersionValue\n{\n\t'major' = 'major',\n\t'minor' = 'minor',\n\t'latest' = 'latest',\n\t'greatest' = 'greatest',\n\t'newest' = 'newest'\n}\n\nexport const enum EnumVersionValue2\n{\n\tany = '*',\n\n\tlatest = 'latest',\n\tnext = 'next',\n\tbeta = 'beta',\n\tcanary = 'canary',\n\tstable = 'stable',\n\tdev = 'dev',\n}\n\nexport type IPackageJsonDependenciesField =\n\t'dependencies'\n\t| 'devDependencies'\n\t| 'peerDependencies'\n\t| 'optionalDependencies'\n;\n\nconst packageJsonDependenciesFields = [\n\t'dependencies' as const,\n\t'devDependencies' as const,\n\t'peerDependencies' as const,\n\t'optionalDependencies' as const,\n] as const\n\nexport { packageJsonDependenciesFields }\n\n/**\n * This is a set of config values that will be used at publish-time.\n * It’s especially handy if you want to set the tag, registry or access,\n * so that you can ensure that a given package is not tagged with “latest”,\n * published to the global public registry or that a scoped module is private by default.\n *\n * Any config values can be overridden,\n * but only “tag”, “registry” and “access” probably matter for the purposes of publishing.\n */\nexport interface IPackageJsonPublishConfig\n{\n\tregistry?: string | EnumPublishConfigRegistry;\n\taccess?: string | \"public\" | \"restricted\";\n\ttag?: IPackageJsonTag;\n\n\t[k: string]: any;\n}\n\nexport type IPackageJsonTag = string | ITSTypeAndStringLiteral<Exclude<ITSValueOf<typeof EnumVersionValue2>, EnumVersionValue2.any>>;\n\nexport type { IReleaseType }\n"]}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type IBooleanString = "true" | "false";
|
|
2
|
+
export type IBranch = string | "master" | "canary" | "main";
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["\nexport type IBooleanString = \"true\" | \"false\"\n\nexport type IBranch = string | \"master\" | \"canary\"\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["\nexport type IBooleanString = \"true\" | \"false\"\n\nexport type IBranch = string | \"master\" | \"canary\" | \"main\"\n"]}
|
package/package-json.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by user on 2019/5/18.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { JSONSchemaForNPMPackageJsonFiles2 as CoreProperties } from './types/package.json';
|
|
5
|
+
import type { IDependency, IPackageJsonDependenciesField } from './lib/package-json/types';
|
|
6
6
|
import type { ITSOverwrite } from 'ts-type/lib/type/record';
|
|
7
7
|
import { IPackageJsonExtendYarn } from './lib/package-json/yarn';
|
|
8
8
|
import { ITSPartialRecord } from 'ts-type/lib/type/record/partial';
|
|
9
9
|
import { ITSOmitIndexSignatures } from 'ts-type/lib/helper/record/omit-index';
|
|
10
10
|
import { _IPackageJsonCore } from './lib/package-json/extend';
|
|
11
|
+
import { IPackageJsonExports } from './lib/package-json/exports';
|
|
11
12
|
export { EnumVersionValue2 } from './lib/package-json/types';
|
|
12
13
|
export * from './lib/package-json/types';
|
|
13
|
-
export
|
|
14
|
+
export type ILibPackageJson = typeof import('./types/package.json');
|
|
14
15
|
/**
|
|
15
16
|
* @example IPackageJson<unknown>
|
|
16
17
|
*/
|
|
17
|
-
export interface IPackageJson<T =
|
|
18
|
+
export interface IPackageJson<T = unknown> extends ITSOverwrite<ITSOmitIndexSignatures<CoreProperties>, _IPackageJsonCore & ITSPartialRecord<IPackageJsonDependenciesField, IDependency> & IPackageJsonExtendYarn & IPackageJsonExports> {
|
|
18
19
|
[k: string]: T;
|
|
19
20
|
}
|
|
20
21
|
export default IPackageJson;
|
package/package-json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["package-json.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["package-json.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAWH,kDAA6D;AAApD,0GAAA,iBAAiB,OAAA;AAC1B,2DAAyC","sourcesContent":["/**\n * Created by user on 2019/5/18.\n */\n\nimport type { JSONSchemaForNPMPackageJsonFiles2 as CoreProperties } from './types/package.json';\nimport type { IDependency, IPackageJsonDependenciesField } from './lib/package-json/types';\nimport type { ITSOverwrite } from 'ts-type/lib/type/record';\nimport { IPackageJsonExtendYarn } from './lib/package-json/yarn';\nimport { ITSPartialRecord } from 'ts-type/lib/type/record/partial';\nimport { ITSOmitIndexSignatures } from 'ts-type/lib/helper/record/omit-index';\nimport { _IPackageJsonCore } from './lib/package-json/extend';\nimport { IPackageJsonExports, IPackageJsonExportsEntryObjectRoot } from './lib/package-json/exports';\n\nexport { EnumVersionValue2 } from './lib/package-json/types';\nexport * from './lib/package-json/types';\n\nexport type ILibPackageJson = typeof import('./types/package.json');\n\n/**\n * @example IPackageJson<unknown>\n */\nexport interface IPackageJson<T = unknown> extends ITSOverwrite<ITSOmitIndexSignatures<CoreProperties>, _IPackageJsonCore & ITSPartialRecord<IPackageJsonDependenciesField, IDependency> & IPackageJsonExtendYarn & IPackageJsonExports>\n{\n/*\n\t//[k in Exclude<string, keyof CoreProperties>]: T;\n\t[k: string]: unknown;\n */\n\t// @ts-ignore\n\t[k: string]: T;\n}\n\nexport default IPackageJson\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-type/package-dts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Typescript type definition for NPM package json",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
|
-
"url": "git+https://github.com/bluelovers/ws-ts-type.git"
|
|
41
|
+
"url": "git+https://github.com/bluelovers/ws-ts-type.git",
|
|
42
|
+
"directory": "packages/package-dts"
|
|
42
43
|
},
|
|
43
44
|
"license": "ISC",
|
|
44
45
|
"author": "",
|
|
@@ -51,6 +52,10 @@
|
|
|
51
52
|
"lint": "eslint **/*.ts",
|
|
52
53
|
"pretest": "yarn run build",
|
|
53
54
|
"test": "yarn run ts:check",
|
|
55
|
+
"test:jest": "jest --passWithNoTests",
|
|
56
|
+
"test:jest:snapshot": "yarn run test:jest -- -u",
|
|
57
|
+
"test:snapshot": "yarn run test -- -u",
|
|
58
|
+
"test:tsd": "ynpx tsd",
|
|
54
59
|
"posttest": "git commit -m \"build(schema): update schema\" ./types ./schema & echo posttest",
|
|
55
60
|
"build": "yarn run update:schema",
|
|
56
61
|
"preversion": "yarn run test",
|
|
@@ -61,20 +66,13 @@
|
|
|
61
66
|
"update:schema": "ts-node ./script/index"
|
|
62
67
|
},
|
|
63
68
|
"dependencies": {
|
|
64
|
-
"@types/semver": "^7.3.
|
|
65
|
-
"ts-type": "^
|
|
66
|
-
},
|
|
67
|
-
"devDependencies": {
|
|
68
|
-
"axios": "^0.27.2",
|
|
69
|
-
"bluebird": "^3.7.2",
|
|
70
|
-
"dot-values2": "^2.0.6",
|
|
71
|
-
"fs-extra": "^10.1.0",
|
|
72
|
-
"json-schema-to-typescript": "^11.0.2"
|
|
69
|
+
"@types/semver": "^7.3.12",
|
|
70
|
+
"ts-type": "^3.0.1"
|
|
73
71
|
},
|
|
74
72
|
"publishConfig": {
|
|
75
73
|
"access": "public"
|
|
76
74
|
},
|
|
77
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "fa34eea119b9bcbb363061ddffcfe9d78c2d0ddd",
|
|
78
76
|
"sharedDependencies": {
|
|
79
77
|
"eslint-config-bluelovers": "latest"
|
|
80
78
|
}
|
package/schema/travis.json
CHANGED
package/script/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Created by user on 2019/5/18.
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const util_1 = require("./util");
|
|
10
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
let skipExists;
|
|
13
|
+
skipExists = false;
|
|
14
|
+
bluebird_1.default
|
|
15
|
+
.each([
|
|
16
|
+
'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/package.json',
|
|
17
|
+
'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/eslintrc.json',
|
|
18
|
+
'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/travis.json',
|
|
19
|
+
'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/tsconfig.json',
|
|
20
|
+
'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/lerna.json',
|
|
21
|
+
], (href) => {
|
|
22
|
+
let handleSchemaBeforeCompile;
|
|
23
|
+
switch ((0, path_1.basename)(href)) {
|
|
24
|
+
case 'package.json':
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
handleSchemaBeforeCompile = (schema) => {
|
|
27
|
+
try {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
delete schema.definitions.coreProperties.patternProperties;
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
schema.definitions.coreProperties.additionalProperties = false;
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
schema.definitions.coreProperties.additionalItems = false;
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
console.dir(schema.definitions.coreProperties);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
}
|
|
39
|
+
return schema;
|
|
40
|
+
};
|
|
41
|
+
break;
|
|
42
|
+
case 'lerna.json':
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
handleSchemaBeforeCompile = (schema) => {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
schema.properties.command.additionalProperties = false;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
schema.properties.command.additionalItems = false;
|
|
49
|
+
return schema;
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
return (0, util_1.downloadJsonAndBuild)({
|
|
54
|
+
href,
|
|
55
|
+
skipExists,
|
|
56
|
+
handleSchemaBeforeCompile,
|
|
57
|
+
});
|
|
58
|
+
})
|
|
59
|
+
.tap(r => console.log(r.length));
|
|
60
|
+
/*
|
|
61
|
+
downloadJsonAndBuild({
|
|
62
|
+
href: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/package.json',
|
|
63
|
+
skipExists,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
downloadJsonAndBuild({
|
|
67
|
+
href: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/eslintrc.json',
|
|
68
|
+
skipExists,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
downloadJsonAndBuild({
|
|
72
|
+
href: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/travis.json',
|
|
73
|
+
skipExists,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
downloadJsonAndBuild({
|
|
77
|
+
href: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/tsconfig.json',
|
|
78
|
+
skipExists,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
downloadJsonAndBuild({
|
|
82
|
+
href: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/lerna.json',
|
|
83
|
+
skipExists,
|
|
84
|
+
});
|
|
85
|
+
*/
|
|
86
|
+
/*
|
|
87
|
+
Bluebird.resolve(axios.get('https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/package.json'))
|
|
88
|
+
.then(function (res)
|
|
89
|
+
{
|
|
90
|
+
console.log(`downloaded`);
|
|
91
|
+
|
|
92
|
+
if (typeof res.data === 'string')
|
|
93
|
+
{
|
|
94
|
+
return JSON.parse(res.data)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return res.data
|
|
98
|
+
})
|
|
99
|
+
.tap(function (data)
|
|
100
|
+
{
|
|
101
|
+
return fs.writeJSON(path.join(__dirname, '../schema/package.json'), data, {
|
|
102
|
+
spaces: "\t",
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
.tap(function (data)
|
|
106
|
+
{
|
|
107
|
+
console.log(`json saved`);
|
|
108
|
+
})
|
|
109
|
+
.then(function (data)
|
|
110
|
+
{
|
|
111
|
+
console.log(`start compile .d.ts`);
|
|
112
|
+
|
|
113
|
+
return compile(data, 'IPackageJson', {
|
|
114
|
+
enableConstEnums: true,
|
|
115
|
+
unreachableDefinitions: true,
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
.then(function (ts)
|
|
119
|
+
{
|
|
120
|
+
console.log(`compiled`);
|
|
121
|
+
|
|
122
|
+
return fs.writeFile(path.join(__dirname, '../types', 'package.json.d.ts'), ts)
|
|
123
|
+
})
|
|
124
|
+
.tap(function (data)
|
|
125
|
+
{
|
|
126
|
+
console.log(`.d.ts saved`);
|
|
127
|
+
})
|
|
128
|
+
;
|
|
129
|
+
*/
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,iCAA2E;AAC3E,wDAAgC;AAChC,+BAAgC;AAGhC,IAAI,UAAmB,CAAC;AACxB,UAAU,GAAG,KAAK,CAAC;AAEnB,kBAAQ;KACN,IAAI,CAAC;IACL,qFAAqF;IACrF,sFAAsF;IACtF,oFAAoF;IACpF,sFAAsF;IACtF,mFAAmF;CACnF,EAAE,CAAC,IAAI,EAAE,EAAE;IAEX,IAAI,yBAAmF,CAAC;IAGxF,QAAQ,IAAA,eAAQ,EAAC,IAAI,CAAC,EACtB;QACC,KAAK,cAAc;YAElB,aAAa;YACb,yBAAyB,GAAG,CAAC,MAA+C,EAAE,EAAE;gBAE/E,IACA;oBACC,aAAa;oBACb,OAAO,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,iBAAiB,CAAC;oBAE3D,aAAa;oBACb,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,oBAAoB,GAAG,KAAK,CAAC;oBAC/D,aAAa;oBACb,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,eAAe,GAAG,KAAK,CAAC;oBAE1D,aAAa;oBACb,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;iBAC/C;gBACD,OAAO,CAAC,EACR;iBAEC;gBAED,OAAO,MAAM,CAAA;YACd,CAAC,CAAA;YAED,MAAM;QACP,KAAK,YAAY;YAEhB,aAAa;YACb,yBAAyB,GAAG,CAAC,MAA6C,EAAE,EAAE;gBAE7E,aAAa;gBACb,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC;gBACvD,aAAa;gBACb,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC;gBAElD,OAAO,MAAM,CAAA;YACd,CAAC,CAAA;YAED,MAAM;KACP;IAED,OAAO,IAAA,2BAAoB,EAAC;QAC3B,IAAI;QACJ,UAAU;QACV,yBAAyB;KACzB,CAAC,CAAC;AACJ,CAAC,CAAC;KACD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CE","sourcesContent":["/**\n * Created by user on 2019/5/18.\n */\n\nimport { downloadJsonAndBuild, IDownloadJsonAndBuildParams } from './util';\nimport Bluebird from 'bluebird';\nimport { basename } from 'path';\nimport { unsetValue } from 'dot-values2';\n\nlet skipExists: boolean;\nskipExists = false;\n\nBluebird\n\t.each([\n\t\t'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/package.json',\n\t\t'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/eslintrc.json',\n\t\t'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/travis.json',\n\t\t'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/tsconfig.json',\n\t\t'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/lerna.json',\n\t], (href) =>\n\t{\n\t\tlet handleSchemaBeforeCompile: IDownloadJsonAndBuildParams[\"handleSchemaBeforeCompile\"];\n\n\n\t\tswitch (basename(href))\n\t\t{\n\t\t\tcase 'package.json':\n\n\t\t\t\t// @ts-ignore\n\t\t\t\thandleSchemaBeforeCompile = (schema: typeof import('../schema/package.json')) => {\n\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tdelete schema.definitions.coreProperties.patternProperties;\n\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tschema.definitions.coreProperties.additionalProperties = false;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tschema.definitions.coreProperties.additionalItems = false;\n\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tconsole.dir(schema.definitions.coreProperties);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e)\n\t\t\t\t\t{\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn schema\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase 'lerna.json':\n\n\t\t\t\t// @ts-ignore\n\t\t\t\thandleSchemaBeforeCompile = (schema: typeof import('../schema/lerna.json')) => {\n\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tschema.properties.command.additionalProperties = false;\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tschema.properties.command.additionalItems = false;\n\n\t\t\t\t\treturn schema\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn downloadJsonAndBuild({\n\t\t\thref,\n\t\t\tskipExists,\n\t\t\thandleSchemaBeforeCompile,\n\t\t});\n\t})\n\t.tap(r => console.log(r.length))\n;\n\n/*\ndownloadJsonAndBuild({\n\thref: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/package.json',\n\tskipExists,\n});\n\ndownloadJsonAndBuild({\n\thref: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/eslintrc.json',\n\tskipExists,\n});\n\ndownloadJsonAndBuild({\n\thref: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/travis.json',\n\tskipExists,\n});\n\ndownloadJsonAndBuild({\n\thref: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/tsconfig.json',\n\tskipExists,\n});\n\ndownloadJsonAndBuild({\n\thref: 'https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/lerna.json',\n\tskipExists,\n});\n */\n\n/*\nBluebird.resolve(axios.get('https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/package.json'))\n\t.then(function (res)\n\t{\n\t\tconsole.log(`downloaded`);\n\n\t\tif (typeof res.data === 'string')\n\t\t{\n\t\t\treturn JSON.parse(res.data)\n\t\t}\n\n\t\treturn res.data\n\t})\n\t.tap(function (data)\n\t{\n\t\treturn fs.writeJSON(path.join(__dirname, '../schema/package.json'), data, {\n\t\t\tspaces: \"\\t\",\n\t\t})\n\t})\n\t.tap(function (data)\n\t{\n\t\tconsole.log(`json saved`);\n\t})\n\t.then(function (data)\n\t{\n\t\tconsole.log(`start compile .d.ts`);\n\n\t\treturn compile(data, 'IPackageJson', {\n\t\t\tenableConstEnums: true,\n\t\t\tunreachableDefinitions: true,\n\t\t})\n\t})\n\t.then(function (ts)\n\t{\n\t\tconsole.log(`compiled`);\n\n\t\treturn fs.writeFile(path.join(__dirname, '../types', 'package.json.d.ts'), ts)\n\t})\n\t.tap(function (data)\n\t{\n\t\tconsole.log(`.d.ts saved`);\n\t})\n;\n*/\n\n"]}
|
package/script/util.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by user on 2019/5/19.
|
|
3
|
+
*/
|
|
4
|
+
import Bluebird from "bluebird";
|
|
5
|
+
import { JSONSchema4 } from 'json-schema';
|
|
6
|
+
export interface IDownloadJsonAndBuildParams {
|
|
7
|
+
href: string;
|
|
8
|
+
saveName?: string;
|
|
9
|
+
savePath?: string;
|
|
10
|
+
compileName?: string;
|
|
11
|
+
savePathCompile?: string;
|
|
12
|
+
saveNameCompile?: string;
|
|
13
|
+
skipExists?: boolean;
|
|
14
|
+
handleSchemaBeforeCompile?<T extends JSONSchema4>(schema: T): T;
|
|
15
|
+
}
|
|
16
|
+
export declare function downloadJsonAndBuild(options: IDownloadJsonAndBuildParams): Bluebird<any>;
|
|
17
|
+
export declare function handleFileName(name: string): string;
|
package/script/util.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Created by user on 2019/5/19.
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleFileName = exports.downloadJsonAndBuild = void 0;
|
|
10
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const axios_1 = __importDefault(require("axios"));
|
|
13
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
14
|
+
const json_schema_to_typescript_1 = require("json-schema-to-typescript");
|
|
15
|
+
function downloadJsonAndBuild(options) {
|
|
16
|
+
if (!options.saveName) {
|
|
17
|
+
options.saveName = path_1.default.basename(options.href);
|
|
18
|
+
}
|
|
19
|
+
if (!options.saveNameCompile) {
|
|
20
|
+
options.saveNameCompile = handleFileName(options.saveName);
|
|
21
|
+
}
|
|
22
|
+
let filePath = path_1.default.join(__dirname, '../', options.savePath || 'schema', options.saveName);
|
|
23
|
+
let filePathCompile = path_1.default.join(__dirname, '..', options.savePathCompile || 'types', options.saveNameCompile);
|
|
24
|
+
let label = `[${path_1.default.basename(options.saveName)}]`;
|
|
25
|
+
console.log(`${options.saveName}\n${options.saveNameCompile}`);
|
|
26
|
+
let { skipExists = true } = options;
|
|
27
|
+
if (skipExists && fs_extra_1.default.existsSync(filePathCompile)) {
|
|
28
|
+
console.warn(label, `skip`);
|
|
29
|
+
return bluebird_1.default.resolve(null);
|
|
30
|
+
}
|
|
31
|
+
return bluebird_1.default.resolve()
|
|
32
|
+
.then(() => axios_1.default.get(options.href, {
|
|
33
|
+
timeout: 10 * 1000,
|
|
34
|
+
}))
|
|
35
|
+
.then(function (res) {
|
|
36
|
+
console.log(label, `downloaded`);
|
|
37
|
+
if (typeof res.data === 'string') {
|
|
38
|
+
return JSON.parse(res.data);
|
|
39
|
+
}
|
|
40
|
+
return res.data;
|
|
41
|
+
})
|
|
42
|
+
.tap(function (data) {
|
|
43
|
+
return fs_extra_1.default.writeJSON(filePath, data, {
|
|
44
|
+
spaces: "\t",
|
|
45
|
+
});
|
|
46
|
+
})
|
|
47
|
+
.tap(function () {
|
|
48
|
+
console.log(label, `json saved`);
|
|
49
|
+
})
|
|
50
|
+
.then(function (data) {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
console.log(label, `start compile .d.ts`);
|
|
53
|
+
return (0, json_schema_to_typescript_1.compile)((_b = (_a = options.handleSchemaBeforeCompile) === null || _a === void 0 ? void 0 : _a.call(options, data)) !== null && _b !== void 0 ? _b : data, 'IMySchema', {
|
|
54
|
+
enableConstEnums: true,
|
|
55
|
+
unreachableDefinitions: true,
|
|
56
|
+
});
|
|
57
|
+
})
|
|
58
|
+
.tap(function (ts) {
|
|
59
|
+
console.log(label, `compiled`);
|
|
60
|
+
return fs_extra_1.default.writeFile(filePathCompile, ts);
|
|
61
|
+
})
|
|
62
|
+
.tap(function () {
|
|
63
|
+
console.log(label, `.d.ts saved`);
|
|
64
|
+
})
|
|
65
|
+
.thenReturn(true);
|
|
66
|
+
}
|
|
67
|
+
exports.downloadJsonAndBuild = downloadJsonAndBuild;
|
|
68
|
+
function handleFileName(name) {
|
|
69
|
+
return name + '.d.ts';
|
|
70
|
+
}
|
|
71
|
+
exports.handleFileName = handleFileName;
|
|
72
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Created by user on 2019/5/19.\n */\n\nimport fs from \"fs-extra\"\nimport http from \"http\"\nimport path from \"path\"\nimport axios from \"axios\"\nimport Bluebird from \"bluebird\"\nimport { compile, compileFromFile } from 'json-schema-to-typescript'\nimport { JSONSchema4 } from 'json-schema';\n\nexport interface IDownloadJsonAndBuildParams\n{\n\thref: string;\n\tsaveName?: string;\n\tsavePath?: string;\n\tcompileName?: string;\n\n\tsavePathCompile?: string;\n\tsaveNameCompile?: string;\n\n\tskipExists?: boolean;\n\n\thandleSchemaBeforeCompile?<T extends JSONSchema4>(schema: T): T;\n\n}\n\nexport function downloadJsonAndBuild(options: IDownloadJsonAndBuildParams)\n{\n\tif (!options.saveName)\n\t{\n\t\toptions.saveName = path.basename(options.href)\n\t}\n\n\tif (!options.saveNameCompile)\n\t{\n\t\toptions.saveNameCompile = handleFileName(options.saveName)\n\t}\n\n\tlet filePath = path.join(__dirname, '../', options.savePath || 'schema', options.saveName);\n\n\tlet filePathCompile = path.join(__dirname, '..', options.savePathCompile || 'types', options.saveNameCompile);\n\n\tlet label = `[${path.basename(options.saveName)}]`;\n\n\tconsole.log(`${options.saveName}\\n${options.saveNameCompile}`);\n\n\tlet { skipExists = true } = options;\n\n\tif (skipExists && fs.existsSync(filePathCompile))\n\t{\n\t\tconsole.warn(label, `skip`);\n\n\t\treturn Bluebird.resolve(null)\n\t}\n\n\treturn Bluebird.resolve()\n\t\t.then(() => axios.get(options.href, {\n\t\t\ttimeout: 10 * 1000,\n\t\t}))\n\t\t.then(function (res)\n\t\t{\n\t\t\tconsole.log(label, `downloaded`);\n\n\t\t\tif (typeof res.data === 'string')\n\t\t\t{\n\t\t\t\treturn JSON.parse(res.data)\n\t\t\t}\n\n\t\t\treturn res.data\n\t\t})\n\t\t.tap(function (data)\n\t\t{\n\t\t\treturn fs.writeJSON(filePath, data, {\n\t\t\t\tspaces: \"\\t\",\n\t\t\t})\n\t\t})\n\t\t.tap(function ()\n\t\t{\n\t\t\tconsole.log(label, `json saved`);\n\t\t})\n\t\t.then(function (data)\n\t\t{\n\t\t\tconsole.log(label, `start compile .d.ts`);\n\n\t\t\treturn compile(options.handleSchemaBeforeCompile?.(data) ?? data, 'IMySchema', {\n\t\t\t\tenableConstEnums: true,\n\t\t\t\tunreachableDefinitions: true,\n\t\t\t})\n\t\t})\n\t\t.tap(function (ts)\n\t\t{\n\t\t\tconsole.log(label, `compiled`);\n\n\t\t\treturn fs.writeFile(filePathCompile, ts)\n\t\t})\n\t\t.tap(function ()\n\t\t{\n\t\t\tconsole.log(label, `.d.ts saved`);\n\t\t})\n\t\t.thenReturn(true)\n\t\t;\n}\n\nexport function handleFileName(name: string)\n{\n\treturn name + '.d.ts';\n}\n"]}
|
package/travis-json.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Created by user on 2019/5/19.
|
|
3
3
|
*/
|
|
4
4
|
import { JSONSchemaForTravisCIConfigurationFiles } from './types/travis.json';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type ILibCore = typeof import('./types/travis.json');
|
|
6
|
+
export type ITravisCI = JSONSchemaForTravisCIConfigurationFiles & {};
|
|
7
7
|
export default ITravisCI;
|
package/tsconfig-json.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Created by user on 2019/5/19.
|
|
3
3
|
*/
|
|
4
4
|
import { JSONSchemaForTheTypeScriptCompilerSConfigurationFile } from './types/tsconfig.json';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type ILibCore = typeof import('./types/tsconfig.json');
|
|
6
|
+
export type ITsconfig = JSONSchemaForTheTypeScriptCompilerSConfigurationFile & {};
|
|
7
7
|
export default ITsconfig;
|
package/types/travis.json.d.ts
CHANGED
package/types/tsconfig.json.d.ts
CHANGED
|
@@ -446,6 +446,7 @@ export interface CompilerOptions {
|
|
|
446
446
|
| "ES2018.Regexp"
|
|
447
447
|
| "ES2019"
|
|
448
448
|
| "ES2019.Array"
|
|
449
|
+
| "ES2019.Intl"
|
|
449
450
|
| "ES2019.Object"
|
|
450
451
|
| "ES2019.String"
|
|
451
452
|
| "ES2019.Symbol"
|
|
@@ -525,6 +526,10 @@ export interface CompilerOptions {
|
|
|
525
526
|
}
|
|
526
527
|
) &
|
|
527
528
|
string)[];
|
|
529
|
+
/**
|
|
530
|
+
* Specify how TypeScript determine a file as module.
|
|
531
|
+
*/
|
|
532
|
+
moduleDetection?: "auto" | "legacy" | "force";
|
|
528
533
|
/**
|
|
529
534
|
* When type checking, take into account `null` and `undefined`.
|
|
530
535
|
*/
|