@into-cps-association/libms 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEVELOPER.md +11 -29
- package/README.md +64 -36
- package/config/libms.yaml.default +12 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/config/.env.default +0 -6
package/DEVELOPER.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Developer Instructions
|
|
2
2
|
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
The **pm2** package needs to be available for tests.
|
|
6
|
+
You can install the same by executing
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g pm2
|
|
10
|
+
```
|
|
11
|
+
|
|
3
12
|
## :gear: Configure
|
|
4
13
|
|
|
5
14
|
This microservice needs library assets and configuration
|
|
@@ -26,34 +35,7 @@ yarn clean # Deletes "build", "coverage", "dist" and other temp files
|
|
|
26
35
|
```
|
|
27
36
|
|
|
28
37
|
**NOTE:** The integration, end-to-end and http tests require a valid
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```ini
|
|
32
|
-
PORT='4001'
|
|
33
|
-
MODE='local'
|
|
34
|
-
LOCAL_PATH ='/Users/<Username>/DTaaS/files'
|
|
35
|
-
LOG_LEVEL='debug'
|
|
36
|
-
APOLLO_PATH='/lib'
|
|
37
|
-
GRAPHQL_PLAYGROUND='true'
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Here is another with `git` mode.
|
|
41
|
-
|
|
42
|
-
```ini
|
|
43
|
-
PORT='4001'
|
|
44
|
-
MODE='git'
|
|
45
|
-
LOCAL_PATH ='/Users/<Username>/DTaaS/files'
|
|
46
|
-
LOG_LEVEL='debug'
|
|
47
|
-
APOLLO_PATH='/lib'
|
|
48
|
-
GRAPHQL_PLAYGROUND='true'
|
|
49
|
-
|
|
50
|
-
GIT_USER1_REPO_URL='<git repo url>'
|
|
51
|
-
GIT_USER1_API_TOKEN='<TOKEN>'
|
|
52
|
-
...
|
|
53
|
-
GIT_USERX_REPO_URL='<git repo url>'
|
|
54
|
-
GIT_USERX_API_TOKEN='<TOKEN>'
|
|
55
|
-
```
|
|
56
|
-
|
|
38
|
+
configuration. This configuration is already set in `libms.test.yaml` file.
|
|
57
39
|
|
|
58
40
|
## Service Endpoint
|
|
59
41
|
|
|
@@ -99,7 +81,7 @@ for more information publishing docker images.
|
|
|
99
81
|
The default registry for npm packages is [npmjs](https://registry.npmjs.org).
|
|
100
82
|
|
|
101
83
|
```bash
|
|
102
|
-
|
|
84
|
+
npm install -g @into-cps-association/libms
|
|
103
85
|
```
|
|
104
86
|
|
|
105
87
|
The steps for publishing the package to npmjs are listed in
|
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
|
-
The **lib microservice** is a simplified file manager
|
|
4
|
-
It
|
|
3
|
+
The **lib microservice** is a simplified file manager which serves files
|
|
4
|
+
from local file system or public git repositories. It is possible to
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Upload and download files from web browser
|
|
7
|
+
* Query available files and download them using GraphQL API
|
|
8
|
+
* Clone public git repositories and serve them as local files
|
|
8
9
|
|
|
9
10
|
## :arrow_down: Install
|
|
10
11
|
|
|
@@ -14,15 +15,9 @@ The default registry for npm packages is [npmjs](https://registry.npmjs.org).
|
|
|
14
15
|
Install the package with the following commands
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
|
|
18
|
-
sudo npm install -g pm2
|
|
18
|
+
npm install -g @into-cps-association/libms
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
The package on [npmjs](https://registry.npmjs.org) is published
|
|
22
|
-
less frequently than the one on Github NPM Registry. But
|
|
23
|
-
the package on npmjs is more stable version of libms and should
|
|
24
|
-
be used for production purposes.
|
|
25
|
-
|
|
26
21
|
### Github NPM Registry
|
|
27
22
|
|
|
28
23
|
The package is also available in Github
|
|
@@ -31,8 +26,8 @@ The package is also available in Github
|
|
|
31
26
|
Set the registry and install the package with the following commands
|
|
32
27
|
|
|
33
28
|
```bash
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
npm config set @into-cps-association:registry https://npm.pkg.github.com
|
|
30
|
+
npm install -g @into-cps-association/libms
|
|
36
31
|
```
|
|
37
32
|
|
|
38
33
|
The _npm install_ command asks for username and password. The username is
|
|
@@ -46,29 +41,61 @@ needs to have _read:packages_ scope.
|
|
|
46
41
|
The microservices requires config specified in INI format.
|
|
47
42
|
The template configuration file is:
|
|
48
43
|
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
```yaml
|
|
45
|
+
port: '4001'
|
|
46
|
+
mode: 'git' # either git or local
|
|
47
|
+
local-path: 'files'
|
|
48
|
+
log-level: 'debug'
|
|
49
|
+
apollo-path: '/lib'
|
|
50
|
+
graphql-playground: 'true'
|
|
51
|
+
|
|
52
|
+
git-repos:
|
|
53
|
+
- user-1:
|
|
54
|
+
repo-url: 'https://github.com/isomorphic-git/lightning-fs'
|
|
55
|
+
- user-2:
|
|
56
|
+
repo-url: 'https://gitlab.com/dtaas/user2.git'
|
|
57
|
+
- common:
|
|
58
|
+
repo-url: 'https://gitlab.com/dtaas/common'
|
|
64
59
|
```
|
|
65
60
|
|
|
66
|
-
The `
|
|
61
|
+
The `local-path` variable is the relative filepath to the
|
|
67
62
|
location of the local directory which will be served to users
|
|
68
63
|
by the Library microservice.
|
|
69
64
|
|
|
70
65
|
Replace the default values the appropriate values for your setup.
|
|
71
|
-
Please save this config in a file.
|
|
66
|
+
Please save this config in a file as a yaml file, for example as `libms.yaml`.
|
|
67
|
+
|
|
68
|
+
### Operation Modes
|
|
69
|
+
|
|
70
|
+
The mode indicates the backend storage for the files.
|
|
71
|
+
There are two possible modes - `local` and `git`.
|
|
72
|
+
The files available in the `local-path` are served to users in `local` mode.
|
|
73
|
+
In the `git` mode, the remote git repos are cloned and they are
|
|
74
|
+
served to users as local files.
|
|
75
|
+
|
|
76
|
+
#### git mode
|
|
77
|
+
|
|
78
|
+
A fragment of the config for `git` mode is:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
...
|
|
82
|
+
git-repos:
|
|
83
|
+
- user-1:
|
|
84
|
+
repo-url: 'https://github.com/isomorphic-git/lightning-fs'
|
|
85
|
+
- user-2:
|
|
86
|
+
repo-url: 'https://gitlab.com/dtaas/user2.git'
|
|
87
|
+
- common:
|
|
88
|
+
repo-url: 'https://gitlab.com/dtaas/common'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Here, `user-1`, `user-2` and `common` are the local directories into which
|
|
92
|
+
the remote git repositories get cloned. The name of the repository need not
|
|
93
|
+
match with the local directory name. For example, the above configuration
|
|
94
|
+
enables library microservice to clone
|
|
95
|
+
`https://github.com/isomorphic-git/lightning-fs` repository into
|
|
96
|
+
`user-1` directory. Any git server accessible over
|
|
97
|
+
HTTP(S) protocol is supported.
|
|
98
|
+
The `.git` suffix is optional.
|
|
72
99
|
|
|
73
100
|
## :rocket: Use
|
|
74
101
|
|
|
@@ -82,7 +109,7 @@ The lib microservice is a file server. It supports file transfer
|
|
|
82
109
|
over GraphQL and HTTP protocols.
|
|
83
110
|
|
|
84
111
|
Options:
|
|
85
|
-
-c, --config <file> provide the config file (default .
|
|
112
|
+
-c, --config <file> provide the config file (default libms.yaml)
|
|
86
113
|
-H, --http <file> enable the HTTP server with the specified config
|
|
87
114
|
-h, --help display help for libms
|
|
88
115
|
```
|
|
@@ -91,9 +118,9 @@ Both the options are not mandatory.
|
|
|
91
118
|
|
|
92
119
|
### Configuration file
|
|
93
120
|
|
|
94
|
-
The config is saved
|
|
121
|
+
The config is saved `libms.yaml` file by convention. If `-c` is not specified
|
|
95
122
|
The **libms** looks for
|
|
96
|
-
|
|
123
|
+
`libms.yaml` file in the working directory from which it is run.
|
|
97
124
|
If you want to run **libms** without explicitly specifying the configuration
|
|
98
125
|
file, run
|
|
99
126
|
|
|
@@ -108,11 +135,11 @@ libms -c FILE-PATH
|
|
|
108
135
|
libms --config FILE-PATH
|
|
109
136
|
```
|
|
110
137
|
|
|
111
|
-
If the environment file is named something other than
|
|
112
|
-
for example as `config
|
|
138
|
+
If the environment file is named something other than `libms.yaml`,
|
|
139
|
+
for example as `config/libms.yaml.default`, you can run
|
|
113
140
|
|
|
114
141
|
```sh
|
|
115
|
-
libms -c "config
|
|
142
|
+
libms -c "config/libms.yaml.default"
|
|
116
143
|
```
|
|
117
144
|
|
|
118
145
|
You can press `Ctl+C` to halt the application.
|
|
@@ -151,6 +178,7 @@ libms --http FILE-PATH
|
|
|
151
178
|
"confirmCopy": true,
|
|
152
179
|
"confirmMove": true,
|
|
153
180
|
"showConfig": false,
|
|
181
|
+
"showDotFiles": false,
|
|
154
182
|
"showFileName": true,
|
|
155
183
|
"contact": false,
|
|
156
184
|
"configDialog": false,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
port: '4001'
|
|
2
|
+
mode: 'git'
|
|
3
|
+
local-path: '..\..\files'
|
|
4
|
+
log-level: 'debug'
|
|
5
|
+
apollo-path: '/lib'
|
|
6
|
+
graphql-playground: 'true'
|
|
7
|
+
|
|
8
|
+
git-repos:
|
|
9
|
+
- user-1:
|
|
10
|
+
repo-url: 'https://github.com/isomorphic-git/lightning-fs'
|
|
11
|
+
- user-2:
|
|
12
|
+
repo-url: 'https://github.com/isomorphic-git/lightning-fs'
|