diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 35281a9..02d63d3 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -71,11 +71,9 @@ jobs:
- name: install project
run: npm --omit=dev install
- - name: test post install
- run: node ./bin/install.js
- name: test run help
- run: node ./bin/index.js -h
+ run: djlint -h
- name: test run lint
- run: echo "
" | node ./bin/index.js --check
+ run: echo "
" | djlint - --check
diff --git a/bin/index.js b/bin/index.js
deleted file mode 100644
index 0efe2ca..0000000
--- a/bin/index.js
+++ /dev/null
@@ -1,202 +0,0 @@
-#!/usr/bin/env node
-
-const process = require('process');
-const { PythonShell } = require('python-shell');
-
-PythonShell.defaultOptions = {
- mode: 'text',
- pythonOptions: ['-u'],
- env: { PYCHARM_HOSTED: 1 }, // Force color
-};
-
-function clean(output) {
- return output.replace(/python -m /g, '');
-}
-
-const yargs = require('yargs');
-
-const stdin = process.stdin;
-
-function getStdin() {
- // https://github.com/sindresorhus/get-stdin/pull/19/files
- let returnValue = '';
-
- return new Promise((resolve) => {
- if (stdin.isTTY) {
- resolve(returnValue);
- return;
- }
-
- const timeout = setTimeout(() => {
- resolve(returnValue);
- }, 100);
-
- stdin.unref();
- stdin.setEncoding('utf8');
-
- stdin.on('readable', () => {
- clearTimeout(timeout);
- stdin.ref();
-
- let chunk;
-
- while ((chunk = stdin.read())) {
- returnValue += chunk;
- }
- });
-
- stdin.on('end', () => {
- resolve(returnValue);
- });
- });
-}
-
-getStdin().then((string_) => {
- run(string_);
-});
-
-function run(stdin) {
- const options = yargs
- .scriptName('djlint')
- .usage(
- `Usage: $0 [OPTIONS] SRC ...
-
- djLint ยท lint and reformat HTML templates.`,
- )
- .option('e', {
- alias: 'extension',
- describe: 'File extension to check [default: html]',
- type: 'string',
- demandOption: false,
- })
- .option('h', {
- alias: 'help',
- describe: 'Show this message and exit.',
- type: 'boolean',
- demandOption: false,
- })
- .option('i', {
- alias: 'ignore',
- describe: 'Codes to ignore. ex: "H014,H017"',
- type: 'string',
- demandOption: false,
- })
- .option('reformat', {
- describe: 'Reformat the file(s).',
- type: 'boolean',
- demandOption: false,
- })
- .option('check', {
- describe: 'Check formatting on the file(s).',
- type: 'boolean',
- demandOption: false,
- })
- .option('indent', {
- describe: 'Indent spacing. [default: 4]',
- type: 'int',
- demandOption: false,
- })
- .option('quiet', {
- describe: 'Do not print diff when reformatting.',
- type: 'boolean',
- demandOption: false,
- })
- .option('warn', {
- describe: 'Return errors as warnings.',
- type: 'boolean',
- demandOption: false,
- })
- .option('profile', {
- describe:
- 'Enable defaults by template language. ops: django, jinja, nunjucks, handlebars, golang, angular, html [default: html]',
- type: 'string',
- demandOption: false,
- })
- .option('require-pragma', {
- describe:
- "Only format or lint files that starts with a comment with the text 'djlint:on'",
- type: 'boolean',
- demandOption: false,
- })
- .option('lint', {
- describe: 'Lint for common issues. [default option]',
- type: 'boolean',
- demandOption: false,
- })
- .option('use-gitignore', {
- describe: 'Use .gitignore file to extend excludes.',
- type: 'boolean',
- demandOption: false,
- })
- .option('format-css', {
- describe: 'Also format contents of