diff options
| author | Marie <marie@kaifa.ch> | 2024-02-19 19:05:15 +0000 |
|---|---|---|
| committer | Marie <marie@kaifa.ch> | 2024-02-19 19:05:15 +0000 |
| commit | 4246b6434dd1daf4e16a873bee211ce5d43fc4fd (patch) | |
| tree | e5c680875320237716f8b77381fb14a06f3c9e98 /scripts/tarball.mjs | |
| parent | merge: Bridged error message for when you try search for a post and it fails ... (diff) | |
| parent | fix: icons and update urls (diff) | |
| download | sharkey-4246b6434dd1daf4e16a873bee211ce5d43fc4fd.tar.gz sharkey-4246b6434dd1daf4e16a873bee211ce5d43fc4fd.tar.bz2 sharkey-4246b6434dd1daf4e16a873bee211ce5d43fc4fd.zip | |
merge: Merge upstream from 19th Feburary (!428)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/428
Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Amelia Yukii <amelia.yukii@shourai.de>
Diffstat (limited to 'scripts/tarball.mjs')
| -rw-r--r-- | scripts/tarball.mjs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/tarball.mjs b/scripts/tarball.mjs new file mode 100644 index 0000000000..fbb833d94e --- /dev/null +++ b/scripts/tarball.mjs @@ -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', `sharkey-${meta.version}.tar.gz`))); +} |