Skip to content

Commit b2c0c18

Browse files
author
Cédric Belin
committed
Add the TypeScript settings
1 parent 72b1cac commit b2c0c18

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

example/gulpfile.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {phpMinify} from "@cedx/php-minifier";
2+
import gulp from "gulp";
3+
import process from "node:process";
4+
5+
// Compresses a given set of PHP scripts.
6+
export function compressPhp() {
7+
const isWindows = process.platform == "win32";
8+
const options = {
9+
binary: isWindows ? "C:/Program Files/PHP/php.exe" : "/usr/bin/php",
10+
mode: isWindows ? "safe" : "fast",
11+
silent: process.stdout.isTTY
12+
};
13+
14+
return gulp.src("path/to/**/*.php", {read: false})
15+
.pipe(phpMinify(options))
16+
.pipe(gulp.dest("path/to/out"));
17+
}

lib/index.cjs

Lines changed: 0 additions & 2 deletions
This file was deleted.

lib/index.mjs

Lines changed: 0 additions & 2 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"name": "@cedx/php-minifier",
77
"repository": "cedx/php-minifier",
8-
"type": "commonjs",
9-
"version": "4.0.1",
8+
"type": "module",
9+
"version": "5.0.0",
1010
"author": {
1111
"email": "cedric@belin.io",
1212
"name": "Cédric Belin",
@@ -20,7 +20,10 @@
2020
"plugin-error": "^2.0.1"
2121
},
2222
"devDependencies": {
23+
"@coffeelint/cli": "^5.2.11",
24+
"@types/gulp": "^4.0.17",
2325
"@types/node": "^22.8.7",
26+
"coffeescript": "^2.7.0",
2427
"terser": "^5.36.0",
2528
"vinyl": "^3.0.0"
2629
},
@@ -29,11 +32,11 @@
2932
},
3033
"exports": {
3134
"types": "./lib/index.d.ts",
32-
"import": "./lib/index.mjs",
33-
"default": "./lib/index.cjs"
35+
"default": "./lib/index.js"
3436
},
3537
"files": [
3638
"lib/",
39+
"src/",
3740
"www/"
3841
],
3942
"keywords": [
@@ -48,6 +51,6 @@
4851
},
4952
"scripts": {
5053
"start": "node bin/php_minifier.js --help",
51-
"test": "lix Test"
54+
"test": "cake test"
5255
}
5356
}

tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"noEmit": true,
5+
"module": "NodeNext"
6+
}
7+
}

0 commit comments

Comments
 (0)