@@ -63,15 +63,15 @@ export const enforceTargetType = makeStringEnumTypeEnforcer(...kTargets);
63
63
64
64
const kIndent = " " ;
65
65
66
- export async function check ( target : Target ) : Promise < void > {
66
+ export async function check ( target : Target , strict ?: boolean ) : Promise < void > {
67
67
const services = renderServices ( notebookContext ( ) ) ;
68
68
try {
69
69
info ( `Quarto ${ quartoConfig . version ( ) } ` ) ;
70
70
if ( target === "info" || target === "all" ) {
71
71
await checkInfo ( services ) ;
72
72
}
73
73
if ( target === "versions" || target === "all" ) {
74
- await checkVersions ( services ) ;
74
+ await checkVersions ( services , strict ) ;
75
75
}
76
76
if ( target === "install" || target === "all" ) {
77
77
await checkInstall ( services ) ;
@@ -96,8 +96,8 @@ async function checkInfo(_services: RenderServices) {
96
96
info ( kIndent + "Quarto cache location: " + cacheDir ) ;
97
97
}
98
98
99
- async function checkVersions ( _services : RenderServices ) {
100
- const checkVersion = async (
99
+ async function checkVersions ( _services : RenderServices , strict ?: boolean ) {
100
+ const checkVersion = (
101
101
version : string | undefined ,
102
102
constraint : string ,
103
103
name : string ,
@@ -116,6 +116,20 @@ async function checkVersions(_services: RenderServices) {
116
116
}
117
117
} ;
118
118
119
+ const strictCheckVersion = (
120
+ version : string ,
121
+ constraint : string ,
122
+ name : string ,
123
+ ) => {
124
+ if ( version !== constraint ) {
125
+ info (
126
+ ` NOTE: ${ name } version ${ version } does not strictly match ${ constraint } and strict checking is enabled. Please use ${ constraint } .` ,
127
+ ) ;
128
+ } else {
129
+ info ( ` ${ name } version ${ version } : OK` ) ;
130
+ }
131
+ } ;
132
+
119
133
completeMessage ( "Checking versions of quarto binary dependencies..." ) ;
120
134
121
135
let pandocVersion = lines (
@@ -124,6 +138,15 @@ async function checkVersions(_services: RenderServices) {
124
138
stdout : "piped" ,
125
139
} ) ) . stdout ! ,
126
140
) [ 0 ] ?. split ( " " ) [ 1 ] ;
141
+ const sassVersion = ( await dartCommand ( [ "--version" ] ) ) ?. trim ( ) ;
142
+ const denoVersion = Deno . version . deno ;
143
+ const typstVersion = lines (
144
+ ( await execProcess ( {
145
+ cmd : [ typstBinaryPath ( ) , "--version" ] ,
146
+ stdout : "piped" ,
147
+ } ) ) . stdout ! ,
148
+ ) [ 0 ] . split ( " " ) [ 1 ] ;
149
+
127
150
// We hack around pandocVersion to build a sem-verish string
128
151
// that satisfies the semver package
129
152
// if pandoc reports more than three version numbers, pick the first three
@@ -138,29 +161,33 @@ async function checkVersions(_services: RenderServices) {
138
161
) . join ( "." ) ;
139
162
}
140
163
}
141
- checkVersion ( pandocVersion , ">=2.19.2" , "Pandoc" ) ;
142
-
143
- const sassVersion = ( await dartCommand ( [ "--version" ] ) ) ?. trim ( ) ;
144
- checkVersion ( sassVersion , ">=1.32.8" , "Dart Sass" ) ;
145
164
146
- // manually check Deno version without shelling out
147
- // because we're actually running in Deno right now
148
- if ( ! satisfies ( Deno . version . deno , ">=1.33.1" ) ) {
149
- info (
150
- ` NOTE: Deno version ${ Deno . version . deno } is too old. Please upgrade to 1.33.1 or later.` ,
151
- ) ;
152
- } else {
153
- info ( ` Deno version ${ Deno . version . deno } : OK` ) ;
165
+ // FIXME: all of these strict checks should be done by
166
+ // loading the configuration file directly, but that
167
+ // file is in an awkward format and it is not packaged
168
+ // with our installers
169
+ const checkData : [ string | undefined , string , string ] [ ] = strict
170
+ ? [
171
+ [ pandocVersion , "3.6.3" , "Pandoc" ] ,
172
+ [ sassVersion , "1.85.1" , "Dart Sass" ] ,
173
+ [ denoVersion , "1.46.3" , "Deno" ] ,
174
+ [ typstVersion , "0.13.0" , "Typst" ] ,
175
+ ]
176
+ : [
177
+ [ pandocVersion , ">=2.19.2" , "Pandoc" ] ,
178
+ [ sassVersion , ">=1.32.8" , "Dart Sass" ] ,
179
+ [ denoVersion , ">=1.33.1" , "Deno" ] ,
180
+ [ typstVersion , ">=0.10.0" , "Typst" ] ,
181
+ ] ;
182
+ const fun = strict ? strictCheckVersion : checkVersion ;
183
+ for ( const [ version , constraint , name ] of checkData ) {
184
+ if ( version === undefined ) {
185
+ info ( ` ${ name } version: (not detected)` ) ;
186
+ } else {
187
+ fun ( version , constraint , name ) ;
188
+ }
154
189
}
155
190
156
- let typstVersion = lines (
157
- ( await execProcess ( {
158
- cmd : [ typstBinaryPath ( ) , "--version" ] ,
159
- stdout : "piped" ,
160
- } ) ) . stdout ! ,
161
- ) [ 0 ] . split ( " " ) [ 1 ] ;
162
- checkVersion ( typstVersion , ">=0.10.0" , "Typst" ) ;
163
-
164
191
completeMessage ( "Checking versions of quarto dependencies......OK" ) ;
165
192
}
166
193
0 commit comments