New build script.
This commit is contained in:
parent
9f202bdd9d
commit
c1b8e8adb1
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,5 +12,6 @@ lib/
|
||||
.yarnrc*
|
||||
yarn-error.log
|
||||
.pnp*
|
||||
node_modules/
|
||||
|
||||
yarn.lock
|
||||
|
38
build.ts
Normal file
38
build.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import {build} from "esbuild";
|
||||
|
||||
/**
|
||||
* Build the library.
|
||||
* @param devMode - Dev mode.
|
||||
*/
|
||||
function buildLibrary(devMode: boolean = false): void
|
||||
{
|
||||
// Compilation de l'application.
|
||||
build({
|
||||
entryPoints: ["src/index.ts"],
|
||||
outfile: "lib/index.js",
|
||||
bundle: true,
|
||||
minify: true,
|
||||
sourcemap: true,
|
||||
format: "esm",
|
||||
loader: {
|
||||
".ts": "ts",
|
||||
},
|
||||
watch: devMode ? {
|
||||
// Affichage suite à une recompilation.
|
||||
onRebuild(error, result) {
|
||||
console.log(new Date());
|
||||
if (!error && result.errors.length == 0)
|
||||
console.log("Successfully built.");
|
||||
else
|
||||
console.error("Error!");
|
||||
}
|
||||
} : false,
|
||||
})
|
||||
// Fonction lancée pour une compilation réussie.
|
||||
.then(() => { console.log(new Date()); console.log("Success."); })
|
||||
// Fonction lancée pour une compilation échouée.
|
||||
.catch((e) => console.error(e.message));
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
buildLibrary(process.argv?.[2] == "dev");
|
24
package.json
24
package.json
@ -2,18 +2,24 @@
|
||||
"name": "@sharkitek/core",
|
||||
"version": "1.2.0",
|
||||
"description": "Sharkitek core models library.",
|
||||
"keywords": ["sharkitek", "model", "serialization", "diff", "dirty", "deserialization", "property"],
|
||||
"keywords": [
|
||||
"sharkitek",
|
||||
"model",
|
||||
"serialization",
|
||||
"diff",
|
||||
"dirty",
|
||||
"deserialization",
|
||||
"property"
|
||||
],
|
||||
"repository": "https://git.madeorsk.com/Sharkitek/core",
|
||||
"author": "Madeorsk <madeorsk@protonmail.com>",
|
||||
"license": "MIT",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"build": "parcel build",
|
||||
"dev": "parcel watch",
|
||||
"build": "ts-node build.ts && tsc --emitDeclarationOnly",
|
||||
"test": "jest"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"source": "src/index.ts",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
@ -22,13 +28,11 @@
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/packager-ts": "2.6.2",
|
||||
"@parcel/transformer-typescript-types": "2.6.2",
|
||||
"@types/jest": "^28.1.6",
|
||||
"esbuild": "^0.15.8",
|
||||
"jest": "^28.1.3",
|
||||
"parcel": "^2.6.2",
|
||||
"ts-jest": "^28.0.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"packageManager": "yarn@3.2.2"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,10 @@
|
||||
{
|
||||
"ts-node": {
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS"
|
||||
}
|
||||
},
|
||||
|
||||
"files": ["src/index.ts"],
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib/",
|
||||
@ -11,7 +17,7 @@
|
||||
"sourceMap": true,
|
||||
"module": "ES6",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES5",
|
||||
"target": "ES6",
|
||||
|
||||
"lib": [
|
||||
"ESNext",
|
||||
|
Reference in New Issue
Block a user