forked from misskey-dev/misskey
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide tarball (misskey-dev#13260)
* feat: provide tarball * build: pack on build-assets * chore: use ignore-walk * chore: debug * build: dependencies
- Loading branch information
1 parent
f349861
commit d9d183c
Showing
6 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { createWriteStream } from 'node:fs'; | ||
import { mkdir } from 'node:fs/promises'; | ||
import { resolve } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import glob from 'fast-glob'; | ||
import walk from 'ignore-walk'; | ||
import Pack from 'tar/lib/pack.js'; | ||
import meta from '../package.json' assert { type: "json" }; | ||
|
||
const cwd = fileURLToPath(new URL('..', import.meta.url)); | ||
const ignore = [ | ||
'**/.git/**/*', | ||
'**/*ignore', | ||
'**/.gitmodules', | ||
// Exclude files you don't want to include in the tarball here | ||
]; | ||
|
||
export default async function build() { | ||
const mkdirPromise = mkdir(resolve(cwd, 'built', 'tarball'), { recursive: true }); | ||
const pack = new Pack({ cwd, gzip: true }); | ||
const patterns = await walk({ path: cwd, ignoreFiles: ['.gitignore'] }); | ||
|
||
for await (const entry of glob.stream(patterns, { cwd, ignore, dot: true })) { | ||
pack.add(entry); | ||
} | ||
|
||
pack.end(); | ||
|
||
await mkdirPromise; | ||
|
||
pack.pipe(createWriteStream(resolve(cwd, 'built', 'tarball', `misskey-${meta.version}.tar.gz`))); | ||
} |