Skip to content

Commit

Permalink
chore(repo): update repo to 13.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Jan 29, 2022
1 parent cdf2cf0 commit 5e3f1d4
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 189 deletions.
26 changes: 13 additions & 13 deletions package.json
Expand Up @@ -60,19 +60,19 @@
"@ngrx/schematics": "~13.0.0",
"@ngrx/store": "~13.0.0",
"@ngrx/store-devtools": "~13.0.0",
"@nrwl/cli": "13.7.0",
"@nrwl/cypress": "13.7.0",
"@nrwl/eslint-plugin-nx": "13.7.0",
"@nrwl/jest": "13.7.0",
"@nrwl/js": "13.7.0",
"@nrwl/linter": "13.7.0",
"@nrwl/next": "13.7.0",
"@nrwl/node": "13.7.0",
"@nrwl/cli": "13.7.1",
"@nrwl/cypress": "13.7.1",
"@nrwl/eslint-plugin-nx": "13.7.1",
"@nrwl/jest": "13.7.1",
"@nrwl/js": "13.7.1",
"@nrwl/linter": "13.7.1",
"@nrwl/next": "13.7.1",
"@nrwl/node": "13.7.1",
"@nrwl/nx-cloud": "13.1.2",
"@nrwl/react": "13.7.0",
"@nrwl/tao": "13.7.0",
"@nrwl/web": "13.7.0",
"@nrwl/workspace": "13.7.0",
"@nrwl/react": "13.7.1",
"@nrwl/tao": "13.7.1",
"@nrwl/web": "13.7.1",
"@nrwl/workspace": "13.7.1",
"@parcel/watcher": "2.0.4",
"@phenomnomnominal/tsquery": "4.1.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
Expand Down Expand Up @@ -300,4 +300,4 @@
"**/xmlhttprequest-ssl": "~1.6.2",
"immer": "~9.0.6"
}
}
}
14 changes: 7 additions & 7 deletions packages/workspace/src/core/hasher/file-hasher.ts
@@ -1,16 +1,16 @@
import { GitBasedFileHasher } from "./git-based-file-hasher";
import { appRootPath } from "@nrwl/tao/src/utils/app-root";
import { NodeBasedFileHasher } from "./node-based-file-hasher";
import { FileHasherBase } from "./file-hasher-base";
import { execSync } from "child_process";
import { GitBasedFileHasher } from './git-based-file-hasher';
import { appRootPath } from '@nrwl/tao/src/utils/app-root';
import { NodeBasedFileHasher } from './node-based-file-hasher';
import { FileHasherBase } from './file-hasher-base';
import { execSync } from 'child_process';

function createFileHasher(): FileHasherBase {
// special case for unit tests
if (appRootPath === "/root") {
if (appRootPath === '/root') {
return new NodeBasedFileHasher();
}
try {
execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
return new GitBasedFileHasher();
} catch {
return new NodeBasedFileHasher();
Expand Down
120 changes: 60 additions & 60 deletions packages/workspace/src/core/project-graph/daemon/client/client.ts
@@ -1,39 +1,39 @@
import { ProjectGraph } from "@nrwl/devkit";
import { ChildProcess, spawn, spawnSync } from "child_process";
import { openSync, readFileSync } from "fs";
import { ensureDirSync, ensureFileSync } from "fs-extra";
import { connect } from "net";
import { performance } from "perf_hooks";
import { output } from "../../../../utilities/output";
import { ProjectGraph } from '@nrwl/devkit';
import { ChildProcess, spawn, spawnSync } from 'child_process';
import { openSync, readFileSync } from 'fs';
import { ensureDirSync, ensureFileSync } from 'fs-extra';
import { connect } from 'net';
import { performance } from 'perf_hooks';
import { output } from '../../../../utilities/output';
import {
safelyCleanUpExistingProcess,
writeDaemonJsonProcessCache
} from "../cache";
import { FULL_OS_SOCKET_PATH, killSocketOrPath } from "../socket-utils";
writeDaemonJsonProcessCache,
} from '../cache';
import { FULL_OS_SOCKET_PATH, killSocketOrPath } from '../socket-utils';
import {
DAEMON_DIR_FOR_CURRENT_WORKSPACE,
DAEMON_OUTPUT_LOG_FILE
} from "../tmp-dir";
DAEMON_OUTPUT_LOG_FILE,
} from '../tmp-dir';

export async function startInBackground(): Promise<ChildProcess["pid"]> {
export async function startInBackground(): Promise<ChildProcess['pid']> {
await safelyCleanUpExistingProcess();
ensureDirSync(DAEMON_DIR_FOR_CURRENT_WORKSPACE);
ensureFileSync(DAEMON_OUTPUT_LOG_FILE);

const out = openSync(DAEMON_OUTPUT_LOG_FILE, "a");
const err = openSync(DAEMON_OUTPUT_LOG_FILE, "a");
const backgroundProcess = spawn(process.execPath, ["../server/start.js"], {
const out = openSync(DAEMON_OUTPUT_LOG_FILE, 'a');
const err = openSync(DAEMON_OUTPUT_LOG_FILE, 'a');
const backgroundProcess = spawn(process.execPath, ['../server/start.js'], {
cwd: __dirname,
stdio: ["ignore", out, err],
stdio: ['ignore', out, err],
detached: true,
windowsHide: true,
shell: false
shell: false,
});
backgroundProcess.unref();

// Persist metadata about the background process so that it can be cleaned up later if needed
await writeDaemonJsonProcessCache({
processId: backgroundProcess.pid
processId: backgroundProcess.pid,
});

/**
Expand All @@ -48,9 +48,9 @@ export async function startInBackground(): Promise<ChildProcess["pid"]> {
} else if (attempts > 200) {
// daemon fails to start, the process probably exited
// we print the logs and exit the client
reject(daemonProcessException(
"Failed to start the Nx Daemon process."
));
reject(
daemonProcessException('Failed to start the Nx Daemon process.')
);
} else {
attempts++;
}
Expand All @@ -60,18 +60,18 @@ export async function startInBackground(): Promise<ChildProcess["pid"]> {

function daemonProcessException(message: string) {
try {
let log = readFileSync(DAEMON_OUTPUT_LOG_FILE).toString().split("\n");
let log = readFileSync(DAEMON_OUTPUT_LOG_FILE).toString().split('\n');
if (log.length > 20) {
log = log.slice(log.length - 20);
}
return new Error(
[
message,
"Messages from the log:",
'Messages from the log:',
...log,
"\n",
`More information: ${DAEMON_OUTPUT_LOG_FILE}`
].join("\n")
'\n',
`More information: ${DAEMON_OUTPUT_LOG_FILE}`,
].join('\n')
);
} catch (e) {
return new Error(message);
Expand All @@ -80,22 +80,22 @@ function daemonProcessException(message: string) {

export function startInCurrentProcess(): void {
output.log({
title: `Daemon Server - Starting in the current process...`
title: `Daemon Server - Starting in the current process...`,
});

spawnSync(process.execPath, ["../server/start.js"], {
spawnSync(process.execPath, ['../server/start.js'], {
cwd: __dirname,
stdio: "inherit"
stdio: 'inherit',
});
}

export function stop(): void {
spawnSync(process.execPath, ["../server/stop.js"], {
spawnSync(process.execPath, ['../server/stop.js'], {
cwd: __dirname,
stdio: "inherit"
stdio: 'inherit',
});

output.log({ title: "Daemon Server - Stopped" });
output.log({ title: 'Daemon Server - Stopped' });
}

/**
Expand All @@ -113,7 +113,7 @@ export async function isServerAvailable(): Promise<boolean> {
socket.destroy();
resolve(true);
});
socket.once("error", () => {
socket.once('error', () => {
resolve(false);
});
} catch (err) {
Expand All @@ -134,25 +134,25 @@ export async function isServerAvailable(): Promise<boolean> {
*/
export async function getProjectGraphFromServer(): Promise<ProjectGraph> {
return new Promise((resolve, reject) => {
performance.mark("getProjectGraphFromServer-start");
performance.mark('getProjectGraphFromServer-start');
const socket = connect(FULL_OS_SOCKET_PATH);

socket.on("error", (err) => {
socket.on('error', (err) => {
if (!err.message) {
return reject(err);
}
if (err.message.startsWith("LOCK-FILES-CHANGED")) {
if (err.message.startsWith('LOCK-FILES-CHANGED')) {
return getProjectGraphFromServer().then(resolve, reject);
}
let error: any;
if (err.message.startsWith("connect ENOENT")) {
error = daemonProcessException("The Daemon Server is not running");
} else if (err.message.startsWith("connect ECONNREFUSED")) {
if (err.message.startsWith('connect ENOENT')) {
error = daemonProcessException('The Daemon Server is not running');
} else if (err.message.startsWith('connect ECONNREFUSED')) {
error = daemonProcessException(
`A server instance had not been fully shut down. Please try running the command again.`
);
killSocketOrPath();
} else if (err.message.startsWith("read ECONNRESET")) {
} else if (err.message.startsWith('read ECONNRESET')) {
error = daemonProcessException(
`Unable to connect to the daemon process.`
);
Expand All @@ -165,51 +165,51 @@ export async function getProjectGraphFromServer(): Promise<ProjectGraph> {
* request payload. See the notes above createServer() for more context as to why we explicitly
* request the graph from the client like this.
*/
socket.on("connect", () => {
socket.write("REQUEST_PROJECT_GRAPH_PAYLOAD");
socket.on('connect', () => {
socket.write('REQUEST_PROJECT_GRAPH_PAYLOAD');

let serializedProjectGraphResult = "";
socket.on("data", (data) => {
let serializedProjectGraphResult = '';
socket.on('data', (data) => {
serializedProjectGraphResult += data.toString();
});

socket.on("end", () => {
socket.on('end', () => {
try {
performance.mark("json-parse-start");
performance.mark('json-parse-start');
const projectGraphResult = JSON.parse(serializedProjectGraphResult);
performance.mark("json-parse-end");
performance.mark('json-parse-end');
performance.measure(
"deserialize graph result on the client",
"json-parse-start",
"json-parse-end"
'deserialize graph result on the client',
'json-parse-start',
'json-parse-end'
);
if (projectGraphResult.error) {
reject(projectGraphResult.error);
} else {
performance.measure(
"total for getProjectGraphFromServer()",
"getProjectGraphFromServer-start",
"json-parse-end"
'total for getProjectGraphFromServer()',
'getProjectGraphFromServer-start',
'json-parse-end'
);
return resolve(projectGraphResult.projectGraph);
}
} catch (e) {
const endOfGraph =
serializedProjectGraphResult.length > 300
? serializedProjectGraphResult.substring(
serializedProjectGraphResult.length - 300
)
serializedProjectGraphResult.length - 300
)
: serializedProjectGraphResult;
reject(
daemonProcessException(
[
"Could not deserialize project graph.",
'Could not deserialize project graph.',
`Message: ${e.message}`,
"\n",
'\n',
`Received:`,
endOfGraph,
"\n"
].join("\n")
'\n',
].join('\n')
)
);
}
Expand Down

1 comment on commit 5e3f1d4

@vercel
Copy link

@vercel vercel bot commented on 5e3f1d4 Jan 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.