diff --git a/.gitignore b/.gitignore index a198a78..0aa23d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ bin/ -node_modules/ \ No newline at end of file +node_modules/ +private/ +test/ \ No newline at end of file diff --git a/dev.ps1 b/dev.ps1 new file mode 100644 index 0000000..f0f25fb --- /dev/null +++ b/dev.ps1 @@ -0,0 +1,3 @@ +md test +cd test +node ../src/main.js \ No newline at end of file diff --git a/package.json b/package.json index fd9e137..e455047 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "src/main.js", "module": "CommonJS", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "powershell ./dev.ps1" }, "repository": { "type": "git", diff --git a/src/main.js b/src/main.js index 45dd96b..d614922 100644 --- a/src/main.js +++ b/src/main.js @@ -19,21 +19,31 @@ const declarations = "./script_types"; const version_registred = { "build-version":"1.0.0.0", "version":"1.0.0.0", - "glags":[ - "generated_types" - ] + "flags":[ + "generated_types", + "script_module_list" + ], + "script_modules":[] }; const OSSYSTEM = os.platform() === "win32"?"win":"linux"; CompareLatestVersions(); - + +async function Preload(v){ + console.log("Loggin as 'Documentation Manager Bot'") + await System('git config --global user.name "Documentation Manager Bot"'); + await System('git config --global user.email "conmaster2112@gmail.com"'); + await System(`git checkout ${v}`); +} + async function Finish(v,version){ console.log("Versions registred"); await promises.writeFile("exist.json",JSON.stringify(version_registred,null," ")); console.log("Loggin as 'Documentation Manager Bot'") await System('git config --global user.name "Documentation Manager Bot"'); await System('git config --global user.email "conmaster2112@gmail.com"'); + await System(`git checkout ${v}`); console.log("Commit"); await System("git add ."); await System(`git commit -m \"New ${v} v${v==="stable"?GetEngine(version):version}\"`); @@ -91,6 +101,7 @@ async function runDocs(v,version){ DoFiles(docs_generated + "/script_modules",declarations, (file, data)=>{ const Json = JSON.parse(data.toString()); const script_module = new ScriptModule(Json); + version_registred.script_modules.push(file); return [file.replace(".json",".d.ts"),script_module.toString()]; }).then(()=>Finish(v,version)).catch(er=>{ global.console.error(er.message); @@ -146,6 +157,7 @@ async function CompareLatestVersions(){ }) _preview = false; console.log("New Stable Version Found: " + engine); + await Preload("stable"); Generate("stable",stable); return; } @@ -156,6 +168,7 @@ async function CompareLatestVersions(){ }) _preview = true; console.log("New Stable Version Found: " + preview); + await Preload("preview"); Generate("preview",preview); return; }