Skip to content
This repository was archived by the owner on Dec 30, 2023. It is now read-only.

Commit 1837e4f

Browse files
authored
feat(packages): ✨ Add snippets related to config (read, and merge) (#35)
1 parent 85cc906 commit 1837e4f

27 files changed

+553
-7
lines changed

.changeset/large-wolves-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@terminal-nerds/snippets-config": minor
3+
---
4+
5+
✨ Added a module `merge` for snippets related to merging configs.

.changeset/moody-peaches-cheer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@terminal-nerds/snippets-runtime": minor
3+
---
4+
5+
✨ Added a module `error` which re-exports snippets related to `RuntimeError`;

.changeset/sixty-squids-sit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@terminal-nerds/snippets-config": minor
3+
---
4+
5+
✨ Added a module `read` for snippets related to reading config.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Reusable pieces of code, which can be **reused** across the projects.
100100
| ------------------------------- | ------------------------------------------------ |
101101
| [![snippets badge]][snippets] | [![snippets version badge]][snippets npm page] |
102102
| <!-- PACKAGES --> | <!-- PACKAGES --> |
103+
| [![config badge]][config] | [![config version badge]][config npm page] |
103104
| [![extension badge]][extension] | [![extension version badge]][extension npm page] |
104105
| [![error badge]][error] | [![error version badge]][error npm page] |
105106
| [![regexp badge]][regexp] | [![regexp version badge]][regexp npm page] |
@@ -115,6 +116,11 @@ Reusable pieces of code, which can be **reused** across the projects.
115116

116117
<!-- prettier-ignore-start -->
117118
<!-- PACKAGES LINKS -->
119+
[config]: ./packages/config/README.md
120+
[config badge]: https://img.shields.io/static/v1?label=%40terminal-nerds&message=snippets-config&style=flat-square&color=informational
121+
[config version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-config/latest?style=flat-square&logo=npm
122+
[config npm page]: https://www.npmjs.com/package/@terminal-nerds/snippets-config
123+
118124
[extension]: ./packages/extension/README.md
119125
[extension badge]: https://img.shields.io/static/v1?label=%40terminal-nerds&message=snippets-extension&style=flat-square&color=informational
120126
[extension version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-extension/latest?style=flat-square&logo=npm

packages/config/.depcheckrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignores": ["@terminal-nerds/*-config", "tsup", "vitest"]
3+
}

packages/config/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# @terminal-nerds/snippets-config<!-- markdownlint-disable line-length list-marker-space no-duplicate-header ul-style ul-indent no-bare-urls -->

packages/config/LICENSE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/xeho91/Nextcloud/Projects/terminal-nerds/snippets/LICENSE.md

packages/config/README.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# @terminal-nerds/snippets-config
2+
3+
![package version badge]
4+
[![size badge]][size url]
5+
[![dependencies badge]][dependencies url]
6+
7+
➡️ **This package wraps all available modules with snippets related to config**
8+
— part of the [terminal-nerds/snippets] project.
9+
10+
[terminal-nerds/snippets]: https://github.com/terminal-nerds/snippets
11+
[package version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-config/latest?style=for-the-badge&logo=npm
12+
[dependencies badge]: https://img.shields.io/librariesio/release/npm/@terminal-nerds/snippets-config?style=for-the-badge
13+
[dependencies url]: https://libraries.io/npm/@terminal-nerds%2snippets-config
14+
[size badge]: https://img.shields.io/bundlephobia/minzip/@terminal-nerds/snippets-config?style=for-the-badge&label=size
15+
[size url]: https://packagephobia.com/result?p=@terminal-nerds/snippets-config
16+
17+
## Modules included
18+
19+
[![documentation badge]][documentation url]
20+
21+
[documentation badge]: https://img.shields.io/static/v1?color=informational&style=for-the-badge&label=documentation&message=jsdocs.io
22+
[documentation url]: https://jsdocs.io/package/@terminal-nerds/snippets-config
23+
24+
<!-- prettier-sort-markdown-table -->
25+
26+
| Name | Size |
27+
| ---------------------------------------- | --------------------------------------------------- |
28+
| [`@terminal-nerds/snippets-error/merge`] | ![merge size gzip badge] ![merge size brotli badge] |
29+
| [`@terminal-nerds/snippets-error/read`] | ![read size gzip badge] ![read size brotli badge] |
30+
31+
<!-- prettier-ignore-start -->
32+
<!-- MODULES LINKS -->
33+
[`@terminal-nerds/snippets-error/merge`]: https://github.com/terminal-nerds/snippets/blob/main/packages/error/source/merge/merge.ts
34+
[merge size gzip badge]: https://badgen.net/badgesize/gzip/file-url/unpkg.com/@terminal-nerds/snippets-error/dist/merge/merge.js?label=gzip
35+
[merge size brotli badge]: https://badgen.net/badgesize/brotli/file-url/unpkg.com/@terminal-nerds/snippets-error/dist/merge/merge.js?label=brotli
36+
37+
[`@terminal-nerds/snippets-error/read`]: https://github.com/terminal-nerds/snippets/blob/main/packages/error/source/read/read.ts
38+
[read size gzip badge]: https://badgen.net/badgesize/gzip/file-url/unpkg.com/@terminal-nerds/snippets-error/dist/read/read.js?label=gzip
39+
[read size brotli badge]: https://badgen.net/badgesize/brotli/file-url/unpkg.com/@terminal-nerds/snippets-error/dist/read/read.js?label=brotli
40+
<!-- prettier-ignore-end -->
41+
42+
---
43+
44+
## Prerequisites & usage
45+
46+
### Optional
47+
48+
[![supported typescript version badge]][typescript]
49+
![types badge]
50+
51+
[typescript]: https://typescriptlang.org/
52+
[typescript icon]: https://api.iconify.design/logos/typescript-icon.svg
53+
[supported typescript version badge]: https://img.shields.io/github/package-json/dependency-version/terminal-nerds/snippets/peer/typescript?filename=packages%2Ftypescript%2Fpackage.json&logo=typescript&style=for-the-badge&label=typescript
54+
[types badge]: https://img.shields.io/npm/types/@terminal-nerds/snippets-config?style=for-the-badge&logo=typescript
55+
56+
If you are using ![typescript icon] [TypeScript],
57+
the latest version, which supports new features _(such as `satisfies`)_, is supported.
58+
59+
### Runtime environments
60+
61+
This package can be used in several runtime environments.
62+
We aim for cross-runtime compatibility and ensure proper error messages
63+
if a particular snippet cannot be run in the currently running environment.
64+
65+
#### Browsers
66+
67+
We use [browserslist] to define the minimum browsers versions supported.\
68+
Take a look at our [shared browserslist configuration] for more details.
69+
70+
[browserslist]: https://github.com/browserslist/browserslist
71+
[shared browserslist configuration]: https://github.com/terminal-nerds/configs/blob/main/packages/browserslist/source/browsers.ts
72+
73+
**Usage**:
74+
75+
```html
76+
<script type="module">
77+
import { snippet } from "https://cdn.jsdelivr.net/npm/@terminal-nerds/snippets-config";
78+
</script>
79+
```
80+
81+
---
82+
83+
#### Bun
84+
85+
We aim to support the latest version of ![bun icon] [bun].
86+
87+
**Usage**:
88+
89+
Firstly, install it:
90+
91+
```sh
92+
bun add @terminal-nerds/snippets-config
93+
```
94+
95+
And then in a particular file:
96+
97+
```js
98+
import { snippet } from "@terminal-nerds/snippets-config";
99+
```
100+
101+
[bun]: https://bun.sh/
102+
[bun icon]: https://api.iconify.design/logos/bun.svg
103+
104+
---
105+
106+
#### Deno
107+
108+
We aim to support the latest version of ![deno icon] [Deno].
109+
110+
**Usage**:
111+
112+
```ts
113+
import { snippet } from "npm:@terminal-nerds/snippets-config";
114+
```
115+
116+
[deno]: https://deno.land/
117+
[deno icon]: https://api.iconify.design/logos/deno.svg
118+
119+
---
120+
121+
#### Node.js
122+
123+
[![node.js version support badge]][node.js]
124+
125+
The latest ![node.js icon] [Node.js] LTS _(Long-Term Support)_ version is the minimum one supported.
126+
127+
> **Warning**\
128+
> **This package is written in [ES Module] _(ESM)_ type.**\
129+
> So, if you wish to use it in a project with CommonJS (CJS) type, you need to bundle this package or a particular module(s).
130+
131+
**Usage**:
132+
133+
Install it first with the Node.js package manager of your choice. In our example, we use [pnpm].
134+
135+
```sh
136+
pnpm add @terminal-nerds/snippets-config
137+
```
138+
139+
And then in a particular file:
140+
141+
```js
142+
import { snippet } from "@terminal-nerds/snippets-config";
143+
```
144+
145+
[ES Module]: https://www.freecodecamp.org/news/javascript-es-modules-and-module-bundlers
146+
[pnpm]: https://pnpm.io
147+
[node.js]: https://nodejs.org/en/
148+
[node.js icon]: https://api.iconify.design/logos/nodejs-icon.svg
149+
[node.js version support badge]: https://img.shields.io/node/v-lts/@terminal-nerds/snippets?style=for-the-badge&logo=nodedotjs
150+
151+
---
152+
153+
## Security
154+
155+
[![workflow security badge]][security policy]
156+
157+
🔐 For more information, please refer to the [Security section] at the root of
158+
the [terminal-nerds/snippets] monorepo.
159+
160+
[workflow security badge]: https://img.shields.io/github/actions/workflow/status/terminal-nerds/snippets/maintenance.yml?label=Security&logo=github&style=for-the-badge&branch=main
161+
[security section]: https://github.com/terminal-nerds/snippets#security
162+
[security policy]: https://github.com/terminal-nerds/snippets/security/policy
163+
164+
---
165+
166+
## License
167+
168+
[![license badge]][license]
169+
170+
⚖️ For more information, please refer to the [License section] at the root of the [terminal-nerds/snippets] monorepo.
171+
172+
[license]: https://github.com/terminal-nerds/snippets/blob/main/LICENSE.md
173+
[license badge]: https://img.shields.io/github/license/terminal-nerds/snippets?style=for-the-badge
174+
[license section]: https://github.com/terminal-nerds/snippets#License
175+
176+
### Contributing
177+
178+
[![contributors badge]][contributors url]
179+
180+
🤝 **Contributions of any kind are welcome!**
181+
182+
Please refer to the monorepo _([terminal-nerds/snippets])_ project's [CONTRIBUTING file] for more information
183+
if you wish to get involved.
184+
185+
[contributing file]: https://github.com/terminal-nerds/snippets/blob/main/.github/CONTRIBUTING.md
186+
[contributors badge]: https://img.shields.io/github/contributors/terminal-nerds/snippets?style=for-the-badge
187+
[contributors url]: https://github.com/terminal-nerds/snippets#contributors
188+
189+
### Author
190+
191+
🎉 The idea of this project was initiated by [xeho91]. However, it's the [contributors] who matter the most.
192+
193+
[contributors]: https://github.com/terminal-nerds/snippets/blob/main/README.md#project-contributors
194+
[xeho91]: https://github.com/xeho91

packages/config/package.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"$schema": "https://json.schemastore.org/package",
3+
"type": "module",
4+
"name": "@terminal-nerds/snippets-config",
5+
"version": "0.0.0",
6+
"description": "@terminal-nerds reusable snippets for configs.",
7+
"keywords": [
8+
"snippets",
9+
"typescript",
10+
"config"
11+
],
12+
"license": "MIT",
13+
"author": {
14+
"name": "Mateusz Kadlubowski",
15+
"email": "[email protected]",
16+
"url": "https://xeho91.com"
17+
},
18+
"homepage": "https://github.com/terminal-nerds/snippets",
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/terminal-nerds/snippets.git",
22+
"directory": "packages/config"
23+
},
24+
"bugs": "https://github.com/terminal-nerds/snippets/issues",
25+
"engines": {
26+
"node": ">=18"
27+
},
28+
"exports": {
29+
".": {
30+
"types": "./dist/main.d.ts",
31+
"import": "./dist/main.js"
32+
},
33+
"./*": {
34+
"types": "./dist/*/*.d.ts",
35+
"import": "./dist/*/*.js"
36+
}
37+
},
38+
"files": [
39+
"dist/"
40+
],
41+
"scripts": {
42+
"build": "tsup",
43+
"clean": "concurrently \"pnpm:clean:*\" --group --timings",
44+
"clean:build": "del \"./dist\"",
45+
"clean:cache": "del \"./node_modules/.cache\"",
46+
"clean:test": "del \"./coverage\"",
47+
"dev:test": "vitest watch --ui",
48+
"dev:pkg": "tsup --watch",
49+
"fix": "concurrently \"pnpm:fix:*\" --group --timings",
50+
"fix:format": "pretty-quick --branch main --pattern \"packages/config/**/*\" --verbose",
51+
"fix:js": "pnpm lint:js --fix",
52+
"fix:md": "pnpm lint:md --fix",
53+
"fix:pkg": "syncpack format ; syncpack fix-mismatches",
54+
"lint": "concurrently \"pnpm:lint:*\" --group --timings",
55+
"lint:deps": "depcheck",
56+
"lint:format": "pnpm fix:format --check",
57+
"lint:js": "DEBUG=\"eslint:cli-engine\" eslint . --ext .cjs,.js,.ts,.json,.yml --cache --cache-location \"./node_modules/.cache/eslint\"",
58+
"lint:md": "markdownlint . --config \"../../.markdownlint.json\" --dot --ignore \"./LICENSE.md\" --ignore-path \"../../.gitignore\"",
59+
"lint:pkg": "syncpack list-mismatches",
60+
"lint:types": "tsc --noEmit",
61+
"test:unit": "vitest run --dir \"./source\""
62+
},
63+
"peerDependencies": {
64+
"typescript": "4.9.5"
65+
},
66+
"devDependencies": {
67+
"@terminal-nerds/snippets-test": "workspace:*"
68+
},
69+
"peerDependenciesMeta": {
70+
"typescript": {
71+
"optional": true
72+
}
73+
},
74+
"dependencies": {
75+
"@terminal-nerds/snippets-runtime": "workspace:*",
76+
"deepmerge-ts": "4.3.0",
77+
"pkg-dir": "7.0.0",
78+
"type-fest": "3.5.7"
79+
}
80+
}

packages/config/source/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* MODULES */
2+
export * from "./merge/merge.js";
3+
export * from "./read/read.js";

0 commit comments

Comments
 (0)