MCPcopy
hub / github.com/activepieces/activepieces / loadPieceFromFolder

Function loadPieceFromFolder

tools/scripts/utils/piece-script-utils.ts:186–209  ·  view source on GitHub ↗
(folderPath: string)

Source from the content-addressed store, hash-verified

184}
185
186async function loadPieceFromFolder(folderPath: string): Promise<PieceMetadata | null> {
187 try {
188 const packageJson = await readPackageJson(folderPath);
189 const payload = loadPieceViaChildProcess(folderPath);
190 const i18n = await pieceTranslation.initializeI18n(folderPath)
191 const metadata: PieceMetadata = {
192 ...payload.metadata,
193 name: packageJson.name,
194 version: packageJson.version,
195 i18n,
196 authors: payload.authors,
197 directoryPath: folderPath,
198 minimumSupportedRelease: payload.minimumSupportedRelease ?? '0.0.0',
199 maximumSupportedRelease: payload.maximumSupportedRelease ?? '99999.99999.9999',
200 };
201
202 validateMetadata(metadata);
203 return metadata;
204 }
205 catch (ex) {
206 console.error(ex)
207 }
208 return null
209}
210
211function loadPieceViaChildProcess(folderPath: string): LoadedPieceChildPayload {
212 const stdout = execFileSync('node', [LOAD_PIECE_METADATA_CHILD, folderPath], {

Callers 2

findNewPiecesFunction · 0.70
findAllPiecesFunction · 0.70

Calls 4

readPackageJsonFunction · 0.90
loadPieceViaChildProcessFunction · 0.85
validateMetadataFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected