1
0
Fork 0

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
[*.{ts,json}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
[*.{ts,json}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

5
.gitignore vendored
View File

@ -1,4 +1,3 @@
deno.d.ts
.vscode
.local
.vscode
.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
# 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
denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@"
exec deno $denocmd $denoargs

View File

@ -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");
}