@teambit/application 0.0.408 → 0.0.411
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/app-build-context.d.ts +4 -0
- package/dist/app-build-context.js.map +1 -1
- package/dist/application.d.ts +4 -0
- package/dist/application.js.map +1 -1
- package/dist/build.task.d.ts +3 -0
- package/dist/build.task.js +40 -3
- package/dist/build.task.js.map +1 -1
- package/package-tar/teambit-application-0.0.411.tgz +0 -0
- package/package.json +12 -12
- package/{preview-1655695598583.js → preview-1655954795354.js} +2 -2
- package/package-tar/teambit-application-0.0.408.tgz +0 -0
|
@@ -14,4 +14,8 @@ export interface AppBuildContext extends BuildContext {
|
|
|
14
14
|
* app Component object
|
|
15
15
|
*/
|
|
16
16
|
appComponent: Component;
|
|
17
|
+
/**
|
|
18
|
+
* A path (relative to the capsule root) that contain artifacts that will be picked and store by default
|
|
19
|
+
*/
|
|
20
|
+
artifactsDir: string;
|
|
17
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["app-build-context.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Capsule } from '@teambit/isolator';\nimport { BuildContext } from '@teambit/builder';\n\nexport interface AppBuildContext extends BuildContext {\n /**\n * name of the type of the app. e.g. `react-app`\n */\n name: string;\n /**\n * Application capsule\n */\n capsule: Capsule;\n /**\n * app Component object\n */\n appComponent: Component;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["app-build-context.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Capsule } from '@teambit/isolator';\nimport { BuildContext } from '@teambit/builder';\n\nexport interface AppBuildContext extends BuildContext {\n /**\n * name of the type of the app. e.g. `react-app`\n */\n name: string;\n /**\n * Application capsule\n */\n capsule: Capsule;\n /**\n * app Component object\n */\n appComponent: Component;\n\n /**\n * A path (relative to the capsule root) that contain artifacts that will be picked and store by default\n */\n artifactsDir: string;\n}\n"],"mappings":""}
|
package/dist/application.d.ts
CHANGED
package/dist/application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["application.ts"],"sourcesContent":["import { AppContext } from './app-context';\nimport { AppDeployContext } from './app-deploy-context';\nimport { AppBuildContext } from './app-build-context';\nimport { AppBuildResult } from './app-build-result';\n\nexport type DeployFn = (context: AppDeployContext) => Promise<void>;\n\nexport interface Application {\n /**\n * name of the application. e.g. ripple-ci.\n */\n name: string;\n\n /**\n * run the application.\n */\n run(context: AppContext): Promise<number | void>;\n\n /**\n * build the application.\n */\n build?(context: AppBuildContext): Promise<AppBuildResult>;\n\n /**\n * application deployment. this is a build task.\n */\n deploy?: DeployFn;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["application.ts"],"sourcesContent":["import { AppContext } from './app-context';\nimport { AppDeployContext } from './app-deploy-context';\nimport { AppBuildContext } from './app-build-context';\nimport { AppBuildResult } from './app-build-result';\n\nexport type DeployFn = (context: AppDeployContext) => Promise<void>;\n\nexport interface Application {\n /**\n * name of the application. e.g. ripple-ci.\n */\n name: string;\n\n /**\n * run the application.\n */\n run(context: AppContext): Promise<number | void>;\n\n /**\n * build the application.\n */\n build?(context: AppBuildContext): Promise<AppBuildResult>;\n\n /**\n * application deployment. this is a build task.\n */\n deploy?: DeployFn;\n\n /**\n * Type of the application\n */\n applicationType?: string;\n}\n"],"mappings":""}
|
package/dist/build.task.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BuildTask, BuiltTaskResult, BuildContext, ComponentResult, ArtifactDefinition } from '@teambit/builder';
|
|
2
2
|
import { ApplicationMain } from './application.main.runtime';
|
|
3
3
|
export declare const BUILD_TASK = "build_application";
|
|
4
|
+
export declare const ARTIFACTS_DIR_NAME = "apps";
|
|
4
5
|
export declare type AppsResults = {
|
|
5
6
|
componentResult: ComponentResult;
|
|
6
7
|
artifacts?: ArtifactDefinition[];
|
|
@@ -16,4 +17,6 @@ export declare class AppsBuildTask implements BuildTask {
|
|
|
16
17
|
readonly location = "end";
|
|
17
18
|
constructor(application: ApplicationMain, opt?: Options);
|
|
18
19
|
execute(context: BuildContext): Promise<BuiltTaskResult>;
|
|
20
|
+
private getArtifactDirectory;
|
|
21
|
+
private getDefaultArtifactDef;
|
|
19
22
|
}
|
package/dist/build.task.js
CHANGED
|
@@ -11,7 +11,7 @@ require("core-js/modules/es.promise.js");
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", {
|
|
12
12
|
value: true
|
|
13
13
|
});
|
|
14
|
-
exports.BUILD_TASK = exports.AppsBuildTask = void 0;
|
|
14
|
+
exports.BUILD_TASK = exports.AppsBuildTask = exports.ARTIFACTS_DIR_NAME = void 0;
|
|
15
15
|
|
|
16
16
|
function _defineProperty2() {
|
|
17
17
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -23,6 +23,16 @@ function _defineProperty2() {
|
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function _path() {
|
|
27
|
+
const data = require("path");
|
|
28
|
+
|
|
29
|
+
_path = function () {
|
|
30
|
+
return data;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
function _pMapSeries() {
|
|
27
37
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
28
38
|
|
|
@@ -33,6 +43,16 @@ function _pMapSeries() {
|
|
|
33
43
|
return data;
|
|
34
44
|
}
|
|
35
45
|
|
|
46
|
+
function _builder() {
|
|
47
|
+
const data = require("@teambit/builder");
|
|
48
|
+
|
|
49
|
+
_builder = function () {
|
|
50
|
+
return data;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
|
|
36
56
|
function _component() {
|
|
37
57
|
const data = require("@teambit/component");
|
|
38
58
|
|
|
@@ -55,6 +75,8 @@ function _application() {
|
|
|
55
75
|
|
|
56
76
|
const BUILD_TASK = 'build_application';
|
|
57
77
|
exports.BUILD_TASK = BUILD_TASK;
|
|
78
|
+
const ARTIFACTS_DIR_NAME = 'apps';
|
|
79
|
+
exports.ARTIFACTS_DIR_NAME = ARTIFACTS_DIR_NAME;
|
|
58
80
|
|
|
59
81
|
class AppsBuildTask {
|
|
60
82
|
constructor(application, opt = {
|
|
@@ -83,11 +105,14 @@ class AppsBuildTask {
|
|
|
83
105
|
const appDeployContext = Object.assign(context, {
|
|
84
106
|
capsule,
|
|
85
107
|
appComponent: component,
|
|
86
|
-
name: app.name
|
|
108
|
+
name: app.name,
|
|
109
|
+
artifactsDir: this.getArtifactDirectory()
|
|
87
110
|
});
|
|
88
111
|
const deployContext = await app.build(appDeployContext);
|
|
112
|
+
const defaultArtifacts = this.getDefaultArtifactDef(app.applicationType || app.name);
|
|
113
|
+
const artifacts = defaultArtifacts.concat(deployContext.artifacts || []);
|
|
89
114
|
return {
|
|
90
|
-
artifacts
|
|
115
|
+
artifacts,
|
|
91
116
|
componentResult: {
|
|
92
117
|
component: capsule.component,
|
|
93
118
|
errors: deployContext.errors,
|
|
@@ -120,6 +145,18 @@ class AppsBuildTask {
|
|
|
120
145
|
};
|
|
121
146
|
}
|
|
122
147
|
|
|
148
|
+
getArtifactDirectory() {
|
|
149
|
+
return (0, _path().join)(_builder().CAPSULE_ARTIFACTS_DIR, ARTIFACTS_DIR_NAME);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
getDefaultArtifactDef(nameSuffix) {
|
|
153
|
+
return [{
|
|
154
|
+
name: `app-build-${nameSuffix}`,
|
|
155
|
+
globPatterns: ['**'],
|
|
156
|
+
rootDir: this.getArtifactDirectory()
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
|
|
123
160
|
}
|
|
124
161
|
|
|
125
162
|
exports.AppsBuildTask = AppsBuildTask;
|
package/dist/build.task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BUILD_TASK","AppsBuildTask","constructor","application","opt","deploy","ApplicationAspect","id","execute","context","apps","listApps","capsuleNetwork","componentsResults","mapSeries","app","aspectId","getAppAspect","name","undefined","capsule","seedersCapsules","getCapsuleIgnoreVersion","ComponentID","fromString","build","component","appDeployContext","Object","assign","appComponent","deployContext","artifacts","componentResult","errors","warnings","_metadata","flatMap","res","filter","a","_componentsResults","map"],"sources":["build.task.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport {
|
|
1
|
+
{"version":3,"names":["BUILD_TASK","ARTIFACTS_DIR_NAME","AppsBuildTask","constructor","application","opt","deploy","ApplicationAspect","id","execute","context","apps","listApps","capsuleNetwork","componentsResults","mapSeries","app","aspectId","getAppAspect","name","undefined","capsule","seedersCapsules","getCapsuleIgnoreVersion","ComponentID","fromString","build","component","appDeployContext","Object","assign","appComponent","artifactsDir","getArtifactDirectory","deployContext","defaultArtifacts","getDefaultArtifactDef","applicationType","artifacts","concat","componentResult","errors","warnings","_metadata","flatMap","res","filter","a","_componentsResults","map","join","CAPSULE_ARTIFACTS_DIR","nameSuffix","globPatterns","rootDir"],"sources":["build.task.ts"],"sourcesContent":["import { join } from 'path';\nimport mapSeries from 'p-map-series';\nimport {\n BuildTask,\n BuiltTaskResult,\n BuildContext,\n ComponentResult,\n ArtifactDefinition,\n CAPSULE_ARTIFACTS_DIR,\n} from '@teambit/builder';\nimport { ComponentID } from '@teambit/component';\nimport { ApplicationAspect } from './application.aspect';\nimport { ApplicationMain } from './application.main.runtime';\nimport { AppBuildContext } from './app-build-context';\n\nexport const BUILD_TASK = 'build_application';\nexport const ARTIFACTS_DIR_NAME = 'apps';\n\nexport type AppsResults = {\n componentResult: ComponentResult;\n artifacts?: ArtifactDefinition[];\n};\n\nexport type Options = {\n deploy: boolean;\n};\nexport class AppsBuildTask implements BuildTask {\n name = BUILD_TASK;\n aspectId = ApplicationAspect.id;\n readonly location = 'end';\n constructor(private application: ApplicationMain, private opt: Options = { deploy: true }) {}\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const apps = this.application.listApps();\n const { capsuleNetwork } = context;\n const componentsResults = await mapSeries(apps, async (app): Promise<AppsResults | undefined> => {\n const aspectId = this.application.getAppAspect(app.name);\n if (!aspectId) return undefined;\n const capsule = capsuleNetwork.seedersCapsules.getCapsuleIgnoreVersion(ComponentID.fromString(aspectId));\n if (!capsule || !app.build) return undefined;\n const { component } = capsule;\n const appDeployContext: AppBuildContext = Object.assign(context, {\n capsule,\n appComponent: component,\n name: app.name,\n artifactsDir: this.getArtifactDirectory(),\n });\n const deployContext = await app.build(appDeployContext);\n const defaultArtifacts: ArtifactDefinition[] = this.getDefaultArtifactDef(app.applicationType || app.name);\n const artifacts = defaultArtifacts.concat(deployContext.artifacts || []);\n\n return {\n artifacts,\n componentResult: {\n component: capsule.component,\n errors: deployContext.errors,\n warnings: deployContext.warnings,\n /**\n * @guysaar223\n * @ram8\n * TODO: we need to think how to pass private metadata between build pipes, maybe create shared context\n * or create new deploy context on builder\n */\n // @ts-ignore\n _metadata: { deployContext },\n },\n };\n });\n\n const artifacts = componentsResults\n .flatMap((res) => {\n return res?.artifacts;\n })\n .filter((a) => !!a) as ArtifactDefinition[];\n const _componentsResults = componentsResults\n .map((res) => {\n return res?.componentResult;\n })\n .filter((a) => !!a) as ComponentResult[];\n return {\n artifacts,\n componentsResults: _componentsResults,\n };\n }\n\n private getArtifactDirectory() {\n return join(CAPSULE_ARTIFACTS_DIR, ARTIFACTS_DIR_NAME);\n }\n\n private getDefaultArtifactDef(nameSuffix: string): ArtifactDefinition[] {\n return [\n {\n name: `app-build-${nameSuffix}`,\n globPatterns: ['**'],\n rootDir: this.getArtifactDirectory(),\n },\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQA;EAAA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AC,IAAD,CAFhB;MAGEC,OAAO,EAAE,KAAKrB,oBAAL;IAHX,CADK,CAAP;EAOD;;AAvE6C"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/application",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.411",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/harmony/application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "application",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.411"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"@babel/runtime": "7.12.18",
|
|
17
17
|
"core-js": "^3.0.0",
|
|
18
18
|
"@teambit/harmony": "0.3.3",
|
|
19
|
-
"@teambit/builder": "0.0.
|
|
20
|
-
"@teambit/component": "0.0.
|
|
21
|
-
"@teambit/isolator": "0.0.
|
|
22
|
-
"@teambit/envs": "0.0.
|
|
19
|
+
"@teambit/builder": "0.0.769",
|
|
20
|
+
"@teambit/component": "0.0.769",
|
|
21
|
+
"@teambit/isolator": "0.0.769",
|
|
22
|
+
"@teambit/envs": "0.0.769",
|
|
23
23
|
"@teambit/cli-table": "0.0.34",
|
|
24
|
-
"@teambit/cli": "0.0.
|
|
25
|
-
"@teambit/aspect-loader": "0.0.
|
|
26
|
-
"@teambit/logger": "0.0.
|
|
27
|
-
"@teambit/workspace": "0.0.
|
|
24
|
+
"@teambit/cli": "0.0.508",
|
|
25
|
+
"@teambit/aspect-loader": "0.0.769",
|
|
26
|
+
"@teambit/logger": "0.0.601",
|
|
27
|
+
"@teambit/workspace": "0.0.769"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/react": "^17.0.8",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/node": "12.20.4"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@teambit/legacy": "1.0.
|
|
39
|
+
"@teambit/legacy": "1.0.288",
|
|
40
40
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
41
41
|
"react": "^16.8.0 || ^17.0.0"
|
|
42
42
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"react": "-"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@teambit/legacy": "1.0.
|
|
67
|
+
"@teambit/legacy": "1.0.288",
|
|
68
68
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
69
69
|
"react": "^16.8.0 || ^17.0.0"
|
|
70
70
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.411/dist/application.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.411/dist/application.docs.mdx')]
|
|
Binary file
|