spire.officejs-service-win-ve 1.0.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/README.md +70 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/lib/OfficeServer/config/default.json +261 -0
- package/lib/OfficeServer/config/log4js/development.json +14 -0
- package/lib/OfficeServer/config/log4js/production.json +124 -0
- package/lib/OfficeServer/node_sqlite3.node +0 -0
- package/lib/OfficeServer/officeserver-win.exe +0 -0
- package/lib/run_servers.bat +8 -0
- package/package.json +16 -0
- package/scripts/copy-config.js +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# spire.officejs-service-win
|
|
2
|
+
|
|
3
|
+
The `spire.officejs-service-win` package provides the **Spire.OfficeJS backend server service** for **Windows (x64)** platforms. It is the server-side companion to the [Spire.OfficeJS](https://www.e-iceblue.com/Introduce/spire-office-js.html) front-end library, enabling document processing capabilities such as collaborative editing and persistent storage on Windows systems.
|
|
4
|
+
|
|
5
|
+
## What's Included
|
|
6
|
+
|
|
7
|
+
- **Native Server Binary** — `officeserver-win.exe`, the core Office document server compiled for Windows x64
|
|
8
|
+
- **SQLite Native Addon** — `node_sqlite3.node` for local data persistence
|
|
9
|
+
- **Default Configuration** — pre-configured server settings (port, storage, logging, database, security, etc.)
|
|
10
|
+
- **Auto-Config Setup** — a postinstall script that copies the default configuration to your project root as `spire.officejs-server-config.json`
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install spire.officejs-service-win
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
During installation, the postinstall script will automatically copy a default server configuration file (`spire.officejs-server-config.json`) to your project root. If the file already exists, it will not be overwritten — this prevents accidental overwrites of your custom configuration.
|
|
19
|
+
|
|
20
|
+
## Platform Support
|
|
21
|
+
|
|
22
|
+
| Platform | Architecture | Package |
|
|
23
|
+
|----------|-------------|---------|
|
|
24
|
+
| Windows | x64 | `spire.officejs-service-win` |
|
|
25
|
+
| Linux | x64 | `spire.officejs-service-linux` |
|
|
26
|
+
| Linux | ARM | `spire.officejs-service-arm` |
|
|
27
|
+
|
|
28
|
+
## Running the Server: Development vs Production
|
|
29
|
+
|
|
30
|
+
The `run_servers.bat` script — the runtime environment is entirely controlled by the `spire.officejs-server-config.json` configuration file. The workflow for both environments is: **configure first, then run**.
|
|
31
|
+
|
|
32
|
+
### Development Environment
|
|
33
|
+
|
|
34
|
+
**Step 1 — Prepare the development config**
|
|
35
|
+
|
|
36
|
+
Edit `spire.officejs-server-config.json` in your project root.
|
|
37
|
+
|
|
38
|
+
**Step 2 — Start the server**
|
|
39
|
+
|
|
40
|
+
Run your project in development environment.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
**Step 3 — Stop the server**
|
|
44
|
+
|
|
45
|
+
stop your project in development environment.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Production Environment
|
|
49
|
+
|
|
50
|
+
**Step 1 — Prepare the production config**
|
|
51
|
+
|
|
52
|
+
Before building, edit `spire.officejs-server-config.json` in your project root and ensure the following production settings are properly configured:
|
|
53
|
+
|
|
54
|
+
**Step 2 — Start the server**
|
|
55
|
+
|
|
56
|
+
Switch the directory to `/dist/spire.officejs/service`, double-click `run_servers.bat` to launch the server. The script starts `officeserver-win.exe` as a background process.
|
|
57
|
+
|
|
58
|
+
**Step 3 — Stop the server**
|
|
59
|
+
|
|
60
|
+
To stop the server in production:
|
|
61
|
+
|
|
62
|
+
- If the server was launched via `run_servers.bat` interactively, close the console window or press `Ctrl + C` in the terminal where it is running.
|
|
63
|
+
- If the server is running as a background process, open **Task Manager**, locate `officeserver-win.exe`, and end the task.
|
|
64
|
+
- For unattended deployments (e.g., Windows Service), stop the service via `services.msc` or `sc stop <service-name>`.
|
|
65
|
+
|
|
66
|
+
## Getting More Help
|
|
67
|
+
|
|
68
|
+
- Visit the Spire.OfficeJS home page: [https://www.e-iceblue.com/Introduce/spire-office-js.html](https://www.e-iceblue.com/Introduce/spire-office-js.html)
|
|
69
|
+
- Forum: [https://www.e-iceblue.com/forum/](https://www.e-iceblue.com/forum/)
|
|
70
|
+
- Temporary License: [https://www.e-iceblue.com/TemLicense.html](https://www.e-iceblue.com/TemLicense.html)
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
{
|
|
2
|
+
"StatsdInformation": {
|
|
3
|
+
"useMetrics": false,
|
|
4
|
+
"host": "127.0.0.1",
|
|
5
|
+
"port": "8125",
|
|
6
|
+
"prefix": "ds."
|
|
7
|
+
},
|
|
8
|
+
"LogInformation": {
|
|
9
|
+
"filePath": "./config/log4js/production.json",
|
|
10
|
+
"options": {
|
|
11
|
+
"replaceConsole": true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"RabbitmqQueue": {
|
|
15
|
+
"type": "rabbitmq",
|
|
16
|
+
"visibilityTimeout": 300,
|
|
17
|
+
"retentionPeriod": 900
|
|
18
|
+
|
|
19
|
+
},
|
|
20
|
+
"StorageInformation": {
|
|
21
|
+
"fs": {
|
|
22
|
+
"folderPath": "../../../storage/App_Data/cache/files",
|
|
23
|
+
"urlExpires": 2592000,
|
|
24
|
+
"secretString": "officecloud"
|
|
25
|
+
},
|
|
26
|
+
"region": "",
|
|
27
|
+
"endpoint": "http://127.0.0.1/s3",
|
|
28
|
+
"bucketName": "cache",
|
|
29
|
+
"storageFolderName": "files",
|
|
30
|
+
"urlExpires": 604800,
|
|
31
|
+
"accessKeyId": "AKID",
|
|
32
|
+
"secretAccessKey": "SECRET",
|
|
33
|
+
"useRequestToGetUrl": false,
|
|
34
|
+
"useSignedUrl": false,
|
|
35
|
+
"externalHost": null
|
|
36
|
+
},
|
|
37
|
+
"DnscacheInformation": {
|
|
38
|
+
"enable": true,
|
|
39
|
+
"ttl": 300,
|
|
40
|
+
"cachesize": 1000
|
|
41
|
+
},
|
|
42
|
+
"ServicesInformation": {
|
|
43
|
+
"OfficeServer": {
|
|
44
|
+
"server": {
|
|
45
|
+
"port": 8000,
|
|
46
|
+
"workerpercpu": 1,
|
|
47
|
+
"mode": "development",
|
|
48
|
+
"limitsTempfileUpload": 10485760000,
|
|
49
|
+
"limitsImageSize": 26214400,
|
|
50
|
+
"limitsMediaSize": 104857600,
|
|
51
|
+
"limitsImageDownloadTimeout": {
|
|
52
|
+
"connectionAndInactivity": "10s",
|
|
53
|
+
"wholeCycle": "2m"
|
|
54
|
+
},
|
|
55
|
+
"limitsMediaDownloadTimeout": {
|
|
56
|
+
"connectionAndInactivity": "10s",
|
|
57
|
+
"wholeCycle": "2m"
|
|
58
|
+
},
|
|
59
|
+
"callbackRequestTimeout": {
|
|
60
|
+
"wholeCycle": "2m"
|
|
61
|
+
},
|
|
62
|
+
"healthcheckfilepath": "../../public/healthcheck.docx",
|
|
63
|
+
"savetimeoutdelay": 5000,
|
|
64
|
+
"edit_singleton": false,
|
|
65
|
+
"forgottenfiles": "forgotten",
|
|
66
|
+
"forgottenfilesname": "output",
|
|
67
|
+
"maxRequestChanges": 20000,
|
|
68
|
+
"openProtectedFile": true,
|
|
69
|
+
"editorDataStorage": "editorDataMemory",
|
|
70
|
+
"customeTokenKey": "",
|
|
71
|
+
"whiteList": "*",
|
|
72
|
+
"defineToolbar": true
|
|
73
|
+
},
|
|
74
|
+
"requestDefaults": {
|
|
75
|
+
"headers": {
|
|
76
|
+
"User-Agent": "Node.js/6.13"
|
|
77
|
+
},
|
|
78
|
+
"rejectUnauthorized": true
|
|
79
|
+
},
|
|
80
|
+
"autoAssembly": {
|
|
81
|
+
"enable": false,
|
|
82
|
+
"interval": "5m",
|
|
83
|
+
"step": "1m"
|
|
84
|
+
},
|
|
85
|
+
"utils": {
|
|
86
|
+
"utilsCommonFontDir": "../../../../fontsweb",
|
|
87
|
+
"utilsFontsSearchPatterns": "*.ttf;*.ttc;*.otf;*.gz",
|
|
88
|
+
"resourceExpires": 31536000,
|
|
89
|
+
"limitsImageTypesUpload": "jpg;png;gif;bmp",
|
|
90
|
+
"limitsMediaTypesUpload": "mp4;avi;mov;flv;rmvb;3gp",
|
|
91
|
+
"limitsImageTypesCopy": "jpg;png;gif;bmp;svg"
|
|
92
|
+
},
|
|
93
|
+
"sqlite3": {
|
|
94
|
+
"path": "../../data/spire_cloud_task_result.db",
|
|
95
|
+
"tableChanges": "doc_changes",
|
|
96
|
+
"tableResult": "task_result",
|
|
97
|
+
"max_allowed_packet": "1048575"
|
|
98
|
+
},
|
|
99
|
+
"sql": {
|
|
100
|
+
"type": "mysql",
|
|
101
|
+
"dbHost": "127.0.0.1",
|
|
102
|
+
"dbPort": 3306,
|
|
103
|
+
"dbUser": "root",
|
|
104
|
+
"dbPass": "",
|
|
105
|
+
"charset": "utf8",
|
|
106
|
+
"connectionlimit": 10,
|
|
107
|
+
"max_allowed_packet": 1048575,
|
|
108
|
+
"dbName": "officecloud",
|
|
109
|
+
"tableChanges": "doc_changes",
|
|
110
|
+
"tableResult": "task_result",
|
|
111
|
+
"customer_count_table": "jos_cloud_app_count",
|
|
112
|
+
"customer_history_table": "jos_use_lists",
|
|
113
|
+
"customer_item_table": "jos_cloud_app_items"
|
|
114
|
+
},
|
|
115
|
+
"redis": {
|
|
116
|
+
"name": "redis",
|
|
117
|
+
"prefix": "ds:",
|
|
118
|
+
"host": "192.168.1.62",
|
|
119
|
+
"port": 6379,
|
|
120
|
+
"password": "e-iceblue601",
|
|
121
|
+
"timeout": 86400,
|
|
122
|
+
"useMongoDb":true
|
|
123
|
+
},
|
|
124
|
+
"mongodb": {
|
|
125
|
+
"url": "192.168.0.176",
|
|
126
|
+
"dbName": "admin",
|
|
127
|
+
"port": 27017,
|
|
128
|
+
"timeOut": "86400"
|
|
129
|
+
},
|
|
130
|
+
"pubsub": {
|
|
131
|
+
"name": "pubsubRabbitMQ",
|
|
132
|
+
"maxChanges": 1000
|
|
133
|
+
},
|
|
134
|
+
"expire": {
|
|
135
|
+
"saveLock": 60,
|
|
136
|
+
"presence": 300,
|
|
137
|
+
"locks": 604800,
|
|
138
|
+
"changeindex": 86400,
|
|
139
|
+
"lockDoc": 60,
|
|
140
|
+
"message": 86400,
|
|
141
|
+
"lastsave": 604800,
|
|
142
|
+
"forcesave": 604800,
|
|
143
|
+
"saved": 3600,
|
|
144
|
+
"autosave_interval": 600000,
|
|
145
|
+
"documentsCron": "0 */2 * * * *",
|
|
146
|
+
"files": 86400,
|
|
147
|
+
"filesCron": "00 00 */1 * * *",
|
|
148
|
+
"filesremovedatonce": 100,
|
|
149
|
+
"sessionidle": "0",
|
|
150
|
+
"sessionabsolute": "30d",
|
|
151
|
+
"sessionclosecommand": "2m",
|
|
152
|
+
"pemStdTTL": "1h",
|
|
153
|
+
"pemCheckPeriod": "10m",
|
|
154
|
+
"updateVersionStatus": "5m",
|
|
155
|
+
"filesCacheCron": "0 */2 * * *",
|
|
156
|
+
"filesCache": 7
|
|
157
|
+
},
|
|
158
|
+
"ipfilter": {
|
|
159
|
+
"rules": [
|
|
160
|
+
{
|
|
161
|
+
"address": "*",
|
|
162
|
+
"allowed": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"useforrequest": false,
|
|
166
|
+
"errorcode": 403
|
|
167
|
+
},
|
|
168
|
+
"secret": {
|
|
169
|
+
"browser": {
|
|
170
|
+
"string": "secret",
|
|
171
|
+
"file": "",
|
|
172
|
+
"tenants": {}
|
|
173
|
+
},
|
|
174
|
+
"inbox": {
|
|
175
|
+
"string": "secret",
|
|
176
|
+
"file": "",
|
|
177
|
+
"tenants": {}
|
|
178
|
+
},
|
|
179
|
+
"outbox": {
|
|
180
|
+
"string": "secret",
|
|
181
|
+
"file": ""
|
|
182
|
+
},
|
|
183
|
+
"session": {
|
|
184
|
+
"string": "secret",
|
|
185
|
+
"file": ""
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"token": {
|
|
189
|
+
"enable": {
|
|
190
|
+
"browser": false,
|
|
191
|
+
"request": {
|
|
192
|
+
"inbox": false,
|
|
193
|
+
"outbox": false
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"browser": {
|
|
197
|
+
"secretFromInbox": true
|
|
198
|
+
},
|
|
199
|
+
"inbox": {
|
|
200
|
+
"header": "Authorization",
|
|
201
|
+
"prefix": "Bearer ",
|
|
202
|
+
"inBody": false
|
|
203
|
+
},
|
|
204
|
+
"outbox": {
|
|
205
|
+
"header": "Authorization",
|
|
206
|
+
"prefix": "Bearer ",
|
|
207
|
+
"algorithm": "HS256",
|
|
208
|
+
"expires": "5m",
|
|
209
|
+
"inBody": false
|
|
210
|
+
},
|
|
211
|
+
"session": {
|
|
212
|
+
"algorithm": "HS256",
|
|
213
|
+
"expires": "30d"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"plugins": {
|
|
217
|
+
"uri": "/sdkjs-plugins",
|
|
218
|
+
"autostart": []
|
|
219
|
+
},
|
|
220
|
+
"editor": {
|
|
221
|
+
"spellcheckerUrl": "/spellchecker",
|
|
222
|
+
"reconnection": {
|
|
223
|
+
"attempts": 50,
|
|
224
|
+
"delay": "2s"
|
|
225
|
+
},
|
|
226
|
+
"websocketMaxPayloadSize": "1.5MB"
|
|
227
|
+
},
|
|
228
|
+
"sockjs": {
|
|
229
|
+
"sockjs_url": "",
|
|
230
|
+
"websocket": true
|
|
231
|
+
},
|
|
232
|
+
"callbackBackoffOptions": {
|
|
233
|
+
"retries": 0,
|
|
234
|
+
"timeout": {
|
|
235
|
+
"factor": 2,
|
|
236
|
+
"minTimeout": 1000,
|
|
237
|
+
"maxTimeout": 2147483647,
|
|
238
|
+
"randomize": false
|
|
239
|
+
},
|
|
240
|
+
"httpStatus": "429,500-599"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"LicenseInformation": {
|
|
245
|
+
"license_file": "",
|
|
246
|
+
"warning_limit_percents": 70
|
|
247
|
+
|
|
248
|
+
},
|
|
249
|
+
"storage": {
|
|
250
|
+
"host": "",
|
|
251
|
+
"port": 4567,
|
|
252
|
+
"directory": "",
|
|
253
|
+
"silent": true
|
|
254
|
+
},
|
|
255
|
+
"SpellChecker": {
|
|
256
|
+
"server": {
|
|
257
|
+
"port": 8080,
|
|
258
|
+
"mode": "development"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"appenders": {
|
|
3
|
+
"stdout": {
|
|
4
|
+
"type": "console"
|
|
5
|
+
},
|
|
6
|
+
"alllogs": {
|
|
7
|
+
"type": "dateFile",
|
|
8
|
+
"filename": "../../logs/alllogs",
|
|
9
|
+
"pattern": ".yyyy-MM-dd.log",
|
|
10
|
+
"alwaysIncludePattern": true,
|
|
11
|
+
"compress": true,
|
|
12
|
+
"layout": {
|
|
13
|
+
"type": "pattern",
|
|
14
|
+
"pattern": "[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"errorlogs": {
|
|
18
|
+
"type": "dateFile",
|
|
19
|
+
"filename": "../../logs/errorlogs",
|
|
20
|
+
"pattern": ".yyyy-MM-dd.log",
|
|
21
|
+
"alwaysIncludePattern": true,
|
|
22
|
+
"compress": true,
|
|
23
|
+
"layout": {
|
|
24
|
+
"type": "pattern",
|
|
25
|
+
"pattern": "[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"onlyerrors": {
|
|
29
|
+
"type": "logLevelFilter",
|
|
30
|
+
"appender": "errorlogs",
|
|
31
|
+
"level": "error"
|
|
32
|
+
},
|
|
33
|
+
"officeservice-alllogs": {
|
|
34
|
+
"type": "dateFile",
|
|
35
|
+
"filename": "../../logs/office/officeservice-alllogs",
|
|
36
|
+
"pattern": ".yyyy-MM-dd.log",
|
|
37
|
+
"alwaysIncludePattern": true,
|
|
38
|
+
"compress": true,
|
|
39
|
+
"layout": {
|
|
40
|
+
"type": "pattern",
|
|
41
|
+
"pattern": "[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"officeservice-errorlogs": {
|
|
45
|
+
"type": "dateFile",
|
|
46
|
+
"filename": "../../logs/office/officeservice-errorlogs",
|
|
47
|
+
"pattern": ".yyyy-MM-dd.log",
|
|
48
|
+
"alwaysIncludePattern": true,
|
|
49
|
+
"compress": true,
|
|
50
|
+
"layout": {
|
|
51
|
+
"type": "pattern",
|
|
52
|
+
"pattern": "[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"officeservice-onlyerrors": {
|
|
56
|
+
"type": "logLevelFilter",
|
|
57
|
+
"appender": "officeservice-errorlogs",
|
|
58
|
+
"level": "error"
|
|
59
|
+
},
|
|
60
|
+
"cleancacheservice-alllogs": {
|
|
61
|
+
"type": "dateFile",
|
|
62
|
+
"filename": "../../logs/cleancache/cleancacheservice-alllogs",
|
|
63
|
+
"pattern": ".yyyy-MM-dd.log",
|
|
64
|
+
"alwaysIncludePattern": true,
|
|
65
|
+
"compress": true,
|
|
66
|
+
"layout": {
|
|
67
|
+
"type": "pattern",
|
|
68
|
+
"pattern": "[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"cleancacheservice-errorlogs": {
|
|
72
|
+
"type": "dateFile",
|
|
73
|
+
"filename": "../../logs/cleancache/cleancacheservice-errorlogs",
|
|
74
|
+
"pattern": ".yyyy-MM-dd.log",
|
|
75
|
+
"alwaysIncludePattern": true,
|
|
76
|
+
"compress": true,
|
|
77
|
+
"layout": {
|
|
78
|
+
"type": "pattern",
|
|
79
|
+
"pattern": "[%d{yyyy-MM-dd hh:mm:ss} %5.5p] %m"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"cleancacheservice-onlyerrors": {
|
|
83
|
+
"type": "logLevelFilter",
|
|
84
|
+
"appender": "cleancacheservice-errorlogs",
|
|
85
|
+
"level": "error"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"categories": {
|
|
89
|
+
"default": {
|
|
90
|
+
"appenders": [
|
|
91
|
+
"stdout"
|
|
92
|
+
],
|
|
93
|
+
"level": "all"
|
|
94
|
+
},
|
|
95
|
+
"nodeJS": {
|
|
96
|
+
"appenders": [
|
|
97
|
+
"onlyerrors",
|
|
98
|
+
"alllogs"
|
|
99
|
+
],
|
|
100
|
+
"level": "debug"
|
|
101
|
+
},
|
|
102
|
+
"officeService": {
|
|
103
|
+
"appenders": [
|
|
104
|
+
"officeservice-onlyerrors",
|
|
105
|
+
"officeservice-alllogs"
|
|
106
|
+
],
|
|
107
|
+
"level": "debug"
|
|
108
|
+
},
|
|
109
|
+
"cleancacheService": {
|
|
110
|
+
"appenders": [
|
|
111
|
+
"cleancacheservice-onlyerrors",
|
|
112
|
+
"cleancacheservice-alllogs"
|
|
113
|
+
],
|
|
114
|
+
"level": "debug"
|
|
115
|
+
},
|
|
116
|
+
"scheduleService": {
|
|
117
|
+
"appenders": [
|
|
118
|
+
"cleancacheservice-onlyerrors",
|
|
119
|
+
"cleancacheservice-alllogs"
|
|
120
|
+
],
|
|
121
|
+
"level": "debug"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "spire.officejs-service-win-ve",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"postinstall": "node scripts/copy-config.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"Spire.OfficeJS",
|
|
12
|
+
"windows"
|
|
13
|
+
],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "MIT"
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// 源文件路径:位于当前包内
|
|
5
|
+
const srcFilePath = path.join(__dirname, '../lib/OfficeServer/config/default.json');
|
|
6
|
+
// const srcFilePath2 = path.join(__dirname, '../lib/OfficeServer/sources/config/default.json');
|
|
7
|
+
// 目标路径:用户执行 npm install 的目录(项目根目录)
|
|
8
|
+
const initCwd = process.env.INIT_CWD || process.cwd();
|
|
9
|
+
// const targetDir = path.join(initCwd, 'spire.officejs-config');
|
|
10
|
+
const destFileName = 'spire.officejs-server-config.json'
|
|
11
|
+
const destFilePath = path.join(initCwd, destFileName);
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
try {
|
|
15
|
+
// let filePath = srcFilePath;
|
|
16
|
+
|
|
17
|
+
// if (fs.existsSync(srcFilePath))
|
|
18
|
+
// filePath = srcFilePath;
|
|
19
|
+
// else if (fs.existsSync(srcFilePath2))
|
|
20
|
+
// filePath = srcFilePath2;
|
|
21
|
+
|
|
22
|
+
// 检查源文件是否存在
|
|
23
|
+
if (!fs.existsSync(srcFilePath))
|
|
24
|
+
return;
|
|
25
|
+
|
|
26
|
+
// 检查目标文件是否已存在,避免覆盖用户自定义配置
|
|
27
|
+
if (fs.existsSync(destFilePath))
|
|
28
|
+
return;
|
|
29
|
+
|
|
30
|
+
// // 确保目标目录存在
|
|
31
|
+
// ensureDirectoryExists(targetDir);
|
|
32
|
+
|
|
33
|
+
// 复制配置文件
|
|
34
|
+
fs.copyFileSync(srcFilePath, destFilePath);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error(error)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
main();
|