@nizza/devkit 0.1.0 → 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.
Files changed (19) hide show
  1. package/README.md +62 -2
  2. package/dist/cjs/executors/deploy/schema.json +4 -4
  3. package/dist/cjs/executors/environments/schema.json +2 -2
  4. package/dist/cjs/executors/publish/schema.json +3 -3
  5. package/dist/cjs/executors/shared/utils.cjs +12 -2
  6. package/dist/cjs/executors/update-executors-file/schema.json +2 -2
  7. package/dist/cjs/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.0.12 → @vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs +1 -1
  8. package/dist/cjs/vitejs/config-builder/plugins.cjs +1 -1
  9. package/dist/esm/executors/deploy/schema.json +4 -4
  10. package/dist/esm/executors/environments/schema.json +2 -2
  11. package/dist/esm/executors/publish/schema.json +3 -3
  12. package/dist/esm/executors/shared/utils.mjs +12 -2
  13. package/dist/esm/executors/update-executors-file/schema.json +2 -2
  14. package/dist/esm/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.0.12 → @vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs +1 -1
  15. package/dist/esm/vitejs/config-builder/plugins.mjs +1 -1
  16. package/executors.json +4 -4
  17. package/package.json +7 -7
  18. /package/dist/cjs/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.0.12 → @vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/chunks/certificate.cjs +0 -0
  19. /package/dist/esm/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.0.12 → @vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/chunks/certificate.mjs +0 -0
package/README.md CHANGED
@@ -1,3 +1,63 @@
1
- # Devkit
1
+ # DevKit
2
2
 
3
- Necessary resources to manage and extend the nizza and perant monorepos.
3
+ DevKit is a library designed to provide the necessary resources to manage and extend the Nizza and Perant monorepos. Featuring a reusable Vite.js codebase, it simplifies the creation of `vite.config.ts` files for every library and application within the monorepo. Additionally, it includes several NX executors to aid in performing tasks within apps and libs efficiently.
4
+
5
+ ## Key Features
6
+
7
+ - **Simplified Vite.js Configuration:** Easily generate `vite.config.ts` files leveraging our reusable codebase.
8
+ - **Custom NX Executors:** Automate common tasks with our specially designed executors for our monorepos.
9
+
10
+ ## Executors
11
+
12
+ DevKit includes a variety of executors to automate and ease the handling of tasks within your project, such as:
13
+
14
+ - **Environments:** Generates environment files (`environment.ts`, `environment.local.ts`, etc.) in the `src/environments` directory, utilizing the project's configuration.
15
+ - **VTEX Link:** Links a package to a VTEX project, facilitating integration and deployment of changes.
16
+ - **Publish:** Automates the process of publishing packages to npm, including version checks and support for dry run testing.
17
+ - **Update Executors File:** Updates paths in the `executors.json` file to point to the correct locations after changes in the project structure.
18
+ - **Deploy:** Deploys project assets to an AWS S3 bucket and invalidates CloudFront distribution cache.
19
+
20
+ ## Usage
21
+
22
+ To use the executors included in DevKit, you don't need NX installed globally due to the inclusion of an `nx` script in your root `package.json`. Each executor is configured and run through the `nx.json` or via specific NX commands using `pnpm`.
23
+
24
+ ## Working with DevKit
25
+
26
+ DevKit streamlines the development and management processes within the Nizza and Perant monorepos. Here are the key commands you can use:
27
+
28
+ ### Building
29
+
30
+ ```bash
31
+ pnpm nx run devkit:build:dev
32
+ pnpm nx run devkit:build:prod
33
+ ```
34
+
35
+ ### Linting
36
+
37
+ ```bash
38
+ pnpm nx run devkit:lint
39
+ ```
40
+
41
+ ### Cleaning
42
+
43
+ ```bash
44
+ pnpm nx run devkit:clean
45
+ ```
46
+
47
+ ### Versioning
48
+
49
+ Manage your project versions effectively.
50
+
51
+ ```bash
52
+ pnpm nx run devkit:version
53
+ ```
54
+
55
+ ### Environment-Specific Commands
56
+
57
+ DevKit supports environment-specific commands for `dev`, `staging`, and `prod`, allowing easy management and deployment across different development stages.
58
+
59
+ For example, to deploy your project in a production environment:
60
+
61
+ ```bash
62
+ pnpm nx run devkit:deploy:prod
63
+ ```
@@ -2,12 +2,12 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "Deploy executor",
5
- "description": "",
5
+ "description": "Deploys project assets to an AWS S3 bucket and invalidates CloudFront distribution cache",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "s3BucketPath": {
9
9
  "type": "string",
10
- "description": "S3 BUCKET ROUTE"
10
+ "description": "The AWS S3 bucket path where the project assets will be deployed. Format: 's3://bucket-name/path'"
11
11
  },
12
12
  "customPath": {
13
13
  "type": "string",
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "cloudFrontDistributionId": {
17
17
  "type": "string",
18
- "description": "Cloudfront distribution id for cache invalidation"
18
+ "description": "The ID of the AWS CloudFront distribution for cache invalidation, ensuring updated assets are served."
19
19
  },
20
20
  "cloudFrontInvalidationPaths": {
21
21
  "type": "array",
22
- "description": "Cloudfront path list that must be invalidated in the cache",
22
+ "description": "List of paths to invalidate in the CloudFront cache. Specify at least one path. Example: ['/index.html']",
23
23
  "items": {
24
24
  "type": "string"
25
25
  },
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
- "title": "Environments executor",
5
- "description": "",
4
+ "title": "Environments Executor",
5
+ "description": "Generates 'environment.ts', 'environment.local.ts', 'environment.prod.ts', and 'environment.staging.ts' files in the 'src/environments' directory if they don't exist, using the project's configuration and package name. Ensures the environments directory exists and standardizes setup for development, local, production, and staging configurations.",
6
6
  "type": "object",
7
7
  "properties": {},
8
8
  "required": []
@@ -2,16 +2,16 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "Publish executor",
5
- "description": "",
5
+ "description": "Automates the process of publishing a package to npm, requiring prior npm authentication. It checks if the current version is greater than both the latest published version and the specified tag version. Supports a dry run mode for testing without actual publication.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "tag": {
9
9
  "type": "string",
10
- "description": "Tag name to publish"
10
+ "description": "The tag name to publish under, used for identifying release channels (e.g., 'alpha', 'beta', 'latest')."
11
11
  },
12
12
  "dryRun": {
13
13
  "type": "boolean",
14
- "description": "Indicates whether a test execution should be done without really publishing",
14
+ "description": "Executes the publish process without actually publishing to npm, allowing for validation and testing of the process.",
15
15
  "default": false
16
16
  }
17
17
  },
@@ -53,10 +53,20 @@ async function runCommand(command, cwd) {
53
53
  }
54
54
  });
55
55
  devkit.logger.info(stdout);
56
- devkit.logger.info(stderr);
56
+ if (stderr) {
57
+ devkit.logger.error('Error Output:');
58
+ devkit.logger.error(stderr);
59
+ }
57
60
  } catch (error) {
58
61
  devkit.logger.error(`Unexpected error running command:`);
59
- devkit.logger.error(error);
62
+ if (error.stdout) {
63
+ devkit.logger.error('Standard Output:');
64
+ devkit.logger.error(error.stdout);
65
+ }
66
+ if (error.stderr) {
67
+ devkit.logger.error('Error Output:');
68
+ devkit.logger.error(error.stderr);
69
+ }
60
70
  throw error;
61
71
  }
62
72
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
- "title": "UpdateExecutorsFile executor",
5
- "description": "",
4
+ "title": "UpdateExecutorsFile Executor",
5
+ "description": "Executor for updating paths in the executors.json file, ensuring they point to the correct locations after changes in the project structure.",
6
6
  "type": "object",
7
7
  "properties": {},
8
8
  "required": []
@@ -10,7 +10,7 @@ function viteBasicSslPlugin(options) {
10
10
  return {
11
11
  name: "vite:basic-ssl",
12
12
  async configResolved(config) {
13
- const certificate = await getCertificate(options?.certDir ?? (config.cacheDir ?? defaultCacheDir) + "/basic-ssl", options?.name, options?.domains);
13
+ const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl", options?.name, options?.domains);
14
14
  const https = () => ({ cert: certificate, key: certificate });
15
15
  if (config.server.https === void 0 || !!config.server.https) {
16
16
  config.server.https = Object.assign({}, config.server.https, https());
@@ -19,7 +19,7 @@ require('crypto');
19
19
  require('fs');
20
20
  require('chalk');
21
21
  require('mri');
22
- var index$1 = require('../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@5.0.12/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs');
22
+ var index$1 = require('../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs');
23
23
 
24
24
  /**
25
25
  * Base plugins configuration for apps and libs.
@@ -2,12 +2,12 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "Deploy executor",
5
- "description": "",
5
+ "description": "Deploys project assets to an AWS S3 bucket and invalidates CloudFront distribution cache",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "s3BucketPath": {
9
9
  "type": "string",
10
- "description": "S3 BUCKET ROUTE"
10
+ "description": "The AWS S3 bucket path where the project assets will be deployed. Format: 's3://bucket-name/path'"
11
11
  },
12
12
  "customPath": {
13
13
  "type": "string",
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "cloudFrontDistributionId": {
17
17
  "type": "string",
18
- "description": "Cloudfront distribution id for cache invalidation"
18
+ "description": "The ID of the AWS CloudFront distribution for cache invalidation, ensuring updated assets are served."
19
19
  },
20
20
  "cloudFrontInvalidationPaths": {
21
21
  "type": "array",
22
- "description": "Cloudfront path list that must be invalidated in the cache",
22
+ "description": "List of paths to invalidate in the CloudFront cache. Specify at least one path. Example: ['/index.html']",
23
23
  "items": {
24
24
  "type": "string"
25
25
  },
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
- "title": "Environments executor",
5
- "description": "",
4
+ "title": "Environments Executor",
5
+ "description": "Generates 'environment.ts', 'environment.local.ts', 'environment.prod.ts', and 'environment.staging.ts' files in the 'src/environments' directory if they don't exist, using the project's configuration and package name. Ensures the environments directory exists and standardizes setup for development, local, production, and staging configurations.",
6
6
  "type": "object",
7
7
  "properties": {},
8
8
  "required": []
@@ -2,16 +2,16 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "Publish executor",
5
- "description": "",
5
+ "description": "Automates the process of publishing a package to npm, requiring prior npm authentication. It checks if the current version is greater than both the latest published version and the specified tag version. Supports a dry run mode for testing without actual publication.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "tag": {
9
9
  "type": "string",
10
- "description": "Tag name to publish"
10
+ "description": "The tag name to publish under, used for identifying release channels (e.g., 'alpha', 'beta', 'latest')."
11
11
  },
12
12
  "dryRun": {
13
13
  "type": "boolean",
14
- "description": "Indicates whether a test execution should be done without really publishing",
14
+ "description": "Executes the publish process without actually publishing to npm, allowing for validation and testing of the process.",
15
15
  "default": false
16
16
  }
17
17
  },
@@ -51,10 +51,20 @@ async function runCommand(command, cwd) {
51
51
  }
52
52
  });
53
53
  logger.info(stdout);
54
- logger.info(stderr);
54
+ if (stderr) {
55
+ logger.error('Error Output:');
56
+ logger.error(stderr);
57
+ }
55
58
  } catch (error) {
56
59
  logger.error(`Unexpected error running command:`);
57
- logger.error(error);
60
+ if (error.stdout) {
61
+ logger.error('Standard Output:');
62
+ logger.error(error.stdout);
63
+ }
64
+ if (error.stderr) {
65
+ logger.error('Error Output:');
66
+ logger.error(error.stderr);
67
+ }
58
68
  throw error;
59
69
  }
60
70
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
- "title": "UpdateExecutorsFile executor",
5
- "description": "",
4
+ "title": "UpdateExecutorsFile Executor",
5
+ "description": "Executor for updating paths in the executors.json file, ensuring they point to the correct locations after changes in the project structure.",
6
6
  "type": "object",
7
7
  "properties": {},
8
8
  "required": []
@@ -6,7 +6,7 @@ function viteBasicSslPlugin(options) {
6
6
  return {
7
7
  name: "vite:basic-ssl",
8
8
  async configResolved(config) {
9
- const certificate = await getCertificate(options?.certDir ?? (config.cacheDir ?? defaultCacheDir) + "/basic-ssl", options?.name, options?.domains);
9
+ const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl", options?.name, options?.domains);
10
10
  const https = () => ({ cert: certificate, key: certificate });
11
11
  if (config.server.https === void 0 || !!config.server.https) {
12
12
  config.server.https = Object.assign({}, config.server.https, https());
@@ -17,7 +17,7 @@ import 'crypto';
17
17
  import 'fs';
18
18
  import 'chalk';
19
19
  import 'mri';
20
- import viteBasicSslPlugin from '../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@5.0.12/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs';
20
+ import viteBasicSslPlugin from '../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs';
21
21
 
22
22
  /**
23
23
  * Base plugins configuration for apps and libs.
package/executors.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "environments": {
4
4
  "implementation": "./dist/cjs/executors/environments/index.cjs",
5
5
  "schema": "./dist/cjs/executors/environments/schema.json",
6
- "description": "Configure project with custom environments"
6
+ "description": "Generates 'environment.ts', 'environment.local.ts', 'environment.prod.ts', and 'environment.staging.ts' files in the 'src/environments' directory if they don't exist, using the project's configuration and package name. Ensures the environments directory exists and standardizes setup for development, local, production, and staging configurations"
7
7
  },
8
8
  "vtex-link": {
9
9
  "implementation": "./dist/cjs/executors/vtex-link/index.cjs",
@@ -13,17 +13,17 @@
13
13
  "publish": {
14
14
  "implementation": "./dist/cjs/executors/publish/index.cjs",
15
15
  "schema": "./dist/cjs/executors/publish/schema.json",
16
- "description": "publish executor"
16
+ "description": "Automates the process of publishing a package to npm, requiring prior npm authentication. It checks if the current version is greater than both the latest published version and the specified tag version. Supports a dry run mode for testing without actual publication"
17
17
  },
18
18
  "update-executors-file": {
19
19
  "implementation": "./dist/cjs/executors/update-executors-file/index.cjs",
20
20
  "schema": "./dist/cjs/executors/update-executors-file/schema.json",
21
- "description": "update-executors-file executor"
21
+ "description": "Executor for updating paths in the executors.json file, ensuring they point to the correct locations after changes in the project structure"
22
22
  },
23
23
  "deploy": {
24
24
  "implementation": "./dist/cjs/executors/deploy/index.cjs",
25
25
  "schema": "./dist/cjs/executors/deploy/schema.json",
26
- "description": "deploy executor"
26
+ "description": "Deploys project assets to an AWS S3 bucket and invalidates CloudFront distribution cache"
27
27
  }
28
28
  }
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/devkit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",
@@ -33,22 +33,22 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@rollup/plugin-commonjs": "^25.0.7",
36
- "@rollup/plugin-json": "^6.0.1",
36
+ "@rollup/plugin-json": "^6.1.0",
37
37
  "@rollup/plugin-node-resolve": "^15.2.3",
38
38
  "@types/semver": "^7.5.0",
39
- "rollup": "^4.2.0",
39
+ "rollup": "^4.17.1",
40
40
  "rollup-plugin-copy": "^3.5.0",
41
41
  "rollup-plugin-delete": "^2.0.0",
42
42
  "rollup-plugin-dts-bundle-generator": "^1.4.0",
43
- "rollup-plugin-swc3": "^0.10.3"
43
+ "rollup-plugin-swc3": "^0.11.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@nx/devkit": "17.0.2",
46
+ "@nx/devkit": "^19.0.0",
47
47
  "@originjs/vite-plugin-commonjs": "^1.0.3",
48
48
  "@rollup/plugin-graphql": "^2.0.4",
49
- "@vitejs/plugin-react-swc": "^3.4.1",
49
+ "@vitejs/plugin-react-swc": "3.6.0",
50
50
  "rollup-plugin-visualizer": "^5.9.2",
51
- "vite": "^4.5.0",
51
+ "vite": "^5.2.10",
52
52
  "vite-plugin-css-injected-by-js": "^3.3.0",
53
53
  "vite-plugin-dts": "^3.6.3",
54
54
  "vite-tsconfig-paths": "^4.2.1"