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

Commit b4ab85a

Browse files
authored
feat(packages): ✨ Add snippets related to URL (#67)
1 parent 1326011 commit b4ab85a

26 files changed

+682
-1
lines changed

.changeset/serious-cars-agree.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@terminal-nerds/snippets-url": minor
3+
---
4+
5+
✨ Add modules with snippets:
6+
7+
- `localhost`
8+
- `schema`
9+
- `social-media`
10+
- `target`

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+
| [![url badge]][url] | [![url version badge]][url npm page] |
103104
| [![array badge]][array] | [![array version badge]][array npm page] |
104105
| [![number badge]][number] | [![number version badge]][number npm page] |
105106
| [![config badge]][config] | [![config version badge]][config npm page] |
@@ -118,6 +119,11 @@ Reusable pieces of code, which can be **reused** across the projects.
118119

119120
<!-- prettier-ignore-start -->
120121
<!-- PACKAGES LINKS -->
122+
[url]: ./packages/url/README.md
123+
[url badge]: https://img.shields.io/static/v1?label=%40terminal-nerds&message=snippets-url&style=flat-square&color=informational
124+
[url version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-url/latest?style=flat-square&logo=npm
125+
[url npm page]: https://www.npmjs.com/package/@terminal-nerds/snippets-url
126+
121127
[array]: ./packages/array/README.md
122128
[array badge]: https://img.shields.io/static/v1?label=%40terminal-nerds&message=snippets-array&style=flat-square&color=informational
123129
[array version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-array/latest?style=flat-square&logo=npm

packages/snippets/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434

3535
<!-- prettier-ignore-start -->
3636
<!-- PACKAGES LINKS -->
37+
[url]: https://github.com/terminal-nerds/snippets/blob/main/packages/url/README.md
38+
[url badge]: https://img.shields.io/static/v1?label=%40terminal-nerds&message=snippets-url&style=flat-square&color=informational
39+
[url version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-url/latest?style=flat-square&logo=npm
40+
[url npm page]: https://www.npmjs.com/package/@terminal-nerds/snippets-url
41+
3742
[array]: https://github.com/terminal-nerds/snippets/blob/main/packages/array/README.md
3843
[array badge]: https://img.shields.io/static/v1?label=%40terminal-nerds&message=snippets-array&style=flat-square&color=informational
3944
[array version badge]: https://img.shields.io/npm/v/@terminal-nerds/snippets-array/latest?style=flat-square&logo=npm

packages/snippets/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"@terminal-nerds/snippets-runtime": "workspace:*",
4646
"@terminal-nerds/snippets-string": "workspace:*",
4747
"@terminal-nerds/snippets-test": "workspace:*",
48-
"@terminal-nerds/snippets-type": "workspace:*"
48+
"@terminal-nerds/snippets-type": "workspace:*",
49+
"@terminal-nerds/snippets-url": "workspace:*"
4950
},
5051
"peerDependencies": {
5152
"typescript": "5.0.2"

packages/snippets/source/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export * from "@terminal-nerds/snippets-runtime";
1010
export * from "@terminal-nerds/snippets-string";
1111
export * from "@terminal-nerds/snippets-test";
1212
export * from "@terminal-nerds/snippets-type";
13+
export * from "@terminal-nerds/snippets-url";

packages/url/.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/url/CHANGELOG.md

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

packages/url/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/url/README.md

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

packages/url/package.json

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"$schema": "https://json.schemastore.org/package",
3+
"type": "module",
4+
"name": "@terminal-nerds/snippets-url",
5+
"version": "0.0.0",
6+
"description": "@terminal-nerds reusable snippets for urls.",
7+
"keywords": [
8+
"snippets",
9+
"typescript",
10+
"url"
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/url"
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+
"require": "./dist/main.cjs"
33+
},
34+
"./*": {
35+
"types": "./dist/*/*.d.ts",
36+
"import": "./dist/*/*.js",
37+
"require": "./dist/*/*.cjs"
38+
}
39+
},
40+
"files": [
41+
"dist/"
42+
],
43+
"scripts": {
44+
"build": "tsup",
45+
"clean": "concurrently \"pnpm:clean:*\" --group --timings",
46+
"clean:build": "del \"./dist\"",
47+
"clean:cache": "del \"./node_modules/.cache\"",
48+
"clean:test": "del \"./coverage\"",
49+
"dev:test": "vitest watch --ui",
50+
"dev:pkg": "tsup --watch",
51+
"fix": "concurrently \"pnpm:fix:*\" --group --timings",
52+
"fix:format": "pretty-quick --branch main --pattern \"packages/url/**/*\" --verbose",
53+
"fix:js": "pnpm lint:js --fix",
54+
"fix:md": "pnpm lint:md --fix",
55+
"fix:pkg": "syncpack format ; syncpack fix-mismatches",
56+
"lint": "concurrently \"pnpm:lint:*\" --group --timings",
57+
"lint:deps": "depcheck",
58+
"lint:format": "pnpm fix:format --check",
59+
"lint:js": "DEBUG=\"eslint:cli-engine\" eslint . --ext .cjs,.js,.ts,.json,.yml --cache --cache-location \"./node_modules/.cache/eslint\"",
60+
"lint:md": "markdownlint . --config \"../../.markdownlint.json\" --dot --ignore \"./LICENSE.md\" --ignore-path \"../../.gitignore\"",
61+
"lint:pkg": "syncpack list-mismatches",
62+
"lint:types": "tsc --noEmit",
63+
"test:unit": "vitest run --dir \"./source\""
64+
},
65+
"peerDependencies": {
66+
"typescript": "5.0.2"
67+
},
68+
"devDependencies": {
69+
"@terminal-nerds/snippets-test": "workspace:*"
70+
},
71+
"peerDependenciesMeta": {
72+
"typescript": {
73+
"optional": true
74+
}
75+
},
76+
"dependencies": {
77+
"zod": "3.21.4"
78+
}
79+
}

0 commit comments

Comments
 (0)