Browse Source

Setup package

https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c
mrkvon 2 years ago
parent
commit
4af1e37c72
9 changed files with 3623 additions and 0 deletions
  1. 2
    0
      .gitignore
  2. 5
    0
      .prettierrc
  3. 7
    0
      jestconfig.json
  4. 42
    0
      package.json
  5. 3
    0
      src/__tests__/example.test.ts
  6. 1
    0
      src/index.ts
  7. 11
    0
      tsconfig.json
  8. 3
    0
      tslint.json
  9. 3549
    0
      yarn.lock

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+node_modules
2
+/lib

+ 5
- 0
.prettierrc View File

@@ -0,0 +1,5 @@
1
+{
2
+  "printWidth": 120,
3
+  "trailingComma": "all",
4
+  "singleQuote": true
5
+}

+ 7
- 0
jestconfig.json View File

@@ -0,0 +1,7 @@
1
+{
2
+  "transform": {
3
+    "^.+\\.(t|j)sx?$": "ts-jest"
4
+  },
5
+  "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
6
+  "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
7
+}

+ 42
- 0
package.json View File

@@ -0,0 +1,42 @@
1
+{
2
+  "name": "osm2pdf",
3
+  "version": "2.0.0",
4
+  "description": "Generate pdf from OpenStreetMap tiles",
5
+  "author": "mrkvon <mrkvon@protonmail.com> (https://mrkvon.org)",
6
+  "repository": {
7
+    "type": "git",
8
+    "url": "git+https://git.mrkvon.org/mrkvon/osm2pdf.git"
9
+  },
10
+  "homepage": "https://git.mrkvon.org/mrkvon/osm2pdf",
11
+  "main": "lib/index.js",
12
+  "types": "lib/index.d.ts",
13
+  "license": "MIT",
14
+  "private": false,
15
+  "preferGlobal": true,
16
+  "keywords": [
17
+    "osm",
18
+    "openstreetmap",
19
+    "pdf",
20
+    "map",
21
+    "maps",
22
+    "offline-map"
23
+  ],
24
+  "scripts": {
25
+    "test": "jest --config jestconfig.json",
26
+    "build": "tsc",
27
+    "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
28
+    "lint": "tslint -p tsconfig.json",
29
+    "prepare": "yarn build",
30
+    "prepublishOnly": "yarn test && yarn lint",
31
+    "preversion": "yarn lint",
32
+    "version": "yarn format && git add -A src",
33
+    "postversion" : "git push && git push --tags"
34
+  },
35
+  "files": ["lib/**/*"],
36
+  "devDependencies": {
37
+    "prettier": "^1.19.1",
38
+    "tslint": "^6.0.0",
39
+    "tslint-config-prettier": "^1.18.0",
40
+    "typescript": "^3.7.5"
41
+  }
42
+}

+ 3
- 0
src/__tests__/example.test.ts View File

@@ -0,0 +1,3 @@
1
+test('example', () => {
2
+  expect(1).toBeTruthy();
3
+});

+ 1
- 0
src/index.ts View File

@@ -0,0 +1 @@
1
+export const Greeter = (name: string) => `Hello ${name}`;

+ 11
- 0
tsconfig.json View File

@@ -0,0 +1,11 @@
1
+{
2
+  "compilerOptions": {
3
+    "target": "es5",
4
+    "module": "commonjs",
5
+    "declaration": true,
6
+    "outDir": "./lib",
7
+    "strict": true
8
+  },
9
+  "include": ["src"],
10
+  "exclude": ["node_modules", "**/__tests__/*"]
11
+}

+ 3
- 0
tslint.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "extends": ["tslint:recommended", "tslint-config-prettier"]
3
+}

+ 3549
- 0
yarn.lock
File diff suppressed because it is too large
View File