mirror of
https://github.com/Discreetly/server.git
synced 2026-01-09 21:08:06 -05:00
rollup initial config
This commit is contained in:
1110
package-lock.json
generated
1110
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -2,12 +2,12 @@
|
|||||||
"name": "discreetly-server",
|
"name": "discreetly-server",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/server.ts",
|
"main": "dist/server.cjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "rollup --config rollup.config.mjs",
|
||||||
"start": "node dist/server.js",
|
"start": "node dist/server.cjs",
|
||||||
"watch": "tsc --watch ./src/server.ts --outDir ./dist/",
|
"watch": "rollup --config rollup.config.mjs --watch",
|
||||||
"serve": "nodemon -q dist/src/server.js",
|
"serve": "nodemon -q dist/server.jcs",
|
||||||
"dev": "concurrently \"npm run watch\" \"npm run serve\""
|
"dev": "concurrently \"npm run watch\" \"npm run serve\""
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -32,10 +32,16 @@
|
|||||||
"socket.io": "^4.6.2"
|
"socket.io": "^4.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-commonjs": "^25.0.2",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
||||||
"@types/cors": "^2.8.13",
|
"@types/cors": "^2.8.13",
|
||||||
"@types/express": "^4.17.17",
|
"@types/express": "^4.17.17",
|
||||||
"concurrently": "^8.2.0",
|
"concurrently": "^8.2.0",
|
||||||
"nodemon": "^2.0.22",
|
"nodemon": "^2.0.22",
|
||||||
|
"rollup": "^3.26.2",
|
||||||
|
"rollup-plugin-cleaner": "^1.0.0",
|
||||||
|
"rollup-plugin-typescript2": "^0.35.0",
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
53
rollup.config.mjs
Normal file
53
rollup.config.mjs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
import typescript from 'rollup-plugin-typescript2'
|
||||||
|
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
||||||
|
import commonjs from '@rollup/plugin-commonjs'
|
||||||
|
import json from '@rollup/plugin-json'
|
||||||
|
import cleaner from 'rollup-plugin-cleaner'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
|
||||||
|
|
||||||
|
const input = 'src/server.ts'
|
||||||
|
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
|
||||||
|
const banner = `/**
|
||||||
|
* @module ${pkg.name}
|
||||||
|
* @version ${pkg.version}
|
||||||
|
* @file ${pkg.description}
|
||||||
|
* @copyright Privacy and Scaling Explorations 2023
|
||||||
|
* @license ${pkg.license}
|
||||||
|
* @see [Github]{@link ${pkg.homepage}}
|
||||||
|
*/`
|
||||||
|
|
||||||
|
|
||||||
|
const typescriptPlugin = typescript({
|
||||||
|
tsconfig: 'tsconfig.json',
|
||||||
|
useTsconfigDeclarationDir: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
const nodePlugins = [
|
||||||
|
typescriptPlugin,
|
||||||
|
// `browser: false` is required for `fs` and other Node.js core modules to be resolved correctly
|
||||||
|
nodeResolve({ browser: false }),
|
||||||
|
// To accept commonjs modules and convert them to ES module, since rollup only bundle ES modules by default
|
||||||
|
commonjs(),
|
||||||
|
// Parse JSON files and make them ES modules. Required when bundling circomlib
|
||||||
|
json(),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
export default [
|
||||||
|
// Node.js build
|
||||||
|
{
|
||||||
|
input,
|
||||||
|
output: { file: pkg.main, format: 'cjs', banner },
|
||||||
|
external: Object.keys(pkg.dependencies),
|
||||||
|
plugins: [
|
||||||
|
cleaner({
|
||||||
|
targets: [
|
||||||
|
'./dist/',
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
...nodePlugins,
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -200,7 +200,7 @@ app.post('/room/add', (req, res) => {
|
|||||||
redisClient.set('rooms', JSON.stringify(loadedRooms));
|
redisClient.set('rooms', JSON.stringify(loadedRooms));
|
||||||
res.status(201).json({ status: `Created room ${roomName}`, loadedRooms });
|
res.status(201).json({ status: `Created room ${roomName}`, loadedRooms });
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
app.get('/logclaimcodes', (req, res) => {
|
app.get('/logclaimcodes', (req, res) => {
|
||||||
pp('-----CLAIMCODES-----', 'debug');
|
pp('-----CLAIMCODES-----', 'debug');
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ES2022",
|
"module": "ES2022",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user