in src/cmd/sign.js [133:165]
export async function getIdFromFile(
filePath,
asyncFsReadFile = defaultAsyncFsReadFile,
) {
let content;
try {
content = await asyncFsReadFile(filePath);
} catch (error) {
if (isErrorWithCode('ENOENT', error)) {
log.debug(`No ID file found at: ${filePath}`);
return;
}
throw error;
}
let lines = content.toString().split('\n');
lines = lines.filter((line) => {
line = line.trim();
if (line && !line.startsWith('#')) {
return line;
}
});
const id = lines[0];
log.debug(`Found extension ID ${id} in ${filePath}`);
if (!id) {
throw new UsageError(`No ID found in extension ID file ${filePath}`);
}
return id;
}