1
1
use super :: write_file;
2
2
use anyhow:: { anyhow, Context , Result } ;
3
- use filetime:: FileTime ;
4
3
use heck:: { ToKebabCase , ToShoutySnakeCase , ToSnakeCase , ToUpperCamelCase } ;
5
4
use serde:: Deserialize ;
6
5
use serde_json:: { json, Map , Value } ;
7
6
use std:: fs:: File ;
8
7
use std:: io:: BufReader ;
9
8
use std:: path:: { Path , PathBuf } ;
10
- use std:: time:: { Duration , SystemTime } ;
11
9
use std:: { fs, str} ;
12
10
13
- const BUILD_TIME : & str = env ! ( "BUILD_TIME" ) ;
14
-
15
11
const CLI_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
16
12
const CLI_VERSION_PLACEHOLDER : & str = "CLI_VERSION" ;
17
13
@@ -20,7 +16,6 @@ const CAMEL_PARSER_NAME_PLACEHOLDER: &str = "CAMEL_PARSER_NAME";
20
16
const UPPER_PARSER_NAME_PLACEHOLDER : & str = "UPPER_PARSER_NAME" ;
21
17
const LOWER_PARSER_NAME_PLACEHOLDER : & str = "LOWER_PARSER_NAME" ;
22
18
23
- const DSL_D_TS_FILE : & str = include_str ! ( "../../npm/dsl.d.ts" ) ;
24
19
const GRAMMAR_JS_TEMPLATE : & str = include_str ! ( "./templates/grammar.js" ) ;
25
20
const PACKAGE_JSON_TEMPLATE : & str = include_str ! ( "./templates/package.json" ) ;
26
21
const GITIGNORE_TEMPLATE : & str = include_str ! ( "./templates/gitignore" ) ;
@@ -209,7 +204,6 @@ pub fn generate_grammar_files(
209
204
json ! ( [
210
205
"grammar.js" ,
211
206
"binding.gyp" ,
212
- "types/dsl.d.ts" ,
213
207
"prebuilds/**" ,
214
208
"bindings/node/*" ,
215
209
"queries/*" ,
@@ -244,33 +238,6 @@ pub fn generate_grammar_files(
244
238
return Ok ( ( ) ) ;
245
239
}
246
240
247
- // Rewrite dsl.d.ts only if its mtime differs from what was set on its creation
248
- missing_path ( repo_path. join ( "types" ) , create_dir) ?. apply ( |path| {
249
- missing_path ( path. join ( "dsl.d.ts" ) , |path| {
250
- write_file ( path, DSL_D_TS_FILE )
251
- } ) ?
252
- . apply_state ( |state| {
253
- let build_time =
254
- SystemTime :: UNIX_EPOCH + Duration :: from_secs_f64 ( BUILD_TIME . parse :: < f64 > ( ) ?) ;
255
-
256
- match state {
257
- PathState :: Exists ( path) => {
258
- let mtime = fs:: metadata ( path) ?. modified ( ) ?;
259
- if mtime != build_time {
260
- write_file ( path, DSL_D_TS_FILE ) ?;
261
- filetime:: set_file_mtime ( path, FileTime :: from_system_time ( build_time) ) ?;
262
- }
263
- }
264
- PathState :: Missing ( path) => {
265
- filetime:: set_file_mtime ( path, FileTime :: from_system_time ( build_time) ) ?;
266
- }
267
- }
268
-
269
- Ok ( ( ) )
270
- } ) ?;
271
- Ok ( ( ) )
272
- } ) ?;
273
-
274
241
// Write .gitignore file
275
242
missing_path ( repo_path. join ( ".gitignore" ) , |path| {
276
243
generate_file ( path, GITIGNORE_TEMPLATE , language_name)
0 commit comments