From 30bd78d45764e55c4fb4e3fee274fc1c4f8e115f Mon Sep 17 00:00:00 2001 From: Jakob Linskeseder Date: Thu, 30 Dec 2021 00:12:59 +0100 Subject: [PATCH] Enable IDE code-highlighting for bin-file By adding the `.js`-extension to the bin-file, IDEs will know that js code-highlighting should be applied to the file, which makes it easier for devs to read the code. --- bin/{handlebars => handlebars.js} | 1 - package-lock.json | 2 +- package.json | 2 +- spec/expected/help.menu.txt | 2 +- tasks/test-bin.js | 4 ++-- 5 files changed, 5 insertions(+), 6 deletions(-) rename bin/{handlebars => handlebars.js} (99%) diff --git a/bin/handlebars b/bin/handlebars.js similarity index 99% rename from bin/handlebars rename to bin/handlebars.js index 17a36609d..fabbb3951 100755 --- a/bin/handlebars +++ b/bin/handlebars.js @@ -111,7 +111,6 @@ delete argv._; const Precompiler = require('../dist/cjs/precompiler'); Precompiler.loadTemplates(argv, function(err, opts) { - if (err) { throw err; } diff --git a/package-lock.json b/package-lock.json index 340373776..6125ccb82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "yargs": "^16.2.0" }, "bin": { - "handlebars": "bin/handlebars" + "handlebars": "bin/handlebars.js" }, "devDependencies": { "@definitelytyped/dtslint": "^0.0.100", diff --git a/package.json b/package.json index cb2ec8807..abba4f034 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "./runtime": "./dist/cjs/handlebars.runtime.js" }, "bin": { - "handlebars": "bin/handlebars" + "handlebars": "bin/handlebars.js" }, "scripts": { "build": "grunt build", diff --git a/spec/expected/help.menu.txt b/spec/expected/help.menu.txt index 027bb73a7..750aa30cd 100644 --- a/spec/expected/help.menu.txt +++ b/spec/expected/help.menu.txt @@ -1,5 +1,5 @@ Precompile handlebar templates. -Usage: handlebars [template|directory]... +Usage: handlebars.js [template|directory]... Options: --help Outputs this message [boolean] diff --git a/tasks/test-bin.js b/tasks/test-bin.js index b1e31e800..6f02e115b 100644 --- a/tasks/test-bin.js +++ b/tasks/test-bin.js @@ -219,9 +219,9 @@ function executeBinHandlebars(...args) { if (os.platform() === 'win32') { // On Windows, the executable handlebars.js file cannot be run directly const nodeJs = process.argv[0]; - return execFilesSyncUtf8(nodeJs, ['./bin/handlebars'].concat(args)); + return execFilesSyncUtf8(nodeJs, ['./bin/handlebars.js'].concat(args)); } - return execFilesSyncUtf8('./bin/handlebars', args); + return execFilesSyncUtf8('./bin/handlebars.js', args); } function execFilesSyncUtf8(command, args) {