@nx-extend/vercel 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @nx-extend/vercel
2
+
3
+ <a href="https://www.npmjs.com/package/@nx-extend/vercel" rel="nofollow">
4
+ <img src="https://badgen.net/npm/v/@nx-extend/vercel" alt="@nx-extend/vercel NPM package">
5
+ </a>
6
+
7
+ **Nx plugin for deploy your app to [Cloud Storage](https://cloud.google.com/storage)**.
8
+
9
+ ## Setup
10
+
11
+ ### Install
12
+
13
+ ```sh
14
+ npm install -D @nx-extend/vercel
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### Upload
20
+
21
+ #### Available options:
22
+
23
+ | name | type | default | description |
24
+ | ------------ | -------- | ------- | ---------------------------------------------------- |
25
+ | | | | |
package/executors.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "executors": {
3
+ "build": {
4
+ "implementation": "./src/executors/build/build.impl",
5
+ "schema": "./src/executors/build/schema.json",
6
+ "description": "Build project with Vercel"
7
+ },
8
+ "deploy": {
9
+ "implementation": "./src/executors/deploy/deploy.impl",
10
+ "schema": "./src/executors/deploy/schema.json",
11
+ "description": "Deploy project to Vercel"
12
+ }
13
+ },
14
+ "builders": {
15
+ "build": {
16
+ "implementation": "./src/executors/build/build.impl",
17
+ "schema": "./src/executors/build/schema.json",
18
+ "description": "Build project with Vercel"
19
+ },
20
+ "deploy": {
21
+ "implementation": "./src/executors/deploy/deploy.impl",
22
+ "schema": "./src/executors/deploy/schema.json",
23
+ "description": "Deploy project to Vercel"
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "name": "vercel",
4
+ "version": "0.0.1",
5
+ "generators": {
6
+ "add": {
7
+ "factory": "./src/generators/add/add.impl",
8
+ "schema": "./src/generators/add/schema.json",
9
+ "description": "Vercel generator"
10
+ }
11
+ }
12
+ }
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@nx-extend/vercel",
3
+ "version": "1.0.0",
4
+ "keywords": [
5
+ "nx",
6
+ "vercel"
7
+ ],
8
+ "homepage": "https://github.com/TriPSs/nx-extend/blob/master/packages/vercel/README.md",
9
+ "bugs": {
10
+ "url": "https://github.com/tripss/nx-extend/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/tripss/nx-extend"
15
+ },
16
+ "license": "MIT",
17
+ "main": "src/index.js",
18
+ "builders": "./executors.json",
19
+ "generators": "./generators.json",
20
+ "typings": "./src/index.d.ts",
21
+ "dependencies": {
22
+ "@nx-extend/core": "1.2.2",
23
+ "shelljs": "^0.8.5"
24
+ },
25
+ "peerDependencies": {}
26
+ }
@@ -0,0 +1,10 @@
1
+ import type { ExecutorContext } from '@nrwl/devkit';
2
+ export interface ExecutorSchema {
3
+ projectId: string;
4
+ orgId: string;
5
+ debug?: boolean;
6
+ }
7
+ export declare function buildExecutor(options: ExecutorSchema, context: ExecutorContext): Promise<{
8
+ success: boolean;
9
+ }>;
10
+ export default buildExecutor;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildExecutor = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const core_1 = require("@nx-extend/core");
6
+ function buildExecutor(options, context) {
7
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8
+ const { targets } = context.workspace.projects[context.projectName];
9
+ if (!targets['build-next']) {
10
+ throw new Error(`"${context.projectName}" is missing the original "build-next" target!`);
11
+ }
12
+ if (!((_b = (_a = targets['build-next']) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.outputPath)) {
13
+ throw new Error('"build-next" target has no "outputPath" configured!');
14
+ }
15
+ // First make sure the .vercel/project.json exists
16
+ (0, devkit_1.writeJsonFile)('./.vercel/project.json', {
17
+ 'projectId': options.projectId,
18
+ 'orgId': options.orgId,
19
+ 'settings': {
20
+ 'createdAt': new Date().getTime(),
21
+ 'framework': 'nextjs',
22
+ 'devCommand': null,
23
+ 'installCommand': 'echo \'\'',
24
+ 'buildCommand': `nx build-next ${context.projectName} --prod`,
25
+ 'outputDirectory': `${(_d = (_c = targets['build-next']) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.outputPath}/.next`,
26
+ 'rootDirectory': null,
27
+ 'directoryListing': false,
28
+ 'nodeVersion': '16.x'
29
+ }
30
+ });
31
+ const { success } = (0, core_1.execCommand)((0, core_1.buildCommand)([
32
+ 'npx vercel build',
33
+ `--output ${(_f = (_e = targets['build-next']) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.outputPath}/.vercel/output`,
34
+ options.debug && '--debug'
35
+ ]));
36
+ if (success) {
37
+ (0, devkit_1.writeJsonFile)(`${(_h = (_g = targets['build-next']) === null || _g === void 0 ? void 0 : _g.options) === null || _h === void 0 ? void 0 : _h.outputPath}/.vercel/project.json`, (0, devkit_1.readJsonFile)('./.vercel/project.json'));
38
+ }
39
+ return Promise.resolve({ success });
40
+ }
41
+ exports.buildExecutor = buildExecutor;
42
+ exports.default = buildExecutor;
43
+ //# sourceMappingURL=build.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../../../packages/vercel/src/executors/build/build.impl.ts"],"names":[],"mappings":";;;AAAA,yCAA0D;AAC1D,0CAA2D;AAU3D,SAAgB,aAAa,CAC3B,OAAuB,EACvB,OAAwB;;IAExB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAEnE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,CAAC,WAAW,gDAAgD,CAAC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0,0 +1,57 @@
1
+ import { readJsonFile, writeJsonFile } from '@nrwl/devkit'
2
+ import { buildCommand, execCommand } from '@nx-extend/core'
3
+
4
+ import type { ExecutorContext } from '@nrwl/devkit'
5
+
6
+ export interface ExecutorSchema {
7
+ projectId: string
8
+ orgId: string
9
+ debug?: boolean
10
+ }
11
+
12
+ export function buildExecutor(
13
+ options: ExecutorSchema,
14
+ context: ExecutorContext
15
+ ): Promise<{ success: boolean }> {
16
+ const { targets } = context.workspace.projects[context.projectName]
17
+
18
+ if (!targets['build-next']) {
19
+ throw new Error(`"${context.projectName}" is missing the original "build-next" target!`)
20
+ }
21
+
22
+ if (!targets['build-next']?.options?.outputPath) {
23
+ throw new Error('"build-next" target has no "outputPath" configured!')
24
+ }
25
+
26
+ // First make sure the .vercel/project.json exists
27
+ writeJsonFile('./.vercel/project.json', {
28
+ 'projectId': options.projectId,
29
+ 'orgId': options.orgId,
30
+ 'settings': {
31
+ 'createdAt': new Date().getTime(),
32
+ 'framework': 'nextjs',
33
+ 'devCommand': null,
34
+ 'installCommand': 'echo \'\'',
35
+ 'buildCommand': `nx build-next ${context.projectName} --prod`,
36
+ 'outputDirectory': `${targets['build-next']?.options?.outputPath}/.next`,
37
+ 'rootDirectory': null,
38
+ 'directoryListing': false,
39
+ 'nodeVersion': '16.x'
40
+ }
41
+ })
42
+
43
+ const { success } = execCommand(buildCommand([
44
+ 'npx vercel build',
45
+ `--output ${targets['build-next']?.options?.outputPath}/.vercel/output`,
46
+
47
+ options.debug && '--debug'
48
+ ]))
49
+
50
+ if (success) {
51
+ writeJsonFile(`${targets['build-next']?.options?.outputPath}/.vercel/project.json`, readJsonFile('./.vercel/project.json'))
52
+ }
53
+
54
+ return Promise.resolve({ success })
55
+ }
56
+
57
+ export default buildExecutor
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const build_impl_1 = require("./build.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(build_impl_1.buildExecutor);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/vercel/src/executors/build/compat.ts"],"names":[],"mappings":";;AAAA,yCAAgD;AAEhD,6CAA4C;AAE5C,kBAAe,IAAA,0BAAiB,EAAC,0BAAa,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "type": "object",
4
+ "cli": "nx",
5
+ "title": "Deploy executor",
6
+ "description": "Deploy to Firebase Hosting",
7
+ "properties": {
8
+ "projectId": {
9
+ "type": "string",
10
+ "description": "Site name in Firebase Hosting"
11
+ },
12
+ "orgId": {
13
+ "type": "string",
14
+ "description": "Site name in Firebase Hosting"
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const deploy_impl_1 = require("./deploy.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(deploy_impl_1.deployExecutor);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/vercel/src/executors/deploy/compat.ts"],"names":[],"mappings":";;AAAA,yCAAgD;AAEhD,+CAA8C;AAE9C,kBAAe,IAAA,0BAAiB,EAAC,4BAAc,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { ExecutorContext } from '@nrwl/devkit';
2
+ export interface ExecutorSchema {
3
+ debug?: boolean;
4
+ }
5
+ export declare function deployExecutor(options: ExecutorSchema, context: ExecutorContext): Promise<{
6
+ success: boolean;
7
+ }>;
8
+ export default deployExecutor;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployExecutor = void 0;
4
+ const core_1 = require("@nx-extend/core");
5
+ const fs_1 = require("fs");
6
+ const path_1 = require("path");
7
+ function deployExecutor(options, context) {
8
+ var _a, _b;
9
+ const { targets } = context.workspace.projects[context.projectName];
10
+ if (!((_b = (_a = targets['build-next']) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.outputPath)) {
11
+ throw new Error('"build-next" target has no "outputPath" configured!');
12
+ }
13
+ if (!(0, fs_1.existsSync)((0, path_1.join)(targets['build-next'].options.outputPath, '.vercel/project.json'))) {
14
+ throw new Error('No ".vercel/project.json" found in dist folder! ');
15
+ }
16
+ return Promise.resolve((0, core_1.execCommand)((0, core_1.buildCommand)([
17
+ 'npx vercel deploy ---prebuilt',
18
+ options.debug && '--debug'
19
+ ]), {
20
+ cwd: targets['build-next'].options.outputPath
21
+ }));
22
+ }
23
+ exports.deployExecutor = deployExecutor;
24
+ exports.default = deployExecutor;
25
+ //# sourceMappingURL=deploy.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.impl.js","sourceRoot":"","sources":["../../../../../../packages/vercel/src/executors/deploy/deploy.impl.ts"],"names":[],"mappings":";;;AAAA,0CAA2D;AAC3D,2BAA+B;AAC/B,+BAA2B;AAQ3B,SAAgB,cAAc,CAC5B,OAAuB,EACvB,OAAwB;;IAExB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAEnE,IAAI,CAAC,CAAA,MAAA,MAAA,OAAO,CAAC,YAAY,CAAC,0CAAE,OAAO,0CAAE,UAAU,CAAA,EAAE;QAC/C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;KACvE;IAED,IAAI,CAAC,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,EAAE;QACvF,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;KACpE;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,kBAAW,EAAC,IAAA,mBAAY,EAAC;QAC9C,+BAA+B;QAC/B,OAAO,CAAC,KAAK,IAAI,SAAS;KAC3B,CAAC,EAAE;QACF,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU;KAC9C,CAAC,CAAC,CAAA;AACL,CAAC;AApBD,wCAoBC;AAED,kBAAe,cAAc,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { buildCommand, execCommand } from '@nx-extend/core'
2
+ import { existsSync } from 'fs'
3
+ import { join } from 'path'
4
+
5
+ import type { ExecutorContext } from '@nrwl/devkit'
6
+
7
+ export interface ExecutorSchema {
8
+ debug?: boolean
9
+ }
10
+
11
+ export function deployExecutor(
12
+ options: ExecutorSchema,
13
+ context: ExecutorContext
14
+ ): Promise<{ success: boolean }> {
15
+ const { targets } = context.workspace.projects[context.projectName]
16
+
17
+ if (!targets['build-next']?.options?.outputPath) {
18
+ throw new Error('"build-next" target has no "outputPath" configured!')
19
+ }
20
+
21
+ if (!existsSync(join(targets['build-next'].options.outputPath, '.vercel/project.json'))) {
22
+ throw new Error('No ".vercel/project.json" found in dist folder! ')
23
+ }
24
+
25
+ return Promise.resolve(execCommand(buildCommand([
26
+ 'npx vercel deploy ---prebuilt',
27
+ options.debug && '--debug'
28
+ ]), {
29
+ cwd: targets['build-next'].options.outputPath
30
+ }))
31
+ }
32
+
33
+ export default deployExecutor
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "type": "object",
4
+ "cli": "nx",
5
+ "title": "Deploy executor",
6
+ "description": "Deploy to Firebase Hosting",
7
+ "properties": {
8
+ }
9
+ }
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export default function (host: Tree, options: unknown): Promise<void>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ function default_1(host, options) {
5
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
6
+ // TODO::
7
+ });
8
+ }
9
+ exports.default = default_1;
10
+ //# sourceMappingURL=add.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.impl.js","sourceRoot":"","sources":["../../../../../../packages/vercel/src/generators/add/add.impl.ts"],"names":[],"mappings":";;;AAIA,mBACE,IAAU,EACV,OAAgB;;QAEhB,SAAS;IACX,CAAC;CAAA;AALD,4BAKC"}
@@ -0,0 +1,10 @@
1
+ import {
2
+ Tree
3
+ } from '@nrwl/devkit'
4
+
5
+ export default async function (
6
+ host: Tree,
7
+ options: unknown
8
+ ) {
9
+ // TODO::
10
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "id": "Vercel",
5
+ "title": "",
6
+ "type": "object",
7
+ "properties": {
8
+ "target": {
9
+ "type": "string",
10
+ "description": "Target to add Firebase Hosting to",
11
+ "$default": {
12
+ "$source": "argv",
13
+ "index": 0
14
+ },
15
+ "x-prompt": "To what target would you like to add Vercel?"
16
+ }
17
+ },
18
+ "required": ["target", "site"]
19
+ }
package/src/index.d.ts ADDED
File without changes
package/src/index.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/vercel/src/index.ts"],"names":[],"mappings":""}