diff --git a/CHANGELOG.md b/CHANGELOG.md index 93d8d229e8..7ffe097d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - `apollo` - Relax graphql version, resolve missing types "Boolean", "String" [#1355](https://github.com/apollographql/apollo-tooling/pull/1355) - - Add `service:list` and tests [#1358](https://github.com/apollographql/apollo-tooling/pull/1358) + - Add `service:list` and tests [#1358](https://github.com/apollographql/apollo-tooling/pull/1358) and header [#1377](https://github.com/apollographql/apollo-tooling/pull/1377) - Update `service:list` test to use a simulated time to prevent relative dates causing snapshot failures [#1374](https://github.com/apollographql/apollo-tooling/pull/1374) - `apollo-codegen-core` - diff --git a/packages/apollo/src/commands/service/__tests__/__snapshots__/list.test.ts.snap b/packages/apollo/src/commands/service/__tests__/__snapshots__/list.test.ts.snap index a553b3cc53..5191903bad 100644 --- a/packages/apollo/src/commands/service/__tests__/__snapshots__/list.test.ts.snap +++ b/packages/apollo/src/commands/service/__tests__/__snapshots__/list.test.ts.snap @@ -16,6 +16,8 @@ Loading Apollo Project [completed] Fetching list of services for graph engine [started] Fetching list of services for graph engine [completed] +name URL last updated +───────── ───────────────────────────── ───────────────────────── accounts http://localhost:4001/graphql 13 May 2019 (a month ago) inventory http://localhost:4002/graphql 16 May 2019 (a month ago) products http://localhost:4003/graphql 16 May 2019 (a month ago) diff --git a/packages/apollo/src/commands/service/list.ts b/packages/apollo/src/commands/service/list.ts index 557e2a4e45..120a47810d 100644 --- a/packages/apollo/src/commands/service/list.ts +++ b/packages/apollo/src/commands/service/list.ts @@ -67,15 +67,16 @@ function formatHumanReadable({ process.env.NODE_ENV === "test" ? new Date("2019-06-13") : undefined ) ) + .sort((s1, s2) => + s1.name.toUpperCase() > s2.name.toUpperCase() ? 1 : -1 + ) .filter(Boolean), { columns: [ - { key: "name", label: "Name" }, + { key: "name", label: "name" }, { key: "url", label: "URL" }, - { key: "updatedAt", label: "Last Updated At" } + { key: "updatedAt", label: "last updated" } ], - // Override `printHeader` so we don't print a header - printHeader: () => {}, // The default `printLine` will output to the console; we want to capture the output so we can test // it. printLine: line => {