@nizza/devkit 0.1.0-beta.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/README.md +62 -2
- package/dist/cjs/executors/deploy/helpers.cjs +1 -1
- package/dist/cjs/executors/deploy/schema.json +4 -4
- package/dist/cjs/executors/environments/schema.json +2 -2
- package/dist/cjs/executors/publish/schema.json +3 -3
- package/dist/cjs/executors/shared/utils.cjs +12 -2
- package/dist/cjs/executors/update-executors-file/schema.json +2 -2
- package/dist/cjs/index.cjs +5 -5
- package/dist/cjs/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4 → @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 +5 -3
- package/dist/cjs/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4 → @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 +10 -6
- package/dist/cjs/scripts/changeset-pre-mode.cjs +1 -1
- package/dist/cjs/vitejs/config-builder/plugins.cjs +1 -1
- package/dist/cjs/vitejs/config-builder/shared/utils/viteCommand.cjs +1 -1
- package/dist/esm/executors/deploy/helpers.mjs +1 -1
- package/dist/esm/executors/deploy/schema.json +4 -4
- package/dist/esm/executors/environments/schema.json +2 -2
- package/dist/esm/executors/publish/schema.json +3 -3
- package/dist/esm/executors/shared/utils.mjs +12 -2
- package/dist/esm/executors/update-executors-file/schema.json +2 -2
- package/dist/esm/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4 → @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 +5 -3
- package/dist/esm/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4 → @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 +10 -6
- package/dist/esm/scripts/changeset-pre-mode.mjs +1 -1
- package/dist/esm/vitejs/config-builder/plugins.mjs +1 -1
- package/dist/esm/vitejs/config-builder/shared/utils/viteCommand.mjs +1 -1
- package/executors.json +4 -4
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DevKit
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
```
|
|
@@ -21,10 +21,10 @@ async function createCloudFrontInvalidation(distributionId, invalidationPaths) {
|
|
|
21
21
|
devkit.logger.info('🔄 CloudFront invalidation created.');
|
|
22
22
|
}
|
|
23
23
|
function validateCustomPath(args) {
|
|
24
|
-
devkit.logger.info(`🔃 Using S3 custom path: "${args.customPath}"`);
|
|
25
24
|
let s3BucketPath = args.s3BucketPath;
|
|
26
25
|
let cloudFrontInvalidationPaths = args.cloudFrontInvalidationPaths;
|
|
27
26
|
if (args.customPath) {
|
|
27
|
+
devkit.logger.info(`🔃 Using S3 custom path: "${args.customPath}"`);
|
|
28
28
|
s3BucketPath = args.s3BucketPath.replace('{customPath}', args.customPath);
|
|
29
29
|
cloudFrontInvalidationPaths = args.cloudFrontInvalidationPaths.map((x)=>x.replace('{customPath}', args.customPath));
|
|
30
30
|
}
|
|
@@ -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
|
|
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": "
|
|
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": "
|
|
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
|
|
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": "
|
|
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": "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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": []
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -21,23 +21,23 @@ exports.publishExecutor = index$2;
|
|
|
21
21
|
exports.updateExecutorsFileExecutor = index$3;
|
|
22
22
|
exports.vtexLinkExecutor = index$4;
|
|
23
23
|
exports.createConfigBuilder = main.createConfigBuilder;
|
|
24
|
-
Object.defineProperty(exports,
|
|
24
|
+
Object.defineProperty(exports, "Flag", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () { return types.Flag; }
|
|
27
27
|
});
|
|
28
|
-
Object.defineProperty(exports,
|
|
28
|
+
Object.defineProperty(exports, "ProjectType", {
|
|
29
29
|
enumerable: true,
|
|
30
30
|
get: function () { return types.ProjectType; }
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports,
|
|
32
|
+
Object.defineProperty(exports, "Stage", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () { return types.Stage; }
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports,
|
|
36
|
+
Object.defineProperty(exports, "Target", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function () { return types.Target; }
|
|
39
39
|
});
|
|
40
|
-
Object.defineProperty(exports,
|
|
40
|
+
Object.defineProperty(exports, "ViteMode", {
|
|
41
41
|
enumerable: true,
|
|
42
42
|
get: function () { return types.ViteMode; }
|
|
43
43
|
});
|
|
@@ -19479,9 +19479,10 @@ function toPositiveHex(hexString) {
|
|
|
19479
19479
|
mostSignificativeHexAsInt -= 8;
|
|
19480
19480
|
return mostSignificativeHexAsInt.toString() + hexString.substring(1);
|
|
19481
19481
|
}
|
|
19482
|
-
function createCertificate() {
|
|
19482
|
+
function createCertificate(name = "example.org", domains) {
|
|
19483
19483
|
const days = 30;
|
|
19484
19484
|
const keySize = 2048;
|
|
19485
|
+
const appendDomains = domains ? domains.map((item) => ({ type: 2, value: item })) : [];
|
|
19485
19486
|
const extensions = [
|
|
19486
19487
|
{
|
|
19487
19488
|
name: "keyUsage",
|
|
@@ -19528,14 +19529,15 @@ function createCertificate() {
|
|
|
19528
19529
|
{
|
|
19529
19530
|
type: 7,
|
|
19530
19531
|
ip: "fe80::1"
|
|
19531
|
-
}
|
|
19532
|
+
},
|
|
19533
|
+
...appendDomains
|
|
19532
19534
|
]
|
|
19533
19535
|
}
|
|
19534
19536
|
];
|
|
19535
19537
|
const attrs = [
|
|
19536
19538
|
{
|
|
19537
19539
|
name: "commonName",
|
|
19538
|
-
value:
|
|
19540
|
+
value: name
|
|
19539
19541
|
},
|
|
19540
19542
|
{
|
|
19541
19543
|
name: "countryName",
|
|
@@ -6,18 +6,22 @@ var path = require('node:path');
|
|
|
6
6
|
var node_fs = require('node:fs');
|
|
7
7
|
|
|
8
8
|
const defaultCacheDir = "node_modules/.vite";
|
|
9
|
-
function viteBasicSslPlugin() {
|
|
9
|
+
function viteBasicSslPlugin(options) {
|
|
10
10
|
return {
|
|
11
11
|
name: "vite:basic-ssl",
|
|
12
12
|
async configResolved(config) {
|
|
13
|
-
const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl");
|
|
13
|
+
const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl", options?.name, options?.domains);
|
|
14
14
|
const https = () => ({ cert: certificate, key: certificate });
|
|
15
|
-
config.server.https
|
|
16
|
-
|
|
15
|
+
if (config.server.https === void 0 || !!config.server.https) {
|
|
16
|
+
config.server.https = Object.assign({}, config.server.https, https());
|
|
17
|
+
}
|
|
18
|
+
if (config.preview.https === void 0 || !!config.preview.https) {
|
|
19
|
+
config.preview.https = Object.assign({}, config.preview.https, https());
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
};
|
|
19
23
|
}
|
|
20
|
-
async function getCertificate(cacheDir) {
|
|
24
|
+
async function getCertificate(cacheDir, name, domains) {
|
|
21
25
|
const cachePath = path.join(cacheDir, "_cert.pem");
|
|
22
26
|
try {
|
|
23
27
|
const [stat, content] = await Promise.all([
|
|
@@ -29,7 +33,7 @@ async function getCertificate(cacheDir) {
|
|
|
29
33
|
}
|
|
30
34
|
return content;
|
|
31
35
|
} catch {
|
|
32
|
-
const content = (await Promise.resolve().then(function () { return require('./chunks/certificate.cjs'); })).createCertificate();
|
|
36
|
+
const content = (await Promise.resolve().then(function () { return require('./chunks/certificate.cjs'); })).createCertificate(name, domains);
|
|
33
37
|
node_fs.promises.mkdir(cacheDir, { recursive: true }).then(() => node_fs.promises.writeFile(cachePath, content)).catch(() => {
|
|
34
38
|
});
|
|
35
39
|
return content;
|
|
@@ -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.
|
|
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.
|
|
@@ -18,7 +18,7 @@ var types = require('../types.cjs');
|
|
|
18
18
|
const nxEnv = vite.loadEnv(mode, process.cwd(), 'NX');
|
|
19
19
|
const nxCommandString = process?.env?.['npm_package_scripts_nx'];
|
|
20
20
|
const modeIsProd = mode === types.ViteMode.PROD;
|
|
21
|
-
const stage =
|
|
21
|
+
const stage = nxEnv?.['NX_TASK_TARGET_CONFIGURATION'] ?? (modeIsProd ? types.Stage.PROD : types.Stage.DEV);
|
|
22
22
|
const target = nxEnv?.['NX_TASK_TARGET_TARGET'] ?? types.Target.BUILD;
|
|
23
23
|
const flags = getViteCmdFlags(nxCommandString);
|
|
24
24
|
const showIn = {
|
|
@@ -19,10 +19,10 @@ async function createCloudFrontInvalidation(distributionId, invalidationPaths) {
|
|
|
19
19
|
logger.info('🔄 CloudFront invalidation created.');
|
|
20
20
|
}
|
|
21
21
|
function validateCustomPath(args) {
|
|
22
|
-
logger.info(`🔃 Using S3 custom path: "${args.customPath}"`);
|
|
23
22
|
let s3BucketPath = args.s3BucketPath;
|
|
24
23
|
let cloudFrontInvalidationPaths = args.cloudFrontInvalidationPaths;
|
|
25
24
|
if (args.customPath) {
|
|
25
|
+
logger.info(`🔃 Using S3 custom path: "${args.customPath}"`);
|
|
26
26
|
s3BucketPath = args.s3BucketPath.replace('{customPath}', args.customPath);
|
|
27
27
|
cloudFrontInvalidationPaths = args.cloudFrontInvalidationPaths.map((x)=>x.replace('{customPath}', args.customPath));
|
|
28
28
|
}
|
|
@@ -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
|
|
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": "
|
|
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": "
|
|
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
|
|
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": "
|
|
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": "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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": []
|
|
@@ -19477,9 +19477,10 @@ function toPositiveHex(hexString) {
|
|
|
19477
19477
|
mostSignificativeHexAsInt -= 8;
|
|
19478
19478
|
return mostSignificativeHexAsInt.toString() + hexString.substring(1);
|
|
19479
19479
|
}
|
|
19480
|
-
function createCertificate() {
|
|
19480
|
+
function createCertificate(name = "example.org", domains) {
|
|
19481
19481
|
const days = 30;
|
|
19482
19482
|
const keySize = 2048;
|
|
19483
|
+
const appendDomains = domains ? domains.map((item) => ({ type: 2, value: item })) : [];
|
|
19483
19484
|
const extensions = [
|
|
19484
19485
|
{
|
|
19485
19486
|
name: "keyUsage",
|
|
@@ -19526,14 +19527,15 @@ function createCertificate() {
|
|
|
19526
19527
|
{
|
|
19527
19528
|
type: 7,
|
|
19528
19529
|
ip: "fe80::1"
|
|
19529
|
-
}
|
|
19530
|
+
},
|
|
19531
|
+
...appendDomains
|
|
19530
19532
|
]
|
|
19531
19533
|
}
|
|
19532
19534
|
];
|
|
19533
19535
|
const attrs = [
|
|
19534
19536
|
{
|
|
19535
19537
|
name: "commonName",
|
|
19536
|
-
value:
|
|
19538
|
+
value: name
|
|
19537
19539
|
},
|
|
19538
19540
|
{
|
|
19539
19541
|
name: "countryName",
|
|
@@ -2,18 +2,22 @@ import path from 'node:path';
|
|
|
2
2
|
import { promises } from 'node:fs';
|
|
3
3
|
|
|
4
4
|
const defaultCacheDir = "node_modules/.vite";
|
|
5
|
-
function viteBasicSslPlugin() {
|
|
5
|
+
function viteBasicSslPlugin(options) {
|
|
6
6
|
return {
|
|
7
7
|
name: "vite:basic-ssl",
|
|
8
8
|
async configResolved(config) {
|
|
9
|
-
const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl");
|
|
9
|
+
const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl", options?.name, options?.domains);
|
|
10
10
|
const https = () => ({ cert: certificate, key: certificate });
|
|
11
|
-
config.server.https
|
|
12
|
-
|
|
11
|
+
if (config.server.https === void 0 || !!config.server.https) {
|
|
12
|
+
config.server.https = Object.assign({}, config.server.https, https());
|
|
13
|
+
}
|
|
14
|
+
if (config.preview.https === void 0 || !!config.preview.https) {
|
|
15
|
+
config.preview.https = Object.assign({}, config.preview.https, https());
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
|
-
async function getCertificate(cacheDir) {
|
|
20
|
+
async function getCertificate(cacheDir, name, domains) {
|
|
17
21
|
const cachePath = path.join(cacheDir, "_cert.pem");
|
|
18
22
|
try {
|
|
19
23
|
const [stat, content] = await Promise.all([
|
|
@@ -25,7 +29,7 @@ async function getCertificate(cacheDir) {
|
|
|
25
29
|
}
|
|
26
30
|
return content;
|
|
27
31
|
} catch {
|
|
28
|
-
const content = (await import('./chunks/certificate.mjs')).createCertificate();
|
|
32
|
+
const content = (await import('./chunks/certificate.mjs')).createCertificate(name, domains);
|
|
29
33
|
promises.mkdir(cacheDir, { recursive: true }).then(() => promises.writeFile(cachePath, content)).catch(() => {
|
|
30
34
|
});
|
|
31
35
|
return content;
|
|
@@ -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.
|
|
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.
|
|
@@ -16,7 +16,7 @@ import { ViteMode, Stage, Target } from '../types.mjs';
|
|
|
16
16
|
const nxEnv = loadEnv(mode, process.cwd(), 'NX');
|
|
17
17
|
const nxCommandString = process?.env?.['npm_package_scripts_nx'];
|
|
18
18
|
const modeIsProd = mode === ViteMode.PROD;
|
|
19
|
-
const stage =
|
|
19
|
+
const stage = nxEnv?.['NX_TASK_TARGET_CONFIGURATION'] ?? (modeIsProd ? Stage.PROD : Stage.DEV);
|
|
20
20
|
const target = nxEnv?.['NX_TASK_TARGET_TARGET'] ?? Target.BUILD;
|
|
21
21
|
const flags = getViteCmdFlags(nxCommandString);
|
|
22
22
|
const showIn = {
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
43
|
+
"rollup-plugin-swc3": "^0.11.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@nx/devkit": "
|
|
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": "
|
|
49
|
+
"@vitejs/plugin-react-swc": "3.6.0",
|
|
50
50
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
51
|
-
"vite": "^
|
|
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"
|