Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide tarball #13260

Merged
merged 5 commits into from
Feb 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: provide tarball
acid-chicken committed Feb 11, 2024

Verified

This commit was signed with the committer’s verified signature.
acid-chicken Acid Chicken
commit c27eba4d39ca244ce657ab41bb55fc4cfb63df9c
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -48,8 +48,8 @@
"lodash": "4.17.21"
},
"dependencies": {
"execa": "8.0.1",
"cssnano": "6.0.3",
"execa": "8.0.1",
"js-yaml": "4.1.0",
"postcss": "8.4.33",
"terser": "5.27.0",
@@ -61,8 +61,10 @@
"cross-env": "7.0.3",
"cypress": "13.6.3",
"eslint": "8.56.0",
"fast-glob": "3.3.2",
"ncp": "2.0.0",
"start-server-and-test": "2.0.3",
"ncp": "2.0.0"
"tar": "6.2.0"
},
"optionalDependencies": {
"@tensorflow/tfjs-core": "4.4.0"
8 changes: 8 additions & 0 deletions packages/backend/src/server/web/ClientServerService.ts
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ const clientAssets = `${_dirname}/../../../../frontend/assets/`;
const assets = `${_dirname}/../../../../../built/_frontend_dist_/`;
const swAssets = `${_dirname}/../../../../../built/_sw_dist_/`;
const viteOut = `${_dirname}/../../../../../built/_vite_/`;
const tarball = `${_dirname}/../../../../../built/tarball/`;

@Injectable()
export class ClientServerService {
@@ -291,6 +292,13 @@ export class ClientServerService {
decorateReply: false,
});

fastify.register(fastifyStatic, {
root: tarball,
prefix: '/tarball/',
immutable: true,
decorateReply: false,
});

fastify.get('/favicon.ico', async (request, reply) => {
return reply.sendFile('/favicon.ico', staticAssets);
});
1 change: 1 addition & 0 deletions packages/frontend/src/pages/about.vue
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<FormLink :to="`/.well-known/nodeinfo`" external>nodeinfo</FormLink>
<FormLink :to="`/robots.txt`" external>robots.txt</FormLink>
<FormLink :to="`/manifest.json`" external>manifest.json</FormLink>
<FormLink :to="`/tarball/misskey-${version}.tar.gz`" external>source code</FormLink>
</div>
</FormSection>
</div>
19 changes: 18 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions scripts/tarball.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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 Pack from 'tar/lib/pack.js';
import meta from '../package.json' assert { type: "json" };

const cwd = fileURLToPath(new URL('..', import.meta.url));
const mkdirPromise = mkdir(resolve(cwd, 'built', 'tarball'), { recursive: true });
const patterns = [
'{assets,fluent-emojis,locales,misskey-assets}/**/*',
'packages/.config/example.yml',
'packages/{backend,frontend,misskey-bubble-game,misskey-js,misskey-js/generator,misskey-reversi,sw}/{src/**/*,.swcrc,*}',
'packages/backend/{assets,migration,nsfw-model}/**/*',
'packages/frontend/{.storybook,@types,assets,lib,public}/**/*',
'!packages/frontend/.storybook/{locale.ts,themes.ts,*.js}',
'!packages/misskey-js/CONTRIBUTING.md',
'packages/meta.json',
'scripts/{changelog-checker/{src/**/*,*},*}',
'.node-version',
'.npmrc',
'CHANGELOD.md',
'COPYING',
'LICENSE',
'README.md',
'SECURITY.md',
'package.json',
'pnpm-lock.yaml',
'pnpm-workspace.yaml',
];
const pack = new Pack({ cwd, gzip: true });

for await (const entry of glob.stream(patterns)) {
pack.add(entry);
}

pack.end();

await mkdirPromise;

pack.pipe(createWriteStream(resolve(cwd, 'built', 'tarball', `misskey-${meta.version}.tar.gz`)));