Skip to content

Commit a472603

Browse files
authored
Fix lifecycle info (#1)
* Fix docker copy error * Fix off-by-one error in if * Fix too early string flattening, causing lifecycle object to be unparsable
1 parent c87eec0 commit a472603

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ USER ${DOCKER_USER}
1111
FROM base as source
1212
ARG DOCKER_USER
1313
WORKDIR /src
14-
COPY package.json bun.lockb .
14+
COPY package.json bun.lockb ./
1515
RUN bun install \
1616
--frozen-lockfile \
1717
--production

util/lists.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const outputTsv = (data: any, properties?: string[]) => {
3232
return
3333
}
3434

35-
properties = properties
35+
properties = properties
3636
? properties
3737
: Object.keys(data[0]);
3838

@@ -44,10 +44,11 @@ const outputTsv = (data: any, properties?: string[]) => {
4444
for (const item of data) {
4545
const lineValues = [];
4646
for (const propIndex in properties) {
47-
const value = `${item[properties[propIndex]]}`;
47+
const value = item[properties[propIndex]];
48+
const stringValue = `${value}`;
4849

49-
if (longestValues[propIndex] < value.length) {
50-
longestValues[propIndex] = value.length;
50+
if (longestValues[propIndex] < stringValue.length) {
51+
longestValues[propIndex] = stringValue.length;
5152
}
5253

5354
lineValues.push(value);
@@ -59,12 +60,22 @@ const outputTsv = (data: any, properties?: string[]) => {
5960
lines.forEach(lineValues => {
6061
let line = '';
6162
for (let i = 0; i < lineValues.length; i++) {
62-
// if is last, then don't add padEnd
63-
if (i < lineValues.length) {
64-
line += lineValues[i] ? lineValues[i].padEnd(longestValues[i] + 1) : '';
65-
} else {
66-
line += lineValues[i];
67-
}
63+
if (lineValues[i] === undefined) {
64+
line += '';
65+
continue;
66+
}
67+
68+
// if is last, then don't add padEnd
69+
if (i < lineValues.length - 1) {
70+
line += `${lineValues[i]}`.padEnd(longestValues[i] + 1);
71+
} else {
72+
if (typeof lineValues[i] === 'string') {
73+
line += lineValues[i]; // header row
74+
}
75+
else {
76+
line += lineValues[i].lts ? 'LTS' : 'STS';
77+
}
78+
}
6879
}
6980

7081
console.log(line);

0 commit comments

Comments
 (0)