Skip to content

Commit 556fbee

Browse files
17 add exports field to package.json (#26)
* add exports field to package.json * code refactoring * update package version * turn on declarationMap * fix jest tests * refactor release pipelines * update readme, fix examples * update tests imports * code refactoring * rename clients/http to clients/request and more code refactoring * add support of http protocol for NodeHttpClient * renaming, code refactoring * code refactoring, ad typedoc package * mark commands with internal attribute * mark more exports as internal * mark more exports as internal * mark more exports as internal * mark more exports as internal * code refactoring * fix some errors for generating docs * code refactoring * code refactoring * code refactoring * add required-first as sorting stratage for documentation * code refactoring
1 parent b8862bc commit 556fbee

187 files changed

Lines changed: 1061 additions & 542 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pull-request.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ jobs:
3131

3232
- name: Test (Browsers)
3333
run: npm run test:browsers
34-

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ node_modules
55

66
# Distribution folder
77
dist/
8+
9+
# npm pack
10+
package/
11+
*.tgz
12+
13+
# typedoc
14+
docs/

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
# Git-Essentials
22
A collection of essential Git commands for your browser and Node.js.
33

4-
# Usage Examples
4+
## Usage Examples
55

6-
## Node.js
6+
### Node.js
77
```typescript
88
import fs from 'fs/promises'
9-
import { clone, HttpClients } from 'git-essentials'
9+
import { clone } from 'git-essentials'
10+
import { makeNodeHttpClient } from 'git-essentials/clients/request/NodeHttpClient'
1011

11-
const http = HttpClients.makeNodeHttpClient()
12+
const http = makeNodeHttpClient()
1213
const dir = 'repos/Welcome'
1314
const url = 'https://github.com/NotesHubApp/Welcome.git'
1415

1516
await clone({ fs, http, dir, url })
1617
```
1718

18-
## Browser
19+
### Browser
1920
```typescript
20-
import { clone, FsClients, HttpClients } from 'git-essentials'
21+
import { clone } from 'git-essentials'
22+
import { InMemoryFsClient } from 'git-essentials/clients/fs/InMemoryFsClient'
23+
import { makeWebHttpClient } from 'git-essentials/clients/request/WebHttpClient'
2124

2225
const corsProxyUrlTransformer = (originalUrl: string) => {
2326
return `https://www.noteshub.app/api/cors-proxy.ts?url=${encodeURIComponent(originalUrl)}`
2427
}
2528

26-
const fs = new FsClients.InMemoryFsClient()
27-
const http = HttpClients.makeWebHttpClient({ transformRequestUrl: corsProxyUrlTransformer })
29+
const fs = new InMemoryFsClient()
30+
const http = makeWebHttpClient({ transformRequestUrl: corsProxyUrlTransformer })
2831
const dir = 'repos/Welcome'
2932
const url = 'https://github.com/NotesHubApp/Welcome.git'
3033

jest.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ import type { Config } from 'jest'
22

33
const config: Config = {
44
preset: 'ts-jest',
5-
testEnvironment: 'node'
5+
testEnvironment: 'node',
6+
modulePathIgnorePatterns: [
7+
"dist"
8+
],
9+
moduleNameMapper: {
10+
'^git-essentials$': '<rootDir>/src',
11+
'^git-essentials/(.+)$': '<rootDir>/src/$1',
12+
'^src/(.+)$': '<rootDir>/src/$1'
13+
},
614
};
715

816
export default config

karma.conf.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = (config: any) => {
3232
"**/*.ts": "karma-typescript"
3333
},
3434
karmaTypescriptConfig: {
35-
exclude: ["node_modules"],
35+
exclude: ["node_modules", "dist"],
3636
compilerOptions: {
3737
"target": "es6",
3838
"strict": true,
@@ -41,6 +41,10 @@ module.exports = (config: any) => {
4141
"noFallthroughCasesInSwitch": true,
4242
"resolveJsonModule": true,
4343
"esModuleInterop": true,
44+
"baseUrl": ".",
45+
"paths": {
46+
"git-essentials": ["./src/index"]
47+
}
4448
},
4549
bundlerOptions: {
4650
addNodeGlobals: true

package-lock.json

Lines changed: 165 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)