|
| 1 | +import { dump } from 'js-yaml'; |
1 | 2 | import { Listr } from 'listr2'; |
2 | 3 | import { writeFile } from 'node:fs/promises'; |
3 | 4 | import path from 'node:path'; |
4 | | -import { Scalar, stringify } from 'yaml'; |
5 | 5 |
|
6 | 6 | import { LoadRemoteConfigurationTask } from '../tasks'; |
7 | 7 | import { InitializeBackendTask } from '../tasks/init_backend'; |
@@ -69,32 +69,9 @@ export const DumpCommand = new BackendCommand<DumpOptions>( |
69 | 69 | task: async (ctx, task) => { |
70 | 70 | await writeFile( |
71 | 71 | opts.output, |
72 | | - stringify(resortConfiguration(ctx.remote), { |
73 | | - sortMapEntries: (a, b) => { |
74 | | - const nameKey = 'name'; |
75 | | - const descKey = 'description'; |
76 | | - const labelKey = 'labels'; |
77 | | - const consumerUsernameKey = 'username'; |
78 | | - const aKey = (a.key as Scalar)?.value; |
79 | | - const bKey = (b.key as Scalar)?.value; |
80 | | - |
81 | | - // make sure the metadata is always at the top |
82 | | - if (aKey && bKey) { |
83 | | - if (aKey === nameKey || bKey === nameKey) |
84 | | - return aKey === nameKey ? -1 : 1; |
85 | | - if ( |
86 | | - aKey === consumerUsernameKey || |
87 | | - bKey === consumerUsernameKey |
88 | | - ) |
89 | | - return aKey === consumerUsernameKey ? -1 : 1; |
90 | | - if (aKey === descKey || bKey === descKey) |
91 | | - return aKey === descKey ? -1 : 1; |
92 | | - if (aKey === labelKey || bKey === labelKey) |
93 | | - return aKey === labelKey ? -1 : 1; |
94 | | - } |
95 | | - |
96 | | - return a.key > b.key ? 1 : a.key < b.key ? -1 : 0; |
97 | | - }, |
| 72 | + dump(resortConfiguration(ctx.remote), { |
| 73 | + noRefs: true, |
| 74 | + sortKeys: true, |
98 | 75 | }), |
99 | 76 | { encoding: 'utf8' }, |
100 | 77 | ); |
|
0 commit comments