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

Release: v0.0.1 #1

Merged
merged 21 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
fix: deploy
  • Loading branch information
KairuiLiu committed Apr 16, 2024
commit 98ba2cbabea9f432e47a9ae415e0d4fb78d7227c
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "conflux-server",
"version": "0.0.1",
"description": "",
"main": "index.js",
"description": "Conflux - Another meeting and collaboration platform",
"main": "main.js",
"type": "module",
"scripts": {
"dev": "rollup -c -w & nodemon --watch dist --exec 'node dist/main.js'",
"dev": "NODE_ENV=DEV rollup -c -w & nodemon --watch dist --exec 'node dist/main.js'",
"build": "rollup -c",
"format": "prettier --write --loglevel silent",
"lint": "eslint --fix",
"type-check": "tsc --noEmit; tsc --noEmit -p create-vite-express/tsconfig.json"
},
"keywords": [],
"author": "",
"author": "Kairui Liu",
"license": "GPL-3.0-only",
"devDependencies": {
"@eslint/eslintrc": "^3.0.2",
Expand Down Expand Up @@ -45,6 +45,7 @@
"prettier": "^3.2.5",
"rollup": "^4.14.2",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-delete": "^2.0.0",
"tslib": "^2.6.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.6.0"
Expand Down
61 changes: 61 additions & 0 deletions pnpm-lock.yaml

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

56 changes: 40 additions & 16 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import typescript from '@rollup/plugin-typescript';
import alias from '@rollup/plugin-alias';
import path from 'path';
import { dirname } from 'path';
import fs from 'fs';
import { fileURLToPath } from 'url';
import path, { dirname } from 'path';
import copy from 'rollup-plugin-copy';
import del from 'rollup-plugin-delete';
import json from '@rollup/plugin-json';
import alias from '@rollup/plugin-alias';
import terser from '@rollup/plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';

const dir = dirname(fileURLToPath(import.meta.url));
const dev = process.env.NODE_ENV === 'DEV';

export default {
input: 'src/main.ts',
output: {
dir: 'dist',
format: 'es',
sourcemap: true,
sourcemap: dev,
},
plugins: [
!dev && del({ targets: 'dist' }),
alias({
entries: [
{
find: '@',
replacement: path.resolve(
dirname(fileURLToPath(import.meta.url)),
'src',
),
replacement: path.resolve(dir, 'src'),
},
],
}),
Expand All @@ -34,11 +37,32 @@ export default {
}),
typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true }),
commonjs(),
!dev && terser(),
copy({
targets: [
{ src: 'ecosystem.config.js', dest: 'dist' }
],
hook: 'writeBundle'
})
{ src: '.env', dest: 'dist' },
!dev && { src: 'ecosystem.config.js', dest: 'dist' },
].filter(Boolean),
hook: 'writeBundle',
}),
!dev && generatePackageJson(),
],
};

function generatePackageJson(options = {}) {
return {
name: 'generate-package-json',
writeBundle() {
const packagePath = path.resolve(dir, 'package.json');
const distPath = path.resolve(dir, 'dist', 'package.json');
const originalPackageJson = JSON.parse(fs.readFileSync(packagePath));
const newPackageJson = {};
Object.keys(originalPackageJson).forEach((key) => {
if (!['devDependencies', 'dependencies', 'scripts'].includes(key)) {
newPackageJson[key] = originalPackageJson[key];
}
});
fs.writeFileSync(distPath, JSON.stringify(newPackageJson, null, 2));
},
};
}
Loading