Skip to content

Commit 266acb2

Browse files
committed
Add defult config
0 parents  commit 266acb2

File tree

8 files changed

+194
-0
lines changed

8 files changed

+194
-0
lines changed

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
root = true
2+
3+
[*.js]
4+
[*.jsx]
5+
[*.ts]
6+
[*.tsx]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[*.json]
15+
indent_style = space
16+
indent_size = 4
17+
end_of_line = lf
18+
charset = utf-8
19+
trim_trailing_whitespace = true
20+
insert_final_newline = false
21+
22+
[*.md, *.yml]
23+
indent_style = space
24+
indent_size = 2
25+
end_of_line = lf
26+
charset = utf-8
27+
trim_trailing_whitespace = false
28+
insert_final_newline = false

.github/workflows/npm-publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish to NPM
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish-npm:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Get package version
14+
id: package-version
15+
uses: martinbeentjes/[email protected]
16+
- name: Setup node environment
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 18
20+
registry-url: https://registry.npmjs.org/
21+
- run: npm ci
22+
- name: Publish to NPM
23+
run: npm publish
24+
env:
25+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
26+
- name: Collect release notes
27+
id: collect-release-notes
28+
run: |
29+
echo "::group::Prepare release notes"
30+
RELEASE_NOTES=$(awk -v ver=${{ steps.package-version.outputs.current-version }} '/^## \[/ { if ($2 == "["ver"]") { p=1 } else { p=0 } } p { print }' CHANGELOG.md | tail -n +3)
31+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
32+
echo "$RELEASE_NOTES" >> $GITHUB_ENV
33+
echo "EOF" >> $GITHUB_ENV
34+
echo "::endgroup::"
35+
- name: Create Release Tag
36+
id: create-release
37+
uses: softprops/action-gh-release@v1
38+
with:
39+
tag_name: ${{ steps.package-version.outputs.current-version }}
40+
body: ${{ env.RELEASE_NOTES }}
41+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.0.0] - 2023-08-16
6+
7+
### Added
8+
9+
- Default Prettier configuration
10+
- Actions release workflow
11+
- Install documentation
12+
- Changes changelog

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 HypeTech
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# HypeTech - Prettier Configuration
2+
3+
The official HypeTech prettier configuration, part of Frontend Coding Standards.
4+
5+
## Installation
6+
7+
The configuration can be installed via package manager.
8+
9+
With PNPM:
10+
11+
```bash
12+
## Preferred way
13+
pnpm add @hypetech/prettier-config -D
14+
```
15+
16+
With NPM:
17+
18+
```bash
19+
npm install --dev @hypetech/prettier-config
20+
```
21+
22+
With Yarn:
23+
24+
```bash
25+
yarn add --dev @hypetech/prettier-config
26+
```
27+
28+
To inform prettier of this configuration, you have to add the `prettier` property to your `package.json` file:
29+
30+
```json
31+
"prettier": "@hypetech/prettier-config"
32+
```
33+
34+
Instead of manually editing your `package.json`, you can also utilize the `npm pkg` subcommand:
35+
36+
```bash
37+
npm pkg set prettier=@hypetech/prettier-config
38+
```
39+
40+
## Extending
41+
42+
[Prettier does not ship with a built-in way of extending configurations](https://prettier.io/docs/en/configuration.html#sharing-configurations).
43+
44+
To extend the configuration, you will have to create a `.prettierrc.js` file (or `.prettierrc.cjs` if your package is a `"type": "module"`) and import the HypeTech configuration using `require`:
45+
46+
```js
47+
module.exports = {
48+
...require('@hypetech/prettier-config'),
49+
semi: true,
50+
}
51+
```
52+
53+
If you have previously added the configuration to your `package.json`, via the `prettier` property, you can now remove it.
54+
You can also utilize the `npm pkg`:
55+
56+
```bash
57+
npm pkg delete prettier
58+
```

main.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "http://json.schemastore.org/prettierrc",
3+
"semi": false,
4+
"singleQuote": false,
5+
"printWidth": 120,
6+
"tabWidth": 4,
7+
"quoteProps": "preserve",
8+
"endOfLine": "auto",
9+
"trailingComma": "es5"
10+
}

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@hypetech/prettier-config",
3+
"version": "1.0.0",
4+
"description": "HypeTech Prettier Configuration",
5+
"keywords": [
6+
"HypeTech",
7+
"prettier"
8+
],
9+
"homepage": "https://github.com/hypetechdev/prettier-config#readme",
10+
"bugs": {
11+
"url": "https://github.com/hypetechdev/prettier-config/issues"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/hypetechdev/prettier-config.git"
16+
},
17+
"license": "MIT",
18+
"author": "HypeTech",
19+
"main": "main.json",
20+
"peerDependencies": {
21+
"prettier": ">=3"
22+
}
23+
}

0 commit comments

Comments
 (0)