-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
41 lines (36 loc) · 1.05 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { readFileSync } from 'node:fs';
// Use import.meta.url to make the path relative to the current source file instead of process.cwd()
const packageFile = readFileSync(new URL('./package.json', import.meta.url));
const pkg = JSON.parse(packageFile.toString());
const projectName = 'phixify';
const compiled = new Date().toUTCString().replace(/GMT/g, 'UTC');
const banner = [
`#!/usr/bin/env node`,
`/**`,
` * ${pkg.name}`,
` * @description ${pkg.description}`,
` * @author ${pkg.author}`,
` * @version ${pkg.version}`,
` * @license ${pkg.license}`,
` * @see ${pkg.homepage}`,
` * @generated ${compiled}`,
` */`,
].join('\n');
const external = Object.keys(pkg.dependencies);
external.push('node_modules');
export default {
input: 'src/index.js',
output: [
{
banner,
name: pkg.name,
file: `dist/${projectName}.js`,
format: 'es',
exports: 'named',
},
],
external,
plugins: [nodeResolve(), json()],
};