@teambit/pkg 0.0.553 → 0.0.557

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.
Files changed (43) hide show
  1. package/dist/pack.task.d.ts +3 -0
  2. package/dist/package.route.d.ts +8 -1
  3. package/dist/pkg.main.runtime.d.ts +100 -1
  4. package/dist/pkg.main.runtime.js +14 -4
  5. package/dist/pkg.main.runtime.js.map +1 -1
  6. package/dist/prepare-packages.task.d.ts +18 -1
  7. package/dist/prepare-packages.task.js +19 -1
  8. package/dist/prepare-packages.task.js.map +1 -1
  9. package/dist/publish-dry-run.task.d.ts +3 -0
  10. package/dist/publish.task.d.ts +3 -0
  11. package/dist/publisher.d.ts +4 -0
  12. package/dist/write-npm-ignore.d.ts +3 -0
  13. package/dist/write-npm-ignore.js +48 -0
  14. package/dist/write-npm-ignore.js.map +1 -0
  15. package/package.json +27 -19
  16. package/tsconfig.json +1 -2
  17. package/exceptions/index.ts +0 -3
  18. package/exceptions/package-tar-filet-not-found.ts +0 -8
  19. package/exceptions/pkg-artifact-not-found.ts +0 -8
  20. package/exceptions/scope-not-found.ts +0 -14
  21. package/index.ts +0 -3
  22. package/pack.cmd.tsx +0 -68
  23. package/pack.task.ts +0 -24
  24. package/package-dependency/index.ts +0 -2
  25. package/package-dependency/package-dependency-factory.ts +0 -71
  26. package/package-dependency/package-dependency.ts +0 -20
  27. package/package-tar/teambit-pkg-0.0.553.tgz +0 -0
  28. package/package.fragment.ts +0 -24
  29. package/package.route.ts +0 -32
  30. package/packer.ts +0 -131
  31. package/pkg-artifact.ts +0 -5
  32. package/pkg.aspect.ts +0 -5
  33. package/pkg.docs.mdx +0 -9
  34. package/pkg.graphql.ts +0 -59
  35. package/pkg.main.runtime.ts +0 -423
  36. package/pkg.service.tsx +0 -39
  37. package/prepare-packages.task.ts +0 -74
  38. package/publish-dry-run.task.ts +0 -44
  39. package/publish.cmd.tsx +0 -57
  40. package/publish.task.ts +0 -33
  41. package/publisher.ts +0 -158
  42. package/types/asset.d.ts +0 -29
  43. package/types/style.d.ts +0 -42
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/pkg",
3
- "version": "0.0.553",
3
+ "version": "0.0.557",
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.553"
9
+ "version": "0.0.557"
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.384",
26
- "@teambit/builder": "0.0.553",
27
- "@teambit/logger": "0.0.469",
28
- "@teambit/component": "0.0.553",
29
- "@teambit/express": "0.0.473",
30
- "@teambit/isolator": "0.0.553",
31
- "@teambit/scope": "0.0.553",
32
- "@teambit/graphql": "0.0.553",
33
- "@teambit/bit-error": "0.0.370",
34
- "@teambit/dependency-resolver": "0.0.553",
35
- "@teambit/envs": "0.0.553",
36
- "@teambit/workspace": "0.0.553",
37
- "@teambit/compiler": "0.0.553",
38
- "@teambit/legacy-bit-id": "0.0.373"
25
+ "@teambit/cli": "0.0.388",
26
+ "@teambit/builder": "0.0.557",
27
+ "@teambit/logger": "0.0.473",
28
+ "@teambit/component": "0.0.557",
29
+ "@teambit/express": "0.0.477",
30
+ "@teambit/isolator": "0.0.557",
31
+ "@teambit/scope": "0.0.557",
32
+ "@teambit/graphql": "0.0.557",
33
+ "@teambit/bit-error": "0.0.374",
34
+ "@teambit/dependency-resolver": "0.0.557",
35
+ "@teambit/envs": "0.0.557",
36
+ "@teambit/workspace": "0.0.557",
37
+ "@teambit/compiler": "0.0.557",
38
+ "@teambit/legacy-bit-id": "0.0.377"
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.103"
50
+ "@teambit/pkg.aspect-docs.pkg": "0.0.107"
51
51
  },
52
52
  "peerDependencies": {
53
- "@teambit/legacy": "1.0.170",
53
+ "@teambit/legacy": "1.0.174",
54
54
  "react-dom": "^16.8.0 || ^17.0.0",
55
55
  "react": "^16.8.0 || ^17.0.0"
56
56
  },
@@ -78,12 +78,20 @@
78
78
  "react": "-"
79
79
  },
80
80
  "peerDependencies": {
81
- "@teambit/legacy": "1.0.170",
81
+ "@teambit/legacy": "1.0.174",
82
82
  "react-dom": "^16.8.0 || ^17.0.0",
83
83
  "react": "^16.8.0 || ^17.0.0"
84
84
  }
85
85
  }
86
86
  },
87
+ "files": [
88
+ "dist",
89
+ "!dist/tsconfig.tsbuildinfo",
90
+ "README.md",
91
+ "README.mdx",
92
+ "*.js",
93
+ "*.json"
94
+ ],
87
95
  "private": false,
88
96
  "engines": {
89
97
  "node": ">=12.22.0"
package/tsconfig.json CHANGED
@@ -15,9 +15,9 @@
15
15
  "skipLibCheck": true,
16
16
  "moduleResolution": "node",
17
17
  "esModuleInterop": true,
18
- "outDir": "dist",
19
18
  "composite": true,
20
19
  "emitDeclarationOnly": true,
20
+ "outDir": "dist",
21
21
  "experimentalDecorators": true,
22
22
  "emitDecoratorMetadata": true,
23
23
  "allowSyntheticDefaultImports": true,
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },
@@ -1,3 +0,0 @@
1
- export { PkgArtifactNotFound } from './pkg-artifact-not-found';
2
- export { ScopeNotFound } from './scope-not-found';
3
- export { PackageTarFiletNotFound } from './package-tar-filet-not-found';
@@ -1,8 +0,0 @@
1
- import { ComponentID } from '@teambit/component';
2
- import { BitError } from '@teambit/bit-error';
3
-
4
- export class PackageTarFiletNotFound extends BitError {
5
- constructor(readonly componentId: ComponentID) {
6
- super(`package tar file artifact for component ${componentId.toString()} was not found`);
7
- }
8
- }
@@ -1,8 +0,0 @@
1
- import { ComponentID } from '@teambit/component';
2
- import { BitError } from '@teambit/bit-error';
3
-
4
- export class PkgArtifactNotFound extends BitError {
5
- constructor(readonly componentId: ComponentID) {
6
- super(`pkg artifact for component ${componentId.toString()} was not found`);
7
- }
8
- }
@@ -1,14 +0,0 @@
1
- import { BitError } from '@teambit/bit-error';
2
-
3
- export class ScopeNotFound extends BitError {
4
- constructor(readonly scopePath?: string) {
5
- super(generateMessage(scopePath));
6
- }
7
- }
8
-
9
- function generateMessage(scopePath?: string) {
10
- if (scopePath) {
11
- return `scope not found at ${scopePath}`;
12
- }
13
- return 'scope not found';
14
- }
package/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export type { PkgMain, PackageJsonProps } from './pkg.main.runtime';
2
- export { PackageDependency, PackageDependencyFactory } from './package-dependency';
3
- export { PkgAspect } from './pkg.aspect';
package/pack.cmd.tsx DELETED
@@ -1,68 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import { Command, CommandOptions } from '@teambit/cli';
3
- import chalk from 'chalk';
4
-
5
- import { Packer, PackOptions } from './packer';
6
-
7
- type PackArgs = [string, string];
8
- type PackCmdOptions = {
9
- outDir?: string;
10
- override?: boolean;
11
- prefix?: boolean;
12
- keep?: boolean;
13
- // useCapsule?: boolean;
14
- };
15
-
16
- export class PackCmd implements Command {
17
- name = 'pack <componentId> [scopePath]';
18
- description = 'create tar for npm publish';
19
- options = [
20
- ['d', 'out-dir <out-dir>', 'directory to put the result tar file'],
21
- ['o', 'override', 'override existing pack file'],
22
- ['k', 'keep', 'should keep isolated environment [default = false]'],
23
- ['p', 'prefix', 'keep custom (binding) prefix'],
24
- // ['c', 'use-capsule', 'isolate using the capsule and pack on the capsule'],
25
- ['j', 'json', 'return the output as JSON'],
26
- ] as CommandOptions;
27
- shortDescription = '';
28
- alias = '';
29
- group = 'collaborate';
30
-
31
- constructor(private packer: Packer) {}
32
-
33
- async report(args: PackArgs, options: PackCmdOptions) {
34
- const packResult = await this.json(args, options);
35
- const warnings: any = packResult.data?.warnings || [];
36
- const warningsOutput: any = warnings.map((warning) => chalk.yellow(warning)).join('\n');
37
- const errors: any = packResult.data?.errors || [];
38
- const errorsOutput: any = errors.map((error) => chalk.yellow(error)).join('\n');
39
- const tarPathOutput = packResult.data.metadata?.tarPath
40
- ? chalk.green(`tar path for component ${packResult.data.id}: ${packResult.data.metadata?.tarPath}`)
41
- : '';
42
- return `${warningsOutput}\n${errorsOutput}\n${tarPathOutput}`;
43
- }
44
-
45
- async json([componentId, scopePath]: PackArgs, options: PackCmdOptions) {
46
- const compId = typeof componentId === 'string' ? componentId : componentId[0];
47
- let scopePathStr: string | undefined;
48
- if (scopePath) {
49
- scopePathStr = typeof scopePath !== 'string' ? scopePath[0] : scopePath;
50
- }
51
-
52
- const concreteOpts: PackOptions = {
53
- writeOptions: {
54
- outDir: options.outDir,
55
- override: options.override,
56
- },
57
- prefix: options.prefix,
58
- keep: options.keep,
59
- // useCapsule: options.useCapsule,
60
- };
61
-
62
- const packResult = await this.packer.packComponent(compId, scopePathStr, concreteOpts);
63
- return {
64
- data: packResult,
65
- code: 0,
66
- };
67
- }
68
- }
package/pack.task.ts DELETED
@@ -1,24 +0,0 @@
1
- import { BuildContext, BuiltTaskResult, BuildTask, TaskLocation } from '@teambit/builder';
2
- import { Logger } from '@teambit/logger';
3
- import { Packer } from './packer';
4
-
5
- /**
6
- * pack components to a .tgz file
7
- */
8
- export class PackTask implements BuildTask {
9
- readonly name = 'PackComponents';
10
- readonly location: TaskLocation = 'end';
11
- constructor(readonly aspectId: string, private packer: Packer, private logger: Logger) {}
12
-
13
- async execute(context: BuildContext): Promise<BuiltTaskResult> {
14
- const capsules = context.capsuleNetwork.seedersCapsules;
15
- this.logger.info(`going to run pack on ${capsules.length} capsules`);
16
- const packResults = await this.packer.packMultipleCapsules(capsules, { override: true }, false, true);
17
- const packArtifactsDefs = this.packer.getArtifactDefInCapsule();
18
-
19
- return {
20
- componentsResults: packResults,
21
- artifacts: [packArtifactsDefs],
22
- };
23
- }
24
- }
@@ -1,2 +0,0 @@
1
- export { PackageDependency, SerializedPackageDependency } from './package-dependency';
2
- export { PackageDependencyFactory } from './package-dependency-factory';
@@ -1,71 +0,0 @@
1
- import {
2
- DependencyLifecycleType,
3
- SerializedDependency,
4
- DependencyFactory,
5
- DependencyList,
6
- } from '@teambit/dependency-resolver';
7
- import LegacyComponent from '@teambit/legacy/dist/consumer/component';
8
- import { PackageDependency, SerializedPackageDependency } from './package-dependency';
9
-
10
- const TYPE = 'package';
11
- // TODO: think about where is the right place to put this
12
- export class PackageDependencyFactory implements DependencyFactory {
13
- // parse<PackageDependency, SerializedDependency>(serialized: SerializedDependency): PackageDependency {
14
- // return new PackageDependency(serialized.id, serialized.version, serialized.type, serialized.lifecycle as DependencyLifecycleType);
15
- // }
16
- type: string;
17
-
18
- constructor() {
19
- this.type = TYPE;
20
- }
21
-
22
- async parse<PackageDependency, S extends SerializedDependency>(serialized: S): Promise<PackageDependency> {
23
- // return new PackageDependency(serialized.id, serialized.version, serialized.type, serialized.lifecycle as DependencyLifecycleType) as unknown as PackageDependency;
24
- return (new PackageDependency(
25
- serialized.id,
26
- serialized.version,
27
- serialized.lifecycle as DependencyLifecycleType,
28
- serialized.source
29
- ) as unknown) as PackageDependency;
30
- }
31
-
32
- async fromLegacyComponent(legacyComponent: LegacyComponent): Promise<DependencyList> {
33
- const runtimePackageDeps = transformLegacyComponentPackageDepsToSerializedDependency(
34
- legacyComponent.packageDependencies,
35
- 'runtime'
36
- );
37
- const devPackageDeps = transformLegacyComponentPackageDepsToSerializedDependency(
38
- legacyComponent.devPackageDependencies,
39
- 'dev'
40
- );
41
- const peerPackageDeps = transformLegacyComponentPackageDepsToSerializedDependency(
42
- legacyComponent.peerPackageDependencies,
43
- 'peer'
44
- );
45
-
46
- const serializedPackageDeps = runtimePackageDeps.concat(devPackageDeps).concat(peerPackageDeps);
47
- const packageDepsP: Promise<PackageDependency>[] = serializedPackageDeps.map((dep) => this.parse(dep));
48
- const packageDeps: PackageDependency[] = await Promise.all(packageDepsP);
49
- const dependencyList = new DependencyList(packageDeps);
50
- return dependencyList;
51
- }
52
-
53
- // parse: <PackageDependency, SerializedDependency>(serialized: SerializedDependency) => {
54
- // return new PackageDependency(serialized.id, serialized.version, serialized.type, serialized.lifecycle as DependencyLifecycleType);
55
- // }
56
- }
57
-
58
- function transformLegacyComponentPackageDepsToSerializedDependency(
59
- packageDepObj: Record<string, string>,
60
- lifecycle: DependencyLifecycleType
61
- ): SerializedPackageDependency[] {
62
- const res = Object.entries(packageDepObj).map(([packageName, version]) => {
63
- return {
64
- id: packageName,
65
- version,
66
- __type: TYPE,
67
- lifecycle,
68
- };
69
- });
70
- return res;
71
- }
@@ -1,20 +0,0 @@
1
- import {
2
- BaseDependency,
3
- SerializedDependency,
4
- DependencyLifecycleType,
5
- DependencySource,
6
- } from '@teambit/dependency-resolver';
7
-
8
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
9
- export interface SerializedPackageDependency extends SerializedDependency {}
10
-
11
- export class PackageDependency extends BaseDependency {
12
- constructor(id: string, version: string, lifecycle: DependencyLifecycleType, source?: DependencySource) {
13
- super(id, version, lifecycle, source);
14
- this._type = 'package';
15
- }
16
-
17
- getPackageName() {
18
- return this.id;
19
- }
20
- }
Binary file
@@ -1,24 +0,0 @@
1
- import { Component, ShowFragment } from '@teambit/component';
2
- import { PkgMain } from './pkg.main.runtime';
3
-
4
- export class PackageFragment implements ShowFragment {
5
- constructor(private pkg: PkgMain) {}
6
-
7
- title = 'package name';
8
-
9
- async renderRow(component: Component) {
10
- return {
11
- title: this.title,
12
- content: this.pkg.getPackageName(component),
13
- };
14
- }
15
-
16
- async json(component: Component) {
17
- return {
18
- title: this.title,
19
- json: this.pkg.getPackageName(component),
20
- };
21
- }
22
-
23
- weight = 3;
24
- }
package/package.route.ts DELETED
@@ -1,32 +0,0 @@
1
- import { Request, Response, Route } from '@teambit/express';
2
- import mime from 'mime';
3
-
4
- import { PkgMain } from './pkg.main.runtime';
5
-
6
- export const routePath = `package`;
7
- export class PackageRoute implements Route {
8
- constructor(
9
- /**
10
- * pkg extension.
11
- */
12
- private pkg: PkgMain
13
- ) {}
14
-
15
- route = `/${routePath}`;
16
- method = 'get';
17
-
18
- middlewares = [
19
- async (req: Request, res: Response) => {
20
- // @ts-ignore TODO: @guy please fix.
21
- const component: any = req.component as any;
22
- const file = await this.pkg.getPackageTarFile(component);
23
- // TODO: 404 again how to handle.
24
- if (!file) return res.status(404).jsonp({ error: 'not found' });
25
- const contents = file.contents;
26
- const contentType = mime.getType('.tgz');
27
- res.set('Content-disposition', `attachment; filename=${file.basename}`);
28
- if (contentType) res.set('Content-Type', contentType);
29
- return res.send(contents);
30
- },
31
- ];
32
- }
package/packer.ts DELETED
@@ -1,131 +0,0 @@
1
- import _ from 'lodash';
2
- import { ComponentFactory } from '@teambit/component';
3
- import { ComponentResult, ArtifactDefinition } from '@teambit/builder';
4
- import { Capsule, IsolatorMain } from '@teambit/isolator';
5
- import { ScopeMain } from '@teambit/scope';
6
- import LegacyScope from '@teambit/legacy/dist/scope/scope';
7
- import { Packer as LegacyPacker, PackWriteOptions, PackOptions } from '@teambit/legacy/dist/pack';
8
- import { Logger } from '@teambit/logger';
9
- import pMap from 'p-map';
10
-
11
- // @ts-ignore (for some reason the tsc -w not found this)
12
- import { ScopeNotFound } from './exceptions/scope-not-found';
13
-
14
- export { PackOptions };
15
-
16
- export type PackResult = Omit<ComponentResult, 'component'>;
17
- export type PackResultWithId = PackResult & {
18
- id: string;
19
- };
20
-
21
- const DEFAULT_TAR_DIR_IN_CAPSULE = 'package-tar';
22
- const PACK_CONCURRENCY = 10;
23
- export const TAR_FILE_ARTIFACT_NAME = 'package tar file';
24
-
25
- export class Packer {
26
- legacyPacker: LegacyPacker;
27
- constructor(
28
- private isolator: IsolatorMain,
29
- private logger: Logger,
30
- private host: ComponentFactory,
31
- private scope?: ScopeMain
32
- ) {
33
- this.legacyPacker = new LegacyPacker(this.logger);
34
- }
35
-
36
- async packComponent(
37
- componentId: string,
38
- scopePath: string | undefined,
39
- options: PackOptions
40
- ): Promise<PackResultWithId> {
41
- // By default do not load scope from cache when packing
42
- const loadScopeFromCache =
43
- options && options.loadScopeFromCache !== undefined ? !!options.loadScopeFromCache : false;
44
- const legacyScope = scopePath ? await LegacyScope.load(scopePath, loadScopeFromCache) : this.scope?.legacyScope;
45
- if (!legacyScope) {
46
- throw new ScopeNotFound(scopePath);
47
- }
48
- // Or the scope we are operate on is legacy, or the host (workspace) is legacy
49
- const isLegacyScope = (scopePath && legacyScope.isLegacy) || this.host.isLegacy;
50
-
51
- // Handle legacy
52
- if (isLegacyScope) {
53
- const res = await this.legacyPacker.pack(componentId, legacyScope, options);
54
- // @ts-ignore
55
- return Object.assign({}, res, { id: componentId });
56
- }
57
-
58
- const capsule = await this.getCapsule(componentId, legacyScope);
59
- const res = await this.packCapsule(capsule, options.writeOptions, options.dryRun);
60
-
61
- return Object.assign({}, _.omit(res, ['component']), { id: componentId });
62
- }
63
-
64
- async packMultipleCapsules(
65
- capsules: Capsule[],
66
- writeOptions: PackWriteOptions = { override: true },
67
- dryRun = false,
68
- omitFullTarPath = false
69
- ): Promise<ComponentResult[]> {
70
- // const description = `packing components${dryRun ? ' (dry-run)' : ''}`;
71
- const results = pMap(
72
- capsules,
73
- (capsule) => {
74
- return this.packCapsule(capsule, writeOptions, dryRun, omitFullTarPath);
75
- },
76
- { concurrency: PACK_CONCURRENCY }
77
- );
78
- return results;
79
- }
80
-
81
- async packCapsule(
82
- capsule: Capsule,
83
- writeOptions: PackWriteOptions = { override: true },
84
- dryRun = false,
85
- omitFullTarPath = false
86
- ): Promise<ComponentResult> {
87
- const concreteWriteOpts = writeOptions;
88
- // Set the package-tar as out dir to easily read the tar later
89
- concreteWriteOpts.outDir = concreteWriteOpts.outDir ?? DEFAULT_TAR_DIR_IN_CAPSULE;
90
- const packResult = await this.legacyPacker.npmPack(
91
- capsule.path,
92
- concreteWriteOpts.outDir || capsule.path,
93
- concreteWriteOpts.override,
94
- dryRun
95
- );
96
- const component = capsule.component;
97
- const fieldsToRemove: string[] = [];
98
- if (omitFullTarPath) {
99
- fieldsToRemove.push('tarPath');
100
- }
101
- // TODO: @gilad please make sure to fix this type error now that I added lodash types
102
- const metadata = _(packResult.metadata).omitBy(_.isUndefined).omit(fieldsToRemove).value() as any;
103
-
104
- return {
105
- component,
106
- metadata,
107
- errors: packResult.errors,
108
- warnings: packResult.warnings,
109
- startTime: packResult.startTime,
110
- endTime: packResult.endTime,
111
- };
112
- }
113
-
114
- getArtifactDefInCapsule(outDir?: string): ArtifactDefinition {
115
- const rootDir = outDir || DEFAULT_TAR_DIR_IN_CAPSULE;
116
- const def: ArtifactDefinition = {
117
- name: TAR_FILE_ARTIFACT_NAME,
118
- globPatterns: [`${rootDir}/*.tgz`],
119
- };
120
- return def;
121
- }
122
-
123
- private async getCapsule(componentIdStr: string, legacyScope: LegacyScope): Promise<Capsule> {
124
- const componentId = await this.host.resolveComponentId(componentIdStr);
125
- const network = await this.isolator.isolateComponents([componentId], { baseDir: this.host.path }, legacyScope);
126
- const capsule = network.seedersCapsules.getCapsule(componentId);
127
-
128
- if (!capsule) throw new Error(`capsule not found for ${componentId}`);
129
- return capsule;
130
- }
131
- }
package/pkg-artifact.ts DELETED
@@ -1,5 +0,0 @@
1
- import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
2
-
3
- export class PkgArtifact {
4
- constructor(private artifacts: AbstractVinyl[]) {}
5
- }
package/pkg.aspect.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const PkgAspect = Aspect.create({
4
- id: 'teambit.pkg/pkg',
5
- });
package/pkg.docs.mdx DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- displayName: PKG
3
- description: Generates, packs and publishes component packages
4
- labels: ['packages', 'aspect', 'pkg']
5
- ---
6
-
7
- import { Pkg } from '@teambit/pkg.aspect-docs.pkg';
8
-
9
- <Pkg />
package/pkg.graphql.ts DELETED
@@ -1,59 +0,0 @@
1
- import { Component } from '@teambit/component';
2
- import { Schema } from '@teambit/graphql';
3
- import gql from 'graphql-tag';
4
-
5
- import { PkgMain } from './pkg.main.runtime';
6
-
7
- export function pkgSchema(pkg: PkgMain): Schema {
8
- return {
9
- typeDefs: gql`
10
- extend type Component {
11
- packageManifest: PackageManifest
12
-
13
- # package name of the component.
14
- packageName: String!
15
- }
16
-
17
- type TarDist {
18
- tarball: String
19
- shasum: String
20
- }
21
-
22
- type VersionsPackageManifest {
23
- name: String
24
- version: String
25
- main: String
26
- dependencies: JSONObject
27
- devDependencies: JSONObject
28
- peerDependencies: JSONObject
29
- scripts: JSONObject
30
- dist: TarDist
31
- }
32
-
33
- type PackageManifest {
34
- name: String
35
- distTags: JSONObject
36
- externalRegistry: Boolean
37
- versions(version: String): [VersionsPackageManifest]
38
- }
39
- `,
40
- resolvers: {
41
- Component: {
42
- packageName: (component: Component) => {
43
- return pkg.getPackageName(component);
44
- },
45
- packageManifest: (component: Component) => {
46
- return pkg.getManifest(component);
47
- },
48
- },
49
- PackageManifest: {
50
- versions: (parent, { version }) => {
51
- if (version) {
52
- return parent.versions.filter((v) => v.version === version);
53
- }
54
- return parent.versions;
55
- },
56
- },
57
- },
58
- };
59
- }