@osdk/generator-utils 2.8.0-beta.15 → 2.8.0-beta.16

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
@@ -1,5 +1,7 @@
1
1
  # @osdk/generator-utils
2
2
 
3
+ ## 2.8.0-beta.16
4
+
3
5
  ## 2.8.0-beta.15
4
6
 
5
7
  ## 2.8.0-beta.14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/generator-utils",
3
- "version": "2.8.0-beta.15",
3
+ "version": "2.8.0-beta.16",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,34 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { describe, expect, it } from "vitest";
18
- import { changeVersionPrefix } from "./changeVersionPrefix.js";
19
- describe(changeVersionPrefix, () => {
20
- const expectedPrefix = "^";
21
- it.each(["1.2.3", "~1.2.3", "^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
22
- const result = await changeVersionPrefix(version, expectedPrefix);
23
- expect(result).toEqual(`${expectedPrefix}1.2.3`);
24
- });
25
- it.each(["workspace:1.2.3", "workspace:~1.2.3", "workspace:^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
26
- const result = await changeVersionPrefix(version, expectedPrefix);
27
- expect(result).toEqual(`workspace:${expectedPrefix}1.2.3`);
28
- });
29
- it.each(["workspace:*", "workspace:^", "workspace:~"])(`replaces "%s" with "workspace:${expectedPrefix}"`, async version => {
30
- const result = await changeVersionPrefix(version, expectedPrefix);
31
- expect(result).toEqual(`workspace:${expectedPrefix}`);
32
- });
33
- });
34
- //# sourceMappingURL=changeVersionPrefix.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"changeVersionPrefix.test.js","names":["describe","expect","it","changeVersionPrefix","expectedPrefix","each","version","result","toEqual"],"sources":["changeVersionPrefix.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { changeVersionPrefix } from \"./changeVersionPrefix.js\";\n\ndescribe(changeVersionPrefix, () => {\n const expectedPrefix = \"^\";\n it.each([\"1.2.3\", \"~1.2.3\", \"^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await changeVersionPrefix(version, expectedPrefix);\n expect(result).toEqual(`${expectedPrefix}1.2.3`);\n },\n );\n\n it.each([\"workspace:1.2.3\", \"workspace:~1.2.3\", \"workspace:^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await changeVersionPrefix(version, expectedPrefix);\n expect(result).toEqual(`workspace:${expectedPrefix}1.2.3`);\n },\n );\n\n it.each([\"workspace:*\", \"workspace:^\", \"workspace:~\"])(\n `replaces \"%s\" with \"workspace:${expectedPrefix}\"`,\n async (version) => {\n const result = await changeVersionPrefix(version, expectedPrefix);\n expect(result).toEqual(`workspace:${expected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 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import * as fs from "node:fs";
18
- import { dirname } from "node:path";
19
- import { fileURLToPath } from "node:url";
20
- import { dirSync } from "tmp";
21
- import { beforeEach, describe, expect, it } from "vitest";
22
- import { getDependencyVersionFromFindUpPackageJson } from "./getDependencyVersionFromFindUpPackageJson.js";
23
- describe(getDependencyVersionFromFindUpPackageJson, () => {
24
- const fakeDepName = "not_a_real_dep_you_would_ever_find";
25
- const fakePeerDepName = "peer_not_a_real_dep_you_would_ever_find";
26
- const fakeDevDepName = "dev_not_a_real_dep_you_would_ever_find";
27
- const fakeDepVersion = "1.2.3";
28
- beforeEach(() => {
29
- const tmpDir = dirSync({
30
- unsafeCleanup: true
31
- });
32
- const tmpDirName = tmpDir.name;
33
- const oldCwd = process.cwd();
34
- process.chdir(tmpDirName);
35
- fs.writeFileSync("package.json", JSON.stringify({
36
- dependencies: {
37
- [fakeDepName]: `${fakeDepVersion}-${fakeDepName}`
38
- },
39
- peerDependencies: {
40
- [fakePeerDepName]: `${fakeDepVersion}-${fakePeerDepName}`
41
- },
42
- devDependencies: {
43
- [fakeDevDepName]: `${fakeDepVersion}-${fakeDevDepName}`
44
- }
45
- }));
46
- return () => {
47
- process.chdir(oldCwd);
48
- tmpDir.removeCallback();
49
- };
50
- });
51
- describe("inferring cwd", () => {
52
- it.each([fakeDepName, fakePeerDepName, fakeDevDepName])("finds the tmp package.json and value for %s", async depName => {
53
- await expect(getDependencyVersionFromFindUpPackageJson(depName)).resolves.toBe(`${fakeDepVersion}-${depName}`);
54
- });
55
- });
56
- describe("not inferring cwd", () => {
57
- it.each([fakeDepName, fakePeerDepName, fakeDevDepName])("does not find the value for %s", async depName => {
58
- await expect(getDependencyVersionFromFindUpPackageJson(depName, {
59
- cwd: dirname(fileURLToPath(import.meta.url))
60
- })).rejects.toThrowError(/^Invariant failed: Could not find a dependency/);
61
- });
62
- it("does find our typescript version", async () => {
63
- await expect(getDependencyVersionFromFindUpPackageJson("typescript", {
64
- cwd: dirname(fileURLToPath(import.meta.url))
65
- })).resolves.toBeDefined();
66
- });
67
- });
68
- });
69
- //# sourceMappingURL=getDependencyVersionFromFindUpPackageJson.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDependencyVersionFromFindUpPackageJson.test.js","names":["fs","dirname","fileURLToPath","dirSync","beforeEach","describe","expect","it","getDependencyVersionFromFindUpPackageJson","fakeDepName","fakePeerDepName","fakeDevDepName","fakeDepVersion","tmpDir","unsafeCleanup","tmpDirName","name","oldCwd","process","cwd","chdir","writeFileSync","JSON","stringify","dependencies","peerDependencies","devDependencies","removeCallback","each","depName","resolves","toBe","import","meta","url","rejects","toThrowError","toBeDefined"],"sources":["getDependencyVersionFromFindUpPackageJson.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirSync } from \"tmp\";\nimport { beforeEach, describe, expect, it } from \"vitest\";\nimport { getDependencyVersionFromFindUpPackageJson } from \"./getDependencyVersionFromFindUpPackageJson.js\";\n\ndescribe(getDependencyVersionFromFindUpPackageJson, () => {\n const fakeDepName = \"not_a_real_dep_you_would_ever_find\";\n const fakePeerDepName = \"peer_not_a_real_dep_you_would_ever_find\";\n const fakeDevDepName = \"dev_not_a_real_dep_you_would_ever_find\";\n const fakeDepVersion = \"1.2.3\";\n\n beforeEach(() => {\n const tmpDir = dirSync({ unsafeCleanup: true });\n const tmpDirName = tmpDir.name;\n const oldCwd = process.cwd();\n\n process.chdir(tmpDirName);\n\n fs.writeFileSync(\n \"package.json\",\n JSON.stringify({\n dependencies: {\n [fakeDepName]: `${fakeDepVersion}-${fakeDepName}`,\n },\n peerDependencies: {\n [fakePeerDepName]: `${fakeDepVersion}-${fakePeerDepName}`,\n },\n devDependencies: {\n [fakeDevDepName]: `${fakeDepVersion}-${fakeDevDepName}`,\n },\n }),\n );\n\n return () => {\n process.chdir(oldCwd);\n tmpDir.removeCallback();\n };\n });\n\n describe(\"inferring cwd\", () => {\n it.each([fakeDepName, fakePeerDepName, fakeDevDepName])(\n \"finds the tmp package.json and value for %s\",\n async (depName) => {\n await expect(\n getDependencyVersionFromFindUpPackageJson(depName),\n ).resolves.toBe(`${fakeDepVersion}-${depName}`);\n },\n );\n });\n\n describe(\"not inferring cwd\", () => {\n it.each([fakeDepName, fakePeerDepName, fakeDevDepName])(\n \"does not find the value for %s\",\n async (depName) => {\n await expect(\n getDependencyVersionFromFindUpPackageJson(depName, {\n cwd: dirname(fileURLToPath(import.meta.url)),\n }),\n ).rejects.toThrowError(\n /^Invariant failed: Could not find a dependency/,\n );\n },\n );\n\n it(\"does find our typescript version\", async () => {\n await expect(\n getDependencyVersionFromFindUpPackageJson(\"typescript\", {\n cwd: dirname(fileURLToPath(import.meta.url)),\n }),\n ).resolves.toBeDefined();\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,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AC,CAAC,CACrD,6CAA6C,EAC7C,MAAOkB,OAAO,IAAK;MACjB,MAAMvB,MAAM,CACVE,yCAAyC,CAACqB,OAAO,CACnD,CAAC,CAACC,QAAQ,CAACC,IAAI,CAAC,GAAGnB,cAAc,IAAIiB,OAAO,EAAE,CAAC;IACjD,CACF,CAAC;EACH,CAAC,CAAC;EAEFxB,QAAQ,CAAC,mBAAmB,EAAE,MAAM;IAClCE,EAAE,CAACqB,IAAI,CAAC,CAACnB,WAAW,EAAEC,eAAe,EAAEC,cAAc,CAAC,CAAC,CACrD,gCAAgC,EAChC,MAAOkB,OAAO,IAAK;MACjB,MAAMvB,MAAM,CACVE,yCAAyC,CAACqB,OAAO,EAAE;QACjDV,GAAG,EAAElB,OAAO,CAACC,aAAa,CAAC8B,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;MAC7C,CAAC,CACH,CAAC,CAACC,OAAO,CAACC,YAAY,CACpB,gDACF,CAAC;IACH,CACF,CAAC;IAED7B,EAAE,CAAC,kCAAkC,EAAE,YAAY;MACjD,MAAMD,MAAM,CACVE,yCAAyC,CAAC,YAAY,EAAE;QACtDW,GAAG,EAAElB,OAAO,CAACC,aAAa,CAAC8B,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;MAC7C,CAAC,CACH,CAAC,CAACJ,QAAQ,CAACO,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,60 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { dirname } from "node:path";
18
- import { fileURLToPath } from "node:url";
19
- import { describe, expect, it } from "vitest";
20
- import { resolveDependenciesFromFindUp } from "./resolveDependenciesFromFindUp.js";
21
- describe(resolveDependenciesFromFindUp, () => {
22
- describe("not provided a version", () => {
23
- it("errors when it does not find a version", async () => {
24
- await expect(resolveDependenciesFromFindUp({
25
- not_a_real_dep_you_would_find: undefined
26
- }, dirname(fileURLToPath(import.meta.url)))).rejects.toThrow(/^Invariant failed: Could not find a dependency for not_a_real_dep_you_would_find in (.*?)$/);
27
- });
28
- });
29
- describe("uses version passed to it", () => {
30
- const expectedPrefix = "^";
31
- it.each(["1.2.3", "~1.2.3", "^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
32
- const result = await resolveDependenciesFromFindUp({
33
- foo: version
34
- }, dirname(fileURLToPath(import.meta.url)));
35
- expect(result).toEqual([{
36
- dependencyName: "foo",
37
- dependencyVersion: `${expectedPrefix}1.2.3`
38
- }]);
39
- });
40
- it.each(["workspace:1.2.3", "workspace:~1.2.3", "workspace:^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
41
- const result = await resolveDependenciesFromFindUp({
42
- foo: version
43
- }, dirname(fileURLToPath(import.meta.url)));
44
- expect(result).toEqual([{
45
- dependencyName: "foo",
46
- dependencyVersion: `workspace:${expectedPrefix}1.2.3`
47
- }]);
48
- });
49
- it.each(["workspace:*", "workspace:^", "workspace:~"])(`replaces "%s" with "workspace:${expectedPrefix}"`, async version => {
50
- const result = await resolveDependenciesFromFindUp({
51
- foo: version
52
- }, dirname(fileURLToPath(import.meta.url)));
53
- expect(result).toEqual([{
54
- dependencyName: "foo",
55
- dependencyVersion: `workspace:${expectedPrefix}`
56
- }]);
57
- });
58
- });
59
- });
60
- //# sourceMappingURL=resolveDependenciesFromFindUp.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveDependenciesFromFindUp.test.js","names":["dirname","fileURLToPath","describe","expect","it","resolveDependenciesFromFindUp","not_a_real_dep_you_would_find","undefined","import","meta","url","rejects","toThrow","expectedPrefix","each","version","result","foo","toEqual","dependencyName","dependencyVersion"],"sources":["resolveDependenciesFromFindUp.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { describe, expect, it } from \"vitest\";\nimport { resolveDependenciesFromFindUp } from \"./resolveDependenciesFromFindUp.js\";\n\ndescribe(resolveDependenciesFromFindUp, () => {\n describe(\"not provided a version\", () => {\n it(\"errors when it does not find a version\", async () => {\n await expect(resolveDependenciesFromFindUp({\n not_a_real_dep_you_would_find: undefined,\n }, dirname(fileURLToPath(import.meta.url)))).rejects.toThrow(\n /^Invariant failed: Could not find a dependency for not_a_real_dep_you_would_find in (.*?)$/,\n );\n });\n });\n\n describe(\"uses version passed to it\", () => {\n const expectedPrefix = \"^\";\n it.each([\"1.2.3\", \"~1.2.3\", \"^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await resolveDependenciesFromFindUp(\n {\n foo: version,\n },\n dirname(fileURLToPath(import.meta.url)),\n );\n expect(result).toEqual([\n {\n dependencyName: \"foo\",\n dependencyVersion: `${expectedPrefix}1.2.3`,\n },\n ]);\n },\n );\n\n it.each([\"workspace:1.2.3\", \"workspace:~1.2.3\", \"workspace:^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await resolveDependenciesFromFindUp(\n {\n foo: version,\n },\n dirname(fileURLToPath(import.meta.url)),\n );\n expect(result).toEqual([\n {\n dependencyName: \"foo\",\n dependencyVersion: `workspace:${expectedPrefix}1.2.3`,\n },\n ]);\n },\n );\n\n it.each([\"workspace:*\", \"workspace:^\", \"workspace:~\"])(\n `replaces \"%s\" with \"workspace:${expectedPrefix}\"`,\n async (version) => {\n const result = await resolveDependenciesFromFindUp(\n {\n foo: version,\n },\n dirname(fileURLToPath(import.meta.url)),\n );\n expect(result).toEqual([\n {\n dependencyName: \"foo\",\n dependencyVersion: `workspace:${expectedPrefix}`,\n },\n ]);\n },\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;AACnC,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6BAA6B,QAAQ,oCAAoC;AAElFH,QAAQ,CAACG,6BAA6B,EAAE,MAAM;EAC5CH,QAAQ,CAAC,wBAAwB,EAAE,MAAM;IACvCE,EAAE,CAAC,wCAAwC,EAAE,YAAY;MACvD,MAAMD,MAAM,CAACE,6BAA6B,CAAC;QACzCC,6BAA6B,EAAEC;MACjC,CAAC,EAAEP,OAAO,CAACC,aAAa,CAACO,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO,CAACC,OAAO,CAC1D,4FACF,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFV,QAAQ,CAAC,2BAA2B,EAAE,MAAM;IAC1C,MAAMW,cAAc,GAAG,GAAG;IAC1BT,EAAE,CAACU,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CACpC,uBAAuBD,cAAc,QAAQ,EAC7C,MAAOE,OAAO,IAA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AC","ignoreList":[]}
@@ -1,34 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { describe, expect, it } from "vitest";
18
- import { changeVersionPrefix } from "./changeVersionPrefix.js";
19
- describe(changeVersionPrefix, () => {
20
- const expectedPrefix = "^";
21
- it.each(["1.2.3", "~1.2.3", "^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
22
- const result = await changeVersionPrefix(version, expectedPrefix);
23
- expect(result).toEqual(`${expectedPrefix}1.2.3`);
24
- });
25
- it.each(["workspace:1.2.3", "workspace:~1.2.3", "workspace:^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
26
- const result = await changeVersionPrefix(version, expectedPrefix);
27
- expect(result).toEqual(`workspace:${expectedPrefix}1.2.3`);
28
- });
29
- it.each(["workspace:*", "workspace:^", "workspace:~"])(`replaces "%s" with "workspace:${expectedPrefix}"`, async version => {
30
- const result = await changeVersionPrefix(version, expectedPrefix);
31
- expect(result).toEqual(`workspace:${expectedPrefix}`);
32
- });
33
- });
34
- //# sourceMappingURL=changeVersionPrefix.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"changeVersionPrefix.test.js","names":["describe","expect","it","changeVersionPrefix","expectedPrefix","each","version","result","toEqual"],"sources":["changeVersionPrefix.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { changeVersionPrefix } from \"./changeVersionPrefix.js\";\n\ndescribe(changeVersionPrefix, () => {\n const expectedPrefix = \"^\";\n it.each([\"1.2.3\", \"~1.2.3\", \"^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await changeVersionPrefix(version, expectedPrefix);\n expect(result).toEqual(`${expectedPrefix}1.2.3`);\n },\n );\n\n it.each([\"workspace:1.2.3\", \"workspace:~1.2.3\", \"workspace:^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await changeVersionPrefix(version, expectedPrefix);\n expect(result).toEqual(`workspace:${expectedPrefix}1.2.3`);\n },\n );\n\n it.each([\"workspace:*\", \"workspace:^\", \"workspace:~\"])(\n `replaces \"%s\" with \"workspace:${expectedPrefix}\"`,\n async (version) => {\n const result = await changeVersionPrefix(version, expectedPrefix);\n expect(result).toEqual(`workspace:${expectedPrefix}`);\n },\n );\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9DH,QAAQ,CAACG,mBAAmB,EAAE,MAAM;EAClC,MAAMC,cAAc,GAAG,GAAG;EAC1BF,EAAE,CAACG,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CACpC,uBAAuBD,cAAc,QAAQ,EAC7C,MAAOE,OAAO,IAAK;IACjB,MAAMC,MAAM,GAAG,MAAMJ,mBAAmB,CAACG,OAAO,EAAEF,cAAc,CAAC;IACjEH,MAAM,CAACM,MAAM,CAAC,CAACC,OAAO,CAAC,GAAGJ,cAAc,OAAO,CAAC;EAClD,CACF,CAAC;EAEDF,EAAE,CAACG,IAAI,CAAC,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAClE,uBAAuBD,cAAc,QAAQ,EAC7C,MAAOE,OAAO,IAAK;IACjB,MAAMC,MAAM,GAAG,MAAMJ,mBAAmB,CAACG,OAAO,EAAEF,cAAc,CAAC;IACjEH,MAAM,CAACM,MAAM,CAAC,CAACC,OAAO,CAAC,aAAaJ,cAAc,OAAO,CAAC;EAC5D,CACF,CAAC;EAEDF,EAAE,CAACG,IAAI,CAAC,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CACpD,iCAAiCD,cAAc,GAAG,EAClD,MAAOE,OAAO,IAAK;IACjB,MAAMC,MAAM,GAAG,MAAMJ,mBAAmB,CAACG,OAAO,EAAEF,cAAc,CAAC;IACjEH,MAAM,CAACM,MAAM,CAAC,CAACC,OAAO,CAAC,aAAaJ,cAAc,EAAE,CAAC;EACvD,CACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,69 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import * as fs from "node:fs";
18
- import { dirname } from "node:path";
19
- import { fileURLToPath } from "node:url";
20
- import { dirSync } from "tmp";
21
- import { beforeEach, describe, expect, it } from "vitest";
22
- import { getDependencyVersionFromFindUpPackageJson } from "./getDependencyVersionFromFindUpPackageJson.js";
23
- describe(getDependencyVersionFromFindUpPackageJson, () => {
24
- const fakeDepName = "not_a_real_dep_you_would_ever_find";
25
- const fakePeerDepName = "peer_not_a_real_dep_you_would_ever_find";
26
- const fakeDevDepName = "dev_not_a_real_dep_you_would_ever_find";
27
- const fakeDepVersion = "1.2.3";
28
- beforeEach(() => {
29
- const tmpDir = dirSync({
30
- unsafeCleanup: true
31
- });
32
- const tmpDirName = tmpDir.name;
33
- const oldCwd = process.cwd();
34
- process.chdir(tmpDirName);
35
- fs.writeFileSync("package.json", JSON.stringify({
36
- dependencies: {
37
- [fakeDepName]: `${fakeDepVersion}-${fakeDepName}`
38
- },
39
- peerDependencies: {
40
- [fakePeerDepName]: `${fakeDepVersion}-${fakePeerDepName}`
41
- },
42
- devDependencies: {
43
- [fakeDevDepName]: `${fakeDepVersion}-${fakeDevDepName}`
44
- }
45
- }));
46
- return () => {
47
- process.chdir(oldCwd);
48
- tmpDir.removeCallback();
49
- };
50
- });
51
- describe("inferring cwd", () => {
52
- it.each([fakeDepName, fakePeerDepName, fakeDevDepName])("finds the tmp package.json and value for %s", async depName => {
53
- await expect(getDependencyVersionFromFindUpPackageJson(depName)).resolves.toBe(`${fakeDepVersion}-${depName}`);
54
- });
55
- });
56
- describe("not inferring cwd", () => {
57
- it.each([fakeDepName, fakePeerDepName, fakeDevDepName])("does not find the value for %s", async depName => {
58
- await expect(getDependencyVersionFromFindUpPackageJson(depName, {
59
- cwd: dirname(fileURLToPath(import.meta.url))
60
- })).rejects.toThrowError(/^Invariant failed: Could not find a dependency/);
61
- });
62
- it("does find our typescript version", async () => {
63
- await expect(getDependencyVersionFromFindUpPackageJson("typescript", {
64
- cwd: dirname(fileURLToPath(import.meta.url))
65
- })).resolves.toBeDefined();
66
- });
67
- });
68
- });
69
- //# sourceMappingURL=getDependencyVersionFromFindUpPackageJson.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDependencyVersionFromFindUpPackageJson.test.js","names":["fs","dirname","fileURLToPath","dirSync","beforeEach","describe","expect","it","getDependencyVersionFromFindUpPackageJson","fakeDepName","fakePeerDepName","fakeDevDepName","fakeDepVersion","tmpDir","unsafeCleanup","tmpDirName","name","oldCwd","process","cwd","chdir","writeFileSync","JSON","stringify","dependencies","peerDependencies","devDependencies","removeCallback","each","depName","resolves","toBe","import","meta","url","rejects","toThrowError","toBeDefined"],"sources":["getDependencyVersionFromFindUpPackageJson.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirSync } from \"tmp\";\nimport { beforeEach, describe, expect, it } from \"vitest\";\nimport { getDependencyVersionFromFindUpPackageJson } from \"./getDependencyVersionFromFindUpPackageJson.js\";\n\ndescribe(getDependencyVersionFromFindUpPackageJson, () => {\n const fakeDepName = \"not_a_real_dep_you_would_ever_find\";\n const fakePeerDepName = \"peer_not_a_real_dep_you_would_ever_find\";\n const fakeDevDepName = \"dev_not_a_real_dep_you_would_ever_find\";\n const fakeDepVersion = \"1.2.3\";\n\n beforeEach(() => {\n const tmpDir = dirSync({ unsafeCleanup: true });\n const tmpDirName = tmpDir.name;\n const oldCwd = process.cwd();\n\n process.chdir(tmpDirName);\n\n fs.writeFileSync(\n \"package.json\",\n JSON.stringify({\n dependencies: {\n [fakeDepName]: `${fakeDepVersion}-${fakeDepName}`,\n },\n peerDependencies: {\n [fakePeerDepName]: `${fakeDepVersion}-${fakePeerDepName}`,\n },\n devDependencies: {\n [fakeDevDepName]: `${fakeDepVersion}-${fakeDevDepName}`,\n },\n }),\n );\n\n return () => {\n process.chdir(oldCwd);\n tmpDir.removeCallback();\n };\n });\n\n describe(\"inferring cwd\", () => {\n it.each([fakeDepName, fakePeerDepName, fakeDevDepName])(\n \"finds the tmp package.json and value for %s\",\n async (depName) => {\n await expect(\n getDependencyVersionFromFindUpPackageJson(depName),\n ).resolves.toBe(`${fakeDepVersion}-${depName}`);\n },\n );\n });\n\n describe(\"not inferring cwd\", () => {\n it.each([fakeDepName, fakePeerDepName, fakeDevDepName])(\n \"does not find the value for %s\",\n async (depName) => {\n await expect(\n getDependencyVersionFromFindUpPackageJson(depName, {\n cwd: dirname(fileURLToPath(import.meta.url)),\n }),\n ).rejects.toThrowError(\n /^Invariant failed: Could not find a dependency/,\n );\n },\n );\n\n it(\"does find our typescript version\", async () => {\n await expect(\n getDependencyVersionFromFindUpPackageJson(\"typescript\", {\n cwd: dirname(fileURLToPath(import.meta.url)),\n }),\n ).resolves.toBeDefined();\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,SAAS;AAC7B,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,OAAO,QAAQ,KAAK;AAC7B,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACzD,SAASC,yCAAyC,QAAQ,gDAAgD;AAE1GH,QAAQ,CAACG,yCAAyC,EAAE,MAAM;EACxD,MAAMC,WAAW,GAAG,oCAAoC;EACxD,MAAMC,eAAe,GAAG,yCAAyC;EACjE,MAAMC,cAAc,GAAG,wCAAwC;EAC/D,MAAMC,cAAc,GAAG,OAAO;EAE9B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,CAACqB,OAAO,EAAE;QACjDV,GAAG,EAAElB,OAAO,CAACC,aAAa,CAAC8B,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;MAC7C,CAAC,CACH,CAAC,CAACC,OAAO,CAACC,YAAY,CACpB,gDACF,CAAC;IACH,CACF,CAAC;IAED7B,EAAE,CAAC,kCAAkC,EAAE,YAAY;MACjD,MAAMD,MAAM,CACVE,yCAAyC,CAAC,YAAY,EAAE;QACtDW,GAAG,EAAElB,OAAO,CAACC,aAAa,CAAC8B,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;MAC7C,CAAC,CACH,CAAC,CAACJ,QAAQ,CAACO,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,60 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { dirname } from "node:path";
18
- import { fileURLToPath } from "node:url";
19
- import { describe, expect, it } from "vitest";
20
- import { resolveDependenciesFromFindUp } from "./resolveDependenciesFromFindUp.js";
21
- describe(resolveDependenciesFromFindUp, () => {
22
- describe("not provided a version", () => {
23
- it("errors when it does not find a version", async () => {
24
- await expect(resolveDependenciesFromFindUp({
25
- not_a_real_dep_you_would_find: undefined
26
- }, dirname(fileURLToPath(import.meta.url)))).rejects.toThrow(/^Invariant failed: Could not find a dependency for not_a_real_dep_you_would_find in (.*?)$/);
27
- });
28
- });
29
- describe("uses version passed to it", () => {
30
- const expectedPrefix = "^";
31
- it.each(["1.2.3", "~1.2.3", "^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
32
- const result = await resolveDependenciesFromFindUp({
33
- foo: version
34
- }, dirname(fileURLToPath(import.meta.url)));
35
- expect(result).toEqual([{
36
- dependencyName: "foo",
37
- dependencyVersion: `${expectedPrefix}1.2.3`
38
- }]);
39
- });
40
- it.each(["workspace:1.2.3", "workspace:~1.2.3", "workspace:^1.2.3"])(`replaces "%s" with "${expectedPrefix}1.2.3"`, async version => {
41
- const result = await resolveDependenciesFromFindUp({
42
- foo: version
43
- }, dirname(fileURLToPath(import.meta.url)));
44
- expect(result).toEqual([{
45
- dependencyName: "foo",
46
- dependencyVersion: `workspace:${expectedPrefix}1.2.3`
47
- }]);
48
- });
49
- it.each(["workspace:*", "workspace:^", "workspace:~"])(`replaces "%s" with "workspace:${expectedPrefix}"`, async version => {
50
- const result = await resolveDependenciesFromFindUp({
51
- foo: version
52
- }, dirname(fileURLToPath(import.meta.url)));
53
- expect(result).toEqual([{
54
- dependencyName: "foo",
55
- dependencyVersion: `workspace:${expectedPrefix}`
56
- }]);
57
- });
58
- });
59
- });
60
- //# sourceMappingURL=resolveDependenciesFromFindUp.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveDependenciesFromFindUp.test.js","names":["dirname","fileURLToPath","describe","expect","it","resolveDependenciesFromFindUp","not_a_real_dep_you_would_find","undefined","import","meta","url","rejects","toThrow","expectedPrefix","each","version","result","foo","toEqual","dependencyName","dependencyVersion"],"sources":["resolveDependenciesFromFindUp.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { describe, expect, it } from \"vitest\";\nimport { resolveDependenciesFromFindUp } from \"./resolveDependenciesFromFindUp.js\";\n\ndescribe(resolveDependenciesFromFindUp, () => {\n describe(\"not provided a version\", () => {\n it(\"errors when it does not find a version\", async () => {\n await expect(resolveDependenciesFromFindUp({\n not_a_real_dep_you_would_find: undefined,\n }, dirname(fileURLToPath(import.meta.url)))).rejects.toThrow(\n /^Invariant failed: Could not find a dependency for not_a_real_dep_you_would_find in (.*?)$/,\n );\n });\n });\n\n describe(\"uses version passed to it\", () => {\n const expectedPrefix = \"^\";\n it.each([\"1.2.3\", \"~1.2.3\", \"^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await resolveDependenciesFromFindUp(\n {\n foo: version,\n },\n dirname(fileURLToPath(import.meta.url)),\n );\n expect(result).toEqual([\n {\n dependencyName: \"foo\",\n dependencyVersion: `${expectedPrefix}1.2.3`,\n },\n ]);\n },\n );\n\n it.each([\"workspace:1.2.3\", \"workspace:~1.2.3\", \"workspace:^1.2.3\"])(\n `replaces \"%s\" with \"${expectedPrefix}1.2.3\"`,\n async (version) => {\n const result = await resolveDependenciesFromFindUp(\n {\n foo: version,\n },\n dirname(fileURLToPath(import.meta.url)),\n );\n expect(result).toEqual([\n {\n dependencyName: \"foo\",\n dependencyVersion: `workspace:${expectedPrefix}1.2.3`,\n },\n ]);\n },\n );\n\n it.each([\"workspace:*\", \"workspace:^\", \"workspace:~\"])(\n `replaces \"%s\" with \"workspace:${expectedPrefix}\"`,\n async (version) => {\n const result = await resolveDependenciesFromFindUp(\n {\n foo: version,\n },\n dirname(fileURLToPath(import.meta.url)),\n );\n expect(result).toEqual([\n {\n dependencyName: \"foo\",\n dependencyVersion: `workspace:${expectedPrefix}`,\n },\n ]);\n },\n );\n });\n});\n"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QAAQ,EAC7C,MAAOE,OAAO,IAAK;MACjB,MAAMC,MAAM,GAAG,MAAMX,6BAA6B,CAChD;QACEY,GAAG,EAAEF;MACP,CAAC,EACDf,OAAO,CAACC,aAAa,CAACO,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CACxC,CAAC;MACDP,MAAM,CAACa,MAAM,CAAC,CAACE,OAAO,CAAC,CACrB;QACEC,cAAc,EAAE,KAAK;QACrBC,iBAAiB,EAAE,aAAaP,cAAc;MAChD,CAAC,CACF,CAAC;IACJ,CACF,CAAC;IAEDT,EAAE,CAACU,IAAI,CAAC,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CACpD,iCAAiCD,cAAc,GAAG,EAClD,MAAOE,OAAO,IAAK;MACjB,MAAMC,MAAM,GAAG,MAAMX,6BAA6B,CAChD;QACEY,GAAG,EAAEF;MACP,CAAC,EACDf,OAAO,CAACC,aAAa,CAACO,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CACxC,CAAC;MACDP,MAAM,CAACa,MAAM,CAAC,CAACE,OAAO,CAAC,CACrB;QACEC,cAAc,EAAE,KAAK;QACrBC,iBAAiB,EAAE,aAAaP,cAAc;MAChD,CAAC,CACF,CAAC;IACJ,CACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"mappings":"","names":[],"sources":["../../src/changeVersionPrefix.test.ts"],"version":3,"file":"changeVersionPrefix.test.d.ts"}
@@ -1 +0,0 @@
1
- {"mappings":"","names":[],"sources":["../../src/getDependencyVersionFromFindUpPackageJson.test.ts"],"version":3,"file":"getDependencyVersionFromFindUpPackageJson.test.d.ts"}
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"mappings":"","names":[],"sources":["../../src/resolveDependenciesFromFindUp.test.ts"],"version":3,"file":"resolveDependenciesFromFindUp.test.d.ts"}