@nizza/devkit 0.1.0-alpha.2 → 0.1.0-alpha.4
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/dist/cjs/executors/deploy/helpers.cjs +26 -0
- package/dist/cjs/executors/deploy/helpers.d.cts +4 -0
- package/dist/cjs/executors/deploy/index.cjs +22 -0
- package/dist/cjs/executors/deploy/index.d.cts +11 -0
- package/dist/cjs/executors/environments/helpers.cjs +63 -0
- package/dist/{src/executors/environments/helpers.d.ts → cjs/executors/environments/helpers.d.cts} +4 -4
- package/dist/cjs/executors/environments/index.cjs +54 -0
- package/dist/{src/executors/environments/executor.d.ts → cjs/executors/environments/index.d.cts} +5 -5
- package/dist/cjs/executors/publish/helpers.cjs +51 -0
- package/dist/{src/executors/publish/helpers.d.ts → cjs/executors/publish/helpers.d.cts} +3 -3
- package/dist/cjs/executors/publish/index.cjs +53 -0
- package/dist/cjs/executors/publish/index.d.cts +12 -0
- package/dist/cjs/executors/shared/utils.cjs +78 -0
- package/dist/cjs/executors/shared/utils.d.cts +34 -0
- package/dist/cjs/executors/update-executors-file/helpers.cjs +64 -0
- package/dist/cjs/executors/update-executors-file/helpers.d.cts +17 -0
- package/dist/cjs/executors/update-executors-file/index.cjs +41 -0
- package/dist/{src/executors/update-executors-file/executor.d.ts → cjs/executors/update-executors-file/index.d.cts} +5 -5
- package/dist/cjs/executors/vtex-link/constants.cjs +9 -0
- package/dist/cjs/executors/vtex-link/constants.d.cts +4 -0
- package/dist/cjs/executors/vtex-link/helpers.cjs +206 -0
- package/dist/{src/executors/vtex-link/helpers.d.ts → cjs/executors/vtex-link/helpers.d.cts} +15 -15
- package/dist/cjs/executors/vtex-link/index.cjs +30 -0
- package/dist/cjs/executors/vtex-link/index.d.cts +5 -0
- package/dist/cjs/index-0ce2daf7.d.ts +2 -0
- package/dist/cjs/index-17143e35.d.ts +2 -0
- package/dist/cjs/index-3080371d.d.ts +3 -0
- package/dist/cjs/index-f6330edc.d.ts +2 -0
- package/dist/cjs/index.cjs +59 -0
- package/dist/cjs/index.d.cts +10 -0
- package/dist/cjs/index.d.cts.map +1 -0
- package/dist/cjs/scripts/changeset-pre-mode.cjs +41 -0
- package/dist/cjs/scripts/changeset-pre-mode.d.cts +2 -0
- package/dist/cjs/shared/logger.cjs +98 -0
- package/dist/{src/logger.d.ts → cjs/shared/logger.d.cts} +5 -6
- package/dist/cjs/shared/utils.cjs +25 -0
- package/dist/{src/shared/utils.d.ts → cjs/shared/utils.d.cts} +2 -2
- package/dist/{src/executors/vtex-link/types.d.ts → cjs/types-1282e639.d.ts} +3 -3
- package/dist/cjs/types-7377dcc9.d.ts +4 -0
- package/dist/cjs/types-763439e4.d.ts +14 -0
- package/dist/cjs/vite/config-builder/configs/app.cjs +13 -0
- package/dist/cjs/vite/config-builder/configs/app.d.cts +4 -0
- package/dist/cjs/vite/config-builder/configs/base.cjs +57 -0
- package/dist/cjs/vite/config-builder/configs/base.d.cts +4 -0
- package/dist/cjs/vite/config-builder/configs/index.cjs +36 -0
- package/dist/cjs/vite/config-builder/configs/index.d.cts +7 -0
- package/dist/cjs/vite/config-builder/configs/lib.cjs +57 -0
- package/dist/cjs/vite/config-builder/configs/lib.d.cts +4 -0
- package/dist/cjs/vite/config-builder/configs/script.cjs +45 -0
- package/dist/cjs/vite/config-builder/configs/script.d.cts +4 -0
- package/dist/cjs/vite/config-builder/main.cjs +43 -0
- package/dist/cjs/vite/config-builder/main.d.cts +10 -0
- package/dist/cjs/vite/config-builder/plugins.cjs +95 -0
- package/dist/{src/vite/config-builder/plugins.d.ts → cjs/vite/config-builder/plugins.d.cts} +7 -7
- package/dist/cjs/vite/config-builder/shared/types.cjs +33 -0
- package/dist/{src/vite/config-builder/shared/types.d.ts → cjs/vite/config-builder/shared/types.d.cts} +17 -17
- package/dist/cjs/vite/config-builder/shared/utils/helpers.cjs +124 -0
- package/dist/{src/vite/config-builder/shared/utils/helpers.d.ts → cjs/vite/config-builder/shared/utils/helpers.d.cts} +10 -10
- package/dist/cjs/vite/config-builder/shared/utils/projectConfig.cjs +114 -0
- package/dist/{src/vite/config-builder/shared/utils/projectConfig.d.ts → cjs/vite/config-builder/shared/utils/projectConfig.d.cts} +8 -8
- package/dist/cjs/vite/config-builder/shared/utils/viteCommand.cjs +59 -0
- package/dist/{src/vite/config-builder/shared/utils/viteCommand.d.ts → cjs/vite/config-builder/shared/utils/viteCommand.d.cts} +4 -4
- package/dist/{src/vite/plugins/shadow-dom-inject-css/index.js → cjs/vite/plugins/shadow-dom-inject-css/index.cjs} +4 -19
- package/dist/cjs/vite/plugins/shadow-dom-inject-css/index.d.cts +7 -0
- package/dist/{src/vite/plugins/third-party-css-inject/main.js → cjs/vite/plugins/third-party-css-inject/main.cjs} +13 -14
- package/dist/cjs/vite/plugins/third-party-css-inject/main.d.cts +17 -0
- package/dist/{src/vite/plugins/third-party-css-inject/utils.js → cjs/vite/plugins/third-party-css-inject/utils.cjs} +8 -20
- package/dist/cjs/vite/plugins/third-party-css-inject/utils.d.cts +5 -0
- package/dist/esm/executors/deploy/helpers.d.mts +4 -0
- package/dist/esm/executors/deploy/helpers.mjs +22 -0
- package/dist/esm/executors/deploy/index.d.mts +11 -0
- package/dist/esm/executors/deploy/index.mjs +20 -0
- package/dist/esm/executors/deploy/schema.json +41 -0
- package/dist/esm/executors/environments/helpers.d.mts +21 -0
- package/dist/esm/executors/environments/helpers.mjs +59 -0
- package/dist/esm/executors/environments/index.d.mts +16 -0
- package/dist/{src/executors/environments/executor.js → esm/executors/environments/index.mjs} +23 -30
- package/dist/esm/executors/environments/schema.json +9 -0
- package/dist/esm/executors/publish/helpers.d.mts +19 -0
- package/dist/esm/executors/publish/helpers.mjs +48 -0
- package/dist/esm/executors/publish/index.d.mts +12 -0
- package/dist/esm/executors/publish/index.mjs +51 -0
- package/dist/esm/executors/publish/schema.json +19 -0
- package/dist/esm/executors/shared/utils.d.mts +34 -0
- package/dist/esm/executors/shared/utils.mjs +72 -0
- package/dist/esm/executors/update-executors-file/helpers.d.mts +17 -0
- package/dist/esm/executors/update-executors-file/helpers.mjs +59 -0
- package/dist/esm/executors/update-executors-file/index.d.mts +12 -0
- package/dist/esm/executors/update-executors-file/index.mjs +39 -0
- package/dist/esm/executors/update-executors-file/schema.json +9 -0
- package/dist/esm/executors/vtex-link/constants.d.mts +4 -0
- package/dist/esm/executors/vtex-link/constants.mjs +5 -0
- package/dist/esm/executors/vtex-link/helpers.d.mts +77 -0
- package/dist/esm/executors/vtex-link/helpers.mjs +192 -0
- package/dist/esm/executors/vtex-link/index.d.mts +5 -0
- package/dist/esm/executors/vtex-link/index.mjs +28 -0
- package/dist/esm/executors/vtex-link/schema.json +25 -0
- package/dist/esm/index-0ce2daf7.d.ts +2 -0
- package/dist/esm/index-17143e35.d.ts +2 -0
- package/dist/esm/index-3080371d.d.ts +3 -0
- package/dist/esm/index-f6330edc.d.ts +2 -0
- package/dist/esm/index.d.mts +10 -0
- package/dist/esm/index.d.mts.map +1 -0
- package/dist/esm/index.mjs +13 -0
- package/dist/esm/scripts/changeset-pre-mode.d.mts +2 -0
- package/dist/esm/scripts/changeset-pre-mode.mjs +39 -0
- package/dist/esm/shared/logger.d.mts +33 -0
- package/dist/{src/logger.js → esm/shared/logger.mjs} +28 -39
- package/dist/esm/shared/utils.d.mts +11 -0
- package/dist/esm/shared/utils.mjs +23 -0
- package/dist/esm/types-1282e639.d.ts +12 -0
- package/dist/esm/types-7377dcc9.d.ts +4 -0
- package/dist/esm/types-763439e4.d.ts +14 -0
- package/dist/esm/vite/config-builder/configs/app.d.mts +4 -0
- package/dist/esm/vite/config-builder/configs/app.mjs +11 -0
- package/dist/esm/vite/config-builder/configs/base.d.mts +4 -0
- package/dist/{src/vite/config-builder/configs/base.js → esm/vite/config-builder/configs/base.mjs} +22 -22
- package/dist/esm/vite/config-builder/configs/index.d.mts +7 -0
- package/dist/esm/vite/config-builder/configs/index.mjs +30 -0
- package/dist/esm/vite/config-builder/configs/lib.d.mts +4 -0
- package/dist/{src/vite/config-builder/configs/lib.js → esm/vite/config-builder/configs/lib.mjs} +16 -18
- package/dist/esm/vite/config-builder/configs/script.d.mts +4 -0
- package/dist/esm/vite/config-builder/configs/script.mjs +43 -0
- package/dist/esm/vite/config-builder/main.d.mts +10 -0
- package/dist/esm/vite/config-builder/main.mjs +41 -0
- package/dist/esm/vite/config-builder/plugins.d.mts +30 -0
- package/dist/esm/vite/config-builder/plugins.mjs +89 -0
- package/dist/esm/vite/config-builder/shared/types.d.mts +155 -0
- package/dist/{src/vite/config-builder/shared/types.js → esm/vite/config-builder/shared/types.mjs} +2 -27
- package/dist/esm/vite/config-builder/shared/utils/helpers.d.mts +81 -0
- package/dist/esm/vite/config-builder/shared/utils/helpers.mjs +98 -0
- package/dist/esm/vite/config-builder/shared/utils/projectConfig.d.mts +60 -0
- package/dist/esm/vite/config-builder/shared/utils/projectConfig.mjs +109 -0
- package/dist/esm/vite/config-builder/shared/utils/viteCommand.d.mts +24 -0
- package/dist/esm/vite/config-builder/shared/utils/viteCommand.mjs +56 -0
- package/dist/esm/vite/plugins/shadow-dom-inject-css/index.d.mts +7 -0
- package/dist/esm/vite/plugins/shadow-dom-inject-css/index.mjs +27 -0
- package/dist/esm/vite/plugins/third-party-css-inject/main.d.mts +17 -0
- package/dist/esm/vite/plugins/third-party-css-inject/main.mjs +45 -0
- package/dist/esm/vite/plugins/third-party-css-inject/utils.d.mts +5 -0
- package/dist/esm/vite/plugins/third-party-css-inject/utils.mjs +97 -0
- package/dist/executors.json +29 -0
- package/package.json +37 -5
- package/dist/package.json +0 -13
- package/dist/src/executors/deploy/executor.d.ts +0 -11
- package/dist/src/executors/deploy/executor.d.ts.map +0 -1
- package/dist/src/executors/deploy/executor.js +0 -27
- package/dist/src/executors/deploy/helpers.d.ts +0 -4
- package/dist/src/executors/deploy/helpers.d.ts.map +0 -1
- package/dist/src/executors/deploy/helpers.js +0 -40
- package/dist/src/executors/environments/executor.d.ts.map +0 -1
- package/dist/src/executors/environments/helpers.d.ts.map +0 -1
- package/dist/src/executors/environments/helpers.js +0 -63
- package/dist/src/executors/publish/executor.d.ts +0 -12
- package/dist/src/executors/publish/executor.d.ts.map +0 -1
- package/dist/src/executors/publish/executor.js +0 -58
- package/dist/src/executors/publish/helpers.d.ts.map +0 -1
- package/dist/src/executors/publish/helpers.js +0 -52
- package/dist/src/executors/shared/index.d.ts +0 -3
- package/dist/src/executors/shared/index.d.ts.map +0 -1
- package/dist/src/executors/shared/index.js +0 -7
- package/dist/src/executors/shared/types.d.ts +0 -4
- package/dist/src/executors/shared/types.d.ts.map +0 -1
- package/dist/src/executors/shared/types.js +0 -4
- package/dist/src/executors/shared/utils.d.ts +0 -34
- package/dist/src/executors/shared/utils.d.ts.map +0 -1
- package/dist/src/executors/shared/utils.js +0 -78
- package/dist/src/executors/update-executors-file/executor.d.ts.map +0 -1
- package/dist/src/executors/update-executors-file/executor.js +0 -46
- package/dist/src/executors/update-executors-file/helpers.d.ts +0 -24
- package/dist/src/executors/update-executors-file/helpers.d.ts.map +0 -1
- package/dist/src/executors/update-executors-file/helpers.js +0 -70
- package/dist/src/executors/update-executors-file/types.d.ts +0 -14
- package/dist/src/executors/update-executors-file/types.d.ts.map +0 -1
- package/dist/src/executors/update-executors-file/types.js +0 -4
- package/dist/src/executors/vtex-link/constants.d.ts +0 -4
- package/dist/src/executors/vtex-link/constants.d.ts.map +0 -1
- package/dist/src/executors/vtex-link/constants.js +0 -24
- package/dist/src/executors/vtex-link/executor.d.ts +0 -5
- package/dist/src/executors/vtex-link/executor.d.ts.map +0 -1
- package/dist/src/executors/vtex-link/executor.js +0 -35
- package/dist/src/executors/vtex-link/helpers.d.ts.map +0 -1
- package/dist/src/executors/vtex-link/helpers.js +0 -187
- package/dist/src/executors/vtex-link/types.d.ts.map +0 -1
- package/dist/src/executors/vtex-link/types.js +0 -4
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -6
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/scripts/changeset-pre-mode.d.ts +0 -2
- package/dist/src/scripts/changeset-pre-mode.d.ts.map +0 -1
- package/dist/src/scripts/changeset-pre-mode.js +0 -41
- package/dist/src/shared/index.d.ts +0 -2
- package/dist/src/shared/index.d.ts.map +0 -1
- package/dist/src/shared/index.js +0 -6
- package/dist/src/shared/utils.d.ts.map +0 -1
- package/dist/src/shared/utils.js +0 -22
- package/dist/src/vite/config-builder/configs/app.d.ts +0 -4
- package/dist/src/vite/config-builder/configs/app.d.ts.map +0 -1
- package/dist/src/vite/config-builder/configs/app.js +0 -19
- package/dist/src/vite/config-builder/configs/base.d.ts +0 -4
- package/dist/src/vite/config-builder/configs/base.d.ts.map +0 -1
- package/dist/src/vite/config-builder/configs/index.d.ts +0 -7
- package/dist/src/vite/config-builder/configs/index.d.ts.map +0 -1
- package/dist/src/vite/config-builder/configs/index.js +0 -28
- package/dist/src/vite/config-builder/configs/lib.d.ts +0 -4
- package/dist/src/vite/config-builder/configs/lib.d.ts.map +0 -1
- package/dist/src/vite/config-builder/configs/script.d.ts +0 -4
- package/dist/src/vite/config-builder/configs/script.d.ts.map +0 -1
- package/dist/src/vite/config-builder/configs/script.js +0 -42
- package/dist/src/vite/config-builder/index.d.ts +0 -3
- package/dist/src/vite/config-builder/index.d.ts.map +0 -1
- package/dist/src/vite/config-builder/index.js +0 -7
- package/dist/src/vite/config-builder/main.d.ts +0 -10
- package/dist/src/vite/config-builder/main.d.ts.map +0 -1
- package/dist/src/vite/config-builder/main.js +0 -37
- package/dist/src/vite/config-builder/plugins.d.ts.map +0 -1
- package/dist/src/vite/config-builder/plugins.js +0 -88
- package/dist/src/vite/config-builder/shared/index.d.ts +0 -3
- package/dist/src/vite/config-builder/shared/index.d.ts.map +0 -1
- package/dist/src/vite/config-builder/shared/index.js +0 -7
- package/dist/src/vite/config-builder/shared/types.d.ts.map +0 -1
- package/dist/src/vite/config-builder/shared/utils/helpers.d.ts.map +0 -1
- package/dist/src/vite/config-builder/shared/utils/helpers.js +0 -61
- package/dist/src/vite/config-builder/shared/utils/index.d.ts +0 -4
- package/dist/src/vite/config-builder/shared/utils/index.d.ts.map +0 -1
- package/dist/src/vite/config-builder/shared/utils/index.js +0 -8
- package/dist/src/vite/config-builder/shared/utils/projectConfig.d.ts.map +0 -1
- package/dist/src/vite/config-builder/shared/utils/projectConfig.js +0 -85
- package/dist/src/vite/config-builder/shared/utils/viteCommand.d.ts.map +0 -1
- package/dist/src/vite/config-builder/shared/utils/viteCommand.js +0 -54
- package/dist/src/vite/index.d.ts +0 -3
- package/dist/src/vite/index.d.ts.map +0 -1
- package/dist/src/vite/index.js +0 -7
- package/dist/src/vite/plugins/index.d.ts +0 -3
- package/dist/src/vite/plugins/index.d.ts.map +0 -1
- package/dist/src/vite/plugins/index.js +0 -7
- package/dist/src/vite/plugins/shadow-dom-inject-css/index.d.ts +0 -8
- package/dist/src/vite/plugins/shadow-dom-inject-css/index.d.ts.map +0 -1
- package/dist/src/vite/plugins/third-party-css-inject/index.d.ts +0 -4
- package/dist/src/vite/plugins/third-party-css-inject/index.d.ts.map +0 -1
- package/dist/src/vite/plugins/third-party-css-inject/index.js +0 -13
- package/dist/src/vite/plugins/third-party-css-inject/main.d.ts +0 -17
- package/dist/src/vite/plugins/third-party-css-inject/main.d.ts.map +0 -1
- package/dist/src/vite/plugins/third-party-css-inject/utils.d.ts +0 -5
- package/dist/src/vite/plugins/third-party-css-inject/utils.d.ts.map +0 -1
- /package/dist/{src → cjs}/executors/deploy/schema.json +0 -0
- /package/dist/{src → cjs}/executors/environments/schema.json +0 -0
- /package/dist/{src → cjs}/executors/publish/schema.json +0 -0
- /package/dist/{src → cjs}/executors/update-executors-file/schema.json +0 -0
- /package/dist/{src → cjs}/executors/vtex-link/schema.json +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return deployExecutor;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _shared = require("../shared");
|
|
12
|
-
const _helpers = require("./helpers");
|
|
13
|
-
async function deployExecutor(opts, ctx) {
|
|
14
|
-
try {
|
|
15
|
-
const { root, name } = (0, _shared.getProjectConfig)(ctx);
|
|
16
|
-
const { s3BucketPath, cloudFrontDistributionId, cloudFrontInvalidationPaths, skipBuild = false } = opts;
|
|
17
|
-
const buildTarget = `${name}:${opts.buildTarget}`;
|
|
18
|
-
if (!skipBuild) await (0, _shared.runCommand)(`nx run ${buildTarget}`);
|
|
19
|
-
await (0, _helpers.cleanS3Bucket)(s3BucketPath);
|
|
20
|
-
await (0, _helpers.copyAssetsToS3)(s3BucketPath, root);
|
|
21
|
-
await (0, _helpers.createCloudFrontInvalidation)(cloudFrontDistributionId, cloudFrontInvalidationPaths);
|
|
22
|
-
const now = new Date().toLocaleString();
|
|
23
|
-
return (0, _shared.ok)(`✨ Build completed successfully on ${now}`);
|
|
24
|
-
} catch (error) {
|
|
25
|
-
return (0, _shared.err)(error, '❌ Error when executing deploy command');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function cleanS3Bucket(s3BucketPath: string): Promise<void>;
|
|
2
|
-
export declare function copyAssetsToS3(s3BucketPath: string, projectRoot: string): Promise<void>;
|
|
3
|
-
export declare function createCloudFrontInvalidation(distributionId: string, invalidationPaths: string[]): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/executors/deploy/helpers.ts"],"names":[],"mappings":"AAGA,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvE;AAED,wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,4BAA4B,CAChD,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
cleanS3Bucket: function() {
|
|
13
|
-
return cleanS3Bucket;
|
|
14
|
-
},
|
|
15
|
-
copyAssetsToS3: function() {
|
|
16
|
-
return copyAssetsToS3;
|
|
17
|
-
},
|
|
18
|
-
createCloudFrontInvalidation: function() {
|
|
19
|
-
return createCloudFrontInvalidation;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _devkit = require("@nx/devkit");
|
|
23
|
-
const _shared = require("../shared");
|
|
24
|
-
async function cleanS3Bucket(s3BucketPath) {
|
|
25
|
-
_devkit.logger.info('🧹 Cleaning S3 bucket...');
|
|
26
|
-
await (0, _shared.runCommand)(`aws s3 rm ${s3BucketPath} --recursive`);
|
|
27
|
-
_devkit.logger.info('✅ S3 bucket cleared.');
|
|
28
|
-
}
|
|
29
|
-
async function copyAssetsToS3(s3BucketPath, projectRoot) {
|
|
30
|
-
_devkit.logger.info('📦 Copying assets to S3 bucket...');
|
|
31
|
-
await (0, _shared.runCommand)(`aws s3 cp ${projectRoot}/dist ${s3BucketPath} --recursive`);
|
|
32
|
-
_devkit.logger.info('🚚 Assets files copied.');
|
|
33
|
-
}
|
|
34
|
-
async function createCloudFrontInvalidation(distributionId, invalidationPaths) {
|
|
35
|
-
const pathsString = invalidationPaths.map((path)=>`"${path}"`).join(' ');
|
|
36
|
-
const command = `aws cloudfront create-invalidation --distribution-id ${distributionId} --paths ${pathsString}`;
|
|
37
|
-
_devkit.logger.info('🔃 Creating invalidation for CloudFront...');
|
|
38
|
-
await (0, _shared.runCommand)(command);
|
|
39
|
-
_devkit.logger.info('🔄 CloudFront invalidation created.');
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executors/environments/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAqB7E,MAAM,WAAW,eAAe;CAAG;AAEnC;;;;;;;;;GASG;AACH,wBAA8B,WAAW,CACvC,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAiB3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/executors/environments/helpers.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAStE;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
createEnvironmentFileContent: function() {
|
|
13
|
-
return createEnvironmentFileContent;
|
|
14
|
-
},
|
|
15
|
-
ensureDirectoryExists: function() {
|
|
16
|
-
return ensureDirectoryExists;
|
|
17
|
-
},
|
|
18
|
-
writeFilesIfNotExist: function() {
|
|
19
|
-
return writeFilesIfNotExist;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _fs = require("fs");
|
|
23
|
-
const _path = require("path");
|
|
24
|
-
const _devkit = require("@nx/devkit");
|
|
25
|
-
const { mkdir, writeFile, access } = _fs.promises;
|
|
26
|
-
async function createEnvironmentFileContent(coreEnvPath) {
|
|
27
|
-
return `
|
|
28
|
-
import { Environment } from '@nizza/core';
|
|
29
|
-
import coreEnvs from '${coreEnvPath}';
|
|
30
|
-
|
|
31
|
-
const config = {
|
|
32
|
-
...coreEnvs,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const environment: Environment<typeof config> = config;
|
|
36
|
-
export default environment;
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
|
-
async function ensureDirectoryExists(dir) {
|
|
40
|
-
try {
|
|
41
|
-
await access(dir);
|
|
42
|
-
_devkit.logger.info('✅ Directory exists.');
|
|
43
|
-
} catch {
|
|
44
|
-
_devkit.logger.info('📁 Directory does not exist. Creating...');
|
|
45
|
-
await mkdir(dir, {
|
|
46
|
-
recursive: true
|
|
47
|
-
});
|
|
48
|
-
_devkit.logger.info('📁 Directory created.');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function writeFilesIfNotExist(basePath, files) {
|
|
52
|
-
await Promise.all(Object.entries(files).map(async ([filename, content])=>{
|
|
53
|
-
const filePath = (0, _path.join)(basePath, filename);
|
|
54
|
-
try {
|
|
55
|
-
await access(filePath);
|
|
56
|
-
_devkit.logger.info(`✅ The file "${filename}" already exists.`);
|
|
57
|
-
} catch {
|
|
58
|
-
_devkit.logger.warn(`📝 The file "${filename}" does not exist. Creating...`);
|
|
59
|
-
await writeFile(filePath, content);
|
|
60
|
-
_devkit.logger.info(`🎉 The file "${filename}" has been created.`);
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { type ExecutorResponse } from '../shared';
|
|
3
|
-
export interface ExecutorOptions {
|
|
4
|
-
tag: string;
|
|
5
|
-
dryRun?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* This is a minimal script to publish package to "npm".
|
|
9
|
-
* Need to authenticate with NPM before running this script.
|
|
10
|
-
*/
|
|
11
|
-
export default function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
|
|
12
|
-
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executors/publish/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAG1D,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAA8B,WAAW,CACvC,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,gBAAgB,CAAC,CA8D3B"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* This is a minimal script to publish package to "npm".
|
|
7
|
-
* Need to authenticate with NPM before running this script.
|
|
8
|
-
*/ "default", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function() {
|
|
11
|
-
return runExecutor;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
|
-
const _devkit = require("@nx/devkit");
|
|
16
|
-
const _semver = /*#__PURE__*/ _interop_require_default._(require("semver"));
|
|
17
|
-
const _shared = require("../../shared");
|
|
18
|
-
const _shared1 = require("../shared");
|
|
19
|
-
const _helpers = require("./helpers");
|
|
20
|
-
async function runExecutor(opts, ctx) {
|
|
21
|
-
try {
|
|
22
|
-
const { tag, dryRun: isDryRun } = opts;
|
|
23
|
-
const { root: projectRoot } = (0, _shared1.getProjectConfig)(ctx);
|
|
24
|
-
// Read the package.json file and extract the name and version.
|
|
25
|
-
const packageJson = (0, _shared.getPkgJson)(projectRoot);
|
|
26
|
-
const { name: packageName, version: packageVersion } = packageJson;
|
|
27
|
-
// Check if the package has been previously published and get the published version.
|
|
28
|
-
const { publishedVersion, isFirstVersion } = await (0, _helpers.checkPublishedVersion)(packageName);
|
|
29
|
-
let greaterThanTagVersion, greaterThanLatestVersion;
|
|
30
|
-
if (!isFirstVersion) {
|
|
31
|
-
// Check if the package version is greater than the latest published version for the specified tag.
|
|
32
|
-
greaterThanTagVersion = publishedVersion?.[tag] ? _semver.default.gt(packageVersion, publishedVersion?.[tag]) : true;
|
|
33
|
-
// Check if the package version is greater than the latest published version.
|
|
34
|
-
greaterThanLatestVersion = _semver.default.gt(packageVersion, publishedVersion.latest);
|
|
35
|
-
console.log(`🔎 package.json version: ${packageVersion}`);
|
|
36
|
-
console.log('🔺 published versions:');
|
|
37
|
-
Object.entries(publishedVersion).forEach(([k, v])=>console.log(` * ${k}: ${v}`));
|
|
38
|
-
console.log('\n');
|
|
39
|
-
}
|
|
40
|
-
// Publish the package if it's the first version or if it's a new version.
|
|
41
|
-
const needsPublish = isFirstVersion || greaterThanLatestVersion && greaterThanTagVersion;
|
|
42
|
-
if (needsPublish) {
|
|
43
|
-
const dryRun = isDryRun ? '--dry-run' : '';
|
|
44
|
-
const commandToPublish = `pnpm publish --access public --tag ${tag} --no-git-checks ${dryRun}`;
|
|
45
|
-
isDryRun && _devkit.logger.info('👀 Skip publish (dry run) \n');
|
|
46
|
-
_devkit.logger.info(`${commandToPublish} \n`);
|
|
47
|
-
// Execute the command to publish the package.
|
|
48
|
-
// process.chdir(projectRoot);
|
|
49
|
-
await (0, _shared1.runCommand)(commandToPublish, projectRoot);
|
|
50
|
-
_devkit.logger.info(`\n🚀 Successfully published ${packageName}@${packageVersion}`);
|
|
51
|
-
} else {
|
|
52
|
-
_devkit.logger.warn(`👻 Package version "${packageVersion}" is invalid.`);
|
|
53
|
-
}
|
|
54
|
-
return (0, _shared1.ok)();
|
|
55
|
-
} catch (error) {
|
|
56
|
-
return (0, _shared1.err)(error, '❌ Error when publishing the package');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/executors/publish/helpers.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,EACnB,GAAG,CAAC,EAAE,MAAM,gBAab;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM;;;GAmB9D"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
checkPublishedVersion: function() {
|
|
13
|
-
return checkPublishedVersion;
|
|
14
|
-
},
|
|
15
|
-
getPublishedPackageVersion: function() {
|
|
16
|
-
return getPublishedPackageVersion;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _devkit = require("@nx/devkit");
|
|
20
|
-
const _child_process = require("child_process");
|
|
21
|
-
const _util = require("util");
|
|
22
|
-
const execAsync = (0, _util.promisify)(_child_process.exec);
|
|
23
|
-
async function getPublishedPackageVersion(packageName, tag) {
|
|
24
|
-
const withTag = tag ? `.${tag}` : ' --json';
|
|
25
|
-
const command = `npm view ${packageName} dist-tags${withTag}`;
|
|
26
|
-
const { stdout, stderr } = await execAsync(command);
|
|
27
|
-
if (stderr) {
|
|
28
|
-
_devkit.logger.error(stderr.trim());
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
const published = stdout.trim();
|
|
32
|
-
return tag ? published : JSON.parse(published);
|
|
33
|
-
}
|
|
34
|
-
async function checkPublishedVersion(packageName) {
|
|
35
|
-
let publishedVersion;
|
|
36
|
-
let isFirstVersion = false;
|
|
37
|
-
try {
|
|
38
|
-
publishedVersion = await getPublishedPackageVersion(packageName);
|
|
39
|
-
} catch (err) {
|
|
40
|
-
if (err?.message.includes('code E404')) {
|
|
41
|
-
isFirstVersion = true;
|
|
42
|
-
_devkit.logger.info(`🏁 This is the first version of "${packageName}" package. \n`);
|
|
43
|
-
} else {
|
|
44
|
-
_devkit.logger.error('❌ Error when checking the last published versions \n');
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
publishedVersion,
|
|
50
|
-
isFirstVersion
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/executors/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/executors/shared/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type ExecutorContext, type ProjectConfiguration } from '@nx/devkit';
|
|
2
|
-
import type { ExecutorResponse } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Indicates a successful executor operation.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} [message] - Optional message to log for the success case.
|
|
7
|
-
* @returns {ExecutorResponse} - An object representing a successful operation.
|
|
8
|
-
*/
|
|
9
|
-
export declare function ok(message?: string): ExecutorResponse;
|
|
10
|
-
/**
|
|
11
|
-
* Indicates a failed executor operation.
|
|
12
|
-
*
|
|
13
|
-
* @param {string | Error | unknown} [err] - An optional error object or message indicating the nature of the failure.
|
|
14
|
-
* @param {string} [message] - An optional message to log for the error case. If not provided, a default error message is logged.
|
|
15
|
-
* @returns {ExecutorResponse} - An object representing a failed operation.
|
|
16
|
-
*/
|
|
17
|
-
export declare function err(err?: string | Error | unknown, message?: string): ExecutorResponse;
|
|
18
|
-
/**
|
|
19
|
-
* Generates a random alphanumeric identifier of a specified length.
|
|
20
|
-
*
|
|
21
|
-
* @param {number} [length=8] - The length of the identifier to generate. Defaults to 8 if not specified.
|
|
22
|
-
* @returns {string} - A string representing a unique identifier.
|
|
23
|
-
*/
|
|
24
|
-
export declare function shortId(length?: number): string;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves the project configuration for the current execution context.
|
|
27
|
-
*
|
|
28
|
-
* @param {ExecutorContext} ctx - The execution context containing project information.
|
|
29
|
-
* @returns {ProjectConfiguration} - The configuration object for the current project.
|
|
30
|
-
* @throws {Error} If the project configuration is invalid or not found.
|
|
31
|
-
*/
|
|
32
|
-
export declare function getProjectConfig(ctx: ExecutorContext): ProjectConfiguration;
|
|
33
|
-
export declare function runCommand(command: string, cwd?: string | URL): Promise<void>;
|
|
34
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/executors/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD;;;;;GAKG;AACH,wBAAgB,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAGrD;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CACjB,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,EAC9B,OAAO,CAAC,EAAE,MAAM,GACf,gBAAgB,CAUlB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,SAAI,UAIjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB,CAK3E;AAED,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,GACjB,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
err: function() {
|
|
13
|
-
return err;
|
|
14
|
-
},
|
|
15
|
-
getProjectConfig: function() {
|
|
16
|
-
return getProjectConfig;
|
|
17
|
-
},
|
|
18
|
-
ok: function() {
|
|
19
|
-
return ok;
|
|
20
|
-
},
|
|
21
|
-
runCommand: function() {
|
|
22
|
-
return runCommand;
|
|
23
|
-
},
|
|
24
|
-
shortId: function() {
|
|
25
|
-
return shortId;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const _devkit = require("@nx/devkit");
|
|
29
|
-
const _crypto = require("crypto");
|
|
30
|
-
const _child_process = require("child_process");
|
|
31
|
-
const _util = require("util");
|
|
32
|
-
const execAsync = (0, _util.promisify)(_child_process.exec);
|
|
33
|
-
function ok(message) {
|
|
34
|
-
message && _devkit.logger.info(message);
|
|
35
|
-
return {
|
|
36
|
-
success: true
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function err(err, message) {
|
|
40
|
-
if (message) {
|
|
41
|
-
_devkit.logger.error(message);
|
|
42
|
-
} else {
|
|
43
|
-
_devkit.logger.error(`❌ an error occurred:`);
|
|
44
|
-
}
|
|
45
|
-
if (err) _devkit.logger.error(err);
|
|
46
|
-
return {
|
|
47
|
-
success: false
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function shortId(length = 8) {
|
|
51
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
52
|
-
return Array.from((0, _crypto.randomBytes)(length), (b)=>chars[b % chars.length]).join('');
|
|
53
|
-
}
|
|
54
|
-
function getProjectConfig(ctx) {
|
|
55
|
-
const projectName = ctx.projectName || '';
|
|
56
|
-
const projectConfig = ctx.projectsConfigurations?.projects?.[projectName];
|
|
57
|
-
if (!projectConfig) throw new Error('Invalid project configuration.');
|
|
58
|
-
return projectConfig;
|
|
59
|
-
}
|
|
60
|
-
async function runCommand(command, cwd) {
|
|
61
|
-
try {
|
|
62
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
63
|
-
...cwd && {
|
|
64
|
-
cwd
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
if (stderr) {
|
|
68
|
-
_devkit.logger.error(`Error running command:`);
|
|
69
|
-
_devkit.logger.error(stderr);
|
|
70
|
-
throw new Error(stderr);
|
|
71
|
-
}
|
|
72
|
-
_devkit.logger.info(stdout);
|
|
73
|
-
} catch (error) {
|
|
74
|
-
_devkit.logger.error(`Unexpected error running command:`);
|
|
75
|
-
_devkit.logger.error(error);
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executors/update-executors-file/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAW,KAAK,gBAAgB,EAAoB,MAAM,WAAW,CAAC;AAE7E,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAI9D;;;;;;GAMG;AACH,wBAA8B,WAAW,CACvC,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,gBAAgB,CAAC,CA8B3B"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* Executor function to update paths in the executors.json file.
|
|
7
|
-
*
|
|
8
|
-
* @param {ExecutorOptions} _opts - Executor options, currently not used but provided for future extensibility.
|
|
9
|
-
* @param {ExecutorContext} ctx - The executor context, providing access to the project configuration.
|
|
10
|
-
* @returns {Promise<ExecutorResponse>} The result object with a success or error status.
|
|
11
|
-
*/ "default", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function() {
|
|
14
|
-
return runExecutor;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
const _fs = require("fs");
|
|
18
|
-
const _path = require("path");
|
|
19
|
-
const _shared = require("../shared");
|
|
20
|
-
const _helpers = require("./helpers");
|
|
21
|
-
const { readFile } = _fs.promises;
|
|
22
|
-
async function runExecutor(_opts, ctx) {
|
|
23
|
-
try {
|
|
24
|
-
const projectConfig = (0, _shared.getProjectConfig)(ctx);
|
|
25
|
-
const rootDir = projectConfig.root;
|
|
26
|
-
const executorsFilePath = (0, _path.join)(rootDir, 'executors.json');
|
|
27
|
-
const distExecutorsFilePath = (0, _path.join)(rootDir, 'dist', 'executors.json');
|
|
28
|
-
const originalContent = JSON.parse(await readFile(executorsFilePath, 'utf8'));
|
|
29
|
-
// Update paths to point to './dist/' and add '.js'
|
|
30
|
-
const updatedExecutors = (0, _helpers.updateExecutorPaths)(originalContent.executors, false);
|
|
31
|
-
// Prepare the version for the dist folder by removing './dist/' from paths
|
|
32
|
-
const distExecutors = (0, _helpers.updateExecutorPaths)(updatedExecutors, true);
|
|
33
|
-
// Write both files asynchronously and in parallel
|
|
34
|
-
await Promise.all([
|
|
35
|
-
(0, _helpers.writeJsonFileAsync)(executorsFilePath, {
|
|
36
|
-
executors: updatedExecutors
|
|
37
|
-
}),
|
|
38
|
-
(0, _helpers.writeJsonFileAsync)(distExecutorsFilePath, {
|
|
39
|
-
executors: distExecutors
|
|
40
|
-
})
|
|
41
|
-
]);
|
|
42
|
-
return (0, _shared.ok)(`🚀 Executors updated successfully.`);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
return (0, _shared.err)(error, `❌ Error processing file: ${error}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Executors } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Transforms the given path by adding or removing the './dist/' prefix
|
|
4
|
-
* and ensuring that it has the '.js' extension if it's not a JSON file.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} path - The original file path to transform.
|
|
7
|
-
* @param {boolean} removeDist - Flag to determine if './dist/' should be removed.
|
|
8
|
-
* @returns {string} The transformed file path.
|
|
9
|
-
*/
|
|
10
|
-
export declare const transformPath: (path: string, removeDist: boolean) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Updates the executor paths for the provided executors object.
|
|
13
|
-
* @param {Executors} executors - The executors object from executors.json.
|
|
14
|
-
* @param {boolean} removeDist - Flag to determine if './dist' should be removed from paths.
|
|
15
|
-
* @returns - The updated executors object with transformed paths.
|
|
16
|
-
*/
|
|
17
|
-
export declare const updateExecutorPaths: (executors: Executors, removeDist: boolean) => Executors;
|
|
18
|
-
/**
|
|
19
|
-
* Writes a JSON file asynchronously.
|
|
20
|
-
* @param {string} path - The file path where to write the JSON data.
|
|
21
|
-
* @param {any} data - The data to be written to the file.
|
|
22
|
-
*/
|
|
23
|
-
export declare const writeJsonFileAsync: (path: string, data: any) => Promise<void>;
|
|
24
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/executors/update-executors-file/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,cAAc,OAAO,KAAG,MAuBjE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,cACnB,SAAS,cACR,OAAO,cAapB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SAAgB,MAAM,QAAQ,GAAG,kBAO/D,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
transformPath: function() {
|
|
13
|
-
return transformPath;
|
|
14
|
-
},
|
|
15
|
-
updateExecutorPaths: function() {
|
|
16
|
-
return updateExecutorPaths;
|
|
17
|
-
},
|
|
18
|
-
writeJsonFileAsync: function() {
|
|
19
|
-
return writeJsonFileAsync;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _devkit = require("@nx/devkit");
|
|
23
|
-
const _fs = require("fs");
|
|
24
|
-
const _ramda = require("ramda");
|
|
25
|
-
const { writeFile } = _fs.promises;
|
|
26
|
-
const transformPath = (path, removeDist)=>{
|
|
27
|
-
const distPrefix = './dist/';
|
|
28
|
-
const distRegex = /^\.\/dist\//;
|
|
29
|
-
const jsExt = '.js';
|
|
30
|
-
const isJs = (0, _ramda.endsWith)(jsExt, path);
|
|
31
|
-
const isJson = (0, _ramda.endsWith)('.json', path);
|
|
32
|
-
const hasDist = (0, _ramda.test)(distRegex, path);
|
|
33
|
-
// Adds './dist/' prefix to the path if it's not already present.
|
|
34
|
-
const addDist = (p)=>hasDist ? p : `${distPrefix}${p}`;
|
|
35
|
-
// Removes './dist/' prefix from the path if present.
|
|
36
|
-
const stripDist = (p)=>(0, _ramda.replace)(distRegex, './', p);
|
|
37
|
-
// Adds '.js' extension to the path if it's not a JSON file and doesn't have the extension already.
|
|
38
|
-
const addJs = (p)=>isJs || isJson ? p : `${p}${jsExt}`;
|
|
39
|
-
// Cleans up any occurrences of '/./' within the path.
|
|
40
|
-
const clean = (p)=>(0, _ramda.replace)(/\/\.\//g, '/', p);
|
|
41
|
-
const transform = (0, _ramda.cond)([
|
|
42
|
-
[
|
|
43
|
-
(0, _ramda.always)(removeDist),
|
|
44
|
-
(0, _ramda.pipe)(stripDist, addJs, clean)
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
_ramda.T,
|
|
48
|
-
(0, _ramda.pipe)(addDist, addJs, clean)
|
|
49
|
-
]
|
|
50
|
-
]);
|
|
51
|
-
return transform(path);
|
|
52
|
-
};
|
|
53
|
-
const updateExecutorPaths = (executors, removeDist)=>{
|
|
54
|
-
return Object.entries(executors).reduce((updatedExecutors, [key, executor])=>{
|
|
55
|
-
updatedExecutors[key] = {
|
|
56
|
-
...executor,
|
|
57
|
-
implementation: transformPath(executor.implementation, removeDist),
|
|
58
|
-
schema: transformPath(executor.schema, removeDist)
|
|
59
|
-
};
|
|
60
|
-
return updatedExecutors;
|
|
61
|
-
}, {});
|
|
62
|
-
};
|
|
63
|
-
const writeJsonFileAsync = async (path, data)=>{
|
|
64
|
-
try {
|
|
65
|
-
await writeFile(path, JSON.stringify(data, null, 2));
|
|
66
|
-
_devkit.logger.info(`✅ Updated: ${path}`);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
_devkit.logger.error(`❌ Error writing file ${path}: ${error}`);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ExecutorOptions {
|
|
2
|
-
}
|
|
3
|
-
export interface ExecutorConfig {
|
|
4
|
-
implementation: string;
|
|
5
|
-
schema: string;
|
|
6
|
-
description: string;
|
|
7
|
-
}
|
|
8
|
-
export interface Executors {
|
|
9
|
-
[executorName: string]: ExecutorConfig;
|
|
10
|
-
}
|
|
11
|
-
export interface ExecutorsFile {
|
|
12
|
-
executors: Executors;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/executors/update-executors-file/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AAGnC,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,SAAS;IACxB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,CAAC;CACxC;AAGD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,SAAS,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/executors/vtex-link/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,oBAA8B,CAAC;AAC7D,eAAO,MAAM,kBAAkB,0CAAqC,CAAC;AACrE,eAAO,MAAM,oBAAoB,oCAA+B,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
ERROR_LINKING_FLAG: function() {
|
|
13
|
-
return ERROR_LINKING_FLAG;
|
|
14
|
-
},
|
|
15
|
-
SUCCESS_LINKING_FLAG: function() {
|
|
16
|
-
return SUCCESS_LINKING_FLAG;
|
|
17
|
-
},
|
|
18
|
-
VTEX_PROJECT_PATH: function() {
|
|
19
|
-
return VTEX_PROJECT_PATH;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const VTEX_PROJECT_PATH = process.env.NZ_VTEX_PROJECT;
|
|
23
|
-
const ERROR_LINKING_FLAG = '[31merror[39m: App build failed';
|
|
24
|
-
const SUCCESS_LINKING_FLAG = '[32minfo[39m: App running';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { type ExecutorResponse } from '../shared';
|
|
3
|
-
import type { ExecutorOptions } from './types';
|
|
4
|
-
export default function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
|
|
5
|
-
//# sourceMappingURL=executor.d.ts.map
|