From 7a2e6e0e05765bad94d194539bb5f47cd867a7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Tue, 5 Nov 2024 10:37:01 +0100 Subject: [PATCH] Fix an issue with VSCode --- Cakefile | 47 +---------------------------------------------- src/Cakefile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 46 deletions(-) mode change 100644 => 120000 Cakefile create mode 100644 src/Cakefile diff --git a/Cakefile b/Cakefile deleted file mode 100644 index 0437b02..0000000 --- a/Cakefile +++ /dev/null @@ -1,46 +0,0 @@ -{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 diff --git a/Cakefile b/Cakefile new file mode 120000 index 0000000..d26489a --- /dev/null +++ b/Cakefile @@ -0,0 +1 @@ +./src/cakefile.coffee \ No newline at end of file diff --git a/src/Cakefile b/src/Cakefile new file mode 100644 index 0000000..0437b02 --- /dev/null +++ b/src/Cakefile @@ -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