From 88204a0f231ec595e845f12d48d41b57f0742cf0 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Wed, 9 Mar 2022 11:30:57 -0500 Subject: [PATCH] feat(core): prep project graph during postinstall (#9204) --- packages/workspace/package.json | 3 +++ packages/workspace/src/init/init.ts | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 packages/workspace/src/init/init.ts diff --git a/packages/workspace/package.json b/packages/workspace/package.json index 4dc947e5155ee..64dda344701a7 100644 --- a/packages/workspace/package.json +++ b/packages/workspace/package.json @@ -2,6 +2,9 @@ "name": "@nrwl/workspace", "version": "0.0.1", "description": "Smart, Fast and Extensible Build System", + "scripts": { + "postinstall": "node ./src/init/init" + }, "repository": { "type": "git", "url": "https://github.com/nrwl/nx.git", diff --git a/packages/workspace/src/init/init.ts b/packages/workspace/src/init/init.ts new file mode 100644 index 0000000000000..15164c12b6ace --- /dev/null +++ b/packages/workspace/src/init/init.ts @@ -0,0 +1,9 @@ +import { createProjectGraphAsync } from '../core/project-graph/project-graph'; + +(async () => { + try { + await createProjectGraphAsync(); + } catch (e) { + // Do not error since this runs in a postinstall + } +})();