Skip to content

Commit fbc797c

Browse files
committed
Adds project scaffolding and automated NPM publishing
Introduces initial configuration files for editor settings, contribution guidelines, license, readme, and ignore rules. Adds a GitHub Actions workflow for automated NPM publishing on main branch pushes, including version checks. Lays the groundwork for collaborative development and streamlined releases.
0 parents  commit fbc797c

File tree

12 files changed

+22867
-0
lines changed

12 files changed

+22867
-0
lines changed

.editorconfig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
# Default indentation: 2 spaces (common in JS)
11+
indent_style = space
12+
indent_size = 2
13+
14+
# Makefiles usually use tabs
15+
[Makefile]
16+
indent_style = tab
17+
18+
# Markdown: keep trailing spaces (for line breaks)
19+
[*.md]
20+
trim_trailing_whitespace = false
21+
22+
# JSON / YAML (same style)
23+
[*.{json,yml,yaml}]
24+
indent_style = space
25+
indent_size = 2
26+
27+
# JS / TS / JSX / TSX
28+
[*.{js,jsx,ts,tsx,cjs,mjs}]
29+
indent_style = space
30+
indent_size = 2
31+
32+
# Package files (package.json, etc)
33+
[{package.json,package-lock.json,yarn.lock,pnpm-lock.yaml}]
34+
indent_style = space
35+
indent_size = 2

.github/workflows/publish.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: "Package Release to NPM"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
check-version:
15+
name: "Check NPM Version"
16+
runs-on: ubuntu-latest
17+
outputs:
18+
should_publish: ${{ steps.check.outputs.should_publish }}
19+
version: ${{ steps.read_version.outputs.version }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Read version from package.json
24+
id: read_version
25+
run: echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
26+
27+
- name: Check if version exists on npm
28+
id: check
29+
run: |
30+
echo "Checking npm for version ${{ steps.read_version.outputs.version }}"
31+
32+
EXISTS=$(npm view $(jq -r '.name' package.json) versions --json | jq -e '.[] | select(.=="'${{ steps.read_version.outputs.version }}'")' || echo "no")
33+
34+
if [ "$EXISTS" = "no" ]; then
35+
echo "should_publish=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "should_publish=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
publish:
41+
name: "Publish to NPM"
42+
needs: check-version
43+
if: needs.check-version.outputs.should_publish == 'true'
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version: '25'
51+
registry-url: 'https://registry.npmjs.org'
52+
scope: \@${{ github.repository_owner }}
53+
54+
- name: Update npm
55+
run: npm install -g npm@latest
56+
57+
- name: Install dependencies
58+
run: npm ci
59+
60+
- name: Build package
61+
run: npm run build
62+
63+
- name: Publish package
64+
run: npm publish --access public
65+
66+
skip-notice:
67+
name: "Skip Publish (Version Exists)"
68+
needs: check-version
69+
if: needs.check-version.outputs.should_publish == 'false'
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Version already published
73+
run: echo "Version ${{ needs.check-version.outputs.version }} already exists on npm. Skipping publish."

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.log
2+
.DS_Store
3+
node_modules
4+
dist/

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src/
2+
.editorconfig
3+
*.md
4+
!README.md

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contributing
2+
3+
Contributions are welcome! Please feel free to submit issues and pull requests.
4+
5+
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
6+
7+
To report issues, please use the issue tracker.
8+
9+
## Environment
10+
11+
Make sure you have Node.js and npm installed on your machine. You can check your versions with:
12+
13+
```
14+
node -v
15+
npm -v
16+
```
17+
18+
This project has been tested with Node.js v25.x and npm v11.x.
19+
20+
## Development Setup
21+
22+
1. Fork the repository and clone it to your local machine.
23+
2. Install dependencies using `npm install`.
24+
3. Make your changes.
25+
4. Commit your changes and push them to your fork.
26+
5. Open a pull request against the main repository.

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) 2025 @libsrcdev
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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# gatsby-remark-autolink-domains
2+
3+
This plugin extracts images from markdown files that are parsed with [`gatsby-transformer-remark`](https://www.gatsbyjs.org/packages/gatsby-transformer-remark/).
4+
5+
## How to install
6+
7+
```sh
8+
npm i --save @libsrcdev/gatsby-remark-autolink-domains
9+
```
10+
11+
## Capatibilities
12+
13+
- Autolink no-scheme domains to their full URL.
14+
- Supports custom extraction logic via a user-defined function.
15+
16+
## Usecases
17+
18+
- Automatically convert plain domain names in markdown to clickable links.
19+
- Customize link extraction based on specific criteria.
20+
21+
## Usage
22+
23+
Example:
24+
25+
```javascript
26+
// In your gatsby-config.js
27+
plugins: [
28+
{
29+
resolve: `gatsby-transformer-remark`,
30+
options: {
31+
plugins: [
32+
{
33+
resolve: `gatsby-remark-autolink-domains`,
34+
options: {
35+
mapUrl: (domain, rest) => {
36+
return {
37+
fullUrl: `custom-full-url-for-${domain}${rest}`,
38+
scheme: 'anycustomscheme',
39+
domain: 'anycustomdomain.com',
40+
}
41+
}
42+
},
43+
},
44+
],
45+
},
46+
},
47+
];
48+
```

0 commit comments

Comments
 (0)