forked from QwikDev/qwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.ts
58 lines (48 loc) · 1.74 KB
/
eslint.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
import { BuildConfig, copyFile, watcher, run, nodeTarget } from './util';
import { join } from 'node:path';
import { build } from 'esbuild';
import { readPackageJson, writePackageJson } from './package-json';
const PACKAGE = 'eslint-plugin-qwik';
export async function buildEslint(config: BuildConfig) {
const eslintDir = join(config.packagesDir, PACKAGE);
const eslintOutput = join(eslintDir, 'dist');
await build({
entryPoints: [join(eslintDir, 'index.ts')],
outfile: join(eslintOutput, 'index.js'),
bundle: true,
sourcemap: false,
target: nodeTarget,
platform: 'node',
minify: !config.dev,
watch: watcher(config),
});
await copyFile(join(eslintDir, 'package.json'), join(eslintOutput, 'package.json'));
await copyFile(join(eslintDir, 'README.md'), join(eslintOutput, 'README.md'));
console.log(`📐 ${PACKAGE}`);
}
export async function publishEslint(
config: BuildConfig,
distTag: string,
version: string,
isDryRun: boolean
) {
const distDir = join(config.packagesDir, PACKAGE, 'dist');
const cliPkg = await readPackageJson(distDir);
// update the cli version
console.log(` update version = "${version}"`);
cliPkg.version = version;
await writePackageJson(distDir, cliPkg);
console.log(`⛴ publishing ${cliPkg.name} ${version}`, isDryRun ? '(dry-run)' : '');
const npmPublishArgs = ['publish', '--tag', distTag];
await run('npm', npmPublishArgs, isDryRun, isDryRun, { cwd: distDir });
console.log(
`🐳 published version "${version}" of ${cliPkg.name} with dist-tag "${distTag}" to npm`,
isDryRun ? '(dry-run)' : ''
);
}
export async function validateEslint(config: BuildConfig, errors: string[]) {
try {
} catch (e: any) {
errors.push(String(e.message || e));
}
}