react-email 1.2.1-canary.4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # react-email
2
+
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add missing metadata such as `engines`, `repository` and images
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @react-email/render@0.0.3
@@ -8,7 +8,7 @@ const check_directory_exist_1 = require("../utils/check-directory-exist");
8
8
  const components_1 = require("../_preview/components");
9
9
  const create_directory_1 = require("../utils/create-directory");
10
10
  const pages_1 = require("../_preview/pages");
11
- const contants_1 = require("../utils/contants");
11
+ const constants_1 = require("../utils/constants");
12
12
  const root_1 = require("../_preview/root");
13
13
  const styles_1 = require("../_preview/styles");
14
14
  const utils_1 = require("../_preview/utils");
@@ -32,10 +32,10 @@ const dev = async () => {
32
32
  exports.dev = dev;
33
33
  const prepareFiles = async () => {
34
34
  const spinner = (0, ora_1.default)('Preparing React email files...').start();
35
- const isFirstTime = !(0, check_directory_exist_1.checkDirectoryExist)(contants_1.REACT_EMAIL_ROOT);
35
+ const isFirstTime = !(0, check_directory_exist_1.checkDirectoryExist)(constants_1.REACT_EMAIL_ROOT);
36
36
  if (isFirstTime) {
37
- await (0, create_directory_1.createDirectory)(contants_1.REACT_EMAIL_ROOT);
38
- await (0, create_directory_1.createDirectory)(path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'src'));
37
+ await (0, create_directory_1.createDirectory)(constants_1.REACT_EMAIL_ROOT);
38
+ await (0, create_directory_1.createDirectory)(path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'src'));
39
39
  await Promise.all([
40
40
  createFilesAndDirectories(components_1.components, 'components'),
41
41
  createFilesAndDirectories(utils_1.utils, 'utils'),
@@ -51,7 +51,7 @@ const prepareFiles = async () => {
51
51
  };
52
52
  const checkForUpdates = async () => {
53
53
  const spinner = (0, ora_1.default)('Checking for updates...').start();
54
- const reactEmailPkg = await fs_1.default.promises.readFile(path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'package.json'), { encoding: 'utf8' });
54
+ const reactEmailPkg = await fs_1.default.promises.readFile(path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'package.json'), { encoding: 'utf8' });
55
55
  const isUpToDate = JSON.parse(reactEmailPkg).version === getPreviewPkg().version;
56
56
  if (isUpToDate) {
57
57
  return spinner.stopAndPersist({
@@ -77,19 +77,19 @@ const updatePackage = async () => {
77
77
  };
78
78
  const generateEmailsPreview = async () => {
79
79
  const spinner = (0, ora_1.default)('Generating emails preview').start();
80
- const hasEmailsDirectory = fs_1.default.existsSync(contants_1.CLIENT_EMAILS_PATH);
81
- const hasPackageEmailsDirectory = fs_1.default.existsSync(contants_1.PACKAGE_EMAILS_PATH);
80
+ const hasEmailsDirectory = fs_1.default.existsSync(constants_1.CLIENT_EMAILS_PATH);
81
+ const hasPackageEmailsDirectory = fs_1.default.existsSync(constants_1.PACKAGE_EMAILS_PATH);
82
82
  if (hasEmailsDirectory) {
83
83
  if (hasPackageEmailsDirectory) {
84
- await fs_1.default.promises.rmdir(contants_1.PACKAGE_EMAILS_PATH, { recursive: true });
84
+ await fs_1.default.promises.rmdir(constants_1.PACKAGE_EMAILS_PATH, { recursive: true });
85
85
  }
86
- await (0, cpy_1.default)(contants_1.CLIENT_EMAILS_PATH, contants_1.PACKAGE_EMAILS_PATH);
86
+ await (0, cpy_1.default)(constants_1.CLIENT_EMAILS_PATH, constants_1.PACKAGE_EMAILS_PATH);
87
87
  return spinner.stopAndPersist({
88
88
  symbol: log_symbols_1.default.success,
89
89
  text: 'Emails preview generated',
90
90
  });
91
91
  }
92
- fs_1.default.promises.mkdir(contants_1.CLIENT_EMAILS_PATH);
92
+ fs_1.default.promises.mkdir(constants_1.CLIENT_EMAILS_PATH);
93
93
  return spinner.stopAndPersist({
94
94
  symbol: log_symbols_1.default.warning,
95
95
  text: 'Emails preview directory is empty',
@@ -97,7 +97,7 @@ const generateEmailsPreview = async () => {
97
97
  };
98
98
  const installDependencies = async () => {
99
99
  const spinner = (0, ora_1.default)('Installing dependencies...').start();
100
- shelljs_1.default.cd(path_1.default.join(contants_1.REACT_EMAIL_ROOT));
100
+ shelljs_1.default.cd(path_1.default.join(constants_1.REACT_EMAIL_ROOT));
101
101
  shelljs_1.default.exec('yarn', { silent: true });
102
102
  spinner.stopAndPersist({
103
103
  symbol: log_symbols_1.default.success,
@@ -106,17 +106,17 @@ const installDependencies = async () => {
106
106
  };
107
107
  const createFilesAndDirectories = async (arr, dir) => {
108
108
  if (dir) {
109
- await (0, create_directory_1.createDirectory)(path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'src', dir));
109
+ await (0, create_directory_1.createDirectory)(path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'src', dir));
110
110
  }
111
111
  const list = arr.map(async ({ content, title, dir: dirName }) => {
112
112
  if (dirName && dir) {
113
- await (0, create_directory_1.createDirectory)(path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'src', dir, dirName));
113
+ await (0, create_directory_1.createDirectory)(path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'src', dir, dirName));
114
114
  }
115
115
  const pathDir = dir
116
116
  ? dirName
117
- ? path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'src', dir, dirName, title)
118
- : path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'src', dir, title)
119
- : path_1.default.join(contants_1.REACT_EMAIL_ROOT, title);
117
+ ? path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'src', dir, dirName, title)
118
+ : path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'src', dir, title)
119
+ : path_1.default.join(constants_1.REACT_EMAIL_ROOT, title);
120
120
  await fs_1.default.promises.writeFile(pathDir, content);
121
121
  });
122
122
  await Promise.all(list);
@@ -131,7 +131,7 @@ const syncPkg = async () => {
131
131
  ...clientPkg.dependencies,
132
132
  },
133
133
  };
134
- await fs_1.default.promises.writeFile(path_1.default.join(contants_1.REACT_EMAIL_ROOT, 'package.json'), JSON.stringify(pkg));
134
+ await fs_1.default.promises.writeFile(path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'package.json'), JSON.stringify(pkg));
135
135
  };
136
136
  const getPreviewPkg = () => {
137
137
  const [previewPkg] = root_1.root.filter((pkg) => pkg.title === 'package.json');
@@ -0,0 +1 @@
1
+ export declare const exportTemplates: (outDir: string, pretty: boolean) => Promise<void>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.exportTemplates = void 0;
30
+ const glob_1 = require("glob");
31
+ const esbuild_1 = __importDefault(require("esbuild"));
32
+ const render_1 = require("@react-email/render");
33
+ const fs_1 = require("fs");
34
+ /*
35
+ This first builds all the templates using esbuild and then puts the output in the `.js`
36
+ files. Then these `.js` files are imported dynamically and rendered to `.html` files
37
+ using the `render` function.
38
+ */
39
+ const exportTemplates = async (outDir, pretty) => {
40
+ const allTemplates = glob_1.glob.sync('emails/*.{tsx,jsx}');
41
+ esbuild_1.default.buildSync({
42
+ bundle: true,
43
+ entryPoints: allTemplates,
44
+ platform: 'node',
45
+ write: true,
46
+ outdir: outDir,
47
+ });
48
+ const allBuiltTemplates = glob_1.glob.sync(`${outDir}/*.js`, {
49
+ absolute: true,
50
+ });
51
+ for (const template of allBuiltTemplates) {
52
+ const component = await Promise.resolve().then(() => __importStar(require(template)));
53
+ const rendered = (0, render_1.render)(component.default(), { pretty });
54
+ const htmlPath = template.replace('.js', '.html');
55
+ (0, fs_1.writeFileSync)(htmlPath, rendered);
56
+ (0, fs_1.unlinkSync)(template);
57
+ }
58
+ };
59
+ exports.exportTemplates = exportTemplates;
package/dist/index.js CHANGED
@@ -2,14 +2,21 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const extra_typings_1 = require("@commander-js/extra-typings");
5
- const contants_1 = require("./utils/contants");
5
+ const constants_1 = require("./utils/constants");
6
6
  const dev_1 = require("./commands/dev");
7
+ const exportTemplates_1 = require("./commands/exportTemplates");
7
8
  extra_typings_1.program
8
- .name(contants_1.PACKAGE_NAME)
9
+ .name(constants_1.PACKAGE_NAME)
9
10
  .description('A live preview of your emails right in your browser')
10
11
  .version('0.0.0');
11
12
  extra_typings_1.program
12
13
  .command('dev')
13
14
  .description('Starts the application in development mode')
14
15
  .action(dev_1.dev);
16
+ extra_typings_1.program
17
+ .command('export')
18
+ .description('Build the templates to the `out` directory')
19
+ .option('--outDir <path>', 'Output directory', 'out')
20
+ .option('-p, --pretty', 'Pretty print the output', false)
21
+ .action(({ outDir, pretty }) => (0, exportTemplates_1.exportTemplates)(outDir, pretty));
15
22
  extra_typings_1.program.parse();
File without changes
File without changes
@@ -5,18 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.watcher = void 0;
7
7
  const chokidar_1 = __importDefault(require("chokidar"));
8
- const contants_1 = require("./contants");
8
+ const constants_1 = require("./constants");
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const cpy_1 = __importDefault(require("cpy"));
12
12
  const watcher = () => chokidar_1.default
13
- .watch(contants_1.CURRENT_PATH, { ignoreInitial: true, cwd: contants_1.CURRENT_PATH })
13
+ .watch(constants_1.CURRENT_PATH, { ignoreInitial: true, cwd: constants_1.CURRENT_PATH })
14
14
  .on('all', async (event, filename) => {
15
- if (event === contants_1.EVENT_FILE_DELETED) {
16
- await fs_1.default.promises.rm(path_1.default.join(contants_1.REACT_EMAIL_ROOT, filename));
15
+ if (event === constants_1.EVENT_FILE_DELETED) {
16
+ await fs_1.default.promises.rm(path_1.default.join(constants_1.REACT_EMAIL_ROOT, filename));
17
17
  }
18
18
  else {
19
- await (0, cpy_1.default)(contants_1.CLIENT_EMAILS_PATH, contants_1.PACKAGE_EMAILS_PATH);
19
+ await (0, cpy_1.default)(constants_1.CLIENT_EMAILS_PATH, constants_1.PACKAGE_EMAILS_PATH);
20
20
  }
21
21
  });
22
22
  exports.watcher = watcher;
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "1.2.1-canary.4",
3
+ "version": "1.3.0",
4
4
  "description": "A live preview of your emails right in your browser.",
5
5
  "bin": {
6
6
  "email": "./dist/index.js"
7
7
  },
8
8
  "types": "./dist/index.d.ts",
9
- "engines": {
10
- "node": ">=14.16"
11
- },
12
9
  "scripts": {
13
10
  "build": "tsc",
14
11
  "prepare": "npm run build",
@@ -19,11 +16,25 @@
19
16
  "clean": "rm -rf dist"
20
17
  },
21
18
  "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/zenorocha/react-email.git",
22
+ "directory": "packages/react-email"
23
+ },
24
+ "keywords": [
25
+ "react",
26
+ "email"
27
+ ],
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
22
31
  "dependencies": {
23
32
  "@commander-js/extra-typings": "9.4.1",
33
+ "@react-email/render": "*",
24
34
  "chokidar": "3.5.3",
25
35
  "commander": "9.4.1",
26
36
  "cpy": "8.1.2",
37
+ "esbuild": "0.16.4",
27
38
  "glob": "8.0.3",
28
39
  "log-symbols": "4.1.0",
29
40
  "ora": "5.4.1",
@@ -36,4 +47,4 @@
36
47
  "prettier": "2.7.1",
37
48
  "ts-node": "10.9.1"
38
49
  }
39
- }
50
+ }
@@ -11,6 +11,9 @@
11
11
  "format:check": "prettier --check \"**/*.{ts,tsx,md}\"",
12
12
  "format": "prettier --write \"**/*.{ts,tsx,md}\""
13
13
  },
14
+ "engines": {
15
+ "node": ">=18.0.0"
16
+ },
14
17
  "dependencies": {
15
18
  "@next/font": "13.0.4",
16
19
  "@radix-ui/colors": "0.1.8",
@@ -34,4 +37,4 @@
34
37
  "tailwindcss": "3.2.4",
35
38
  "typescript": "4.9.3"
36
39
  }
37
- }
40
+ }
@@ -1,11 +1,12 @@
1
+ import * as React from 'react';
1
2
  import { promises as fs } from 'fs';
2
3
  import path from 'path';
3
4
  import { render } from '@react-email/render';
4
5
  import { GetStaticPaths } from 'next';
5
6
  import { Layout } from '../../components/layout';
6
- import * as React from 'react';
7
7
  import { Code } from '../../components';
8
8
  import Head from 'next/head';
9
+ import { useRouter } from 'next/router';
9
10
 
10
11
  interface PreviewProps {}
11
12
 
@@ -56,15 +57,34 @@ const Preview: React.FC<Readonly<PreviewProps>> = ({
56
57
  reactMarkup,
57
58
  slug,
58
59
  }: any) => {
59
- const [viewMode, setViewMode] = React.useState('desktop');
60
60
  const title = `${slug} — React Email`;
61
+ const router = useRouter();
62
+ const [viewMode, setViewMode] = React.useState('desktop');
63
+
64
+ const handleViewMode = (mode: string) => {
65
+ setViewMode(mode);
66
+
67
+ router.push({
68
+ pathname: router.pathname,
69
+ query: {
70
+ ...router.query,
71
+ view: mode,
72
+ },
73
+ });
74
+ };
75
+
76
+ React.useEffect(() => {
77
+ if (router.query.view === 'source' || router.query.view === 'desktop') {
78
+ setViewMode(router.query.view);
79
+ }
80
+ }, [router.query.view]);
61
81
 
62
82
  return (
63
83
  <Layout
64
84
  navItems={navItems}
65
85
  title={slug}
66
86
  viewMode={viewMode}
67
- setViewMode={setViewMode}
87
+ setViewMode={handleViewMode}
68
88
  >
69
89
  <Head>
70
90
  <title>{title}</title>
@@ -6,7 +6,7 @@ import {
6
6
  CLIENT_EMAILS_PATH,
7
7
  PACKAGE_EMAILS_PATH,
8
8
  REACT_EMAIL_ROOT,
9
- } from '../utils/contants';
9
+ } from '../utils/constants';
10
10
  import { root } from '../_preview/root';
11
11
  import { styles } from '../_preview/styles';
12
12
  import { utils } from '../_preview/utils';
@@ -0,0 +1,32 @@
1
+ import { glob } from 'glob';
2
+ import esbuild from 'esbuild';
3
+ import { render } from '@react-email/render';
4
+ import { unlinkSync, writeFileSync } from 'fs';
5
+
6
+ /*
7
+ This first builds all the templates using esbuild and then puts the output in the `.js`
8
+ files. Then these `.js` files are imported dynamically and rendered to `.html` files
9
+ using the `render` function.
10
+ */
11
+ export const exportTemplates = async (outDir: string, pretty: boolean) => {
12
+ const allTemplates = glob.sync('emails/*.{tsx,jsx}');
13
+ esbuild.buildSync({
14
+ bundle: true,
15
+ entryPoints: allTemplates,
16
+ platform: 'node',
17
+ write: true,
18
+ outdir: outDir,
19
+ });
20
+
21
+ const allBuiltTemplates = glob.sync(`${outDir}/*.js`, {
22
+ absolute: true,
23
+ });
24
+
25
+ for (const template of allBuiltTemplates) {
26
+ const component = await import(template);
27
+ const rendered = render(component.default(), { pretty });
28
+ const htmlPath = template.replace('.js', '.html');
29
+ writeFileSync(htmlPath, rendered);
30
+ unlinkSync(template);
31
+ }
32
+ };
package/source/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { program } from '@commander-js/extra-typings';
3
- import { PACKAGE_NAME } from './utils/contants';
3
+ import { PACKAGE_NAME } from './utils/constants';
4
4
  import { dev } from './commands/dev';
5
+ import { exportTemplates } from './commands/exportTemplates';
5
6
 
6
7
  program
7
8
  .name(PACKAGE_NAME)
@@ -13,4 +14,11 @@ program
13
14
  .description('Starts the application in development mode')
14
15
  .action(dev);
15
16
 
17
+ program
18
+ .command('export')
19
+ .description('Build the templates to the `out` directory')
20
+ .option('--outDir <path>', 'Output directory', 'out')
21
+ .option('-p, --pretty', 'Pretty print the output', false)
22
+ .action(({ outDir, pretty }) => exportTemplates(outDir, pretty));
23
+
16
24
  program.parse();
File without changes
@@ -5,7 +5,7 @@ import {
5
5
  EVENT_FILE_DELETED,
6
6
  PACKAGE_EMAILS_PATH,
7
7
  REACT_EMAIL_ROOT,
8
- } from './contants';
8
+ } from './constants';
9
9
  import fs from 'fs';
10
10
  import path from 'path';
11
11
  import copy from 'cpy';
@@ -1,36 +0,0 @@
1
- export declare const previewPkg: {
2
- name: string;
3
- version: string;
4
- description: string;
5
- license: string;
6
- scripts: {
7
- 'dev': string;
8
- 'build': string;
9
- 'start': string;
10
- 'lint': string;
11
- 'format:check': string;
12
- 'format': string;
13
- };
14
- dependencies: {
15
- '@next/font': string;
16
- '@radix-ui/colors': string;
17
- '@radix-ui/react-collapsible': string;
18
- '@radix-ui/react-slot': string;
19
- '@radix-ui/react-toggle-group': string;
20
- 'classnames': string;
21
- 'next': string;
22
- 'prism-react-renderer': string;
23
- 'react': string;
24
- 'react-dom': string;
25
- };
26
- devDependencies: {
27
- '@types/classnames': string;
28
- '@types/node': string;
29
- '@types/react': string;
30
- '@types/react-dom': string;
31
- 'autoprefixer': string;
32
- 'postcss': string;
33
- 'tailwindcss': string;
34
- 'typescript': string;
35
- };
36
- };
@@ -1,39 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- exports.previewPkg = void 0;
4
- exports.previewPkg = {
5
- name: 'react-email-preview',
6
- version: '0.0.1',
7
- description: 'The React Email preview application',
8
- license: 'MIT',
9
- scripts: {
10
- 'dev': 'next dev',
11
- 'build': 'next build',
12
- 'start': 'next start',
13
- 'lint': 'next lint',
14
- 'format:check': 'prettier --check "**/*.{ts,tsx,md}"',
15
- 'format': 'prettier --write "**/*.{ts,tsx,md}"',
16
- },
17
- dependencies: {
18
- '@next/font': '13.0.4',
19
- '@radix-ui/colors': '0.1.8',
20
- '@radix-ui/react-collapsible': '1.0.1',
21
- '@radix-ui/react-slot': '1.0.1',
22
- '@radix-ui/react-toggle-group': '1.0.1',
23
- 'classnames': '2.3.2',
24
- 'next': '13.0.4',
25
- 'prism-react-renderer': '1.3.5',
26
- 'react': '18.2.0',
27
- 'react-dom': '18.2.0',
28
- },
29
- devDependencies: {
30
- '@types/classnames': '2.3.1',
31
- '@types/node': '18.11.9',
32
- '@types/react': '18.0.25',
33
- '@types/react-dom': '18.0.9',
34
- 'autoprefixer': '10.4.13',
35
- 'postcss': '8.4.19',
36
- 'tailwindcss': '3.2.4',
37
- 'typescript': '4.9.3',
38
- },
39
- };
@@ -1 +0,0 @@
1
- export declare const copyFiles: () => Promise<void>;
@@ -1,110 +0,0 @@
1
- 'use strict';
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
7
- Object.defineProperty(exports, '__esModule', { value: true });
8
- exports.copyFiles = void 0;
9
- const path_1 = __importDefault(require('path'));
10
- const cpy_1 = __importDefault(require('cpy'));
11
- const contants_1 = require('./contants');
12
- const copyFiles = async () => {
13
- try {
14
- await (0, cpy_1.default)(
15
- path_1.default.join(
16
- contants_1.NODE_MODULES_PREVIEW_PATH,
17
- 'src',
18
- 'pages',
19
- 'preview',
20
- ),
21
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'pages', 'preview'),
22
- );
23
- await (0, cpy_1.default)(
24
- path_1.default.join(
25
- contants_1.NODE_MODULES_PREVIEW_PATH,
26
- 'src',
27
- 'pages',
28
- '_app.tsx',
29
- ),
30
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'pages'),
31
- );
32
- await (0, cpy_1.default)(
33
- path_1.default.join(
34
- contants_1.NODE_MODULES_PREVIEW_PATH,
35
- 'src',
36
- 'pages',
37
- '_document.tsx',
38
- ),
39
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'pages'),
40
- );
41
- await (0, cpy_1.default)(
42
- path_1.default.join(
43
- contants_1.NODE_MODULES_PREVIEW_PATH,
44
- 'src',
45
- 'pages',
46
- 'index.tsx',
47
- ),
48
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'pages'),
49
- );
50
- await (0, cpy_1.default)(
51
- path_1.default.join(
52
- contants_1.NODE_MODULES_PREVIEW_PATH,
53
- 'src',
54
- 'styles',
55
- ),
56
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'styles'),
57
- );
58
- await (0, cpy_1.default)(
59
- path_1.default.join(
60
- contants_1.NODE_MODULES_PREVIEW_PATH,
61
- 'src',
62
- 'components',
63
- ),
64
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'components'),
65
- );
66
- await (0, cpy_1.default)(
67
- path_1.default.join(contants_1.NODE_MODULES_PREVIEW_PATH, 'src', 'utils'),
68
- path_1.default.join(contants_1.DOT_EMAIL_DEV, 'src', 'utils'),
69
- );
70
- await (0, cpy_1.default)(
71
- path_1.default.join(
72
- contants_1.NODE_MODULES_PREVIEW_PATH,
73
- 'next-env.d.ts',
74
- ),
75
- contants_1.DOT_EMAIL_DEV,
76
- );
77
- await (0, cpy_1.default)(
78
- path_1.default.join(contants_1.NODE_MODULES_PREVIEW_PATH, 'package.json'),
79
- contants_1.DOT_EMAIL_DEV,
80
- );
81
- await (0, cpy_1.default)(
82
- path_1.default.join(
83
- contants_1.NODE_MODULES_PREVIEW_PATH,
84
- 'postcss.config.js',
85
- ),
86
- contants_1.DOT_EMAIL_DEV,
87
- );
88
- await (0, cpy_1.default)(
89
- path_1.default.join(
90
- contants_1.NODE_MODULES_PREVIEW_PATH,
91
- 'tailwind.config.js',
92
- ),
93
- contants_1.DOT_EMAIL_DEV,
94
- );
95
- await (0, cpy_1.default)(
96
- path_1.default.join(
97
- contants_1.NODE_MODULES_PREVIEW_PATH,
98
- 'tsconfig.json',
99
- ),
100
- contants_1.DOT_EMAIL_DEV,
101
- );
102
- await (0, cpy_1.default)(
103
- contants_1.CLIENT_EMAILS_PATH,
104
- contants_1.PACKAGE_EMAILS_PATH,
105
- );
106
- } catch (error) {
107
- console.error({ error });
108
- }
109
- };
110
- exports.copyFiles = copyFiles;