update
This commit is contained in:
parent
c9db0716d7
commit
11d6663429
13
package.json
13
package.json
@ -1,15 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "cnmake",
|
"name": "cnmake",
|
||||||
"version": "0.0.7",
|
"version": "0.0.12",
|
||||||
"description": "一个用Nodejs作为框架编译C/C++的代码库,未来可能会支持更多语言",
|
"description": "一个用Nodejs作为框架编译C/C++的代码库,未来可能会支持更多语言",
|
||||||
"main": "./src/index.ts",
|
"main": "./dist/src/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./src/index.ts",
|
"types": "./dist/src/index.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"cnmake": "./dist/index.js"
|
"cnmake": "./dist/src/index.js"
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"dist", "LICENSE", "README.md", "package.json"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsc && node ./build/index.js"
|
"dev": "tsc && node ./dist/src/index.js -v"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -11,6 +11,8 @@ import { getNmakeDir } from "../Tools/NmakeDir.js";
|
|||||||
import { getBuildDir } from "../Tools/BuildDir.js";
|
import { getBuildDir } from "../Tools/BuildDir.js";
|
||||||
import printErrorOrDebug from "../Tools/PrintErrorOrDebug.js";
|
import printErrorOrDebug from "../Tools/PrintErrorOrDebug.js";
|
||||||
import protectPath from "../Tools/ProtectPath.js";
|
import protectPath from "../Tools/ProtectPath.js";
|
||||||
|
import getAbsolute from "../Tools/GetAbsolutePath.js";
|
||||||
|
import getAbsolutePath from "../Tools/GetAbsolutePath.js";
|
||||||
|
|
||||||
export default class CppProject implements Project , SourceFiles,HaveCompiler,Optimize {
|
export default class CppProject implements Project , SourceFiles,HaveCompiler,Optimize {
|
||||||
name: string;
|
name: string;
|
||||||
@ -41,7 +43,7 @@ export default class CppProject implements Project , SourceFiles,HaveCompiler,Op
|
|||||||
printDebug("adding source files "+files)
|
printDebug("adding source files "+files)
|
||||||
files.forEach(v=>{
|
files.forEach(v=>{
|
||||||
this.sourceFilesPath.push(
|
this.sourceFilesPath.push(
|
||||||
path.join(getNmakeDir(),v)
|
getAbsolutePath(getNmakeDir(),v)
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
printDebug("all files in "+this.name+" :"+this.sourceFilesPath)
|
printDebug("all files in "+this.name+" :"+this.sourceFilesPath)
|
||||||
|
11
src/Tools/GetAbsolutePath.ts
Normal file
11
src/Tools/GetAbsolutePath.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import path from "path"
|
||||||
|
|
||||||
|
const getAbsolutePath = (basePath:string,p:string):string=>{
|
||||||
|
if(path.isAbsolute(p)){
|
||||||
|
return p
|
||||||
|
}else{
|
||||||
|
return path.join(basePath,p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getAbsolutePath
|
18
src/index.ts
18
src/index.ts
@ -7,16 +7,12 @@ import { setNmakePath } from "./Tools/NmakePath.js";
|
|||||||
import CppBuilder from "./Builder/CppBuilder.js";
|
import CppBuilder from "./Builder/CppBuilder.js";
|
||||||
import CppProject from "./Project/CppProject.js";
|
import CppProject from "./Project/CppProject.js";
|
||||||
|
|
||||||
export{
|
|
||||||
addProject,
|
|
||||||
CppProject,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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))
|
||||||
|
|
||||||
let nmakeFileName = "nmake.js"
|
let nmakeFileName = "cnmake.js"
|
||||||
if(argv["v"])(global as any).isDebug=true
|
if(argv["v"])(global as any).isDebug=true
|
||||||
if (argv["f"]) {nmakeFileName = argv["f"];printDebug(`setting nmake file name to ${argv["f"]}`)}
|
if (argv["f"]) {nmakeFileName = argv["f"];printDebug(`setting nmake file name to ${argv["f"]}`)}
|
||||||
|
|
||||||
@ -45,10 +41,11 @@ printDebug(`running file ${nmakeFilePath}`)
|
|||||||
await import(pathToFileURL(nmakeFilePath).toString())
|
await import(pathToFileURL(nmakeFilePath).toString())
|
||||||
printDebug(`run completion!`,nmakeFilePath)
|
printDebug(`run completion!`,nmakeFilePath)
|
||||||
|
|
||||||
if(argv["b"]){
|
|
||||||
printDebug("will build the project")
|
|
||||||
await new CppBuilder().build()
|
await new CppBuilder().build()
|
||||||
}
|
// if(argv["b"]){
|
||||||
|
// printDebug("will build the project")
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
// if (argv[0]) {
|
// if (argv[0]) {
|
||||||
// switch (argv[0]) {
|
// switch (argv[0]) {
|
||||||
@ -60,3 +57,8 @@ if(argv["b"]){
|
|||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
export {
|
||||||
|
addProject,
|
||||||
|
CppProject
|
||||||
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/* Modules */
|
/* Modules */
|
||||||
"module": "NodeNext", /* Specify what module code is generated. */
|
"module": "NodeNext", /* Specify what module code is generated. */
|
||||||
// "rootDir": "./src", /* Specify the root folder within your source files. */
|
"rootDir": "./src", /* Specify the root folder within your source files. */
|
||||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
Loading…
Reference in New Issue
Block a user