@servicetitan/startup 36.1.2-canary.9 → 36.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.
@@ -1 +1 @@
1
- {"version":3,"file":"check-startup-location.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/check-startup-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAO,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,wBAAgB,oBAAoB,CAChC,WAAW,EAAE,WAAW,EACxB,EAAE,kBAAkB,EAAE,GAAE,YAAiB,QAgB5C"}
1
+ {"version":3,"file":"check-startup-location.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/check-startup-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAO,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,wBAAgB,oBAAoB,CAChC,WAAW,EAAE,WAAW,EACxB,EAAE,kBAAkB,EAAE,GAAE,YAAiB,QA+B5C"}
@@ -11,10 +11,22 @@ Object.defineProperty(exports, "checkStartupLocation", {
11
11
  const _utils = require("../../utils");
12
12
  const _clinpm = require("./cli-npm");
13
13
  function checkStartupLocation(commandName, { allowRunFromGlobal } = {}) {
14
- if (allowRunFromGlobal || process.env.SKIP_STARTUP_LOCATION_CHECK) {
14
+ if (process.env.SKIP_STARTUP_LOCATION_CHECK) {
15
15
  return;
16
16
  }
17
17
  const projectRoot = (0, _clinpm.npmGetProjectRoot)();
18
+ /*
19
+ * Set nx's workspace root so lerna/nx don't walk past a worktree into the
20
+ * main repo. nx walks ancestors looking for node_modules/nx and picks the
21
+ * highest match, which lands on the main repo when the worktree was
22
+ * created inside it. See FAR-1803.
23
+ */ if (projectRoot) {
24
+ var _process_env, _NX_WORKSPACE_ROOT_PATH;
25
+ (_NX_WORKSPACE_ROOT_PATH = (_process_env = process.env).NX_WORKSPACE_ROOT_PATH) !== null && _NX_WORKSPACE_ROOT_PATH !== void 0 ? _NX_WORKSPACE_ROOT_PATH : _process_env.NX_WORKSPACE_ROOT_PATH = projectRoot;
26
+ }
27
+ if (allowRunFromGlobal) {
28
+ return;
29
+ }
18
30
  if (projectRoot && __dirname.startsWith(projectRoot)) {
19
31
  process.env.SKIP_STARTUP_LOCATION_CHECK = 'true';
20
32
  return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/utils/check-startup-location.ts"],"sourcesContent":["import { CommandName, log } from '../../utils';\nimport { CommandEntry } from '../commands/types';\nimport { npmGetProjectRoot } from './cli-npm';\n\nexport function checkStartupLocation(\n commandName: CommandName,\n { allowRunFromGlobal }: CommandEntry = {}\n) {\n if (allowRunFromGlobal || process.env.SKIP_STARTUP_LOCATION_CHECK) {\n return;\n }\n\n const projectRoot = npmGetProjectRoot();\n if (projectRoot && __dirname.startsWith(projectRoot)) {\n process.env.SKIP_STARTUP_LOCATION_CHECK = 'true';\n return;\n }\n\n log.error(\n `Error: ${commandName} must be run from the local @servicetitan/startup installation`\n );\n process.exit(1);\n}\n"],"names":["checkStartupLocation","commandName","allowRunFromGlobal","process","env","SKIP_STARTUP_LOCATION_CHECK","projectRoot","npmGetProjectRoot","__dirname","startsWith","log","error","exit"],"mappings":";;;;+BAIgBA;;;eAAAA;;;uBAJiB;wBAEC;AAE3B,SAASA,qBACZC,WAAwB,EACxB,EAAEC,kBAAkB,EAAgB,GAAG,CAAC,CAAC;IAEzC,IAAIA,sBAAsBC,QAAQC,GAAG,CAACC,2BAA2B,EAAE;QAC/D;IACJ;IAEA,MAAMC,cAAcC,IAAAA,yBAAiB;IACrC,IAAID,eAAeE,UAAUC,UAAU,CAACH,cAAc;QAClDH,QAAQC,GAAG,CAACC,2BAA2B,GAAG;QAC1C;IACJ;IAEAK,UAAG,CAACC,KAAK,CACL,CAAC,OAAO,EAAEV,YAAY,8DAA8D,CAAC;IAEzFE,QAAQS,IAAI,CAAC;AACjB"}
1
+ {"version":3,"sources":["../../../src/cli/utils/check-startup-location.ts"],"sourcesContent":["import { CommandName, log } from '../../utils';\nimport { CommandEntry } from '../commands/types';\nimport { npmGetProjectRoot } from './cli-npm';\n\nexport function checkStartupLocation(\n commandName: CommandName,\n { allowRunFromGlobal }: CommandEntry = {}\n) {\n if (process.env.SKIP_STARTUP_LOCATION_CHECK) {\n return;\n }\n\n const projectRoot = npmGetProjectRoot();\n\n /*\n * Set nx's workspace root so lerna/nx don't walk past a worktree into the\n * main repo. nx walks ancestors looking for node_modules/nx and picks the\n * highest match, which lands on the main repo when the worktree was\n * created inside it. See FAR-1803.\n */\n if (projectRoot) {\n process.env.NX_WORKSPACE_ROOT_PATH ??= projectRoot;\n }\n\n if (allowRunFromGlobal) {\n return;\n }\n\n if (projectRoot && __dirname.startsWith(projectRoot)) {\n process.env.SKIP_STARTUP_LOCATION_CHECK = 'true';\n return;\n }\n\n log.error(\n `Error: ${commandName} must be run from the local @servicetitan/startup installation`\n );\n process.exit(1);\n}\n"],"names":["checkStartupLocation","commandName","allowRunFromGlobal","process","env","SKIP_STARTUP_LOCATION_CHECK","projectRoot","npmGetProjectRoot","NX_WORKSPACE_ROOT_PATH","__dirname","startsWith","log","error","exit"],"mappings":";;;;+BAIgBA;;;eAAAA;;;uBAJiB;wBAEC;AAE3B,SAASA,qBACZC,WAAwB,EACxB,EAAEC,kBAAkB,EAAgB,GAAG,CAAC,CAAC;IAEzC,IAAIC,QAAQC,GAAG,CAACC,2BAA2B,EAAE;QACzC;IACJ;IAEA,MAAMC,cAAcC,IAAAA,yBAAiB;IAErC;;;;;KAKC,GACD,IAAID,aAAa;YACbH,cAAAA;SAAAA,0BAAAA,CAAAA,eAAAA,QAAQC,GAAG,EAACI,sBAAsB,cAAlCL,qCAAAA,0BAAAA,aAAYK,sBAAsB,GAAKF;IAC3C;IAEA,IAAIJ,oBAAoB;QACpB;IACJ;IAEA,IAAII,eAAeG,UAAUC,UAAU,CAACJ,cAAc;QAClDH,QAAQC,GAAG,CAACC,2BAA2B,GAAG;QAC1C;IACJ;IAEAM,UAAG,CAACC,KAAK,CACL,CAAC,OAAO,EAAEX,YAAY,8DAA8D,CAAC;IAEzFE,QAAQU,IAAI,CAAC;AACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/startup",
3
- "version": "36.1.2-canary.9",
3
+ "version": "36.2.0",
4
4
  "description": "CLI to create multi-package Lerna projects with TypeScript and React",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/uikit/startup",
6
6
  "repository": {
@@ -97,13 +97,13 @@
97
97
  "@jest/core": "~30.3.0",
98
98
  "@jest/types": "~30.3.0",
99
99
  "@jsdevtools/coverage-istanbul-loader": "^3.0.5",
100
- "@servicetitan/eslint-config": "36.1.2-canary.9",
101
- "@servicetitan/install": "36.1.2-canary.9",
102
- "@servicetitan/startup-utils": "36.1.2-canary.9",
103
- "@servicetitan/stylelint-config": "36.1.2-canary.9",
100
+ "@servicetitan/eslint-config": "36.2.0",
101
+ "@servicetitan/install": "36.2.0",
102
+ "@servicetitan/startup-utils": "36.2.0",
103
+ "@servicetitan/stylelint-config": "36.2.0",
104
104
  "@svgr/webpack": "^8.1.0",
105
105
  "@swc/cli": "^0.8.1",
106
- "@swc/core": "1.15.24",
106
+ "@swc/core": "1.15.33",
107
107
  "@types/debug": "^4.1.12",
108
108
  "@types/jest": "~30.0.0",
109
109
  "@vitest/coverage-v8": "^4.1.5",
@@ -138,7 +138,7 @@
138
138
  "multimatch": "~8.0.0",
139
139
  "patch-package": "^8.0.1",
140
140
  "portfinder": "~1.0.38",
141
- "postcss": "~8.5.10",
141
+ "postcss": "~8.5.14",
142
142
  "prettier": "~3.8.3",
143
143
  "sass": "~1.99.0",
144
144
  "sass-loader": "~16.0.7",
@@ -184,5 +184,6 @@
184
184
  },
185
185
  "cli": {
186
186
  "webpack": false
187
- }
187
+ },
188
+ "gitHead": "87254b2caf60b20eb46c33b40ffb4dd05ad3e0f7"
188
189
  }
@@ -12,6 +12,7 @@ jest.mock('../cli-npm');
12
12
  describe('[startup] Cli Utils', () => {
13
13
  describe(checkStartupLocation.name, () => {
14
14
  const originalSkipLocationCheck = process.env.SKIP_STARTUP_LOCATION_CHECK;
15
+ const originalNxWorkspaceRootPath = process.env.NX_WORKSPACE_ROOT_PATH;
15
16
  const commandName: any = 'test';
16
17
  let entry: CommandEntry | undefined;
17
18
 
@@ -20,6 +21,7 @@ describe('[startup] Cli Utils', () => {
20
21
  jest.mocked(npmGetProjectRoot).mockReturnValue(process.cwd());
21
22
  jest.spyOn(process, 'exit').mockImplementation(jest.fn() as any);
22
23
  delete process.env.SKIP_STARTUP_LOCATION_CHECK;
24
+ delete process.env.NX_WORKSPACE_ROOT_PATH;
23
25
  entry = undefined;
24
26
  });
25
27
 
@@ -27,12 +29,15 @@ describe('[startup] Cli Utils', () => {
27
29
  if (originalSkipLocationCheck !== undefined) {
28
30
  process.env.SKIP_STARTUP_LOCATION_CHECK = originalSkipLocationCheck;
29
31
  }
32
+ if (originalNxWorkspaceRootPath !== undefined) {
33
+ process.env.NX_WORKSPACE_ROOT_PATH = originalNxWorkspaceRootPath;
34
+ }
30
35
  });
31
36
 
32
37
  const subject = () => checkStartupLocation(commandName, entry);
33
38
 
34
- function itDoesNothing() {
35
- test('does nothing', () => {
39
+ function itDoesNotExitWithError() {
40
+ test('does not exit with error', () => {
36
41
  subject();
37
42
 
38
43
  expect(log.error).not.toHaveBeenCalled();
@@ -40,7 +45,16 @@ describe('[startup] Cli Utils', () => {
40
45
  });
41
46
  }
42
47
 
43
- itDoesNothing();
48
+ function itSetsNxWorkspaceRootPath() {
49
+ test('sets NX_WORKSPACE_ROOT_PATH to the project root', () => {
50
+ subject();
51
+
52
+ expect(process.env.NX_WORKSPACE_ROOT_PATH).toEqual(npmGetProjectRoot());
53
+ });
54
+ }
55
+
56
+ itDoesNotExitWithError();
57
+ itSetsNxWorkspaceRootPath();
44
58
 
45
59
  test('sets process.env.SKIP_STARTUP_LOCATION_CHECK', () => {
46
60
  subject();
@@ -48,6 +62,18 @@ describe('[startup] Cli Utils', () => {
48
62
  expect(process.env.SKIP_STARTUP_LOCATION_CHECK).toBeDefined();
49
63
  });
50
64
 
65
+ describe('when NX_WORKSPACE_ROOT_PATH is already set', () => {
66
+ const existingRoot = '/existing/workspace/root';
67
+
68
+ beforeEach(() => (process.env.NX_WORKSPACE_ROOT_PATH = existingRoot));
69
+
70
+ test('does not overwrite NX_WORKSPACE_ROOT_PATH', () => {
71
+ subject();
72
+
73
+ expect(process.env.NX_WORKSPACE_ROOT_PATH).toEqual(existingRoot);
74
+ });
75
+ });
76
+
51
77
  describe('when running from non-project directory', () => {
52
78
  beforeEach(() => jest.mocked(npmGetProjectRoot).mockReturnValue('foo'));
53
79
 
@@ -63,13 +89,20 @@ describe('[startup] Cli Utils', () => {
63
89
  describe('when command allows running from global location', () => {
64
90
  beforeEach(() => (entry = { allowRunFromGlobal: true }));
65
91
 
66
- itDoesNothing();
92
+ itDoesNotExitWithError();
93
+ itSetsNxWorkspaceRootPath();
67
94
  });
68
95
 
69
96
  describe('when parent process has already checked location', () => {
70
97
  beforeEach(() => (process.env.SKIP_STARTUP_LOCATION_CHECK = 'true'));
71
98
 
72
- itDoesNothing();
99
+ itDoesNotExitWithError();
100
+
101
+ test('does not set NX_WORKSPACE_ROOT_PATH', () => {
102
+ subject();
103
+
104
+ expect(process.env.NX_WORKSPACE_ROOT_PATH).toBeUndefined();
105
+ });
73
106
  });
74
107
  });
75
108
  });
@@ -6,11 +6,26 @@ export function checkStartupLocation(
6
6
  commandName: CommandName,
7
7
  { allowRunFromGlobal }: CommandEntry = {}
8
8
  ) {
9
- if (allowRunFromGlobal || process.env.SKIP_STARTUP_LOCATION_CHECK) {
9
+ if (process.env.SKIP_STARTUP_LOCATION_CHECK) {
10
10
  return;
11
11
  }
12
12
 
13
13
  const projectRoot = npmGetProjectRoot();
14
+
15
+ /*
16
+ * Set nx's workspace root so lerna/nx don't walk past a worktree into the
17
+ * main repo. nx walks ancestors looking for node_modules/nx and picks the
18
+ * highest match, which lands on the main repo when the worktree was
19
+ * created inside it. See FAR-1803.
20
+ */
21
+ if (projectRoot) {
22
+ process.env.NX_WORKSPACE_ROOT_PATH ??= projectRoot;
23
+ }
24
+
25
+ if (allowRunFromGlobal) {
26
+ return;
27
+ }
28
+
14
29
  if (projectRoot && __dirname.startsWith(projectRoot)) {
15
30
  process.env.SKIP_STARTUP_LOCATION_CHECK = 'true';
16
31
  return;