@@ -47,6 +47,13 @@ cli.command(
47
47
const versions = Array . isArray ( args . versions ) ? args . versions : [ args . versions ] ;
48
48
const generators = Array . isArray ( args . generators ) ? args . generators : [ args . generators ] ;
49
49
50
+ const lockfile = await readLockfile ( ) ;
51
+
52
+ if ( lockfile == null ) {
53
+ consola . error ( "no lockfile found, run `mojis versions --write-lockfile` to generate one" ) ;
54
+ process . exit ( 1 ) ;
55
+ }
56
+
50
57
function isGeneratorEnabled ( generator : string ) {
51
58
return generators . includes ( generator ) ;
52
59
}
@@ -75,12 +82,27 @@ cli.command(
75
82
throw new Error ( `no adapter found for version ${ version } ` ) ;
76
83
}
77
84
85
+ const lockfileMetadata = lockfile . versions . find ( ( v ) => v . emoji_version === version ) ?. metadata ?? {
86
+ emojis : null ,
87
+ metadata : null ,
88
+ sequences : null ,
89
+ shortcodes : null ,
90
+ unicodeNames : null ,
91
+ variations : null ,
92
+ zwj : null ,
93
+ } ;
94
+
78
95
if ( isGeneratorEnabled ( "metadata" ) ) {
79
96
if ( adapter . metadata == null ) {
80
97
throw new MojisNotImplemented ( "metadata" ) ;
81
98
}
82
99
83
- const { groups, emojiMetadata } = await adapter . metadata ( { emojiVersion : version , force, unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! } ) ;
100
+ const { groups, emojiMetadata } = await adapter . metadata ( {
101
+ emojiVersion : version ,
102
+ force,
103
+ unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! ,
104
+ lockfileMetadata,
105
+ } ) ;
84
106
85
107
await fs . ensureDir ( `./data/v${ version } /metadata` ) ;
86
108
@@ -102,7 +124,12 @@ cli.command(
102
124
throw new MojisNotImplemented ( "sequences" ) ;
103
125
}
104
126
105
- const { sequences, zwj } = await adapter . sequences ( { emojiVersion : version , force, unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! } ) ;
127
+ const { sequences, zwj } = await adapter . sequences ( {
128
+ emojiVersion : version ,
129
+ force,
130
+ unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! ,
131
+ lockfileMetadata,
132
+ } ) ;
106
133
107
134
await fs . ensureDir ( `./data/v${ version } ` ) ;
108
135
@@ -124,7 +151,12 @@ cli.command(
124
151
throw new MojisNotImplemented ( "variations" ) ;
125
152
}
126
153
127
- const variations = await adapter . variations ( { emojiVersion : version , force, unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! } ) ;
154
+ const variations = await adapter . variations ( {
155
+ emojiVersion : version ,
156
+ force,
157
+ unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! ,
158
+ lockfileMetadata,
159
+ } ) ;
128
160
129
161
await fs . ensureDir ( `./data/v${ version } ` ) ;
130
162
await fs . writeFile (
@@ -139,7 +171,12 @@ cli.command(
139
171
throw new MojisNotImplemented ( "emojis" ) ;
140
172
}
141
173
142
- const { emojiData, emojis } = await adapter . emojis ( { emojiVersion : version , force, unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! } ) ;
174
+ const { emojiData, emojis } = await adapter . emojis ( {
175
+ emojiVersion : version ,
176
+ force,
177
+ unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! ,
178
+ lockfileMetadata,
179
+ } ) ;
143
180
144
181
await fs . ensureDir ( `./data/v${ version } ` ) ;
145
182
@@ -177,7 +214,13 @@ cli.command(
177
214
throw new MojisNotImplemented ( "shortcodes" ) ;
178
215
}
179
216
180
- const shortcodes = await adapter . shortcodes ( { emojiVersion : version , force, unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! , providers } ) ;
217
+ const shortcodes = await adapter . shortcodes ( {
218
+ emojiVersion : version ,
219
+ force,
220
+ unicodeVersion : getUnicodeVersionByEmojiVersion ( version ) ! ,
221
+ providers,
222
+ lockfileMetadata,
223
+ } ) ;
181
224
182
225
await fs . ensureDir ( `./data/v${ version } /shortcodes` ) ;
183
226
0 commit comments