Skip to content

Commit fdcd6a3

Browse files
author
Cédric Belin
committed
Port the build system to Cake
1 parent c1d76b4 commit fdcd6a3

File tree

13 files changed

+47
-204
lines changed

13 files changed

+47
-204
lines changed

Cakefile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{spawnSync} = require "node:child_process"
2+
{readdirSync, rmSync} = require "node:fs"
3+
{extname, join} = require "node:path"
4+
{env} = require "node:process"
5+
pkg = require "./package.json"
6+
7+
option "-m", "--map", "Whether to generate source maps."
8+
9+
task "build", "Builds the project.", (options) ->
10+
sourcemaps = if options.map then ["--map"] else []
11+
run "coffee", "--compile", sourcemaps..., "--no-header", "--output", "lib", "src"
12+
13+
task "clean", "Deletes all generated files.", ->
14+
rmSync join("lib", file) for file in readdirSync "lib" when not file.endsWith ".d.ts"
15+
rmSync join("var", file), recursive: yes for file in readdirSync "var" when file isnt ".gitkeep"
16+
17+
task "dist", "Packages the project.", ->
18+
invoke "clean"
19+
invoke "build"
20+
21+
task "lint", "Performs the static analysis of source code.", ->
22+
npx "coffeelint", "--file=etc/coffeelint.json", "Cakefile", "example", "src", "test"
23+
24+
task "publish", "Publishes the package.", ->
25+
invoke "dist"
26+
run "npm", "publish", "--registry=#{registry}" for registry in ["https://registry.npmjs.org", "https://npm.pkg.github.com"]
27+
run "git", action..., "v#{pkg.version}" for action in [["tag"], ["push", "origin"]]
28+
29+
task "test", "Runs the test suite.", ->
30+
env.NODE_ENV = "test"
31+
run "coffee", "--compile", "--map", "--no-header", "--output", "lib", "src", "test"
32+
run "node", "--enable-source-maps", "--test", "--test-reporter=spec", "lib/**/*_test.js"
33+
34+
task "watch", "Watches for file changes.", (options) ->
35+
sourcemaps = if options.map then ["--map"] else []
36+
run "coffee", "--compile", sourcemaps..., "--no-header", "--output", "lib", "--watch", "src", "test"
37+
38+
# Executes a command from a local package.
39+
npx = (command, args...) -> run "npm", "exec", "--", command, args...
40+
41+
# Spawns a new process using the specified command.
42+
run = (command, args...) ->
43+
{status} = spawnSync command, args, shell: yes, stdio: "inherit"
44+
if status isnt 0
45+
console.error "Command failed:", command, args...
46+
process.exit status

lib/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Transform} from "node:stream";
1+
import {Transform} from "node:stream";
22

33
/**
44
* Defines the options of a {@link GulpPlugin} instance.

package-lock.json

Lines changed: 0 additions & 132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"@types/gulp": "^4.0.17",
2525
"@types/node": "^22.8.7",
2626
"coffeescript": "^2.7.0",
27-
"terser": "^5.36.0",
2827
"vinyl": "^3.0.0"
2928
},
3029
"engines": {

scripts.hxml

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

scripts/Build.hx

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

scripts/Clean.hx

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

scripts/Dist.hx

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

scripts/Install.hx

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

scripts/Lint.hx

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

0 commit comments

Comments
 (0)