Skip to content

Commit

Permalink
Merge pull request #11 from NghiaCaNgao/dev
Browse files Browse the repository at this point in the history
Improve builder
  • Loading branch information
nacana22 authored Aug 23, 2023
2 parents 0617c12 + ab80f7e commit 565d375
Show file tree
Hide file tree
Showing 47 changed files with 59 additions and 1,640 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Publish LunarDate
run-name: ${{ github.actor }} publishes LunarDate
on:
pull_request:
pull_request: # when accepting a pull request
types:
- closed
branches: #target branch
- main
workflow_dispatch:
workflow_dispatch: # or intentionally executing
inputs:
publish_confirm:
type: boolean
description: Confirm publishing
default: false
jobs:
release-modules:
if: github.event.inputs.publish_confirm || (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release'))
release-modules: # when accepted publish or pull request marked as `release` (see in Pull Request > labels)
if: github.event.inputs.publish_confirm || (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release'))
permissions:
contents: write
runs-on: ubuntu-latest
Expand All @@ -27,7 +27,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
registry-url: "https://registry.npmjs.org" # registry to set up for auth
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Test LunarDate
run-name: ${{ github.actor }} tests LunarDate
on: [pull_request]
on: [pull_request] # Run on every pull request
jobs:
test-modules:
test-modules: # Test modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
coverage
test/ts/node_modules
test/ts/node_modules
*.tgz
bin
dist
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## [2.0.1] - 2023-08-23
### Fixed
- Sửa lỗi import để tương thích với commonjs typescript
## [2.0.0] - 2023-06-22
### Added
- Thêm interfaces: list **`ILunarDateEx`**, **`ILunarDateLeap`**
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Remake từ <b><a href="https://www.informatik.uni-leipzig.de/~duc/amlich/calrul

## Table of Contents

- [Feature](#features)
- [Features](#features)
- [Installation](#installation)
- [Package manager](#package-manager)
- [CDN](#cdn)
Expand Down Expand Up @@ -66,7 +66,7 @@ Cài đặt qua NPM
npm install @nghiavuive/lunar_date_vi
```

Khi cài đặt xong, ta có thể import bằng `import` hoặc `require`. Trước khi bắt đầu, đảm bảo rằng `package.json``"type": "module"`.
Xem demo cài đặt với các module types: **[LunarDate_Import](https://github.com/NghiaCaNgao/LunarDate_Import)**

```typescript
import { LunarDate, SolarDate } from "@nghiavuive/lunar_date_vi";
Expand All @@ -79,7 +79,7 @@ Nếu sử dụng Typescript, lưu ý cấu hình `tsconfig.json` như sau:
"compilerOptions": {
"esModuleInterop": true,
"moduleResolution": "node",
"module": "ESNext"
"module": "ESNext" // Hoặc "CommonJS" nếu dùng CJS
},
"include": ["./**/*.ts"],
"exclude": ["node_modules"]
Expand All @@ -89,7 +89,7 @@ Nếu sử dụng Typescript, lưu ý cấu hình `tsconfig.json` như sau:
Nếu sử dụng `require`

```javascript
const calendar = require("@nghiavuive/lunar_date_vi/dist/index.cjs");
const calendar = require("@nghiavuive/lunar_date_vi");
```

### CDN
Expand All @@ -104,7 +104,7 @@ Sử dụng qua jsDelivr

Sử dụng `ES Module` với Typescript. JavaScript tương tự.

> **Note** Nếu sử dụng `ts-node` thì cần chạy `npx ts-node --esm <filename>`
> **Note** Nếu sử dụng `ts-node` thì cần chạy `npx ts-node --esm <filename>`. Hiện tại chưa tương thích với Node 20.x
Đoạn lệnh sau chuyển từ lịch dương sang lịch âm (trên) và âm sang dương (dưới).

Expand Down
3 changes: 1 addition & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"type": "module", add in package.json
"type": "module", remove to run npx ts-node
- Thêm nhiều thông tin hơn https://lichngaytot.com/xem-ngay-tot-xau.html
Loading

0 comments on commit 565d375

Please sign in to comment.