@nx-extend/vercel 1.0.0 → 1.2.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 CHANGED
@@ -0,0 +1,25 @@
1
+
2
+ # [1.2.0](https://github.com/TriPSs/nx-extend/compare/vercel@1.1.1...vercel@1.2.0) (2022-09-06)
3
+
4
+
5
+ ### Features
6
+
7
+ * **vercel:** When deploying with `production` configuration also use that environment on Vercel ([e601cc3](https://github.com/TriPSs/nx-extend/commit/e601cc3fe136cfd9d1e82804569f43aa203cf8d1))
8
+
9
+
10
+
11
+ ## [1.1.1](https://github.com/TriPSs/nx-extend/compare/vercel@1.1.0...vercel@1.1.1) (2022-09-05)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **vercel:** Fixed pull command overwriting the project settings ([4bdfa01](https://github.com/TriPSs/nx-extend/commit/4bdfa0147a8c95afdb2f1c89bc89445ef616c73b))
17
+
18
+
19
+
20
+ # [1.1.0](https://github.com/TriPSs/nx-extend/compare/vercel@1.0.0...vercel@1.1.0) (2022-09-05)
21
+
22
+
23
+ ### Features
24
+
25
+ * **vercel:** Added pulling of environment before building ([bad51f4](https://github.com/TriPSs/nx-extend/commit/bad51f4f0f25e413827c5f623ef21ad8a0061353))
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <img src="https://badgen.net/npm/v/@nx-extend/vercel" alt="@nx-extend/vercel NPM package">
5
5
  </a>
6
6
 
7
- **Nx plugin for deploy your app to [Cloud Storage](https://cloud.google.com/storage)**.
7
+ **Nx plugin for deploy your app to [Vercel](https://vercel.com)**.
8
8
 
9
9
  ## Setup
10
10
 
@@ -16,10 +16,20 @@ npm install -D @nx-extend/vercel
16
16
 
17
17
  ## Usage
18
18
 
19
- ### Upload
19
+ ### Build
20
20
 
21
21
  #### Available options:
22
22
 
23
- | name | type | default | description |
24
- | ------------ | -------- | ------- | ---------------------------------------------------- |
25
- | | | | |
23
+ | name | type | default | description |
24
+ |-------------------|-----------|---------|---------------------------|
25
+ | **`--projectId`** | `string` | `` | Project ID of Vercel |
26
+ | **`--orgId`** | `string` | `` | Organisation ID of Vercel |
27
+ | **`--debug`** | `boolean` | `false` | Run Vercel in debug mode |
28
+
29
+ ### Deploy
30
+
31
+ #### Available options:
32
+
33
+ | name | type | default | description |
34
+ |---------------|-----------|---------|--------------------------|
35
+ | **`--debug`** | `boolean` | `false` | Run Vercel in debug mode |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx-extend/vercel",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "keywords": [
5
5
  "nx",
6
6
  "vercel"
@@ -14,18 +14,30 @@ function buildExecutor(options, context) {
14
14
  }
15
15
  // First make sure the .vercel/project.json exists
16
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'
17
+ projectId: options.projectId,
18
+ orgId: options.orgId,
19
+ settings: {}
20
+ });
21
+ // Pull latest
22
+ (0, core_1.execCommand)((0, core_1.buildCommand)([
23
+ 'npx vercel pull --yes',
24
+ context.configurationName === 'production' && '--environment=production',
25
+ options.debug && '--debug'
26
+ ]));
27
+ // Update the project json with the correct settings
28
+ (0, devkit_1.writeJsonFile)('./.vercel/project.json', {
29
+ projectId: options.projectId,
30
+ orgId: options.orgId,
31
+ settings: {
32
+ createdAt: new Date().getTime(),
33
+ framework: 'nextjs',
34
+ devCommand: null,
35
+ installCommand: 'echo \'\'',
36
+ buildCommand: `nx build-next ${context.projectName} --prod`,
37
+ outputDirectory: `${(_d = (_c = targets['build-next']) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.outputPath}/.next`,
38
+ rootDirectory: null,
39
+ directoryListing: false,
40
+ nodeVersion: '16.x'
29
41
  }
30
42
  });
31
43
  const { success } = (0, core_1.execCommand)((0, core_1.buildCommand)([
@@ -1 +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,CAAA;KACzF;IAED,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,kDAAkD;IAClD,IAAA,sBAAa,EAAC,wBAAwB,EAAE;QACtC,WAAW,EAAE,OAAO,CAAC,SAAS;QAC9B,OAAO,EAAE,OAAO,CAAC,KAAK;QACtB,UAAU,EAAE;YACV,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;YACjC,WAAW,EAAE,QAAQ;YACrB,YAAY,EAAE,IAAI;YAClB,gBAAgB,EAAE,WAAW;YAC7B,cAAc,EAAE,iBAAiB,OAAO,CAAC,WAAW,SAAS;YAC7D,iBAAiB,EAAE,GAAG,MAAA,MAAA,OAAO,CAAC,YAAY,CAAC,0CAAE,OAAO,0CAAE,UAAU,QAAQ;YACxE,eAAe,EAAE,IAAI;YACrB,kBAAkB,EAAE,KAAK;YACzB,aAAa,EAAE,MAAM;SACtB;KACF,CAAC,CAAA;IAEF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAW,EAAC,IAAA,mBAAY,EAAC;QAC3C,kBAAkB;QAClB,YAAY,MAAA,MAAA,OAAO,CAAC,YAAY,CAAC,0CAAE,OAAO,0CAAE,UAAU,iBAAiB;QAEvE,OAAO,CAAC,KAAK,IAAI,SAAS;KAC3B,CAAC,CAAC,CAAA;IAEH,IAAI,OAAO,EAAE;QACX,IAAA,sBAAa,EAAC,GAAG,MAAA,MAAA,OAAO,CAAC,YAAY,CAAC,0CAAE,OAAO,0CAAE,UAAU,uBAAuB,EAAE,IAAA,qBAAY,EAAC,wBAAwB,CAAC,CAAC,CAAA;KAC5H;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;AACrC,CAAC;AA3CD,sCA2CC;AAED,kBAAe,aAAa,CAAA"}
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,CAAA;KACzF;IAED,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,kDAAkD;IAClD,IAA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C,wBAAwB,CAAC,CAAC,CAAA;KAC5H;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;AACrC,CAAC;AA1DD,sCA0DC;AAED,kBAAe,aAAa,CAAA"}
@@ -25,18 +25,33 @@ export function buildExecutor(
25
25
 
26
26
  // First make sure the .vercel/project.json exists
27
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'
28
+ projectId: options.projectId,
29
+ orgId: options.orgId,
30
+ settings: {}
31
+ })
32
+
33
+ // Pull latest
34
+ execCommand(buildCommand([
35
+ 'npx vercel pull --yes',
36
+ context.configurationName === 'production' && '--environment=production',
37
+
38
+ options.debug && '--debug'
39
+ ]))
40
+
41
+ // Update the project json with the correct settings
42
+ writeJsonFile('./.vercel/project.json', {
43
+ projectId: options.projectId,
44
+ orgId: options.orgId,
45
+ settings: {
46
+ createdAt: new Date().getTime(),
47
+ framework: 'nextjs',
48
+ devCommand: null,
49
+ installCommand: 'echo \'\'',
50
+ buildCommand: `nx build-next ${context.projectName} --prod`,
51
+ outputDirectory: `${targets['build-next']?.options?.outputPath}/.next`,
52
+ rootDirectory: null,
53
+ directoryListing: false,
54
+ nodeVersion: '16.x'
40
55
  }
41
56
  })
42
57
 
@@ -15,6 +15,7 @@ function deployExecutor(options, context) {
15
15
  }
16
16
  return Promise.resolve((0, core_1.execCommand)((0, core_1.buildCommand)([
17
17
  'npx vercel deploy ---prebuilt',
18
+ context.configurationName === 'production' && '--prod',
18
19
  options.debug && '--debug'
19
20
  ]), {
20
21
  cwd: targets['build-next'].options.outputPath
@@ -1 +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"}
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,iBAAiB,KAAK,YAAY,IAAI,QAAQ;QAEtD,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;AAtBD,wCAsBC;AAED,kBAAe,cAAc,CAAA"}
@@ -24,6 +24,8 @@ export function deployExecutor(
24
24
 
25
25
  return Promise.resolve(execCommand(buildCommand([
26
26
  'npx vercel deploy ---prebuilt',
27
+ context.configurationName === 'production' && '--prod',
28
+
27
29
  options.debug && '--debug'
28
30
  ]), {
29
31
  cwd: targets['build-next'].options.outputPath
@@ -3,7 +3,7 @@
3
3
  "type": "object",
4
4
  "cli": "nx",
5
5
  "title": "Deploy executor",
6
- "description": "Deploy to Firebase Hosting",
6
+ "description": "Deploy to Vercel",
7
7
  "properties": {
8
8
  }
9
9
  }