@teambit/pkg 0.0.554 → 0.0.555
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/dist/pack.task.d.ts +3 -0
- package/dist/package.route.d.ts +8 -1
- package/dist/pkg.main.runtime.d.ts +100 -1
- package/dist/prepare-packages.task.d.ts +14 -0
- package/dist/publish-dry-run.task.d.ts +3 -0
- package/dist/publish.task.d.ts +3 -0
- package/dist/publisher.d.ts +4 -0
- package/package-tar/teambit-pkg-0.0.555.tgz +0 -0
- package/package.json +19 -19
- package/tsconfig.json +0 -1
- package/package-tar/teambit-pkg-0.0.554.tgz +0 -0
package/dist/pack.task.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BuildContext, BuiltTaskResult, BuildTask, TaskLocation } from '@teambit/builder';
|
|
2
2
|
import { Logger } from '@teambit/logger';
|
|
3
3
|
import { Packer } from './packer';
|
|
4
|
+
/**
|
|
5
|
+
* pack components to a .tgz file
|
|
6
|
+
*/
|
|
4
7
|
export declare class PackTask implements BuildTask {
|
|
5
8
|
readonly aspectId: string;
|
|
6
9
|
private packer;
|
package/dist/package.route.d.ts
CHANGED
|
@@ -3,8 +3,15 @@ import { Request, Response, Route } from '@teambit/express';
|
|
|
3
3
|
import { PkgMain } from './pkg.main.runtime';
|
|
4
4
|
export declare const routePath = "package";
|
|
5
5
|
export declare class PackageRoute implements Route {
|
|
6
|
+
/**
|
|
7
|
+
* pkg extension.
|
|
8
|
+
*/
|
|
6
9
|
private pkg;
|
|
7
|
-
constructor(
|
|
10
|
+
constructor(
|
|
11
|
+
/**
|
|
12
|
+
* pkg extension.
|
|
13
|
+
*/
|
|
14
|
+
pkg: PkgMain);
|
|
8
15
|
route: string;
|
|
9
16
|
method: string;
|
|
10
17
|
middlewares: ((req: Request, res: Response) => Promise<import("express").Response<any>>)[];
|
|
@@ -19,12 +19,30 @@ export interface PackageJsonProps {
|
|
|
19
19
|
}
|
|
20
20
|
export declare type PackageJsonPropsRegistry = SlotRegistry<PackageJsonProps>;
|
|
21
21
|
export declare type PkgExtensionConfig = {};
|
|
22
|
+
/**
|
|
23
|
+
* Config for variants
|
|
24
|
+
*/
|
|
22
25
|
export declare type ComponentPkgExtensionConfig = {
|
|
26
|
+
/**
|
|
27
|
+
* properties to add to the package.json of the component.
|
|
28
|
+
*/
|
|
23
29
|
packageJson: Record<string, any>;
|
|
24
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Data stored in the component
|
|
33
|
+
*/
|
|
25
34
|
export declare type ComponentPkgExtensionData = {
|
|
35
|
+
/**
|
|
36
|
+
* properties to add to the package.json of the component.
|
|
37
|
+
*/
|
|
26
38
|
packageJsonModification: Record<string, any>;
|
|
39
|
+
/**
|
|
40
|
+
* Final package.json after creating tar file
|
|
41
|
+
*/
|
|
27
42
|
pkgJson?: Record<string, any>;
|
|
43
|
+
/**
|
|
44
|
+
* Checksum of the tar file
|
|
45
|
+
*/
|
|
28
46
|
checksum?: string;
|
|
29
47
|
};
|
|
30
48
|
declare type ComponentPackageManifest = {
|
|
@@ -41,15 +59,33 @@ declare type VersionPackageManifest = {
|
|
|
41
59
|
};
|
|
42
60
|
};
|
|
43
61
|
export declare class PkgMain {
|
|
62
|
+
/**
|
|
63
|
+
* logger extension
|
|
64
|
+
*/
|
|
44
65
|
readonly logger: Logger;
|
|
66
|
+
/**
|
|
67
|
+
* pkg extension configuration.
|
|
68
|
+
*/
|
|
45
69
|
readonly config: PkgExtensionConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Registry for changes by other extensions.
|
|
72
|
+
*/
|
|
46
73
|
private packageJsonPropsRegistry;
|
|
47
74
|
private workspace;
|
|
48
75
|
private scope;
|
|
49
76
|
private builder;
|
|
77
|
+
/**
|
|
78
|
+
* A utils class to packing components into tarball
|
|
79
|
+
*/
|
|
50
80
|
private packer;
|
|
81
|
+
/**
|
|
82
|
+
* envs extension.
|
|
83
|
+
*/
|
|
51
84
|
private envs;
|
|
52
85
|
private componentAspect;
|
|
86
|
+
/**
|
|
87
|
+
* keep it as public. external env might want to register it to the snap pipeline
|
|
88
|
+
*/
|
|
53
89
|
publishTask: PublishTask;
|
|
54
90
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
55
91
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
@@ -67,18 +103,81 @@ export declare class PkgMain {
|
|
|
67
103
|
ComponentMain,
|
|
68
104
|
GraphqlMain
|
|
69
105
|
], config: PkgExtensionConfig, [packageJsonPropsRegistry]: [PackageJsonPropsRegistry]): Promise<PkgMain>;
|
|
106
|
+
/**
|
|
107
|
+
* get the package name of a component.
|
|
108
|
+
*/
|
|
70
109
|
getPackageName(component: Component): string;
|
|
110
|
+
/**
|
|
111
|
+
* returns the package path in the /node_modules/ folder
|
|
112
|
+
*/
|
|
71
113
|
getModulePath(component: Component, options?: {
|
|
72
114
|
absPath?: boolean;
|
|
73
115
|
}): string;
|
|
74
|
-
|
|
116
|
+
/**
|
|
117
|
+
*Creates an instance of PkgExtension.
|
|
118
|
+
* @param {PkgExtensionConfig} config
|
|
119
|
+
* @param {PackageJsonPropsRegistry} packageJsonPropsRegistry
|
|
120
|
+
* @param {Packer} packer
|
|
121
|
+
* @memberof PkgExtension
|
|
122
|
+
*/
|
|
123
|
+
constructor(
|
|
124
|
+
/**
|
|
125
|
+
* logger extension
|
|
126
|
+
*/
|
|
127
|
+
logger: Logger,
|
|
128
|
+
/**
|
|
129
|
+
* pkg extension configuration.
|
|
130
|
+
*/
|
|
131
|
+
config: PkgExtensionConfig,
|
|
132
|
+
/**
|
|
133
|
+
* Registry for changes by other extensions.
|
|
134
|
+
*/
|
|
135
|
+
packageJsonPropsRegistry: PackageJsonPropsRegistry, workspace: Workspace, scope: ScopeMain, builder: BuilderMain,
|
|
136
|
+
/**
|
|
137
|
+
* A utils class to packing components into tarball
|
|
138
|
+
*/
|
|
139
|
+
packer: Packer,
|
|
140
|
+
/**
|
|
141
|
+
* envs extension.
|
|
142
|
+
*/
|
|
143
|
+
envs: EnvsMain, componentAspect: ComponentMain,
|
|
144
|
+
/**
|
|
145
|
+
* keep it as public. external env might want to register it to the snap pipeline
|
|
146
|
+
*/
|
|
147
|
+
publishTask: PublishTask);
|
|
148
|
+
/**
|
|
149
|
+
* register changes in the package.json
|
|
150
|
+
*/
|
|
75
151
|
registerPackageJsonNewProps(props: PackageJsonProps): void;
|
|
152
|
+
/**
|
|
153
|
+
* Pack a component and generate a tarball suitable for npm registry
|
|
154
|
+
*
|
|
155
|
+
* @param {string} componentId
|
|
156
|
+
* @param {(string | undefined)} scopePath
|
|
157
|
+
* @param {string} outDir
|
|
158
|
+
* @param {boolean} [prefix=false]
|
|
159
|
+
* @param {boolean} [override=false]
|
|
160
|
+
* @param {boolean} [keep=false]
|
|
161
|
+
* @returns {Promise<PackResult>}
|
|
162
|
+
* @memberof PkgExtension
|
|
163
|
+
*/
|
|
76
164
|
packComponent(componentId: string, scopePath: string | undefined, options: PackOptions): Promise<PackResult>;
|
|
165
|
+
/**
|
|
166
|
+
* Merge the configs provided by:
|
|
167
|
+
* 1. envs configured in the component - via getPackageJsonProps method
|
|
168
|
+
* 2. extensions that registered to the registerPackageJsonNewProps slot (and configured for the component)
|
|
169
|
+
* 3. props defined by the user (they are the strongest one)
|
|
170
|
+
*/
|
|
77
171
|
mergePackageJsonProps(component: Component): Promise<PackageJsonProps>;
|
|
78
172
|
getPackageJsonModifications(component: Component): Record<string, any>;
|
|
79
173
|
getPkgArtifact(component: Component): Promise<PkgArtifact>;
|
|
80
174
|
getManifest(component: Component): Promise<ComponentPackageManifest>;
|
|
81
175
|
private getAllSnapsManifests;
|
|
176
|
+
/**
|
|
177
|
+
* Check if the component should be fetched from bit registry or from another registry
|
|
178
|
+
* This will usually determined by the latest version of the component
|
|
179
|
+
* @param component
|
|
180
|
+
*/
|
|
82
181
|
isPublishedToExternalRegistry(component: Component): boolean;
|
|
83
182
|
private getComponentBuildData;
|
|
84
183
|
getSnapManifest(component: Component, snap: Snap): Promise<VersionPackageManifest | undefined>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BuildContext, BuiltTaskResult, BuildTask } from '@teambit/builder';
|
|
2
2
|
import { Logger } from '@teambit/logger';
|
|
3
|
+
/**
|
|
4
|
+
* prepare packages for publishing.
|
|
5
|
+
*/
|
|
3
6
|
export declare class PreparePackagesTask implements BuildTask {
|
|
4
7
|
readonly aspectId: string;
|
|
5
8
|
private logger;
|
|
@@ -7,8 +10,19 @@ export declare class PreparePackagesTask implements BuildTask {
|
|
|
7
10
|
readonly location = "end";
|
|
8
11
|
constructor(aspectId: string, logger: Logger);
|
|
9
12
|
execute(context: BuildContext): Promise<BuiltTaskResult>;
|
|
13
|
+
/**
|
|
14
|
+
* remove the source files and copy the dists files
|
|
15
|
+
* into the root of the capsule.
|
|
16
|
+
* this is needed when components import from other components internal paths. without this task,
|
|
17
|
+
* the internal paths are the source, so node will throw an error when trying to use them. this
|
|
18
|
+
* task makes sure that the internal paths point to the consumable code (dists).
|
|
19
|
+
*/
|
|
10
20
|
private executeDistAsRootTask;
|
|
11
21
|
private removeSourceFiles;
|
|
12
22
|
private moveDistToRoot;
|
|
23
|
+
/**
|
|
24
|
+
* by default, the "main" prop points to the dist file (e.g. "dist/index./js").
|
|
25
|
+
* here, we have to change it because there is no dist dir anymore.
|
|
26
|
+
*/
|
|
13
27
|
private updatePackageJson;
|
|
14
28
|
}
|
|
@@ -2,6 +2,9 @@ import { BuildContext, BuiltTaskResult, BuildTask } from '@teambit/builder';
|
|
|
2
2
|
import { Logger } from '@teambit/logger';
|
|
3
3
|
import { Publisher } from './publisher';
|
|
4
4
|
import { Packer } from './packer';
|
|
5
|
+
/**
|
|
6
|
+
* publish build task is running "publish --dry-run" to avoid later npm errors during export
|
|
7
|
+
*/
|
|
5
8
|
export declare class PublishDryRunTask implements BuildTask {
|
|
6
9
|
readonly aspectId: string;
|
|
7
10
|
private publisher;
|
package/dist/publish.task.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BuildContext, BuiltTaskResult, BuildTask, TaskLocation } from '@teambit/builder';
|
|
2
2
|
import { Logger } from '@teambit/logger';
|
|
3
3
|
import { Publisher } from './publisher';
|
|
4
|
+
/**
|
|
5
|
+
* publish components by running "npm publish"
|
|
6
|
+
*/
|
|
4
7
|
export declare class PublishTask implements BuildTask {
|
|
5
8
|
readonly aspectId: string;
|
|
6
9
|
private publisher;
|
package/dist/publisher.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export declare class Publisher {
|
|
|
21
21
|
private publishOneCapsule;
|
|
22
22
|
private getTagFlagForPreRelease;
|
|
23
23
|
private getComponentCapsules;
|
|
24
|
+
/**
|
|
25
|
+
* only components that use pkg extension and configure "publishConfig" with their own registry
|
|
26
|
+
* or custom "name", should be published. ignore the rest.
|
|
27
|
+
*/
|
|
24
28
|
private getIdsToPublish;
|
|
25
29
|
shouldPublish(extensions: ExtensionDataList): boolean;
|
|
26
30
|
private getExtraArgsFromConfig;
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/pkg",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.555",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/pkg/pkg",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.pkg",
|
|
8
8
|
"name": "pkg",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.555"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"p-map-series": "2.1.0",
|
|
23
23
|
"@babel/runtime": "7.12.18",
|
|
24
24
|
"core-js": "^3.0.0",
|
|
25
|
-
"@teambit/cli": "0.0.
|
|
26
|
-
"@teambit/builder": "0.0.
|
|
27
|
-
"@teambit/logger": "0.0.
|
|
28
|
-
"@teambit/component": "0.0.
|
|
29
|
-
"@teambit/express": "0.0.
|
|
30
|
-
"@teambit/isolator": "0.0.
|
|
31
|
-
"@teambit/scope": "0.0.
|
|
32
|
-
"@teambit/graphql": "0.0.
|
|
33
|
-
"@teambit/bit-error": "0.0.
|
|
34
|
-
"@teambit/dependency-resolver": "0.0.
|
|
35
|
-
"@teambit/envs": "0.0.
|
|
36
|
-
"@teambit/workspace": "0.0.
|
|
37
|
-
"@teambit/compiler": "0.0.
|
|
38
|
-
"@teambit/legacy-bit-id": "0.0.
|
|
25
|
+
"@teambit/cli": "0.0.386",
|
|
26
|
+
"@teambit/builder": "0.0.555",
|
|
27
|
+
"@teambit/logger": "0.0.471",
|
|
28
|
+
"@teambit/component": "0.0.555",
|
|
29
|
+
"@teambit/express": "0.0.475",
|
|
30
|
+
"@teambit/isolator": "0.0.555",
|
|
31
|
+
"@teambit/scope": "0.0.555",
|
|
32
|
+
"@teambit/graphql": "0.0.555",
|
|
33
|
+
"@teambit/bit-error": "0.0.372",
|
|
34
|
+
"@teambit/dependency-resolver": "0.0.555",
|
|
35
|
+
"@teambit/envs": "0.0.555",
|
|
36
|
+
"@teambit/workspace": "0.0.555",
|
|
37
|
+
"@teambit/compiler": "0.0.555",
|
|
38
|
+
"@teambit/legacy-bit-id": "0.0.375"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/mime": "2.0.3",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@types/jest": "^26.0.0",
|
|
48
48
|
"@types/react-dom": "^17.0.5",
|
|
49
49
|
"@types/node": "12.20.4",
|
|
50
|
-
"@teambit/pkg.aspect-docs.pkg": "0.0.
|
|
50
|
+
"@teambit/pkg.aspect-docs.pkg": "0.0.105"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@teambit/legacy": "1.0.
|
|
53
|
+
"@teambit/legacy": "1.0.172",
|
|
54
54
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
55
55
|
"react": "^16.8.0 || ^17.0.0"
|
|
56
56
|
},
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"react": "-"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@teambit/legacy": "1.0.
|
|
81
|
+
"@teambit/legacy": "1.0.172",
|
|
82
82
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
83
83
|
"react": "^16.8.0 || ^17.0.0"
|
|
84
84
|
}
|
package/tsconfig.json
CHANGED
|
Binary file
|