Skip to content

Commit

Permalink
feat: update to Node 16 with strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Oct 21, 2022
1 parent 656ae29 commit 9cfa0b2
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ inputs:
description: 'Path to the Nx workspace, needed if not the repository root'
required: false
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
branding:
icon: 'terminal'
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "nrwl-nx-action",
"version": "3.0.0",
"version": "3.1.0",
"description": "![Banner](.github/assets/banner-thin.png)",
"main": "lib/index.js",
"scripts": {
"build": "tsc",
"build": "tsc --build ./tsconfig.build.json",
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"prepackage": "npm run build",
Expand Down Expand Up @@ -47,6 +47,7 @@
"@commitlint/cli": "17.1.2",
"@commitlint/config-conventional": "17.1.0",
"@octokit/webhooks": "10.3.0",
"@tsconfig/node16-strictest": "1.0.4",
"@typescript-eslint/eslint-plugin": "5.40.1",
"@typescript-eslint/parser": "5.40.1",
"@vercel/ncc": "0.34.0",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as core from '@actions/core';

import { CommandBuilder } from './command-builder';
import { Inputs } from './inputs';
import type { Inputs } from './inputs';
import { runNx } from './run-nx';

const ARGS_REGEX = /\w+|"(?:\\"|[^"])+"/g;
Expand Down
11 changes: 5 additions & 6 deletions src/run-nx.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as github from '@actions/github';
// eslint-disable-next-line import/no-unresolved
import { PullRequest, PushEvent } from '@octokit/webhooks-types';
import type { PullRequest, PushEvent } from '@octokit/webhooks-types';

import { CommandWrapper } from './command-builder';
import { Inputs } from './inputs';
import type { CommandWrapper } from './command-builder';
import type { Inputs } from './inputs';

async function retrieveGitBoundaries(): Promise<[base: string, head: string]> {
if (github.context.eventName === 'pull_request') {
Expand Down Expand Up @@ -89,11 +88,11 @@ export async function runNx(inputs: Inputs, nx: CommandWrapper): Promise<void> {

if (inputs.nxCloud) {
args.push('--scan');
process.env.NX_RUN_GROUP = github.context.runId.toString();
process.env['NX_RUN_GROUP'] = github.context.runId.toString();

if (github.context.eventName === 'pull_request') {
const prPayload = github.context.payload.pull_request as PullRequest;
process.env.NX_BRANCH = prPayload.number.toString();
process.env['NX_BRANCH'] = prPayload.number.toString();
}
}

Expand Down
5 changes: 5 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": [],
"files": ["src/index.ts"]
}
12 changes: 5 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"extends": "@tsconfig/node16-strictest/tsconfig.json",
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"removeComments": true,
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true
"rootDir": "./src"
},
"exclude": ["node_modules", "**/*.spec.ts"]
"include": ["**/*.ts"],
"exclude": ["dist", "lib"]
}

0 comments on commit 9cfa0b2

Please sign in to comment.