Skip to content

Commit

Permalink
feat: provide building products in more formats
Browse files Browse the repository at this point in the history
  • Loading branch information
hujiulong committed Jan 16, 2023
1 parent dc48766 commit da8d857
Show file tree
Hide file tree
Showing 22 changed files with 436 additions and 108 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'no-continue': 'off',
'no-mixed-operators': 'off',
Expand Down
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "21:00"
interval: monthly
open-pull-requests-limit: 10
ignore:
- dependency-name: eslint-config-airbnb-typescript
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"semi": true,
"singleQuote": true
"singleQuote": true,
"printWidth": 80
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
> 导航电子地图在公开出版、销售、传播、展示和使用前,必须进行空间位置技术处理。<br> — GB 20263―2006《导航电子地图安全处理技术基本要求》,4.1
## Install
## 安装
通过npm安装:
```bash
npm install gcoord --save
```
或者直接在页面中引入:
```html
<script src="https://unpkg.com/gcoord/dist/gcoord.js"></script>
<script src="https://unpkg.com/gcoord/dist/gcoord.global.prod.js"></script>
```
## Import
## 引入
CommonJS:
```js
const gcoord = require('gcoord');
Expand All @@ -40,7 +40,7 @@ import gcoord from 'gcoord';
同时也支持AMD和CMD规范


## Usage
## 使用
例如从手机的GPS得到一个经纬度坐标,需要将其展示在百度地图上,则应该将当前坐标从[WGS-84](https://github.com/hujiulong/gcoord/wiki/%E5%9C%B0%E7%90%86%E5%9D%90%E6%A0%87%E7%B3%BB#wgs-84---%E4%B8%96%E7%95%8C%E5%A4%A7%E5%9C%B0%E6%B5%8B%E9%87%8F%E7%B3%BB%E7%BB%9F)坐标系转换为[BD-09](https://github.com/hujiulong/gcoord/wiki/%E5%9C%B0%E7%90%86%E5%9D%90%E6%A0%87%E7%B3%BB#bd-09---%E7%99%BE%E5%BA%A6%E5%9D%90%E6%A0%87%E7%B3%BB)坐标系
```js
var result = gcoord.transform(
Expand Down
66 changes: 66 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"mainEntryPointFilePath": "./dist/types/index.d.ts",

"apiReport": {
"enabled": false
},

"docModel": {
"enabled": false
},

"dtsRollup": {
"enabled": true
},

"tsdocMetadata": {
"enabled": false
},

"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},

"extractorMessageReporting": {
"default": {
"logLevel": "warning",
"addToApiReportFile": true
},

"ae-missing-release-tag": {
"logLevel": "none"
}
},

"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
},

"tsdoc-undefined-tag": {
"logLevel": "none"
},

"tsdoc-escape-greater-than": {
"logLevel": "none"
},

"tsdoc-malformed-inline-tag": {
"logLevel": "none"
},

"tsdoc-escape-right-brace": {
"logLevel": "none"
},

"tsdoc-unnecessary-backslash": {
"logLevel": "none"
}
}
}
}
Binary file removed crs.jpg
Binary file not shown.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/gcoord.cjs.prod.js');
} else {
module.exports = require('./dist/gcoord.cjs.js');
}
16 changes: 10 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ module.exports = {
testEnvironment: 'node',
verbose: true,
roots: ['<rootDir>/test/'],
testURL: 'http://localhost/',
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
isolatedModules: true,
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: {
target: 'esnext',
sourceMap: true,
},
},
],
},
coveragePathIgnorePatterns: ['/node_modules/', '/test/helpers/'],
coverageDirectory: './coverage/',
Expand Down
45 changes: 30 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
"name": "gcoord",
"version": "0.3.2",
"description": "geographic coordinate library",
"main": "dist/gcoord.js",
"module": "dist/gcoord.esm.js",
"types": "dist/types/index.d.ts",
"main": "index.js",
"module": "dist/gcoord.esm-bundler.js",
"types": "dist/gcoord.d.ts",
"unpkg": "dist/gcoord.global.js",
"jsdelivr": "dist/gcoord.global.js",
"files": [
"src",
"dist",
"index.js"
],
"sideEffects": false,
"scripts": {
"build": "rollup -c ./rollup.config.js",
"build": "node scripts/build.js",
"lint": "eslint --ext .js,.ts, ./src",
"test": "jest && codecov",
"release": "node scripts/release.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"format": "prettier --write \"src/**/*.ts\"",
"gpr-setup": "node scripts/gpr-setup.js"
},
"files": [
"src",
"dist"
],
"gitHooks": {
"pre-commit": "lint-staged",
"commit-msg": "node scripts/verify-commit.js"
Expand All @@ -42,22 +45,34 @@
"url": "https://github.com/hujiulong/gcoord/issues"
},
"homepage": "https://github.com/hujiulong/gcoord#readme",
"keywords": [
"map",
"coordinate",
"wgs84",
"gcj02",
"bd09"
],
"engines": {
"node": ">=16.11.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.33.7",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-terser": "^0.3.0",
"@types/jest": "^29.2.5",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"chalk": "^5.2.0",
"@typescript-eslint/parser": "^5.48.1",
"chalk": "^4.1.2",
"codecov": "^3.8.1",
"conventional-changelog-cli": "^2.1.1",
"conventional-changelog-cli": "^2.2.2",
"enquirer": "^2.3.6",
"eslint": "^7.20.0",
"execa": "^6.1.0",
"jest": "^27.0.4",
"execa": "^4.1.0",
"jest": "^29.3.1",
"lint-staged": "^13.1.0",
"minimist": "^1.2.5",
"prettier": "^2.2.1",
"rollup": "^2.39.0",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^3.10.0",
"rollup-plugin-typescript2": "^0.34.1",
"semver": "^7.3.4",
"ts-jest": "^29.0.4",
Expand Down
37 changes: 0 additions & 37 deletions rollup.config.js

This file was deleted.

Loading

0 comments on commit da8d857

Please sign in to comment.