Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Sep 14, 2024
1 parent 5e3566f commit aa8bd56
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 166 deletions.
1 change: 0 additions & 1 deletion .moon/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ tasks:
- package.json

compile:
# command: tsup --config ../shared/tsup.base.ts
command: tshy
inputs:
- src
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"lint-staged": "14.0.1",
"ts-node": "10.9.1",
"tshy": "^1.14.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vitest": "^0.34.5"
},
Expand Down
1 change: 0 additions & 1 deletion packages/jsx-email/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ tasks:
cache: false

compile:
# command: tsup --config tsup.config.ts
command: tshy
inputs:
- src
Expand Down
2 changes: 1 addition & 1 deletion packages/jsx-email/src/cli/commands/check.mts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const command: CommandFn = async (argv: CheckOptions, input) => {

log();

runCheck(file.fileName, file.html);
runCheck(file.fileName, file.html!);

return true;
};
1 change: 1 addition & 0 deletions packages/jsx-email/src/cli/commands/help.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import chalk from 'chalk';

// @ts-ignore
import pkg from '../../../package.json' assert { type: 'json' };

import type { CommandFn } from './types.mjs';
Expand Down
10 changes: 5 additions & 5 deletions packages/jsx-email/src/cli/commands/preview.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { mkdir, realpath, rmdir } from 'node:fs/promises';
import os from 'node:os';
import { dirname, join, relative, resolve, win32, posix } from 'node:path';
import { fileURLToPath } from 'node:url';

import watcher from '@parcel/watcher';
import react from '@vitejs/plugin-react-swc';
import chalk from 'chalk';
Expand All @@ -16,9 +17,10 @@ import {
union,
type Output as Infer
} from 'valibot';
import { build as viteBuild, createServer, type InlineConfig, ViteDevServer } from 'vite';
import { build as viteBuild, createServer, type InlineConfig, type ViteDevServer } from 'vite';

import { log } from '../../log.js';

import { buildTemplates } from './build.mjs';
import type { CommandFn } from './types.mjs';

Expand All @@ -44,6 +46,7 @@ interface BuildForPreviewParams {
targetPath: string;
}

// eslint-disable-next-line no-console
const newline = () => console.log('');
const normalizePath = (filename: string) => filename.split(win32.sep).join(posix.sep);

Expand Down Expand Up @@ -110,6 +113,7 @@ const getTempBuildPath = async () => {
};

const getConfig = async ({ targetPath, argv }: PreviewCommonParams) => {
// @ts-ignore
const root = join(dirname(fileURLToPath(import.meta.resolve('@jsx-email/app-preview'))), 'app');
const buildPath = await getTempBuildPath();
const { exclude, host = false, port = 55420 } = argv;
Expand All @@ -135,15 +139,12 @@ const getConfig = async ({ targetPath, argv }: PreviewCommonParams) => {
clearScreen: false,
configFile: false,
plugins: [react()],
// ...viteConfig,
resolve: {
alias: {
'@jsxemailbuild': buildPath,
'@jsxemailsrc': targetPath
// ...viteConfig.resolve?.alias
}
},
// root,
server: { fs: { strict: false }, host, port: parseInt(port.toString(), 10) }
} satisfies InlineConfig;

Expand All @@ -169,7 +170,6 @@ const buildDeployable = async ({ targetPath, argv }: PreviewCommonParams) => {
},
define: {
'process.env': '{}'
// ...config.define
},
mode: 'development'
});
Expand Down
4 changes: 3 additions & 1 deletion packages/jsx-email/src/cli/commands/types.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type React from 'react';

export type Flags = Record<string, string | boolean | undefined>;

export type CommandFn = (flags: Flags, inputs: string[]) => Promise<boolean>;

export type TemplateFn = (props: {}) => JSX.Element;
export type TemplateFn = (props: {}) => React.JSX.Element;
23 changes: 0 additions & 23 deletions packages/jsx-email/tsup.config.ts

This file was deleted.

Loading

0 comments on commit aa8bd56

Please sign in to comment.