File tree Expand file tree Collapse file tree
tests/integration/multi-nodejs-test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- const yargs = require ( 'yargs' ) ( process . argv . slice ( 2 ) )
3+ import { createRequire } from 'node:module' ;
4+ import yargs from 'yargs' ;
5+
6+ const require = createRequire ( import . meta. url ) ;
7+ const Precompiler = require ( '../dist/cjs/precompiler' ) ;
8+
9+ const parser = yargs ( process . argv . slice ( 2 ) )
410 . usage ( 'Precompile handlebar templates.\nUsage: $0 [template|directory]...' )
511 . help ( false )
612 . version ( false )
@@ -107,18 +113,17 @@ const yargs = require('yargs')(process.argv.slice(2))
107113 } )
108114 . wrap ( 120 ) ;
109115
110- const argv = yargs . parseSync ( ) ;
116+ const argv = parser . parseSync ( ) ;
111117argv . files = argv . _ ;
112118delete argv . _ ;
113119
114- const Precompiler = require ( '../dist/cjs/precompiler' ) ;
115120Precompiler . loadTemplates ( argv , function ( err , opts ) {
116121 if ( err ) {
117122 throw err ;
118123 }
119124
120125 if ( opts . help || ( ! opts . templates . length && ! opts . version ) ) {
121- yargs . showHelp ( 'log' ) ;
126+ parser . showHelp ( 'log' ) ;
122127 } else {
123128 Precompiler . cli ( opts ) ;
124129 }
Original file line number Diff line number Diff line change 1616 "url" : " https://github.com/handlebars-lang/handlebars.js.git"
1717 },
1818 "bin" : {
19- "handlebars" : " bin/handlebars.js "
19+ "handlebars" : " bin/handlebars.mjs "
2020 },
2121 "files" : [
2222 " bin" ,
Original file line number Diff line number Diff line change 11Precompile handlebar templates.
2- Usage: handlebars.js [template|directory]...
2+ Usage: handlebars.mjs [template|directory]...
33
44Options:
55 -f, --output Output File [string]
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const fs = require('fs');
22const { execCommand, FileTestHelper } = require ( 'cli-testlab' ) ;
33const Handlebars = require ( '../../lib' ) ;
44
5- const cli = 'node ./bin/handlebars.js ' ;
5+ const cli = 'node ./bin/handlebars.mjs ' ;
66
77expect . extend ( {
88 toEqualWithRelaxedSpace ( received , expected ) {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
1414unset npm_config_prefix
1515
1616echo " Handlebars should be able to run in various versions of NodeJS"
17- for node_version_to_test in 18 20 ; do
17+ for node_version_to_test in 20 22 ; do
1818
1919 rm -rf target node_modules package-lock.json
2020 mkdir target
You can’t perform that action at this time.
0 commit comments