Skip to content

Commit 7a2e6e0

Browse files
author
Cédric Belin
committed
Fix an issue with VSCode
1 parent a21ac16 commit 7a2e6e0

File tree

2 files changed

+47
-46
lines changed

2 files changed

+47
-46
lines changed

Cakefile

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

Cakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./src/cakefile.coffee

src/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+
{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

0 commit comments

Comments
 (0)