From 98635fca282fe11faf45f00dffcf69a66357de29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Sun, 5 Sep 2021 23:52:23 +0200 Subject: [PATCH] Fix text files indentation --- .editorconfig | 15 ++++--- .gitignore | 5 +-- .vscode/launch.json | 22 ----------- .vscode/settings.json | 1 - .vscode/tasks.json | 11 ------ run | 33 ++++++++-------- src/normalize.ts | 91 +++++++++++++++++++++++-------------------- 7 files changed, 73 insertions(+), 105 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json delete mode 100644 .vscode/tasks.json diff --git a/.editorconfig b/.editorconfig index f1b4eb3..9495107 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,10 +1,9 @@ root = true - [*.{ts,json}] - charset = utf-8 - end_of_line = lf - insert_final_newline = true - indent_style = space - indent_size = 2 - trim_trailing_whitespace = true - \ No newline at end of file +[*.{ts,json}] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9ab1dc5..233829b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ deno.d.ts - .vscode - .local - \ No newline at end of file +.vscode +.local \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 5bc14c6..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Deno", - "type": "node", - "request": "launch", - "cwd": "${workspaceFolder}", - "program": "cli.ts", - "console": "externalTerminal", - "attachSimplePort": 9229, - "runtimeExecutable": "deno", - "runtimeArgs": [ - "run", - "--inspect", - "--allow-run=./run", - "--allow-read=.", - "--allow-write=." - ] - } - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 650f9a7..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1 +0,0 @@ -{ "deno.enable": true } diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 8802f7d..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "test", - "type": "shell", - "group": { "kind": "test", "isDefault": true }, - "command": "./run test" - } - ] -} diff --git a/run b/run index a9c2fd6..ada1af1 100755 --- a/run +++ b/run @@ -1,20 +1,19 @@ #!/bin/sh - # Simplified run tool for deno commands +# Simplified run tool for deno commands - if test $# -eq 0 - then - echo "Usage: $0 [file or command]" - exit 1 - elif echo $1 | grep -q '.*.ts' - then - denocmd=run - denoargs=$1 - shift - else - denocmd=$1 - shift - fi +if test $# -eq 0 +then + echo "Usage: $0 [file or command]" + exit 1 +elif echo $1 | grep -q '.*.ts' +then + denocmd=run + denoargs=$1 + shift +else + denocmd=$1 + shift +fi - denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@" - exec deno $denocmd $denoargs - \ No newline at end of file +denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@" +exec deno $denocmd $denoargs \ No newline at end of file diff --git a/src/normalize.ts b/src/normalize.ts index 68cfd8e..41cc129 100755 --- a/src/normalize.ts +++ b/src/normalize.ts @@ -51,26 +51,27 @@ export class ProjectNormalizer { async updateRunScript() { await this.sys.writeTextFile( "run", - `#!/bin/sh - # Simplified run tool for deno commands - - if test $# -eq 0 - then - echo "Usage: $0 [file or command]" - exit 1 - elif echo $1 | grep -q '.*\.ts' - then - denocmd=run - denoargs=$1 - shift - else - denocmd=$1 - shift - fi - - denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@" - exec deno $denocmd $denoargs - `, + [ + `#!/bin/sh`, + `# Simplified run tool for deno commands`, + ``, + `if test $# -eq 0`, + `then`, + ` echo "Usage: $0 [file or command]"`, + ` exit 1`, + `elif echo $1 | grep -q '.*\.ts'`, + `then`, + ` denocmd=run`, + ` denoargs=$1`, + ` shift`, + `else`, + ` denocmd=$1`, + ` shift`, + `fi`, + ``, + `denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@"`, + `exec deno $denocmd $denoargs`, + ].join("\n"), ); await this.sys.chmod("run", 0o755); } @@ -87,16 +88,17 @@ export class ProjectNormalizer { async updateEditorConfig() { await this.sys.writeTextFile( ".editorconfig", - `root = true - - [*.{ts,json}] - charset = utf-8 - end_of_line = lf - insert_final_newline = true - indent_style = space - indent_size = 2 - trim_trailing_whitespace = true - `, + [ + `root = true`, + ``, + `[*.{ts,json}]`, + `charset = utf-8`, + `end_of_line = lf`, + `insert_final_newline = true`, + `indent_style = space`, + `indent_size = 2`, + `trim_trailing_whitespace = true`, + ].join("\n"), ); } @@ -168,21 +170,23 @@ export class ProjectNormalizer { async updateGitIgnore() { await this.sys.writeTextFile( ".gitignore", - `deno.d.ts - .vscode - .local - `, + [ + `deno.d.ts`, + `.vscode`, + `.local`, + ].join("\n"), ); } async updateGitHooks() { await this.sys.writeTextFile( ".git/hooks/pre-commit", - `#!/bin/sh - set -e - ./run fmt --check - ./run test - `, + [ + `#!/bin/sh`, + `set -e`, + `./run fmt --check`, + `./run test`, + ].join("\n"), ); await this.sys.chmod(".git/hooks/pre-commit", 0o755); } @@ -201,10 +205,11 @@ export class ProjectNormalizer { } await this.sys.writeTextFile( "README.md", - `# typescript/${project} - - [![Build Status](https://thunderk.visualstudio.com/typescript/_apis/build/status/${project}?branchName=master)](https://dev.azure.com/thunderk/typescript/_build?pipelineNameFilter=${project}) - ${sections}`, + [ + `# typescript/${project}`, + `[![Build Status](https://thunderk.visualstudio.com/typescript/_apis/build/status/${project}?branchName=master)](https://dev.azure.com/thunderk/typescript/_build?pipelineNameFilter=${project})`, + sections, + ].join("\n"), ); await this.formatPath("README.md"); }