Update library build and test configuration.
This commit is contained in:
parent
13c852cd52
commit
0876c59c98
7 changed files with 88 additions and 87 deletions
38
build.ts
38
build.ts
|
@ -1,38 +0,0 @@
|
|||
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");
|
|
@ -1,5 +1,6 @@
|
|||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||
module.exports = {
|
||||
|
||||
export default {
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "node",
|
||||
|
||||
|
|
77
package.json
77
package.json
|
@ -1,38 +1,43 @@
|
|||
{
|
||||
"name": "@sharkitek/core",
|
||||
"version": "2.0.1",
|
||||
"description": "Sharkitek core models library.",
|
||||
"keywords": [
|
||||
"sharkitek",
|
||||
"model",
|
||||
"serialization",
|
||||
"diff",
|
||||
"dirty",
|
||||
"deserialization",
|
||||
"property"
|
||||
],
|
||||
"repository": "https://git.madeorsk.com/Sharkitek/core",
|
||||
"author": "Madeorsk <madeorsk@protonmail.com>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "parcel build",
|
||||
"test": "jest"
|
||||
},
|
||||
"source": "src/index.ts",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@parcel/packager-ts": "2.7.0",
|
||||
"@parcel/transformer-typescript-types": "2.7.0",
|
||||
"@types/jest": "^28.1.6",
|
||||
"esbuild": "^0.15.8",
|
||||
"jest": "^28.1.3",
|
||||
"parcel": "^2.7.0",
|
||||
"ts-jest": "^28.0.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4"
|
||||
}
|
||||
"name": "@sharkitek/core",
|
||||
"version": "2.0.1",
|
||||
"description": "Sharkitek core models library.",
|
||||
"keywords": [
|
||||
"sharkitek",
|
||||
"model",
|
||||
"serialization",
|
||||
"diff",
|
||||
"dirty",
|
||||
"deserialization",
|
||||
"property"
|
||||
],
|
||||
"repository": "https://git.madeorsk.com/Sharkitek/core",
|
||||
"author": "Madeorsk <madeorsk@protonmail.com>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsc && vite build",
|
||||
"test": "jest"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "src/index.ts",
|
||||
"types": "lib/index.d.ts",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.13",
|
||||
"@types/node": "^22.7.4",
|
||||
"jest": "^29.7.0",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"ts-jest": "^29.2.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.4.8",
|
||||
"vite-plugin-dts": "^4.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"reflect-metadata": "^0.2.2"
|
||||
},
|
||||
"packageManager": "yarn@4.5.0"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
export * from "./Model/Model";
|
||||
|
||||
export * from "./Model/Definition";
|
||||
|
|
|
@ -33,7 +33,7 @@ class Author extends Model<Author>
|
|||
};
|
||||
}
|
||||
|
||||
constructor(name: string = undefined, firstName: string = undefined, email: string = undefined, createdAt: Date = undefined)
|
||||
constructor(name: string = "", firstName: string = "", email: string = "", createdAt: Date = new Date())
|
||||
{
|
||||
super();
|
||||
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
{
|
||||
"ts-node": {
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS"
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
}
|
||||
},
|
||||
|
||||
"files": ["src/index.ts"],
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib/",
|
||||
"incremental": true,
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"resolveJsonModule": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"module": "ES6",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES6",
|
||||
|
||||
"target": "ES6",
|
||||
"moduleResolution": "Bundler",
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"DOM"
|
||||
]
|
||||
],
|
||||
}
|
||||
}
|
||||
|
|
30
vite.config.ts
Normal file
30
vite.config.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import {ConfigEnv, defineConfig, UserConfig} from "vite";
|
||||
import dts from "vite-plugin-dts";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
|
||||
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
return ({
|
||||
build: {
|
||||
outDir: "lib",
|
||||
sourcemap: true,
|
||||
minify: "esbuild",
|
||||
lib: {
|
||||
entry: "src/index.ts",
|
||||
formats: ["es"],
|
||||
fileName: "index",
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ["reflect-metadata"],
|
||||
},
|
||||
},
|
||||
|
||||
plugins: [
|
||||
dts({
|
||||
insertTypesEntry: true,
|
||||
rollupTypes: true,
|
||||
exclude: ["node_modules"],
|
||||
}),
|
||||
]
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue