update
This commit is contained in:
		
							parent
							
								
									fd1d436ff6
								
							
						
					
					
						commit
						374de7ad2c
					
				@ -1,9 +1,12 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "cnmake",
 | 
					  "name": "cnmake",
 | 
				
			||||||
  "version": "0.0.1",
 | 
					  "version": "0.0.2",
 | 
				
			||||||
  "description": "一个用Nodejs作为框架编译C/C++的代码库,未来可能会支持更多语言",
 | 
					  "description": "一个用Nodejs作为框架编译C/C++的代码库,未来可能会支持更多语言",
 | 
				
			||||||
  "main": "./src/index.ts",
 | 
					  "main": "./src/index.ts",
 | 
				
			||||||
  "type": "module",
 | 
					  "type": "module",
 | 
				
			||||||
 | 
					  "bin": {
 | 
				
			||||||
 | 
					    "cnmake": "./dist/index.js"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "dev": "tsc && node ./build/index.js"
 | 
					    "dev": "tsc && node ./build/index.js"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
				
			|||||||
@ -2,10 +2,12 @@ import Project from "../Project/Project.js";
 | 
				
			|||||||
import printErrorOrDebug from "./PrintErrorOrDebug.js";
 | 
					import printErrorOrDebug from "./PrintErrorOrDebug.js";
 | 
				
			||||||
import { getGlobalProjects } from "./Projects.js";
 | 
					import { getGlobalProjects } from "./Projects.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addProject = (f:{():Project}) =>{
 | 
					const addProject = (f:{():Project}) =>{
 | 
				
			||||||
    const project = f()
 | 
					    const project = f()
 | 
				
			||||||
    if(getGlobalProjects()[project.name]){
 | 
					    if(getGlobalProjects()[project.name]){
 | 
				
			||||||
        printErrorOrDebug(`the project name "${project.name}" was used please rename it`)
 | 
					        printErrorOrDebug(`the project name "${project.name}" was used please rename it`)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    getGlobalProjects()[project.name] = project
 | 
					    getGlobalProjects()[project.name] = project
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default addProject
 | 
				
			||||||
							
								
								
									
										26
									
								
								src/index.ts
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								src/index.ts
									
									
									
									
									
								
							@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env node
 | 
				
			||||||
import path from "path";
 | 
					import path from "path";
 | 
				
			||||||
import printDebug from "./Tools/DebugPrint.js";
 | 
					import printDebug from "./Tools/DebugPrint.js";
 | 
				
			||||||
import { existsSync } from "fs";
 | 
					import { existsSync } from "fs";
 | 
				
			||||||
@ -5,6 +6,30 @@ import printErrorOrDebug from "./Tools/PrintErrorOrDebug.js";
 | 
				
			|||||||
import { setNmakePath } from "./Tools/NmakePath.js";
 | 
					import { setNmakePath } from "./Tools/NmakePath.js";
 | 
				
			||||||
import CppBuilder from "./Builder/CppBuilder.js";
 | 
					import CppBuilder from "./Builder/CppBuilder.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export * from "./Builder/Builder.js"
 | 
				
			||||||
 | 
					export * from "./Builder/CppBuilder.js"
 | 
				
			||||||
 | 
					export * from "./Compiler/Compiler.js"
 | 
				
			||||||
 | 
					export * from "./Compiler/GppCompiler.js"
 | 
				
			||||||
 | 
					export * from "./Project/CppProject.js"
 | 
				
			||||||
 | 
					export * from "./Project/Project.js"
 | 
				
			||||||
 | 
					export * from "./Tools/AddProject.js"
 | 
				
			||||||
 | 
					export * from "./Tools/BuildDir.js"
 | 
				
			||||||
 | 
					export * from "./Tools/DebugPrint.js"
 | 
				
			||||||
 | 
					export * from "./Tools/DefaultCompiler.js"
 | 
				
			||||||
 | 
					export * from "./Tools/ExecAsync.js"
 | 
				
			||||||
 | 
					export * from "./Tools/GetExecutableExtension.js"
 | 
				
			||||||
 | 
					export * from "./Tools/GetExecutablePathsFromEnv.js"
 | 
				
			||||||
 | 
					export * from "./Tools/GetPathsFromEnv.js"
 | 
				
			||||||
 | 
					export * from "./Tools/GlobalNmake.js"
 | 
				
			||||||
 | 
					export * from "./Tools/NmakeDir.js"
 | 
				
			||||||
 | 
					export * from "./Tools/NmakePath.js"
 | 
				
			||||||
 | 
					export * from "./Tools/PrintErrorOrDebug.js"
 | 
				
			||||||
 | 
					export * from "./Tools/Projects.js"
 | 
				
			||||||
 | 
					export * from "./Tools/ProtectPath.js"
 | 
				
			||||||
 | 
					export * from "./Tools/SetGetDefaultCompiler.js"
 | 
				
			||||||
 | 
					export * from "./Tools/SourceFilesToString.js"
 | 
				
			||||||
 | 
					export * from "./Tools/TryGetCompilerVersion.js"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// const argv = require('minimist')(process.argv.slice(2))
 | 
					// const argv = require('minimist')(process.argv.slice(2))
 | 
				
			||||||
import minimist from "minimist";
 | 
					import minimist from "minimist";
 | 
				
			||||||
const argv = minimist(process.argv.slice(2))
 | 
					const argv = minimist(process.argv.slice(2))
 | 
				
			||||||
@ -26,6 +51,7 @@ setNmakePath(nmakeFilePath)
 | 
				
			|||||||
printDebug("adding ts-node")
 | 
					printDebug("adding ts-node")
 | 
				
			||||||
// import ts_node from "ts-node" 
 | 
					// import ts_node from "ts-node" 
 | 
				
			||||||
import { pathToFileURL } from "url";
 | 
					import { pathToFileURL } from "url";
 | 
				
			||||||
 | 
					import addProject from "./Tools/AddProject.js";
 | 
				
			||||||
// ts_node.register()
 | 
					// ts_node.register()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printDebug("adding global values")
 | 
					printDebug("adding global values")
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,7 @@
 | 
				
			|||||||
    // "sourceMap": true,                                /* Create source map files for emitted JavaScript files. */
 | 
					    // "sourceMap": true,                                /* Create source map files for emitted JavaScript files. */
 | 
				
			||||||
    // "inlineSourceMap": true,                          /* Include sourcemap files inside the emitted JavaScript. */
 | 
					    // "inlineSourceMap": true,                          /* Include sourcemap files inside the emitted JavaScript. */
 | 
				
			||||||
    // "outFile": "./",                                  /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
 | 
					    // "outFile": "./",                                  /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
 | 
				
			||||||
    "outDir": "./build",                                   /* Specify an output folder for all emitted files. */
 | 
					    "outDir": "./dist",                                   /* Specify an output folder for all emitted files. */
 | 
				
			||||||
    // "removeComments": true,                           /* Disable emitting comments. */
 | 
					    // "removeComments": true,                           /* Disable emitting comments. */
 | 
				
			||||||
    // "noEmit": true,                                   /* Disable emitting files from a compilation. */
 | 
					    // "noEmit": true,                                   /* Disable emitting files from a compilation. */
 | 
				
			||||||
    // "importHelpers": true,                            /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
 | 
					    // "importHelpers": true,                            /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user