|
1 | 1 | import archiver from 'archiver'
|
2 | 2 | import axios, { AxiosInstance } from 'axios'
|
3 | 3 | import FormData from 'form-data'
|
4 |
| -import { createReadStream, createWriteStream, existsSync, readdirSync, unlinkSync } from 'fs' |
| 4 | +import { createReadStream, createWriteStream, existsSync, readdirSync, readFileSync, unlinkSync } from 'fs' |
5 | 5 | import fs from 'fs-extra'
|
6 | 6 | import minimatch from 'minimatch'
|
7 | 7 | import { join } from 'path'
|
@@ -109,19 +109,22 @@ export default class CurseforgeService {
|
109 | 109 | await this.api.post(`projects/${this.options.curseforgeProject}/upload-file`, { data })
|
110 | 110 | }
|
111 | 111 |
|
112 |
| - private async removeClientContent(config = 'client-only.json') { |
| 112 | + private async removeClientContent(config = '.serverignore') { |
113 | 113 | rimraf.sync('kubejs/assets')
|
114 | 114 |
|
115 | 115 | if (existsSync(config)) {
|
116 |
| - const remove: string[] = fs.readJsonSync(config) |
| 116 | + const excludePatterns: string[] = readFileSync(config) |
| 117 | + .toString() |
| 118 | + .split('\n') |
| 119 | + .map(it => it.trim()) |
117 | 120 |
|
118 |
| - const matches = readdirSync('mods').filter(file => remove.some(pattern => minimatch(file, pattern))) |
| 121 | + const matches = readdirSync('mods').filter(file => excludePatterns.some(pattern => minimatch(file, pattern))) |
119 | 122 |
|
120 | 123 | matches.forEach(f => {
|
121 | 124 | unlinkSync(join('mods', f))
|
122 | 125 | })
|
123 | 126 |
|
124 |
| - console.log(`Removed ${matches.length} files using ${remove.length} patterns`) |
| 127 | + console.log(`Removed ${matches.length} files using ${excludePatterns.length} patterns`) |
125 | 128 | }
|
126 | 129 | }
|
127 | 130 | }
|
0 commit comments