diff --git a/cli/src/generate/grammar_files.rs b/cli/src/generate/grammar_files.rs index 4cf03c35..549bb279 100644 --- a/cli/src/generate/grammar_files.rs +++ b/cli/src/generate/grammar_files.rs @@ -1,17 +1,13 @@ use super::write_file; use anyhow::{anyhow, Context, Result}; -use filetime::FileTime; use heck::{ToKebabCase, ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase}; use serde::Deserialize; use serde_json::{json, Map, Value}; use std::fs::File; use std::io::BufReader; use std::path::{Path, PathBuf}; -use std::time::{Duration, SystemTime}; use std::{fs, str}; -const BUILD_TIME: &str = env!("BUILD_TIME"); - const CLI_VERSION: &str = env!("CARGO_PKG_VERSION"); const CLI_VERSION_PLACEHOLDER: &str = "CLI_VERSION"; @@ -20,7 +16,6 @@ const CAMEL_PARSER_NAME_PLACEHOLDER: &str = "CAMEL_PARSER_NAME"; const UPPER_PARSER_NAME_PLACEHOLDER: &str = "UPPER_PARSER_NAME"; const LOWER_PARSER_NAME_PLACEHOLDER: &str = "LOWER_PARSER_NAME"; -const DSL_D_TS_FILE: &str = include_str!("../../npm/dsl.d.ts"); const GRAMMAR_JS_TEMPLATE: &str = include_str!("./templates/grammar.js"); const PACKAGE_JSON_TEMPLATE: &str = include_str!("./templates/package.json"); const GITIGNORE_TEMPLATE: &str = include_str!("./templates/gitignore"); @@ -209,7 +204,6 @@ pub fn generate_grammar_files( json!([ "grammar.js", "binding.gyp", - "types/dsl.d.ts", "prebuilds/**", "bindings/node/*", "queries/*", @@ -244,33 +238,6 @@ pub fn generate_grammar_files( return Ok(()); } - // Rewrite dsl.d.ts only if its mtime differs from what was set on its creation - missing_path(repo_path.join("types"), create_dir)?.apply(|path| { - missing_path(path.join("dsl.d.ts"), |path| { - write_file(path, DSL_D_TS_FILE) - })? - .apply_state(|state| { - let build_time = - SystemTime::UNIX_EPOCH + Duration::from_secs_f64(BUILD_TIME.parse::()?); - - match state { - PathState::Exists(path) => { - let mtime = fs::metadata(path)?.modified()?; - if mtime != build_time { - write_file(path, DSL_D_TS_FILE)?; - filetime::set_file_mtime(path, FileTime::from_system_time(build_time))?; - } - } - PathState::Missing(path) => { - filetime::set_file_mtime(path, FileTime::from_system_time(build_time))?; - } - } - - Ok(()) - })?; - Ok(()) - })?; - // Write .gitignore file missing_path(repo_path.join(".gitignore"), |path| { generate_file(path, GITIGNORE_TEMPLATE, language_name) diff --git a/cli/src/generate/templates/gitignore b/cli/src/generate/templates/gitignore index 1f2e23ae..27fc43f7 100644 --- a/cli/src/generate/templates/gitignore +++ b/cli/src/generate/templates/gitignore @@ -33,7 +33,6 @@ dist/ /examples/*/ # Grammar volatiles -dsl.d.ts *.wasm *.obj *.o diff --git a/cli/src/generate/templates/grammar.js b/cli/src/generate/templates/grammar.js index b82d06e2..62b7cf3b 100644 --- a/cli/src/generate/templates/grammar.js +++ b/cli/src/generate/templates/grammar.js @@ -1,4 +1,4 @@ -/// +/// // @ts-check module.exports = grammar({ diff --git a/cli/src/generate/templates/package.json b/cli/src/generate/templates/package.json index a73d296e..fe67099b 100644 --- a/cli/src/generate/templates/package.json +++ b/cli/src/generate/templates/package.json @@ -15,7 +15,6 @@ "files": [ "grammar.js", "binding.gyp", - "types/dsl.d.ts", "prebuilds/**", "bindings/node/*", "queries/*",