-
Notifications
You must be signed in to change notification settings - Fork 14
/
tsup.config.ts
139 lines (116 loc) · 2.51 KB
/
tsup.config.ts
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import { defineConfig } from 'tsup';
import { join } from 'path';
import { writeFileSync, readFileSync, copyFileSync } from 'fs';
import * as pkg from './package.json';
const cwd = process.cwd();
const packages = join(cwd, 'packages');
function importSchema () {
const liquifySchema = join(cwd, 'node_modules', '@liquify/schema');
const syncifySchema = join(packages, 'schema');
const sections = readFileSync(join(liquifySchema, 'syncify/shared-schema.json'));
const env = readFileSync(join(liquifySchema, 'syncify/env.json'));
const pkgjson = readFileSync(join(liquifySchema, 'syncify/package-json.json'));
const config = readFileSync(join(liquifySchema, 'syncify.json'));
writeFileSync(join(syncifySchema, 'syncify.json'), pkgjson);
writeFileSync(join(syncifySchema, 'config.json'), config);
writeFileSync(join(syncifySchema, 'sections.json'), sections);
writeFileSync(join(syncifySchema, 'env.json'), env);
copyFileSync(join(packages, 'hot', 'hot.js.liquid'), join(cwd, 'hot.js.liquid'));
}
importSchema();
const json = JSON.stringify;
const noExternal = [
'ansis',
'anymatch',
'clean-stack',
'log-update',
'mergerino',
'minimist',
'p-map',
'p-queue',
'parse-json',
'rambdax',
'strip-json-comments',
'tree-kill',
'wrap-ansi',
'write-file-atomic'
];
const external = [
// Syncify Specific
'@syncify/turndown',
// Third parties
'adm-zip',
'axios',
'cbor',
'chokidar',
'clean-css',
'cross-spawn',
'dotenv',
'enquirer',
'esbuild',
'fast-glob',
'figlet',
'finalhandler',
'fs-extra',
'gray-matter',
'html-minifier-terser',
'markdown-it',
'ngrok',
'node-notifier',
'pathe',
'postcss',
'prompts',
'scrollable-cli',
'serve-static',
'svg-sprite',
'svgo',
'ws',
// BUILD DEPS
'ava',
'eslint',
'prettier',
'tsconfig-type',
'tsup',
'type-fest',
'typescript',
// PEER DEPS
'sass',
'sharp',
'tailwindcss'
];
const define = {
// SYNCIFY VERSION
VERSION: `"${pkg.version}"`,
// CHARACTER SUGAR INJECTIONS
NIL: json(''),
NWL: json('\n'),
NLR: json('\n\n'),
WSP: json(' '),
WSR: json(' ')
};
export default defineConfig({
entry: [
'syncify/cli.ts',
'syncify/api.ts',
'syncify/index.ts'
],
outDir: 'dist',
clean: [
'dist'
],
splitting: false,
treeshake: false,
cjsInterop: true,
format: [
'cjs',
'esm'
],
shims: true,
noExternal,
external,
define,
esbuildOptions (options) {
options.mainFields = [ 'module', 'main' ];
options.chunkNames = 'syncify';
}
});