@teambit/builder 0.0.881 → 0.0.882
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/artifact/artifact-extractor.js +6 -47
- package/dist/artifact/artifact-extractor.js.map +1 -1
- package/dist/artifact/artifact-factory.js +1 -52
- package/dist/artifact/artifact-factory.js.map +1 -1
- package/dist/artifact/artifact-list.js +6 -43
- package/dist/artifact/artifact-list.js.map +1 -1
- package/dist/artifact/artifact.js +4 -20
- package/dist/artifact/artifact.js.map +1 -1
- package/dist/artifact/artifacts.cmd.js +0 -29
- package/dist/artifact/artifacts.cmd.js.map +1 -1
- package/dist/artifact/extension-artifact.js +0 -4
- package/dist/artifact/extension-artifact.js.map +1 -1
- package/dist/artifact/fs-artifact.js +0 -6
- package/dist/artifact/fs-artifact.js.map +1 -1
- package/dist/artifact/index.js +0 -18
- package/dist/artifact/index.js.map +1 -1
- package/dist/build-pipe.js +2 -44
- package/dist/build-pipe.js.map +1 -1
- package/dist/build-pipeline-order.js +7 -44
- package/dist/build-pipeline-order.js.map +1 -1
- package/dist/build-pipeline-result-list.js +2 -35
- package/dist/build-pipeline-result-list.js.map +1 -1
- package/dist/build-task.js +1 -9
- package/dist/build-task.js.map +1 -1
- package/dist/build.cmd.js +0 -27
- package/dist/build.cmd.js.map +1 -1
- package/dist/builder.aspect.js +0 -5
- package/dist/builder.aspect.js.map +1 -1
- package/dist/builder.composition.js +0 -6
- package/dist/builder.composition.js.map +1 -1
- package/dist/builder.graphql.js +0 -19
- package/dist/builder.graphql.js.map +1 -1
- package/dist/builder.main.runtime.js +8 -137
- package/dist/builder.main.runtime.js.map +1 -1
- package/dist/builder.route.js +3 -27
- package/dist/builder.route.js.map +1 -1
- package/dist/builder.service.js +1 -37
- package/dist/builder.service.js.map +1 -1
- package/dist/exceptions/artifact-definition-no-glob.js +0 -3
- package/dist/exceptions/artifact-definition-no-glob.js.map +1 -1
- package/dist/exceptions/artifact-storage-error.js +0 -3
- package/dist/exceptions/artifact-storage-error.js.map +1 -1
- package/dist/exceptions/capsule-not-found.js +0 -3
- package/dist/exceptions/capsule-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -9
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/invalid-task.js +0 -6
- package/dist/exceptions/invalid-task.js.map +1 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +1 -1
- package/dist/pipeline/index.js +0 -3
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/pipeline-results.js +0 -2
- package/dist/pipeline/pipeline-results.js.map +1 -1
- package/dist/storage/default-resolver.js +0 -9
- package/dist/storage/default-resolver.js.map +1 -1
- package/dist/storage/index.js +0 -6
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/s3-resolver.js +4 -0
- package/dist/storage/s3-resolver.js.map +1 -1
- package/dist/task-results-list.js +1 -23
- package/dist/task-results-list.js.map +1 -1
- package/dist/tasks-queue.js +0 -14
- package/dist/tasks-queue.js.map +1 -1
- package/dist/templates/build-task/files/index-file.js +0 -1
- package/dist/templates/build-task/files/index-file.js.map +1 -1
- package/dist/templates/build-task/files/task-file.js +0 -1
- package/dist/templates/build-task/files/task-file.js.map +1 -1
- package/dist/templates/build-task/index.js +0 -7
- package/dist/templates/build-task/index.js.map +1 -1
- package/package-tar/teambit-builder-0.0.882.tgz +0 -0
- package/package.json +11 -11
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-builder-0.0.881.tgz +0 -0
package/dist/exceptions/index.js
CHANGED
|
@@ -21,34 +21,25 @@ Object.defineProperty(exports, "InvalidTask", {
|
|
|
21
21
|
return _invalidTask().InvalidTask;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
25
24
|
function _invalidTask() {
|
|
26
25
|
const data = require("./invalid-task");
|
|
27
|
-
|
|
28
26
|
_invalidTask = function () {
|
|
29
27
|
return data;
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
return data;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
function _capsuleNotFound() {
|
|
36
32
|
const data = require("./capsule-not-found");
|
|
37
|
-
|
|
38
33
|
_capsuleNotFound = function () {
|
|
39
34
|
return data;
|
|
40
35
|
};
|
|
41
|
-
|
|
42
36
|
return data;
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
function _artifactStorageError() {
|
|
46
39
|
const data = require("./artifact-storage-error");
|
|
47
|
-
|
|
48
40
|
_artifactStorageError = function () {
|
|
49
41
|
return data;
|
|
50
42
|
};
|
|
51
|
-
|
|
52
43
|
return data;
|
|
53
44
|
}
|
|
54
45
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { InvalidTask } from './invalid-task';\nexport { CapsuleNotFound } from './capsule-not-found';\nexport { ArtifactStorageError } from './artifact-storage-error';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { InvalidTask } from './invalid-task';\nexport { CapsuleNotFound } from './capsule-not-found';\nexport { ArtifactStorageError } from './artifact-storage-error';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.InvalidTask = void 0;
|
|
7
|
-
|
|
8
7
|
function _bitError() {
|
|
9
8
|
const data = require("@teambit/bit-error");
|
|
10
|
-
|
|
11
9
|
_bitError = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class InvalidTask extends _bitError().BitError {
|
|
19
15
|
constructor(taskAspectId, reason) {
|
|
20
16
|
super(`task of ${taskAspectId} is invalid, ${reason}`);
|
|
21
17
|
this.taskAspectId = taskAspectId;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
exports.InvalidTask = InvalidTask;
|
|
27
21
|
|
|
28
22
|
//# sourceMappingURL=invalid-task.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InvalidTask","BitError","constructor","taskAspectId","reason"],"sources":["invalid-task.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class InvalidTask extends BitError {\n constructor(readonly taskAspectId: string, reason: string) {\n super(`task of ${taskAspectId} is invalid, ${reason}`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InvalidTask","BitError","constructor","taskAspectId","reason"],"sources":["invalid-task.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class InvalidTask extends BitError {\n constructor(readonly taskAspectId: string, reason: string) {\n super(`task of ${taskAspectId} is invalid, ${reason}`);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,WAAW,SAASC,oBAAQ,CAAC;EACxCC,WAAW,CAAUC,YAAoB,EAAEC,MAAc,EAAE;IACzD,KAAK,CAAE,WAAUD,YAAa,gBAAeC,MAAO,EAAC,CAAC;IAAC,KADpCD,YAAoB,GAApBA,YAAoB;EAEzC;AACF;AAAC"}
|
package/dist/index.js
CHANGED
|
@@ -129,84 +129,60 @@ Object.defineProperty(exports, "WholeArtifactStorageResolver", {
|
|
|
129
129
|
return _storage().WholeArtifactStorageResolver;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
-
|
|
133
132
|
function _buildPipe() {
|
|
134
133
|
const data = require("./build-pipe");
|
|
135
|
-
|
|
136
134
|
_buildPipe = function () {
|
|
137
135
|
return data;
|
|
138
136
|
};
|
|
139
|
-
|
|
140
137
|
return data;
|
|
141
138
|
}
|
|
142
|
-
|
|
143
139
|
function _types() {
|
|
144
140
|
const data = require("./types");
|
|
145
|
-
|
|
146
141
|
_types = function () {
|
|
147
142
|
return data;
|
|
148
143
|
};
|
|
149
|
-
|
|
150
144
|
return data;
|
|
151
145
|
}
|
|
152
|
-
|
|
153
146
|
function _buildTask() {
|
|
154
147
|
const data = require("./build-task");
|
|
155
|
-
|
|
156
148
|
_buildTask = function () {
|
|
157
149
|
return data;
|
|
158
150
|
};
|
|
159
|
-
|
|
160
151
|
return data;
|
|
161
152
|
}
|
|
162
|
-
|
|
163
153
|
function _builder() {
|
|
164
154
|
const data = require("./builder.aspect");
|
|
165
|
-
|
|
166
155
|
_builder = function () {
|
|
167
156
|
return data;
|
|
168
157
|
};
|
|
169
|
-
|
|
170
158
|
return data;
|
|
171
159
|
}
|
|
172
|
-
|
|
173
160
|
function _storage() {
|
|
174
161
|
const data = require("./storage");
|
|
175
|
-
|
|
176
162
|
_storage = function () {
|
|
177
163
|
return data;
|
|
178
164
|
};
|
|
179
|
-
|
|
180
165
|
return data;
|
|
181
166
|
}
|
|
182
|
-
|
|
183
167
|
function _artifact() {
|
|
184
168
|
const data = require("./artifact");
|
|
185
|
-
|
|
186
169
|
_artifact = function () {
|
|
187
170
|
return data;
|
|
188
171
|
};
|
|
189
|
-
|
|
190
172
|
return data;
|
|
191
173
|
}
|
|
192
|
-
|
|
193
174
|
function _taskResultsList() {
|
|
194
175
|
const data = require("./task-results-list");
|
|
195
|
-
|
|
196
176
|
_taskResultsList = function () {
|
|
197
177
|
return data;
|
|
198
178
|
};
|
|
199
|
-
|
|
200
179
|
return data;
|
|
201
180
|
}
|
|
202
|
-
|
|
203
181
|
function _artifact2() {
|
|
204
182
|
const data = require("@teambit/legacy/dist/consumer/component/sources/artifact");
|
|
205
|
-
|
|
206
183
|
_artifact2 = function () {
|
|
207
184
|
return data;
|
|
208
185
|
};
|
|
209
|
-
|
|
210
186
|
return data;
|
|
211
187
|
}
|
|
212
188
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { BuildPipe, TaskResults } from './build-pipe';\nexport { ComponentResult, TaskMetadata } from './types';\nexport {\n BuildContext,\n BuildTask,\n BuiltTaskResult,\n TaskLocation,\n BuildTaskHelper,\n CAPSULE_ARTIFACTS_DIR,\n} from './build-task';\nexport type { PipeName } from './builder.service';\nexport type { BuilderMain, RawBuilderData, BuilderData } from './builder.main.runtime';\nexport type { PipelineReport } from './build-pipeline-result-list';\nexport { BuilderAspect } from './builder.aspect';\nexport { WholeArtifactStorageResolver, FileStorageResolver, ArtifactStorageResolver } from './storage';\nexport { Artifact, ArtifactList, ArtifactFactory, ArtifactDefinition, ArtifactModelDefinition } from './artifact';\nexport { TaskResultsList } from './task-results-list';\nexport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { BuildPipe, TaskResults } from './build-pipe';\nexport { ComponentResult, TaskMetadata } from './types';\nexport {\n BuildContext,\n BuildTask,\n BuiltTaskResult,\n TaskLocation,\n BuildTaskHelper,\n CAPSULE_ARTIFACTS_DIR,\n} from './build-task';\nexport type { PipeName } from './builder.service';\nexport type { BuilderMain, RawBuilderData, BuilderData } from './builder.main.runtime';\nexport type { PipelineReport } from './build-pipeline-result-list';\nexport { BuilderAspect } from './builder.aspect';\nexport { WholeArtifactStorageResolver, FileStorageResolver, ArtifactStorageResolver } from './storage';\nexport { Artifact, ArtifactList, ArtifactFactory, ArtifactDefinition, ArtifactModelDefinition } from './artifact';\nexport { TaskResultsList } from './task-results-list';\nexport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/pipeline/index.js
CHANGED
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "PipelineResults", {
|
|
|
9
9
|
return _pipelineResults().PipelineResults;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _pipelineResults() {
|
|
14
13
|
const data = require("./pipeline-results");
|
|
15
|
-
|
|
16
14
|
_pipelineResults = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { PipelineResults } from './pipeline-results';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { PipelineResults } from './pipeline-results';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PipelineResults"],"sources":["pipeline-results.ts"],"sourcesContent":["export class PipelineResults {}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["PipelineResults"],"sources":["pipeline-results.ts"],"sourcesContent":["export class PipelineResults {}\n"],"mappings":";;;;;;AAAO,MAAMA,eAAe,CAAC;AAAE"}
|
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.DefaultResolver = void 0;
|
|
11
|
-
|
|
12
9
|
function _defineProperty2() {
|
|
13
10
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
|
|
15
11
|
_defineProperty2 = function () {
|
|
16
12
|
return data;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
return data;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
class DefaultResolver {
|
|
23
17
|
constructor() {
|
|
24
18
|
(0, _defineProperty2().default)(this, "name", 'default');
|
|
25
19
|
}
|
|
26
|
-
|
|
27
20
|
async store(component, artifact) {
|
|
28
21
|
artifact.files.populateVinylsFromPaths(artifact.rootDir);
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
exports.DefaultResolver = DefaultResolver;
|
|
34
25
|
|
|
35
26
|
//# sourceMappingURL=default-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultResolver","store","component","artifact","files","populateVinylsFromPaths","rootDir"],"sources":["default-resolver.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { FsArtifact } from '../artifact';\nimport { WholeArtifactStorageResolver } from './storage-resolver';\n\nexport class DefaultResolver implements WholeArtifactStorageResolver {\n name = 'default';\n\n async store(component: Component, artifact: FsArtifact) {\n artifact.files.populateVinylsFromPaths(artifact.rootDir);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["DefaultResolver","store","component","artifact","files","populateVinylsFromPaths","rootDir"],"sources":["default-resolver.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { FsArtifact } from '../artifact';\nimport { WholeArtifactStorageResolver } from './storage-resolver';\n\nexport class DefaultResolver implements WholeArtifactStorageResolver {\n name = 'default';\n\n async store(component: Component, artifact: FsArtifact) {\n artifact.files.populateVinylsFromPaths(artifact.rootDir);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIO,MAAMA,eAAe,CAAyC;EAAA;IAAA,8CAC5D,SAAS;EAAA;EAEhB,MAAMC,KAAK,CAACC,SAAoB,EAAEC,QAAoB,EAAE;IACtDA,QAAQ,CAACC,KAAK,CAACC,uBAAuB,CAACF,QAAQ,CAACG,OAAO,CAAC;EAC1D;AACF;AAAC"}
|
package/dist/storage/index.js
CHANGED
|
@@ -27,24 +27,18 @@ Object.defineProperty(exports, "WholeArtifactStorageResolver", {
|
|
|
27
27
|
return _storageResolver().WholeArtifactStorageResolver;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
31
30
|
function _storageResolver() {
|
|
32
31
|
const data = require("./storage-resolver");
|
|
33
|
-
|
|
34
32
|
_storageResolver = function () {
|
|
35
33
|
return data;
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
return data;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
function _defaultResolver() {
|
|
42
38
|
const data = require("./default-resolver");
|
|
43
|
-
|
|
44
39
|
_defaultResolver = function () {
|
|
45
40
|
return data;
|
|
46
41
|
};
|
|
47
|
-
|
|
48
42
|
return data;
|
|
49
43
|
}
|
|
50
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { WholeArtifactStorageResolver, ArtifactStorageResolver, FileStorageResolver } from './storage-resolver';\nexport { DefaultResolver } from './default-resolver';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { WholeArtifactStorageResolver, ArtifactStorageResolver, FileStorageResolver } from './storage-resolver';\nexport { DefaultResolver } from './default-resolver';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// import { Component, ComponentID } from '@teambit/component';
|
|
3
3
|
// import { StorageResolver } from './storage-resolver';
|
|
4
4
|
// import type { ArtifactList } from '../artifact';
|
|
5
|
+
|
|
5
6
|
// export class S3Resolver implements StorageResolver {
|
|
6
7
|
// name = 's3';
|
|
7
8
|
// // todo artifact map
|
|
@@ -13,9 +14,11 @@
|
|
|
13
14
|
// });
|
|
14
15
|
// // files file to upload
|
|
15
16
|
// }
|
|
17
|
+
|
|
16
18
|
// private buildKey(id: ComponentID, taskId: string, path: string) {
|
|
17
19
|
// return id.fullName;
|
|
18
20
|
// }
|
|
21
|
+
|
|
19
22
|
// private upload(key: string, body: string) {
|
|
20
23
|
// const s3 = this.getS3Client();
|
|
21
24
|
// s3.upload({
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
// Body: body,
|
|
25
28
|
// });
|
|
26
29
|
// }
|
|
30
|
+
|
|
27
31
|
// private getS3Client() {
|
|
28
32
|
// //TODO: need to pass bithub token
|
|
29
33
|
// const s3 = new S3({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["s3-resolver.ts"],"sourcesContent":["// import { S3 } from 'aws-sdk';\n// import { Component, ComponentID } from '@teambit/component';\n// import { StorageResolver } from './storage-resolver';\n// import type { ArtifactList } from '../artifact';\n\n// export class S3Resolver implements StorageResolver {\n// name = 's3';\n// // todo artifact map\n// async store(component: Component, artifacts: ArtifactList) {\n// // https://staoge.com/{compId}/aspectId/${path}\n// const artifactsByTaskId = artifacts.groupByTaskId();\n// const files = Object.entries(artifactsByTaskId).map(([taskId, artifact]) => {\n// return artifact.paths.map((path) => this.buildKey(component.id, taskId, path));\n// });\n// // files file to upload\n// }\n\n// private buildKey(id: ComponentID, taskId: string, path: string) {\n// return id.fullName;\n// }\n\n// private upload(key: string, body: string) {\n// const s3 = this.getS3Client();\n// s3.upload({\n// Bucket: 'storage',\n// Key: key,\n// Body: body,\n// });\n// }\n\n// private getS3Client() {\n// //TODO: need to pass bithub token\n// const s3 = new S3({\n// accessKeyId: 'bit',\n// secretAccessKey: process.env.BIT_DEV_TOKEN,\n// endpoint: 'http://bit.test:5003',\n// });\n// return s3;\n// }\n// }\n"],"mappings":"AAAA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":[],"sources":["s3-resolver.ts"],"sourcesContent":["// import { S3 } from 'aws-sdk';\n// import { Component, ComponentID } from '@teambit/component';\n// import { StorageResolver } from './storage-resolver';\n// import type { ArtifactList } from '../artifact';\n\n// export class S3Resolver implements StorageResolver {\n// name = 's3';\n// // todo artifact map\n// async store(component: Component, artifacts: ArtifactList) {\n// // https://staoge.com/{compId}/aspectId/${path}\n// const artifactsByTaskId = artifacts.groupByTaskId();\n// const files = Object.entries(artifactsByTaskId).map(([taskId, artifact]) => {\n// return artifact.paths.map((path) => this.buildKey(component.id, taskId, path));\n// });\n// // files file to upload\n// }\n\n// private buildKey(id: ComponentID, taskId: string, path: string) {\n// return id.fullName;\n// }\n\n// private upload(key: string, body: string) {\n// const s3 = this.getS3Client();\n// s3.upload({\n// Bucket: 'storage',\n// Key: key,\n// Body: body,\n// });\n// }\n\n// private getS3Client() {\n// //TODO: need to pass bithub token\n// const s3 = new S3({\n// accessKeyId: 'bit',\n// secretAccessKey: process.env.BIT_DEV_TOKEN,\n// endpoint: 'http://bit.test:5003',\n// });\n// return s3;\n// }\n// }\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA"}
|
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.TaskResultsList = void 0;
|
|
9
|
-
|
|
10
8
|
function _chalk() {
|
|
11
9
|
const data = _interopRequireDefault(require("chalk"));
|
|
12
|
-
|
|
13
10
|
_chalk = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _bitError() {
|
|
21
16
|
const data = require("@teambit/bit-error");
|
|
22
|
-
|
|
23
17
|
_bitError = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _buildTask() {
|
|
31
23
|
const data = require("./build-task");
|
|
32
|
-
|
|
33
24
|
_buildTask = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
class TaskResultsList {
|
|
41
30
|
constructor(tasksQueue,
|
|
42
31
|
/**
|
|
@@ -46,40 +35,32 @@ class TaskResultsList {
|
|
|
46
35
|
this.tasksQueue = tasksQueue;
|
|
47
36
|
this.tasksResults = tasksResults;
|
|
48
37
|
}
|
|
49
|
-
|
|
50
38
|
hasErrors() {
|
|
51
39
|
return this.tasksResults.some(taskResult => taskResult.componentsResults.find(c => {
|
|
52
40
|
var _c$errors;
|
|
53
|
-
|
|
54
41
|
return (_c$errors = c.errors) === null || _c$errors === void 0 ? void 0 : _c$errors.length;
|
|
55
42
|
}));
|
|
56
43
|
}
|
|
57
|
-
|
|
58
44
|
throwErrorsIfExist() {
|
|
59
45
|
const errorMessage = this.getErrorMessageFormatted();
|
|
60
|
-
|
|
61
46
|
if (errorMessage) {
|
|
62
47
|
throw new (_bitError().BitError)(errorMessage);
|
|
63
48
|
}
|
|
64
49
|
}
|
|
50
|
+
|
|
65
51
|
/**
|
|
66
52
|
* group errors from all tasks and show them nicely to the user
|
|
67
53
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
54
|
getErrorMessageFormatted() {
|
|
71
55
|
const tasksErrors = [];
|
|
72
56
|
let totalErrors = 0;
|
|
73
57
|
this.tasksResults.forEach(taskResult => {
|
|
74
58
|
const compsWithErrors = taskResult.componentsResults.filter(c => {
|
|
75
59
|
var _c$errors2;
|
|
76
|
-
|
|
77
60
|
return (_c$errors2 = c.errors) === null || _c$errors2 === void 0 ? void 0 : _c$errors2.length;
|
|
78
61
|
});
|
|
79
62
|
if (!compsWithErrors.length) return;
|
|
80
|
-
|
|
81
63
|
const title = _chalk().default.bold(`Failed task ${tasksErrors.length + 1}: "${_buildTask().BuildTaskHelper.serializeId(taskResult.task)}" of env "${taskResult.env.id}"\n`);
|
|
82
|
-
|
|
83
64
|
const errorsStr = compsWithErrors.map(compWithErrors => this.aggregateTaskErrorsToOneString(compWithErrors)).join('\n\n');
|
|
84
65
|
const taskErrors = compsWithErrors.reduce((acc, current) => acc + (current.errors || []).length, 0);
|
|
85
66
|
const summery = `\n\nFound ${taskErrors} errors in ${compsWithErrors.length} components`;
|
|
@@ -96,15 +77,12 @@ class TaskResultsList {
|
|
|
96
77
|
const summery = `\n\n\n✖ Total ${totalTasks} tasks. ${totalSucceed} succeeded. ${totalFailed} failed. ${totalSkipped} skipped. Total errors: ${totalErrors}.`;
|
|
97
78
|
return title + errorsStr + summery;
|
|
98
79
|
}
|
|
99
|
-
|
|
100
80
|
aggregateTaskErrorsToOneString(componentResult) {
|
|
101
81
|
const rawErrors = componentResult.errors || [];
|
|
102
82
|
const errors = rawErrors.map(e => typeof e === 'string' ? e : e.toString());
|
|
103
83
|
return `component: ${componentResult.component.id.toString()}\n${errors.join('\n')}`;
|
|
104
84
|
}
|
|
105
|
-
|
|
106
85
|
}
|
|
107
|
-
|
|
108
86
|
exports.TaskResultsList = TaskResultsList;
|
|
109
87
|
|
|
110
88
|
//# sourceMappingURL=task-results-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TaskResultsList","constructor","tasksQueue","tasksResults","hasErrors","some","taskResult","componentsResults","find","c","errors","length","throwErrorsIfExist","errorMessage","getErrorMessageFormatted","BitError","tasksErrors","totalErrors","forEach","compsWithErrors","filter","title","chalk","bold","BuildTaskHelper","serializeId","task","env","id","errorsStr","map","compWithErrors","aggregateTaskErrorsToOneString","join","taskErrors","reduce","acc","current","summery","push","totalTasks","totalFailed","totalSucceed","totalSkipped","componentResult","rawErrors","e","toString","component"],"sources":["task-results-list.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { BuildTaskHelper } from './build-task';\nimport { TasksQueue } from './tasks-queue';\nimport { TaskResults } from './build-pipe';\nimport { ComponentResult } from './types';\n\nexport class TaskResultsList {\n constructor(\n public tasksQueue: TasksQueue,\n /**\n * results of all tasks executed in the build pipeline.\n */\n public tasksResults: TaskResults[]\n ) {}\n\n hasErrors(): boolean {\n return this.tasksResults.some((taskResult) => taskResult.componentsResults.find((c) => c.errors?.length));\n }\n\n throwErrorsIfExist() {\n const errorMessage = this.getErrorMessageFormatted();\n if (errorMessage) {\n throw new BitError(errorMessage);\n }\n }\n\n /**\n * group errors from all tasks and show them nicely to the user\n */\n public getErrorMessageFormatted(): string | null {\n const tasksErrors: string[] = [];\n let totalErrors = 0;\n this.tasksResults.forEach((taskResult) => {\n const compsWithErrors = taskResult.componentsResults.filter((c) => c.errors?.length);\n if (!compsWithErrors.length) return;\n const title = chalk.bold(\n `Failed task ${tasksErrors.length + 1}: \"${BuildTaskHelper.serializeId(taskResult.task)}\" of env \"${\n taskResult.env.id\n }\"\\n`\n );\n const errorsStr = compsWithErrors\n .map((compWithErrors) => this.aggregateTaskErrorsToOneString(compWithErrors))\n .join('\\n\\n');\n const taskErrors = compsWithErrors.reduce((acc, current) => acc + (current.errors || []).length, 0);\n const summery = `\\n\\nFound ${taskErrors} errors in ${compsWithErrors.length} components`;\n totalErrors += taskErrors;\n tasksErrors.push(title + errorsStr + summery);\n });\n if (!tasksErrors.length) return null;\n const title = `\\nThe following errors were found while running the build pipeline\\n`;\n const errorsStr = tasksErrors.join('\\n\\n');\n const totalTasks = this.tasksQueue.length;\n const totalFailed = tasksErrors.length;\n const totalSucceed = this.tasksResults.length - totalFailed;\n const totalSkipped = totalTasks - this.tasksResults.length;\n const summery = `\\n\\n\\n✖ Total ${totalTasks} tasks. ${totalSucceed} succeeded. ${totalFailed} failed. ${totalSkipped} skipped. Total errors: ${totalErrors}.`;\n return title + errorsStr + summery;\n }\n\n private aggregateTaskErrorsToOneString(componentResult: ComponentResult) {\n const rawErrors = componentResult.errors || [];\n const errors = rawErrors.map((e) => (typeof e === 'string' ? e : e.toString()));\n return `component: ${componentResult.component.id.toString()}\\n${errors.join('\\n')}`;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["TaskResultsList","constructor","tasksQueue","tasksResults","hasErrors","some","taskResult","componentsResults","find","c","errors","length","throwErrorsIfExist","errorMessage","getErrorMessageFormatted","BitError","tasksErrors","totalErrors","forEach","compsWithErrors","filter","title","chalk","bold","BuildTaskHelper","serializeId","task","env","id","errorsStr","map","compWithErrors","aggregateTaskErrorsToOneString","join","taskErrors","reduce","acc","current","summery","push","totalTasks","totalFailed","totalSucceed","totalSkipped","componentResult","rawErrors","e","toString","component"],"sources":["task-results-list.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { BuildTaskHelper } from './build-task';\nimport { TasksQueue } from './tasks-queue';\nimport { TaskResults } from './build-pipe';\nimport { ComponentResult } from './types';\n\nexport class TaskResultsList {\n constructor(\n public tasksQueue: TasksQueue,\n /**\n * results of all tasks executed in the build pipeline.\n */\n public tasksResults: TaskResults[]\n ) {}\n\n hasErrors(): boolean {\n return this.tasksResults.some((taskResult) => taskResult.componentsResults.find((c) => c.errors?.length));\n }\n\n throwErrorsIfExist() {\n const errorMessage = this.getErrorMessageFormatted();\n if (errorMessage) {\n throw new BitError(errorMessage);\n }\n }\n\n /**\n * group errors from all tasks and show them nicely to the user\n */\n public getErrorMessageFormatted(): string | null {\n const tasksErrors: string[] = [];\n let totalErrors = 0;\n this.tasksResults.forEach((taskResult) => {\n const compsWithErrors = taskResult.componentsResults.filter((c) => c.errors?.length);\n if (!compsWithErrors.length) return;\n const title = chalk.bold(\n `Failed task ${tasksErrors.length + 1}: \"${BuildTaskHelper.serializeId(taskResult.task)}\" of env \"${\n taskResult.env.id\n }\"\\n`\n );\n const errorsStr = compsWithErrors\n .map((compWithErrors) => this.aggregateTaskErrorsToOneString(compWithErrors))\n .join('\\n\\n');\n const taskErrors = compsWithErrors.reduce((acc, current) => acc + (current.errors || []).length, 0);\n const summery = `\\n\\nFound ${taskErrors} errors in ${compsWithErrors.length} components`;\n totalErrors += taskErrors;\n tasksErrors.push(title + errorsStr + summery);\n });\n if (!tasksErrors.length) return null;\n const title = `\\nThe following errors were found while running the build pipeline\\n`;\n const errorsStr = tasksErrors.join('\\n\\n');\n const totalTasks = this.tasksQueue.length;\n const totalFailed = tasksErrors.length;\n const totalSucceed = this.tasksResults.length - totalFailed;\n const totalSkipped = totalTasks - this.tasksResults.length;\n const summery = `\\n\\n\\n✖ Total ${totalTasks} tasks. ${totalSucceed} succeeded. ${totalFailed} failed. ${totalSkipped} skipped. Total errors: ${totalErrors}.`;\n return title + errorsStr + summery;\n }\n\n private aggregateTaskErrorsToOneString(componentResult: ComponentResult) {\n const rawErrors = componentResult.errors || [];\n const errors = rawErrors.map((e) => (typeof e === 'string' ? e : e.toString()));\n return `component: ${componentResult.component.id.toString()}\\n${errors.join('\\n')}`;\n }\n}\n"],"mappings":"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"}
|
package/dist/tasks-queue.js
CHANGED
|
@@ -4,27 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TasksQueue = void 0;
|
|
7
|
-
|
|
8
7
|
function _buildTask() {
|
|
9
8
|
const data = require("./build-task");
|
|
10
|
-
|
|
11
9
|
_buildTask = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _exceptions() {
|
|
19
15
|
const data = require("./exceptions");
|
|
20
|
-
|
|
21
16
|
_exceptions = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
class TasksQueue extends Array {
|
|
29
22
|
toString() {
|
|
30
23
|
return this.map(({
|
|
@@ -35,8 +28,6 @@ class TasksQueue extends Array {
|
|
|
35
28
|
/**
|
|
36
29
|
* make sure tasks names are valid and there are no duplications
|
|
37
30
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
31
|
validate() {
|
|
41
32
|
this.forEach(({
|
|
42
33
|
task
|
|
@@ -45,15 +36,12 @@ class TasksQueue extends Array {
|
|
|
45
36
|
});
|
|
46
37
|
this.validateDuplications();
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
validateTaskName(task) {
|
|
50
40
|
if (!task.name) throw new (_exceptions().InvalidTask)(task.aspectId, 'name is missing');
|
|
51
41
|
const regexWord = /^\w+$/; // match any word: a-zA-Z0-9 and underscore.
|
|
52
|
-
|
|
53
42
|
const isValid = regexWord.test(task.name);
|
|
54
43
|
if (!isValid) throw new (_exceptions().InvalidTask)(task.aspectId, `name "${task.name}" is invalid, only alphanumeric characters are allowed`);
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
validateDuplications() {
|
|
58
46
|
const uniqueTasks = this.map(({
|
|
59
47
|
env,
|
|
@@ -65,9 +53,7 @@ class TasksQueue extends Array {
|
|
|
65
53
|
}
|
|
66
54
|
});
|
|
67
55
|
}
|
|
68
|
-
|
|
69
56
|
}
|
|
70
|
-
|
|
71
57
|
exports.TasksQueue = TasksQueue;
|
|
72
58
|
|
|
73
59
|
//# sourceMappingURL=tasks-queue.js.map
|
package/dist/tasks-queue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TasksQueue","Array","toString","map","env","task","id","BuildTaskHelper","serializeId","join","validate","forEach","validateTaskName","validateDuplications","name","InvalidTask","aspectId","regexWord","isValid","test","uniqueTasks","uniqTask","filter","u","length"],"sources":["tasks-queue.ts"],"sourcesContent":["import { EnvDefinition } from '@teambit/envs';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { InvalidTask } from './exceptions';\n\ntype EnvTask = { env: EnvDefinition; task: BuildTask };\n\nexport class TasksQueue extends Array<EnvTask> {\n toString() {\n return this.map(({ env, task }) => `env ${env.id}, task ${BuildTaskHelper.serializeId(task)}`).join('\\n');\n }\n /**\n * make sure tasks names are valid and there are no duplications\n */\n validate() {\n this.forEach(({ task }) => {\n this.validateTaskName(task);\n });\n this.validateDuplications();\n }\n\n private validateTaskName(task: BuildTask) {\n if (!task.name) throw new InvalidTask(task.aspectId, 'name is missing');\n const regexWord = /^\\w+$/; // match any word: a-zA-Z0-9 and underscore.\n const isValid = regexWord.test(task.name);\n if (!isValid)\n throw new InvalidTask(task.aspectId, `name \"${task.name}\" is invalid, only alphanumeric characters are allowed`);\n }\n\n private validateDuplications() {\n const uniqueTasks = this.map(({ env, task }) => `${env.id} ${task.aspectId}:${task.name}`);\n uniqueTasks.forEach((uniqTask) => {\n if (uniqueTasks.filter((u) => u === uniqTask).length > 1) {\n throw new InvalidTask(\n uniqTask,\n 'there are two or more tasks with the same name and aspectId in the same environment'\n );\n }\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["TasksQueue","Array","toString","map","env","task","id","BuildTaskHelper","serializeId","join","validate","forEach","validateTaskName","validateDuplications","name","InvalidTask","aspectId","regexWord","isValid","test","uniqueTasks","uniqTask","filter","u","length"],"sources":["tasks-queue.ts"],"sourcesContent":["import { EnvDefinition } from '@teambit/envs';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { InvalidTask } from './exceptions';\n\ntype EnvTask = { env: EnvDefinition; task: BuildTask };\n\nexport class TasksQueue extends Array<EnvTask> {\n toString() {\n return this.map(({ env, task }) => `env ${env.id}, task ${BuildTaskHelper.serializeId(task)}`).join('\\n');\n }\n /**\n * make sure tasks names are valid and there are no duplications\n */\n validate() {\n this.forEach(({ task }) => {\n this.validateTaskName(task);\n });\n this.validateDuplications();\n }\n\n private validateTaskName(task: BuildTask) {\n if (!task.name) throw new InvalidTask(task.aspectId, 'name is missing');\n const regexWord = /^\\w+$/; // match any word: a-zA-Z0-9 and underscore.\n const isValid = regexWord.test(task.name);\n if (!isValid)\n throw new InvalidTask(task.aspectId, `name \"${task.name}\" is invalid, only alphanumeric characters are allowed`);\n }\n\n private validateDuplications() {\n const uniqueTasks = this.map(({ env, task }) => `${env.id} ${task.aspectId}:${task.name}`);\n uniqueTasks.forEach((uniqTask) => {\n if (uniqueTasks.filter((u) => u === uniqTask).length > 1) {\n throw new InvalidTask(\n uniqTask,\n 'there are two or more tasks with the same name and aspectId in the same environment'\n );\n }\n });\n }\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,MAAMA,UAAU,SAASC,KAAK,CAAU;EAC7CC,QAAQ,GAAG;IACT,OAAO,IAAI,CAACC,GAAG,CAAC,CAAC;MAAEC,GAAG;MAAEC;IAAK,CAAC,KAAM,OAAMD,GAAG,CAACE,EAAG,UAASC,4BAAe,CAACC,WAAW,CAACH,IAAI,CAAE,EAAC,CAAC,CAACI,IAAI,CAAC,IAAI,CAAC;EAC3G;EACA;AACF;AACA;EACEC,QAAQ,GAAG;IACT,IAAI,CAACC,OAAO,CAAC,CAAC;MAAEN;IAAK,CAAC,KAAK;MACzB,IAAI,CAACO,gBAAgB,CAACP,IAAI,CAAC;IAC7B,CAAC,CAAC;IACF,IAAI,CAACQ,oBAAoB,EAAE;EAC7B;EAEQD,gBAAgB,CAACP,IAAe,EAAE;IACxC,IAAI,CAACA,IAAI,CAACS,IAAI,EAAE,MAAM,KAAIC,yBAAW,EAACV,IAAI,CAACW,QAAQ,EAAE,iBAAiB,CAAC;IACvE,MAAMC,SAAS,GAAG,OAAO,CAAC,CAAC;IAC3B,MAAMC,OAAO,GAAGD,SAAS,CAACE,IAAI,CAACd,IAAI,CAACS,IAAI,CAAC;IACzC,IAAI,CAACI,OAAO,EACV,MAAM,KAAIH,yBAAW,EAACV,IAAI,CAACW,QAAQ,EAAG,SAAQX,IAAI,CAACS,IAAK,wDAAuD,CAAC;EACpH;EAEQD,oBAAoB,GAAG;IAC7B,MAAMO,WAAW,GAAG,IAAI,CAACjB,GAAG,CAAC,CAAC;MAAEC,GAAG;MAAEC;IAAK,CAAC,KAAM,GAAED,GAAG,CAACE,EAAG,IAAGD,IAAI,CAACW,QAAS,IAAGX,IAAI,CAACS,IAAK,EAAC,CAAC;IAC1FM,WAAW,CAACT,OAAO,CAAEU,QAAQ,IAAK;MAChC,IAAID,WAAW,CAACE,MAAM,CAAEC,CAAC,IAAKA,CAAC,KAAKF,QAAQ,CAAC,CAACG,MAAM,GAAG,CAAC,EAAE;QACxD,MAAM,KAAIT,yBAAW,EACnBM,QAAQ,EACR,qFAAqF,CACtF;MACH;IACF,CAAC,CAAC;EACJ;AACF;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { ${namePascalCase} } from './${name}.task'`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { ${namePascalCase} } from './${name}.task'`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAAS,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,cAAaC,IAAK,QAAO;AAC7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["taskFile","namePascalCase"],"sources":["task-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function taskFile({ namePascalCase }: ComponentContext) {\n return `import {\n BuildTask,\n BuildContext,\n BuiltTaskResult,\n ComponentResult,\n} from '@teambit/builder';\nimport path from 'path';\nimport fs from 'fs';\n\nexport class ${namePascalCase} implements BuildTask {\n constructor(readonly aspectId: string) {}\n readonly name = '${namePascalCase}';\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n // Prepare the component results array which will be used to report back the components processed\n // as well as any additional data regarding this build task execution\n const componentsResults: ComponentResult[] = [];\n // The 'seeder capsules' are capsules for components that are built for their own sake - \n // not for the sake of other components that have them as their dependencies\n const capsules = context.capsuleNetwork.seedersCapsules;\n capsules.forEach((capsule) => {\n // Prepare an 'errors' array to report back of any errors during execution (this will be part of the 'Component Results' data)\n const errors: Error[] = [];\n // Each 'capsule' provides data regarding the component as well as the capsule itself\n const componentName = capsule.component.id.name;\n const capsuleDir = capsule.path;\n\n const artifactContent = \\`The component name is \\${componentName}\\`\n\n try {\n // Generate the artifact inside the capsule's directory\n fs.writeFileSync(\n path.join(capsuleDir, 'output.my-artifact.txt'),\n artifactContent\n );\n } catch (err: any) {\n errors.push(err);\n }\n componentsResults.push({ component: capsule.component, errors });\n });\n\n return {\n artifacts: [\n {\n generatedBy: this.aspectId,\n name: this.name,\n // The glob pattern for artifacts to include in the component version\n globPatterns: ['**/*.my-artifact.txt'],\n },\n ],\n componentsResults,\n };\n }\n}`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["taskFile","namePascalCase"],"sources":["task-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function taskFile({ namePascalCase }: ComponentContext) {\n return `import {\n BuildTask,\n BuildContext,\n BuiltTaskResult,\n ComponentResult,\n} from '@teambit/builder';\nimport path from 'path';\nimport fs from 'fs';\n\nexport class ${namePascalCase} implements BuildTask {\n constructor(readonly aspectId: string) {}\n readonly name = '${namePascalCase}';\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n // Prepare the component results array which will be used to report back the components processed\n // as well as any additional data regarding this build task execution\n const componentsResults: ComponentResult[] = [];\n // The 'seeder capsules' are capsules for components that are built for their own sake - \n // not for the sake of other components that have them as their dependencies\n const capsules = context.capsuleNetwork.seedersCapsules;\n capsules.forEach((capsule) => {\n // Prepare an 'errors' array to report back of any errors during execution (this will be part of the 'Component Results' data)\n const errors: Error[] = [];\n // Each 'capsule' provides data regarding the component as well as the capsule itself\n const componentName = capsule.component.id.name;\n const capsuleDir = capsule.path;\n\n const artifactContent = \\`The component name is \\${componentName}\\`\n\n try {\n // Generate the artifact inside the capsule's directory\n fs.writeFileSync(\n path.join(capsuleDir, 'output.my-artifact.txt'),\n artifactContent\n );\n } catch (err: any) {\n errors.push(err);\n }\n componentsResults.push({ component: capsule.component, errors });\n });\n\n return {\n artifacts: [\n {\n generatedBy: this.aspectId,\n name: this.name,\n // The glob pattern for artifacts to include in the component version\n globPatterns: ['**/*.my-artifact.txt'],\n },\n ],\n componentsResults,\n };\n }\n}`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,QAAQ,CAAC;EAAEC;AAAiC,CAAC,EAAE;EAC7D,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,cAAe;AAC9B;AACA,qBAAqBA,cAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF"}
|
|
@@ -4,27 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.buildTaskTemplate = void 0;
|
|
7
|
-
|
|
8
7
|
function _indexFile() {
|
|
9
8
|
const data = require("./files/index-file");
|
|
10
|
-
|
|
11
9
|
_indexFile = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _taskFile() {
|
|
19
15
|
const data = require("./files/task-file");
|
|
20
|
-
|
|
21
16
|
_taskFile = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
const buildTaskTemplate = {
|
|
29
22
|
name: 'build-task',
|
|
30
23
|
description: 'create a custom build task for your component pipelines',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["buildTaskTemplate","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","taskFile","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index-file';\nimport { taskFile } from './files/task-file';\n\nexport const buildTaskTemplate: ComponentTemplate = {\n name: 'build-task',\n description: 'create a custom build task for your component pipelines',\n hidden: false,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.task.ts`,\n content: taskFile(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["buildTaskTemplate","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","taskFile","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index-file';\nimport { taskFile } from './files/task-file';\n\nexport const buildTaskTemplate: ComponentTemplate = {\n name: 'build-task',\n description: 'create a custom build task for your component pipelines',\n hidden: false,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.task.ts`,\n content: taskFile(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,iBAAoC,GAAG;EAClDC,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,yDAAyD;EACtEC,MAAM,EAAE,KAAK;EACbC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,sBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,UAAS;MACvCM,OAAO,EAAE,IAAAG,oBAAQ,EAACL,OAAO;IAC3B,CAAC,CACF;EACH,CAAC;EACDM,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC;AAAC"}
|
|
Binary file
|