Fix text files indentation

This commit is contained in:
Michaël Lemaire 2021-09-05 23:52:23 +02:00
parent db68faf338
commit 98635fca28
7 changed files with 73 additions and 105 deletions

View file

@ -1,10 +1,9 @@
root = true root = true
[*.{ts,json}] [*.{ts,json}]
charset = utf-8 charset = utf-8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
trim_trailing_whitespace = true trim_trailing_whitespace = true

5
.gitignore vendored
View file

@ -1,4 +1,3 @@
deno.d.ts deno.d.ts
.vscode .vscode
.local .local

22
.vscode/launch.json vendored
View file

@ -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=."
]
}
]
}

View file

@ -1 +0,0 @@
{ "deno.enable": true }

11
.vscode/tasks.json vendored
View file

@ -1,11 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "test",
"type": "shell",
"group": { "kind": "test", "isDefault": true },
"command": "./run test"
}
]
}

33
run
View file

@ -1,20 +1,19 @@
#!/bin/sh #!/bin/sh
# Simplified run tool for deno commands # Simplified run tool for deno commands
if test $# -eq 0 if test $# -eq 0
then then
echo "Usage: $0 [file or command]" echo "Usage: $0 [file or command]"
exit 1 exit 1
elif echo $1 | grep -q '.*.ts' elif echo $1 | grep -q '.*.ts'
then then
denocmd=run denocmd=run
denoargs=$1 denoargs=$1
shift shift
else else
denocmd=$1 denocmd=$1
shift shift
fi fi
denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@" denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@"
exec deno $denocmd $denoargs exec deno $denocmd $denoargs

View file

@ -51,26 +51,27 @@ export class ProjectNormalizer {
async updateRunScript() { async updateRunScript() {
await this.sys.writeTextFile( await this.sys.writeTextFile(
"run", "run",
`#!/bin/sh [
# Simplified run tool for deno commands `#!/bin/sh`,
`# Simplified run tool for deno commands`,
if test $# -eq 0 ``,
then `if test $# -eq 0`,
echo "Usage: $0 [file or command]" `then`,
exit 1 ` echo "Usage: $0 [file or command]"`,
elif echo $1 | grep -q '.*\.ts' ` exit 1`,
then `elif echo $1 | grep -q '.*\.ts'`,
denocmd=run `then`,
denoargs=$1 ` denocmd=run`,
shift ` denoargs=$1`,
else ` shift`,
denocmd=$1 `else`,
shift ` denocmd=$1`,
fi ` shift`,
`fi`,
denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@" ``,
exec deno $denocmd $denoargs `denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@"`,
`, `exec deno $denocmd $denoargs`,
].join("\n"),
); );
await this.sys.chmod("run", 0o755); await this.sys.chmod("run", 0o755);
} }
@ -87,16 +88,17 @@ export class ProjectNormalizer {
async updateEditorConfig() { async updateEditorConfig() {
await this.sys.writeTextFile( await this.sys.writeTextFile(
".editorconfig", ".editorconfig",
`root = true [
`root = true`,
[*.{ts,json}] ``,
charset = utf-8 `[*.{ts,json}]`,
end_of_line = lf `charset = utf-8`,
insert_final_newline = true `end_of_line = lf`,
indent_style = space `insert_final_newline = true`,
indent_size = 2 `indent_style = space`,
trim_trailing_whitespace = true `indent_size = 2`,
`, `trim_trailing_whitespace = true`,
].join("\n"),
); );
} }
@ -168,21 +170,23 @@ export class ProjectNormalizer {
async updateGitIgnore() { async updateGitIgnore() {
await this.sys.writeTextFile( await this.sys.writeTextFile(
".gitignore", ".gitignore",
`deno.d.ts [
.vscode `deno.d.ts`,
.local `.vscode`,
`, `.local`,
].join("\n"),
); );
} }
async updateGitHooks() { async updateGitHooks() {
await this.sys.writeTextFile( await this.sys.writeTextFile(
".git/hooks/pre-commit", ".git/hooks/pre-commit",
`#!/bin/sh [
set -e `#!/bin/sh`,
./run fmt --check `set -e`,
./run test `./run fmt --check`,
`, `./run test`,
].join("\n"),
); );
await this.sys.chmod(".git/hooks/pre-commit", 0o755); await this.sys.chmod(".git/hooks/pre-commit", 0o755);
} }
@ -201,10 +205,11 @@ export class ProjectNormalizer {
} }
await this.sys.writeTextFile( await this.sys.writeTextFile(
"README.md", "README.md",
`# typescript/${project} [
`# typescript/${project}`,
[![Build Status](https://thunderk.visualstudio.com/typescript/_apis/build/status/${project}?branchName=master)](https://dev.azure.com/thunderk/typescript/_build?pipelineNameFilter=${project}) `[![Build Status](https://thunderk.visualstudio.com/typescript/_apis/build/status/${project}?branchName=master)](https://dev.azure.com/thunderk/typescript/_build?pipelineNameFilter=${project})`,
${sections}`, sections,
].join("\n"),
); );
await this.formatPath("README.md"); await this.formatPath("README.md");
} }