Skip to content

Commit

Permalink
Fix an issue with VSCode
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Nov 5, 2024
1 parent a21ac16 commit 7a2e6e0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 46 deletions.
46 changes: 0 additions & 46 deletions Cakefile

This file was deleted.

1 change: 1 addition & 0 deletions Cakefile
46 changes: 46 additions & 0 deletions src/Cakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{spawnSync} = require "node:child_process"
{readdirSync, rmSync} = require "node:fs"
{join} = require "node:path"
{env} = require "node:process"
pkg = require "./package.json"

option "-m", "--map", "Whether to generate source maps."

task "build", "Builds the project.", (options) ->
sourcemaps = if options.map then ["--map"] else []
run "coffee", "--compile", sourcemaps..., "--no-header", "--output", "lib", "src"

task "clean", "Deletes all generated files.", ->
rmSync join("lib", file) for file in readdirSync "lib" when not file.endsWith ".d.ts"
rmSync join("var", file), recursive: yes for file in readdirSync "var" when file isnt ".gitkeep"

task "dist", "Packages the project.", ->
invoke "clean"
invoke "build"

task "lint", "Performs the static analysis of source code.", ->
npx "coffeelint", "--file=etc/coffeelint.json", "Cakefile", "example", "src", "test"

task "publish", "Publishes the package.", ->
invoke "dist"
run "npm", "publish", "--registry=#{registry}" for registry in ["https://registry.npmjs.org", "https://npm.pkg.github.com"]
run "git", action..., "v#{pkg.version}" for action in [["tag"], ["push", "origin"]]

task "test", "Runs the test suite.", ->
env.NODE_ENV = "test"
run "coffee", "--compile", "--map", "--no-header", "--output", "lib", "src", "test"
run "node", "--enable-source-maps", "--test", "--test-reporter=spec", "lib/**/*_test.js"

task "watch", "Watches for file changes.", (options) ->
sourcemaps = if options.map then ["--map"] else []
run "coffee", "--compile", sourcemaps..., "--no-header", "--output", "lib", "--watch", "src", "test"

# Executes a command from a local package.
npx = (command, args...) -> run "npm", "exec", "--", command, args...

# Spawns a new process using the specified command.
run = (command, args...) ->
{status} = spawnSync command, args, shell: yes, stdio: "inherit"
if status isnt 0
console.error "Command failed:", command, args...
process.exit status

0 comments on commit 7a2e6e0

Please sign in to comment.