diff --git a/.editorconfig b/.editorconfig index 51873bc7..9a4062a7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,3 @@ -# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs # editorconfig.org root = true @@ -7,11 +6,10 @@ root = true indent_style = space indent_size = 2 -# We recommend you to keep these unchanged end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] -trim_trailing_whitespace = false \ No newline at end of file +trim_trailing_whitespace = false diff --git a/.npmignore b/.npmignore index d4f7e478..c42f7635 100644 --- a/.npmignore +++ b/.npmignore @@ -7,5 +7,6 @@ !package.json !package-lock.json !README.md +!scripts !tsconfig.json !tslint.json diff --git a/README.md b/README.md index a629ce0d..97a02473 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ A collection of configuration base files for StApps projects. npm install --save-dev @openstapps/configuration ``` +## `.editorconfig` + +This file is automatically copied to your project's root directory upon installation of this package. It tells your editor/IDE about basic settings for indentation and formatting. + ## `tsconfig.json` Create a `tsconfig.json` with the following content: diff --git a/package.json b/package.json index 3dbd2c94..8f0977fe 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "A collection of configuration base files for StApps projects.", "scripts": { "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", + "install": "./scripts/postinstall.sh", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh new file mode 100755 index 00000000..1b722ea3 --- /dev/null +++ b/scripts/postinstall.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +if [[ ! -d "$INIT_CWD/node_modules/@openstapps/configuration/" ]]; then + exit; +fi; + +echo "Copying .editorconfig from @openstapps/configuration to this project." + +cp "$INIT_CWD/node_modules/@openstapps/configuration/.editorconfig" "$INIT_CWD/.editorconfig"