Skip to content

Commit 4a207f9

Browse files
authored
Merge pull request #18 from quran/dev
🎉 Add support for UMD
2 parents ba1ac32 + 818682c commit 4a207f9

File tree

8 files changed

+3574
-2470
lines changed

8 files changed

+3574
-2470
lines changed

.eslintignore

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

.github/workflows/main.yml

+26-16
Original file line numberDiff line numberDiff line change
@@ -13,47 +13,57 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
node: ['14.x', '16.x']
16+
node: ['18.x', '20.x']
1717

1818
steps:
1919
- name: Checkout repo
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121

22-
- name: Use Node ${{ matrix.node }}
23-
uses: actions/setup-node@v1
22+
- name: Setup PNPM
23+
uses: pnpm/action-setup@v4
24+
25+
- name: Install Node.js ${{ matrix.node }}
26+
uses: actions/setup-node@v4
2427
with:
2528
node-version: ${{ matrix.node }}
26-
27-
- name: Install deps and build (with cache)
28-
uses: bahmutov/npm-install@v1
29+
cache: "pnpm"
30+
31+
- name: Install dependencies
32+
shell: bash
33+
run: pnpm install
2934

3035
- name: Lint
31-
run: yarn lint --quiet
36+
run: pnpm lint --quiet
3237

3338
- name: Test
34-
run: yarn test:coverage
39+
run: pnpm test:coverage
3540

3641
- name: Build
37-
run: yarn build
42+
run: pnpm build
3843

3944
test-and-publish:
4045
name: 🎉 Publish to NPM
4146
needs: [build]
4247
if: github.repository == 'quran/api-js' && (github.ref == 'refs/heads/master') && github.event_name != 'pull_request'
4348
runs-on: ubuntu-latest
4449
steps:
45-
- uses: actions/checkout@v2
50+
- uses: actions/checkout@v4
51+
52+
- name: Setup PNPM
53+
uses: pnpm/action-setup@v4
4654

47-
- uses: actions/setup-node@v2
55+
- uses: actions/setup-node@v4
4856
with:
49-
node-version: 14
57+
node-version: 20
5058
registry-url: https://registry.npmjs.org/
59+
cache: "pnpm"
5160

52-
- name: Install deps (with cache)
53-
uses: bahmutov/npm-install@v1
61+
- name: Install dependencies
62+
shell: bash
63+
run: pnpm install
5464

5565
- name: Build
56-
run: yarn build
66+
run: pnpm build
5767

5868
- run: npx semantic-release@17
5969
env:

package.json

+20-9
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@
55
"publishConfig": {
66
"access": "public"
77
},
8-
"version": "1.0.0",
8+
"packageManager": "[email protected]",
9+
"version": "1.7.1",
910
"license": "MIT",
10-
"main": "dist/index.js",
11-
"typings": "dist/index.d.ts",
12-
"module": "dist/index.mjs",
11+
"main": "dist/index.min.js",
12+
"module": "dist/index.min.mjs",
13+
"browser": "dist/index.umd.min.js",
14+
"types": "dist/index.d.ts",
15+
"exports": {
16+
".": {
17+
"require": "./dist/index.min.js",
18+
"import": "./dist/index.min.mjs"
19+
},
20+
"./cdn": "./dist/index.umd.min.js"
21+
},
1322
"files": [
14-
"dist",
15-
"src"
23+
"dist"
1624
],
1725
"scripts": {
26+
"postversion": "node ./scripts/postversion.mjs",
1827
"start": "tsup --watch",
1928
"build": "tsup",
2029
"test": "vitest run",
@@ -29,12 +38,14 @@
2938
"humps": "^2.0.1"
3039
},
3140
"devDependencies": {
32-
"cross-fetch": "^3.1.5",
3341
"@size-limit/preset-small-lib": "^7.0.8",
42+
"@swc/core": "^1.10.4",
3443
"@types/humps": "^2.0.1",
3544
"@typescript-eslint/eslint-plugin": "^5.42.0",
3645
"@typescript-eslint/parser": "^5.42.0",
3746
"@vitest/coverage-c8": "^0.24.4",
47+
"cross-fetch": "^3.1.5",
48+
"esbuild-plugin-umd-wrapper": "^3.0.0",
3849
"eslint": "^8.26.0",
3950
"eslint-config-prettier": "^8.5.0",
4051
"eslint-plugin-prettier": "^4.2.1",
@@ -51,11 +62,11 @@
5162
},
5263
"size-limit": [
5364
{
54-
"path": "dist/index.js",
65+
"path": "dist/index.min.js",
5566
"limit": "15 KB"
5667
},
5768
{
58-
"path": "dist/index.mjs",
69+
"path": "dist/index.min.mjs",
5970
"limit": "15 KB"
6071
}
6172
],

0 commit comments

Comments
 (0)