@nx-extend/react-email 0.0.1 → 0.1.1

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 CHANGED
@@ -2,4 +2,17 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.1.1](https://github.com/TriPSs/nx-extend/compare/react-email@0.1.0...react-email@0.1.1) (2024-01-18)
6
+
7
+
8
+
9
+ # [0.1.0](https://github.com/TriPSs/nx-extend/compare/react-email@0.0.1...react-email@0.1.0) (2023-12-19)
10
+
11
+
12
+ ### Features
13
+
14
+ * **react-email:** Added react email package ([e5e64c8](https://github.com/TriPSs/nx-extend/commit/e5e64c8ce600176b5d40b6c5e6f11affb8349169))
15
+
16
+
17
+
5
18
  ## 0.0.1 (2023-12-19)
package/README.md CHANGED
@@ -12,4 +12,23 @@
12
12
 
13
13
  ```sh
14
14
  npm install -D @nx-extend/react-email
15
+ nx g @nx-extend/react-email:init
15
16
  ```
17
+
18
+ ## Usage
19
+
20
+ ### Serve
21
+
22
+ #### Available options:
23
+
24
+ | name | type | default | description |
25
+ |------|------|---------|-------------|
26
+
27
+ ### Export
28
+
29
+ #### Available options:
30
+
31
+ | name | type | default | description |
32
+ |--------------------|----------|---------|------------------------------------|
33
+ | **`--outputPath`** | `string` | | Output path to output the build to |
34
+
package/executors.json CHANGED
@@ -1,7 +1,26 @@
1
1
  {
2
2
  "executors": {
3
-
3
+ "serve": {
4
+ "implementation": "./src/executors/serve/serve.impl",
5
+ "schema": "./src/executors/serve/schema.json",
6
+ "description": "Start react email in dev mode."
7
+ },
8
+ "export": {
9
+ "implementation": "./src/executors/export/export.impl",
10
+ "schema": "./src/executors/export/schema.json",
11
+ "description": "export react email"
12
+ }
4
13
  },
5
14
  "builders": {
15
+ "serve": {
16
+ "implementation": "./src/executors/serve/serve.impl",
17
+ "schema": "./src/executors/serve/schema.json",
18
+ "description": "Start react email in dev mode."
19
+ },
20
+ "export": {
21
+ "implementation": "./src/executors/export/export.impl",
22
+ "schema": "./src/executors/export/schema.json",
23
+ "description": "export react email"
24
+ }
6
25
  }
7
26
  }
package/generators.json CHANGED
@@ -3,6 +3,10 @@
3
3
  "name": "react-email",
4
4
  "version": "0.0.1",
5
5
  "generators": {
6
-
6
+ "init": {
7
+ "factory": "./src/generators/init/init.impl",
8
+ "schema": "./src/generators/init/schema.json",
9
+ "description": "react email generator"
10
+ }
7
11
  }
8
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx-extend/react-email",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "keywords": [
5
5
  "nx",
6
6
  "react-email"
@@ -15,9 +15,19 @@
15
15
  },
16
16
  "license": "MIT",
17
17
  "main": "./src/index.js",
18
+ "devDependencies": {
19
+ "@react-email/components": "^0.0.13",
20
+ "react-email": "^1.10.1"
21
+ },
18
22
  "builders": "./executors.json",
19
23
  "generators": "./generators.json",
20
24
  "dependencies": {
25
+ "@nx/devkit": "17.2.7",
26
+ "@nx/workspace": "17.2.7",
27
+ "@react-email/components": "0.0.13",
28
+ "react-email": "1.10.1",
29
+ "shelljs": "^0.8.5",
30
+ "@nx-extend/core": "5.2.1",
21
31
  "tslib": "2.6.2"
22
32
  },
23
33
  "type": "commonjs"
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const export_impl_1 = require("./export.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(export_impl_1.exportExecutor);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/react-email/src/executors/export/compat.ts"],"names":[],"mappings":";;AAAA,uCAA8C;AAE9C,+CAA8C;AAE9C,kBAAe,IAAA,0BAAiB,EAAC,4BAAc,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import 'dotenv/config';
3
+ export interface ServeExecutorOptions {
4
+ outputPath: string;
5
+ pretty?: boolean;
6
+ plainText?: boolean;
7
+ }
8
+ export declare function exportExecutor(options: ServeExecutorOptions, context: ExecutorContext): Promise<{
9
+ success: boolean;
10
+ }>;
11
+ export default exportExecutor;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exportExecutor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@nx-extend/core");
6
+ require("dotenv/config");
7
+ function exportExecutor(options, context) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const { sourceRoot, root } = context.workspace.projects[context.projectName];
10
+ if (!options.outputPath) {
11
+ throw new Error('No "outputPath" defined in options!');
12
+ }
13
+ return (0, core_1.execPackageManagerCommand)((0, core_1.buildCommand)([
14
+ 'email export',
15
+ `--dir=${sourceRoot || root}`,
16
+ `--outDir=${options.outputPath}`,
17
+ options.pretty && `--pretty`,
18
+ options.plainText && `--plainText`
19
+ ]), {
20
+ env: process.env
21
+ });
22
+ });
23
+ }
24
+ exports.exportExecutor = exportExecutor;
25
+ exports.default = exportExecutor;
26
+ //# sourceMappingURL=export.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-email/src/executors/export/export.impl.ts"],"names":[],"mappings":";;;;AACA,0CAAyE;AAEzE,yBAAsB;AAQtB,SAAsB,cAAc,CAClC,OAA6B,EAC7B,OAAwB;;QAExB,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAE5E,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACxD,CAAC;QAED,OAAO,IAAA,gCAAyB,EAAC,IAAA,mBAAY,EAAC;YAC5C,cAAc;YACd,SAAS,UAAU,IAAI,IAAI,EAAE;YAC7B,YAAY,OAAO,CAAC,UAAU,EAAE;YAChC,OAAO,CAAC,MAAM,IAAI,UAAU;YAC5B,OAAO,CAAC,SAAS,IAAI,aAAa;SACnC,CAAC,EAAE;YACF,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAA;IACJ,CAAC;CAAA;AAnBD,wCAmBC;AAED,kBAAe,cAAc,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { ExecutorContext } from '@nx/devkit'
2
+ import { buildCommand, execPackageManagerCommand } from '@nx-extend/core'
3
+
4
+ import 'dotenv/config'
5
+
6
+ export interface ServeExecutorOptions {
7
+ outputPath: string
8
+ pretty?: boolean
9
+ plainText?: boolean
10
+ }
11
+
12
+ export async function exportExecutor(
13
+ options: ServeExecutorOptions,
14
+ context: ExecutorContext
15
+ ): Promise<{ success: boolean }> {
16
+ const { sourceRoot, root } = context.workspace.projects[context.projectName]
17
+
18
+ if (!options.outputPath) {
19
+ throw new Error('No "outputPath" defined in options!')
20
+ }
21
+
22
+ return execPackageManagerCommand(buildCommand([
23
+ 'email export',
24
+ `--dir=${sourceRoot || root}`,
25
+ `--outDir=${options.outputPath}`,
26
+ options.pretty && `--pretty`,
27
+ options.plainText && `--plainText`
28
+ ]), {
29
+ env: process.env
30
+ })
31
+ }
32
+
33
+ export default exportExecutor
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 2,
3
+ "outputCapture": "direct-nodejs",
4
+ "type": "object",
5
+ "title": "Export executor",
6
+ "description": "Export react email",
7
+ "properties": {
8
+ "outputPath": {
9
+ "type": "string"
10
+ },
11
+ "pretty": {
12
+ "type": "boolean",
13
+ "default": false
14
+ },
15
+ "plainText": {
16
+ "type": "boolean",
17
+ "default": false
18
+ }
19
+ },
20
+ "required": ["outputPath"]
21
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const serve_impl_1 = require("./serve.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(serve_impl_1.serveExecutor);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/react-email/src/executors/serve/compat.ts"],"names":[],"mappings":";;AAAA,uCAA8C;AAE9C,6CAA4C;AAE5C,kBAAe,IAAA,0BAAiB,EAAC,0BAAa,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 2,
3
+ "outputCapture": "direct-nodejs",
4
+ "type": "object",
5
+ "title": "Serve executor",
6
+ "description": "Runs react email",
7
+ "properties": {
8
+ "port": {
9
+ "type": "string"
10
+ }
11
+ },
12
+ "required": []
13
+ }
@@ -0,0 +1,9 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import 'dotenv/config';
3
+ export interface ServeExecutorOptions {
4
+ port?: string;
5
+ }
6
+ export declare function serveExecutor(options: ServeExecutorOptions, context: ExecutorContext): Promise<{
7
+ success: boolean;
8
+ }>;
9
+ export default serveExecutor;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serveExecutor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@nx-extend/core");
6
+ require("dotenv/config");
7
+ function serveExecutor(options, context) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const { sourceRoot, root } = context.workspace.projects[context.projectName];
10
+ return (0, core_1.execPackageManagerCommand)((0, core_1.buildCommand)([
11
+ 'email dev',
12
+ `--dir=${sourceRoot || root}`,
13
+ options.port && `--port=${options.port}`
14
+ ]), {
15
+ env: process.env
16
+ });
17
+ });
18
+ }
19
+ exports.serveExecutor = serveExecutor;
20
+ exports.default = serveExecutor;
21
+ //# sourceMappingURL=serve.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-email/src/executors/serve/serve.impl.ts"],"names":[],"mappings":";;;;AACA,0CAAyE;AAEzE,yBAAsB;AAMtB,SAAsB,aAAa,CACjC,OAA6B,EAC7B,OAAwB;;QAExB,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAE5E,OAAO,IAAA,gCAAyB,EAAC,IAAA,mBAAY,EAAC;YAC5C,WAAW;YACX,SAAS,UAAU,IAAI,IAAI,EAAE;YAC7B,OAAO,CAAC,IAAI,IAAI,UAAU,OAAO,CAAC,IAAI,EAAE;SACzC,CAAC,EAAE;YACF,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAA;IACJ,CAAC;CAAA;AAbD,sCAaC;AAED,kBAAe,aAAa,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { ExecutorContext } from '@nx/devkit'
2
+ import { buildCommand, execPackageManagerCommand } from '@nx-extend/core'
3
+
4
+ import 'dotenv/config'
5
+
6
+ export interface ServeExecutorOptions {
7
+ port?: string
8
+ }
9
+
10
+ export async function serveExecutor(
11
+ options: ServeExecutorOptions,
12
+ context: ExecutorContext
13
+ ): Promise<{ success: boolean }> {
14
+ const { sourceRoot, root } = context.workspace.projects[context.projectName]
15
+
16
+ return execPackageManagerCommand(buildCommand([
17
+ 'email dev',
18
+ `--dir=${sourceRoot || root}`,
19
+ options.port && `--port=${options.port}`
20
+ ]), {
21
+ env: process.env
22
+ })
23
+ }
24
+
25
+ export default serveExecutor
@@ -0,0 +1,15 @@
1
+ import { Button, Html } from "@react-email/components";
2
+ import * as React from "react";
3
+
4
+ export default function Email() {
5
+ return (
6
+ <Html>
7
+ <Button
8
+ href="https://example.com"
9
+ style={{ background: "#000", color: "#fff", padding: "12px 20px" }}
10
+ >
11
+ Click me
12
+ </Button>
13
+ </Html>
14
+ );
15
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import type { ReactEmailSchema } from './schema';
3
+ export default function (host: Tree, options: ReactEmailSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const core_1 = require("@nx-extend/core");
6
+ const path = require("path");
7
+ const package_json_1 = require("../../../package.json");
8
+ function addFiles(host, options) {
9
+ (0, devkit_1.generateFiles)(host, path.join(__dirname, 'files'), options.projectRoot, Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), template: '' }));
10
+ }
11
+ function default_1(host, options) {
12
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+ const normalizedOptions = (0, core_1.normalizeOptions)(host, options);
14
+ (0, devkit_1.addProjectConfiguration)(host, normalizedOptions.projectName, {
15
+ root: normalizedOptions.projectRoot,
16
+ projectType: 'application',
17
+ sourceRoot: `${normalizedOptions.projectRoot}/src`,
18
+ targets: {
19
+ serve: {
20
+ executor: '@nx-extend/react-email:serve',
21
+ options: {}
22
+ },
23
+ export: {
24
+ executor: '@nx-extend/react-email:export',
25
+ outputs: ['{options.outputPath}'],
26
+ defaultConfiguration: 'production',
27
+ options: {
28
+ outputPath: `dist/${normalizedOptions.projectRoot}`
29
+ },
30
+ configurations: {
31
+ production: {
32
+ pretty: false
33
+ }
34
+ }
35
+ }
36
+ },
37
+ tags: normalizedOptions.parsedTags
38
+ });
39
+ addFiles(host, normalizedOptions);
40
+ yield (0, devkit_1.formatFiles)(host);
41
+ return (0, devkit_1.runTasksInSerial)((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
42
+ 'react-email': package_json_1.devDependencies['react-email'],
43
+ '@react-email/components': package_json_1.devDependencies['@react-email/components']
44
+ }));
45
+ });
46
+ }
47
+ exports.default = default_1;
48
+ //# sourceMappingURL=init.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-email/src/generators/init/init.impl.ts"],"names":[],"mappings":";;;AAAA,uCAQmB;AACnB,0CAAoE;AACpE,6BAA4B;AAI5B,wDAAuD;AAEvD,SAAS,QAAQ,CAAC,IAAU,EAAE,OAAyB;IACrD,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,gDACjE,OAAO,GACP,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KACtB,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC,EACnD,QAAQ,EAAE,EAAE,IACZ,CAAA;AACJ,CAAC;AAED,mBAA+B,IAAU,EAAE,OAAyB;;QAClE,MAAM,iBAAiB,GAAG,IAAA,uBAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEzD,IAAA,gCAAuB,EAAC,IAAI,EAAE,iBAAiB,CAAC,WAAW,EAAE;YAC3D,IAAI,EAAE,iBAAiB,CAAC,WAAW;YACnC,WAAW,EAAE,aAAa;YAC1B,UAAU,EAAE,GAAG,iBAAiB,CAAC,WAAW,MAAM;YAClD,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,QAAQ,EAAE,8BAA8B;oBACxC,OAAO,EAAE,EAAE;iBACZ;gBACD,MAAM,EAAE;oBACN,QAAQ,EAAE,+BAA+B;oBACzC,OAAO,EAAE,CAAC,sBAAsB,CAAC;oBACjC,oBAAoB,EAAE,YAAY;oBAClC,OAAO,EAAE;wBACP,UAAU,EAAE,QAAQ,iBAAiB,CAAC,WAAW,EAAE;qBACpD;oBACD,cAAc,EAAE;wBACd,UAAU,EAAE;4BACV,MAAM,EAAE,KAAK;yBACd;qBACF;iBACF;aACF;YACD,IAAI,EAAE,iBAAiB,CAAC,UAAU;SACnC,CAAC,CAAA;QAEF,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAA;QACjC,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;QAEvB,OAAO,IAAA,yBAAgB,EACrB,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;YACE,aAAa,EAAE,8BAAe,CAAC,aAAa,CAAC;YAC7C,yBAAyB,EAAE,8BAAe,CAAC,yBAAyB,CAAC;SACtE,CACF,CACF,CAAA;IACH,CAAC;CAAA;AA1CD,4BA0CC"}
@@ -0,0 +1,68 @@
1
+ import {
2
+ addDependenciesToPackageJson,
3
+ addProjectConfiguration,
4
+ formatFiles,
5
+ generateFiles,
6
+ names,
7
+ offsetFromRoot, runTasksInSerial,
8
+ Tree
9
+ } from '@nx/devkit'
10
+ import { NormalizedSchema, normalizeOptions } from '@nx-extend/core'
11
+ import * as path from 'path'
12
+
13
+ import type { ReactEmailSchema } from './schema'
14
+
15
+ import { devDependencies } from '../../../package.json'
16
+
17
+ function addFiles(host: Tree, options: NormalizedSchema) {
18
+ generateFiles(host, path.join(__dirname, 'files'), options.projectRoot, {
19
+ ...options,
20
+ ...names(options.name),
21
+ offsetFromRoot: offsetFromRoot(options.projectRoot),
22
+ template: ''
23
+ })
24
+ }
25
+
26
+ export default async function (host: Tree, options: ReactEmailSchema) {
27
+ const normalizedOptions = normalizeOptions(host, options)
28
+
29
+ addProjectConfiguration(host, normalizedOptions.projectName, {
30
+ root: normalizedOptions.projectRoot,
31
+ projectType: 'application',
32
+ sourceRoot: `${normalizedOptions.projectRoot}/src`,
33
+ targets: {
34
+ serve: {
35
+ executor: '@nx-extend/react-email:serve',
36
+ options: {}
37
+ },
38
+ export: {
39
+ executor: '@nx-extend/react-email:export',
40
+ outputs: ['{options.outputPath}'],
41
+ defaultConfiguration: 'production',
42
+ options: {
43
+ outputPath: `dist/${normalizedOptions.projectRoot}`
44
+ },
45
+ configurations: {
46
+ production: {
47
+ pretty: false
48
+ }
49
+ }
50
+ }
51
+ },
52
+ tags: normalizedOptions.parsedTags
53
+ })
54
+
55
+ addFiles(host, normalizedOptions)
56
+ await formatFiles(host)
57
+
58
+ return runTasksInSerial(
59
+ addDependenciesToPackageJson(
60
+ host,
61
+ {},
62
+ {
63
+ 'react-email': devDependencies['react-email'],
64
+ '@react-email/components': devDependencies['@react-email/components']
65
+ }
66
+ )
67
+ )
68
+ }
@@ -0,0 +1,5 @@
1
+ export interface ReactEmailSchema {
2
+ name: string
3
+ tags?: string
4
+ directory?: string
5
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "type": "object",
4
+ "id": "Strapi",
5
+ "title": "",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What name would you like to use?"
15
+ },
16
+ "tags": {
17
+ "type": "string",
18
+ "description": "Add tags to the project (used for linting)",
19
+ "alias": "t"
20
+ },
21
+ "directory": {
22
+ "type": "string",
23
+ "description": "A directory where the project is placed",
24
+ "alias": "d"
25
+ }
26
+ },
27
+ "required": [
28
+ "name"
29
+ ]
30
+ }