Skip to content

Commit 91403dc

Browse files
committed
perf: Initial Release
0 parents  commit 91403dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+16158
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[{package.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
github: [dulajdeshan]
2+
patreon: dulajdeshan
3+
buy_me_a_coffee: dulajdeshan

.github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
10+
schedule:
11+
interval: daily
12+
commit-message:
13+
prefix: fix
14+
prefix-development: chore
15+
include: scope

.github/workflows/main.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches: ['*']
5+
pull_request:
6+
branches: [main]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node-version: [18.x, 20.x]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- name: Install dependencies
22+
run: yarn install
23+
- name: Building package
24+
run: yarn build

.github/workflows/release.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish Package to npmjs
2+
on:
3+
push:
4+
branches:
5+
- release
6+
jobs:
7+
release:
8+
name: Release and Publish
9+
runs-on: ubuntu-latest
10+
if: ${{ github.ref == 'refs/heads/release' }}
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
# Setup .npmrc file to publish to npm
15+
- name: node
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '20.x'
19+
- name: Install dependencies
20+
run: yarn install
21+
- name: Building package
22+
run: yarn build
23+
- name: Install semantic-release
24+
run: yarn global add semantic-release-cli semantic-release
25+
- run: semantic-release --branches release
26+
env:
27+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
############################
4+
# OS X
5+
############################
6+
7+
.DS_Store
8+
.AppleDouble
9+
.LSOverride
10+
Icon
11+
.Spotlight-V100
12+
.Trashes
13+
._*
14+
15+
16+
############################
17+
# Linux
18+
############################
19+
20+
*~
21+
22+
23+
############################
24+
# Windows
25+
############################
26+
27+
Thumbs.db
28+
ehthumbs.db
29+
Desktop.ini
30+
$RECYCLE.BIN/
31+
*.cab
32+
*.msi
33+
*.msm
34+
*.msp
35+
36+
37+
############################
38+
# Packages
39+
############################
40+
41+
*.7z
42+
*.csv
43+
*.dat
44+
*.dmg
45+
*.gz
46+
*.iso
47+
*.jar
48+
*.rar
49+
*.tar
50+
*.zip
51+
*.com
52+
*.class
53+
*.dll
54+
*.exe
55+
*.o
56+
*.seed
57+
*.so
58+
*.swo
59+
*.swp
60+
*.swn
61+
*.swm
62+
*.out
63+
*.pid
64+
65+
66+
############################
67+
# Logs and databases
68+
############################
69+
70+
.tmp
71+
*.log
72+
*.sql
73+
*.sqlite
74+
*.sqlite3
75+
76+
77+
############################
78+
# Misc.
79+
############################
80+
81+
*#
82+
ssl
83+
.idea
84+
nbproject
85+
.tsbuildinfo
86+
.eslintcache
87+
.env
88+
89+
90+
############################
91+
# Strapi
92+
############################
93+
94+
public/uploads/*
95+
!public/uploads/.gitkeep
96+
97+
98+
############################
99+
# Build
100+
############################
101+
102+
dist
103+
build
104+
105+
106+
############################
107+
# Node.js
108+
############################
109+
110+
lib-cov
111+
lcov.info
112+
pids
113+
logs
114+
results
115+
node_modules
116+
.node_history
117+
118+
119+
############################
120+
# Package managers
121+
############################
122+
123+
.yarn/*
124+
!.yarn/cache
125+
!.yarn/unplugged
126+
!.yarn/patches
127+
!.yarn/releases
128+
!.yarn/sdks
129+
!.yarn/versions
130+
.pnp.*
131+
yarn-error.log
132+
133+
134+
############################
135+
# Tests
136+
############################
137+
138+
coverage

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/docs/
2+
*.iml
3+
*ignore
4+
__tests__
5+
.github

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.12.0

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
coverage

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"endOfLine": "lf",
3+
"tabWidth": 2,
4+
"printWidth": 100,
5+
"singleQuote": true,
6+
"trailingComma": "es5"
7+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Dulaj Deshan Ariyaratne
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

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<p align="center">
2+
<img src="./docs/screenshots/strapi-country-select.png" alt="Bootstrap Icons" width="100">
3+
</p>
4+
5+
<h1 align="center">
6+
Strapi Country Select
7+
</h1>
8+
9+
<p align="center">Custom Field plugin for Strapi to select countries in `ISO 3166-1 alpha-2` format</p>
10+
11+
<p align="center">
12+
<a href="https://www.npmjs.com/package/strapi-country-select">
13+
<img src="https://img.shields.io/npm/v/strapi-country-select" alt="Version">
14+
<img src="https://img.shields.io/npm/l/sstrapi-country-select" alt="License">
15+
</a>
16+
</p>
17+
18+
The Strapi Country Select Plugin is a custom plugin for Strapi that allows you to to select countries in `ISO 3166-1 alpha-2` format.
19+
20+
## ⚙️ Installation
21+
22+
To install the Strapi Advanced UUID Plugin, simply run one of the following command:
23+
24+
```
25+
npm install strapi-country-select
26+
```
27+
28+
```
29+
yarn add strapi-country-select
30+
```
31+
32+
## ⚡️ Usage
33+
34+
### How to Setup Country Select Field
35+
36+
After installation you will find the `Country Select` at the custom fields section of the content-type builder.
37+
38+
![strapi country select](./docs/screenshots/screenshot-1.png)
39+
40+
Now You can create new records via the Admin panel, API or GraphQL.
41+
42+
![strapi country select](./docs/screenshots/screenshot-2.png)
43+
44+
## 👍 Contribute
45+
46+
If you want to say **Thank You** and/or support the active development of `Strapi Country Select`:
47+
48+
1. Add a [GitHub Star](https://github.com/Dulajdeshan/strapi-country-select/stargazers) to the project.
49+
2. Support the project by donating a [cup of coffee](https://buymeacoff.ee/dulajdeshan).
50+
51+
## 🧾 License
52+
53+
This plugin is licensed under the MIT License. See the [LICENSE](./LICENSE.md) file for more information.

admin/custom.d.ts

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import getUnicodeFlagIcon from "country-flag-icons/unicode";
2+
3+
import { Typography } from "@strapi/design-system";
4+
import { Globe } from "@strapi/icons";
5+
6+
type TProps = {
7+
code: string;
8+
};
9+
10+
export default function CountryIcon({ code }: TProps) {
11+
if (!Boolean(code)) return <Globe />
12+
13+
const icon = getUnicodeFlagIcon(code);
14+
15+
return <Typography>{icon}</Typography>;
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import CountryIcon from "./CountryIcon";
2+
3+
export { CountryIcon };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { useEffect, useRef } from "react";
2+
3+
import { PLUGIN_ID } from "../../pluginId";
4+
5+
type InitializerProps = {
6+
setPlugin: (id: string) => void;
7+
};
8+
9+
const Initializer = ({ setPlugin }: InitializerProps) => {
10+
const ref = useRef(setPlugin);
11+
12+
useEffect(() => {
13+
ref.current(PLUGIN_ID);
14+
}, []);
15+
16+
return null;
17+
};
18+
19+
export default Initializer;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Initializer from "./Initializer";
2+
3+
export { Initializer };

0 commit comments

Comments
 (0)