Skip to content

Commit

Permalink
feat: migrate to pnpm & support esm
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteKiwi committed Sep 23, 2022
1 parent 0900460 commit ddb4cd6
Show file tree
Hide file tree
Showing 13 changed files with 3,643 additions and 3,344 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@ name: CI

on:
push:
branches: [ main, develop ]
branches: [ main ]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Install
- name: Install
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: |
- args: [--frozen-lockfile]
- name: Build
run: |
yarn
pnpm build
# Test
- name: Test
run: |
yarn run test
# yarn run test:cov
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
pnpm test
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish

on:
push:
branches: [ main ]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Setup npm token
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: |
- args: [--frozen-lockfile]
- name: Build
run: |
pnpm build
- name: Test
run: |
pnpm test
# TODO: version up & commit

- name: Publish
run: |
pnpm publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# compiled output
/lib
/esm
/node_modules

# Logs
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
19 changes: 0 additions & 19 deletions .scripts/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions .scripts/publish.ts

This file was deleted.

11 changes: 0 additions & 11 deletions .scripts/utils/cmd.ts

This file was deleted.

1 change: 0 additions & 1 deletion .scripts/utils/index.ts

This file was deleted.

21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{
"name": "the-camp",
"version": "1.0.1",
"version": "1.1.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "esm/index.js",
"repository": "[email protected]:whitekiwi/the-camp.git",
"author": "Whitekiwi <[email protected]>",
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint \"{{src}/**/*.ts,**.js}\" --fix",
"test": "jest --forceExit --testPathIgnorePatterns='.e2e.*'",
"test": "jest --testPathIgnorePatterns='.e2e.*'",
"test:watch": "jest --watch --testPathIgnorePatterns='.e2e.*'",
"test:cov": "jest --coverage --forceExit --testPathIgnorePatterns='.e2e.*'",
"prebuild": "rimraf ./lib",
"build": "ttsc -p tsconfig.build.json",
"script": "ts-node .scripts/index.ts"
"test:cov": "jest --coverage --testPathIgnorePatterns='.e2e.*'",
"prebuild": "rimraf ./lib ./esm",
"build": "ttsc -p tsconfig.build.json && ttsc -p tsconfig.esm.json"
},
"dependencies": {
"axios": "^0.26.0"
},
"devDependencies": {
"@kiwi-lib/eslint-config": "^1",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@types/node": "^16",
"dotenv": "^16.0.0",
"jest": "^27.5.1",
"rimraf": "^3.0.2",
Expand All @@ -41,7 +44,9 @@
"kiwi-lib"
],
"files": [
"lib"
"lib",
"esm",
"src"
],
"prettier": "@kiwi-lib/eslint-config/prettier.config"
}
Loading

0 comments on commit ddb4cd6

Please sign in to comment.