@osdk/create-app 0.19.0-beta.5 → 0.19.0-beta.6
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 +6 -0
- package/build/browser/cli.d.ts +2 -0
- package/build/browser/cli.d.ts.map +1 -0
- package/build/browser/cli.js +95 -0
- package/build/browser/cli.js.map +1 -0
- package/build/browser/cli.test.d.ts +2 -0
- package/build/browser/cli.test.d.ts.map +1 -0
- package/build/browser/cli.test.js +59 -0
- package/build/browser/cli.test.js.map +1 -0
- package/build/browser/consola.d.ts +3 -0
- package/build/browser/consola.d.ts.map +1 -0
- package/build/browser/consola.js +28 -0
- package/build/browser/consola.js.map +1 -0
- package/build/browser/generate/generateEnv.d.ts +13 -0
- package/build/browser/generate/generateEnv.d.ts.map +1 -0
- package/build/browser/generate/generateEnv.js +50 -0
- package/build/browser/generate/generateEnv.js.map +1 -0
- package/build/browser/generate/generateEnv.test.d.ts +2 -0
- package/build/browser/generate/generateEnv.test.d.ts.map +1 -0
- package/build/browser/generate/generateEnv.test.js +70 -0
- package/build/browser/generate/generateEnv.test.js.map +1 -0
- package/build/browser/generate/generateFoundryConfigJson.d.ts +6 -0
- package/build/browser/generate/generateFoundryConfigJson.d.ts.map +1 -0
- package/build/browser/generate/generateFoundryConfigJson.js +33 -0
- package/build/browser/generate/generateFoundryConfigJson.js.map +1 -0
- package/build/browser/generate/generateFoundryConfigJson.test.d.ts +2 -0
- package/build/browser/generate/generateFoundryConfigJson.test.d.ts.map +1 -0
- package/build/browser/generate/generateFoundryConfigJson.test.js +38 -0
- package/build/browser/generate/generateFoundryConfigJson.test.js.map +1 -0
- package/build/browser/generate/generateNpmRc.d.ts +5 -0
- package/build/browser/generate/generateNpmRc.d.ts.map +1 -0
- package/build/browser/generate/generateNpmRc.js +27 -0
- package/build/browser/generate/generateNpmRc.js.map +1 -0
- package/build/browser/generate/generateNpmRc.test.d.ts +2 -0
- package/build/browser/generate/generateNpmRc.test.d.ts.map +1 -0
- package/build/browser/generate/generateNpmRc.test.js +28 -0
- package/build/browser/generate/generateNpmRc.test.js.map +1 -0
- package/build/browser/highlight.d.ts +3 -0
- package/build/browser/highlight.d.ts.map +1 -0
- package/build/browser/highlight.js +23 -0
- package/build/browser/highlight.js.map +1 -0
- package/build/browser/index.d.ts +5 -0
- package/build/browser/index.d.ts.map +1 -0
- package/build/browser/index.js +18 -540
- package/build/browser/index.js.map +1 -1
- package/build/browser/prompts/promptApplicationRid.d.ts +4 -0
- package/build/browser/prompts/promptApplicationRid.d.ts.map +1 -0
- package/build/browser/prompts/promptApplicationRid.js +31 -0
- package/build/browser/prompts/promptApplicationRid.js.map +1 -0
- package/build/browser/prompts/promptApplicationRid.test.d.ts +2 -0
- package/build/browser/prompts/promptApplicationRid.test.d.ts.map +1 -0
- package/build/browser/prompts/promptApplicationRid.test.js +48 -0
- package/build/browser/prompts/promptApplicationRid.test.js.map +1 -0
- package/build/browser/prompts/promptApplicationUrl.d.ts +5 -0
- package/build/browser/prompts/promptApplicationUrl.d.ts.map +1 -0
- package/build/browser/prompts/promptApplicationUrl.js +50 -0
- package/build/browser/prompts/promptApplicationUrl.js.map +1 -0
- package/build/browser/prompts/promptApplicationUrl.test.d.ts +2 -0
- package/build/browser/prompts/promptApplicationUrl.test.d.ts.map +1 -0
- package/build/browser/prompts/promptApplicationUrl.test.js +68 -0
- package/build/browser/prompts/promptApplicationUrl.test.js.map +1 -0
- package/build/browser/prompts/promptClientId.d.ts +4 -0
- package/build/browser/prompts/promptClientId.d.ts.map +1 -0
- package/build/browser/prompts/promptClientId.js +31 -0
- package/build/browser/prompts/promptClientId.js.map +1 -0
- package/build/browser/prompts/promptClientId.test.d.ts +2 -0
- package/build/browser/prompts/promptClientId.test.d.ts.map +1 -0
- package/build/browser/prompts/promptClientId.test.js +47 -0
- package/build/browser/prompts/promptClientId.test.js.map +1 -0
- package/build/browser/prompts/promptCorsProxy.d.ts +4 -0
- package/build/browser/prompts/promptCorsProxy.d.ts.map +1 -0
- package/build/browser/prompts/promptCorsProxy.js +29 -0
- package/build/browser/prompts/promptCorsProxy.js.map +1 -0
- package/build/browser/prompts/promptCorsProxy.test.d.ts +2 -0
- package/build/browser/prompts/promptCorsProxy.test.d.ts.map +1 -0
- package/build/browser/prompts/promptCorsProxy.test.js +44 -0
- package/build/browser/prompts/promptCorsProxy.test.js.map +1 -0
- package/build/browser/prompts/promptFoundryUrl.d.ts +4 -0
- package/build/browser/prompts/promptFoundryUrl.d.ts.map +1 -0
- package/build/browser/prompts/promptFoundryUrl.js +31 -0
- package/build/browser/prompts/promptFoundryUrl.js.map +1 -0
- package/build/browser/prompts/promptFoundryUrl.test.d.ts +2 -0
- package/build/browser/prompts/promptFoundryUrl.test.d.ts.map +1 -0
- package/build/browser/prompts/promptFoundryUrl.test.js +55 -0
- package/build/browser/prompts/promptFoundryUrl.test.js.map +1 -0
- package/build/browser/prompts/promptOsdkPackage.d.ts +4 -0
- package/build/browser/prompts/promptOsdkPackage.d.ts.map +1 -0
- package/build/browser/prompts/promptOsdkPackage.js +31 -0
- package/build/browser/prompts/promptOsdkPackage.js.map +1 -0
- package/build/browser/prompts/promptOsdkPackage.test.d.ts +2 -0
- package/build/browser/prompts/promptOsdkPackage.test.d.ts.map +1 -0
- package/build/browser/prompts/promptOsdkPackage.test.js +48 -0
- package/build/browser/prompts/promptOsdkPackage.test.js.map +1 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.d.ts +4 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.d.ts.map +1 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.js +31 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.js.map +1 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts +2 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.test.d.ts.map +1 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.test.js +54 -0
- package/build/browser/prompts/promptOsdkRegistryUrl.test.js.map +1 -0
- package/build/browser/prompts/promptOverwrite.d.ts +5 -0
- package/build/browser/prompts/promptOverwrite.d.ts.map +1 -0
- package/build/browser/prompts/promptOverwrite.js +53 -0
- package/build/browser/prompts/promptOverwrite.js.map +1 -0
- package/build/browser/prompts/promptOverwrite.test.d.ts +2 -0
- package/build/browser/prompts/promptOverwrite.test.d.ts.map +1 -0
- package/build/browser/prompts/promptOverwrite.test.js +55 -0
- package/build/browser/prompts/promptOverwrite.test.js.map +1 -0
- package/build/browser/prompts/promptProject.d.ts +4 -0
- package/build/browser/prompts/promptProject.d.ts.map +1 -0
- package/build/browser/prompts/promptProject.js +32 -0
- package/build/browser/prompts/promptProject.js.map +1 -0
- package/build/browser/prompts/promptProject.test.d.ts +2 -0
- package/build/browser/prompts/promptProject.test.d.ts.map +1 -0
- package/build/browser/prompts/promptProject.test.js +47 -0
- package/build/browser/prompts/promptProject.test.js.map +1 -0
- package/build/browser/prompts/promptTemplate.d.ts +6 -0
- package/build/browser/prompts/promptTemplate.d.ts.map +1 -0
- package/build/browser/prompts/promptTemplate.js +45 -0
- package/build/browser/prompts/promptTemplate.js.map +1 -0
- package/build/browser/prompts/promptTemplate.test.d.ts +2 -0
- package/build/browser/prompts/promptTemplate.test.d.ts.map +1 -0
- package/build/browser/prompts/promptTemplate.test.js +48 -0
- package/build/browser/prompts/promptTemplate.test.js.map +1 -0
- package/build/browser/run.d.ts +16 -0
- package/build/browser/run.d.ts.map +1 -0
- package/build/browser/run.js +132 -0
- package/build/browser/run.js.map +1 -0
- package/build/browser/templates.d.ts +23 -0
- package/build/browser/templates.d.ts.map +1 -0
- package/build/browser/templates.js +56 -0
- package/build/browser/templates.js.map +1 -0
- package/build/esm/cli.js +95 -0
- package/build/esm/cli.js.map +1 -0
- package/build/esm/cli.test.js +59 -0
- package/build/esm/cli.test.js.map +1 -0
- package/build/esm/consola.js +28 -0
- package/build/esm/consola.js.map +1 -0
- package/build/esm/generate/generateEnv.js +50 -0
- package/build/esm/generate/generateEnv.js.map +1 -0
- package/build/esm/generate/generateEnv.test.js +70 -0
- package/build/esm/generate/generateEnv.test.js.map +1 -0
- package/build/esm/generate/generateFoundryConfigJson.js +33 -0
- package/build/esm/generate/generateFoundryConfigJson.js.map +1 -0
- package/build/esm/generate/generateFoundryConfigJson.test.js +38 -0
- package/build/esm/generate/generateFoundryConfigJson.test.js.map +1 -0
- package/build/esm/generate/generateNpmRc.js +27 -0
- package/build/esm/generate/generateNpmRc.js.map +1 -0
- package/build/esm/generate/generateNpmRc.test.js +28 -0
- package/build/esm/generate/generateNpmRc.test.js.map +1 -0
- package/build/esm/highlight.js +23 -0
- package/build/esm/highlight.js.map +1 -0
- package/build/esm/index.js +18 -540
- package/build/esm/index.js.map +1 -1
- package/build/esm/prompts/promptApplicationRid.js +31 -0
- package/build/esm/prompts/promptApplicationRid.js.map +1 -0
- package/build/esm/prompts/promptApplicationRid.test.js +48 -0
- package/build/esm/prompts/promptApplicationRid.test.js.map +1 -0
- package/build/esm/prompts/promptApplicationUrl.js +50 -0
- package/build/esm/prompts/promptApplicationUrl.js.map +1 -0
- package/build/esm/prompts/promptApplicationUrl.test.js +68 -0
- package/build/esm/prompts/promptApplicationUrl.test.js.map +1 -0
- package/build/esm/prompts/promptClientId.js +31 -0
- package/build/esm/prompts/promptClientId.js.map +1 -0
- package/build/esm/prompts/promptClientId.test.js +47 -0
- package/build/esm/prompts/promptClientId.test.js.map +1 -0
- package/build/esm/prompts/promptCorsProxy.js +29 -0
- package/build/esm/prompts/promptCorsProxy.js.map +1 -0
- package/build/esm/prompts/promptCorsProxy.test.js +44 -0
- package/build/esm/prompts/promptCorsProxy.test.js.map +1 -0
- package/build/esm/prompts/promptFoundryUrl.js +31 -0
- package/build/esm/prompts/promptFoundryUrl.js.map +1 -0
- package/build/esm/prompts/promptFoundryUrl.test.js +55 -0
- package/build/esm/prompts/promptFoundryUrl.test.js.map +1 -0
- package/build/esm/prompts/promptOsdkPackage.js +31 -0
- package/build/esm/prompts/promptOsdkPackage.js.map +1 -0
- package/build/esm/prompts/promptOsdkPackage.test.js +48 -0
- package/build/esm/prompts/promptOsdkPackage.test.js.map +1 -0
- package/build/esm/prompts/promptOsdkRegistryUrl.js +31 -0
- package/build/esm/prompts/promptOsdkRegistryUrl.js.map +1 -0
- package/build/esm/prompts/promptOsdkRegistryUrl.test.js +54 -0
- package/build/esm/prompts/promptOsdkRegistryUrl.test.js.map +1 -0
- package/build/esm/prompts/promptOverwrite.js +53 -0
- package/build/esm/prompts/promptOverwrite.js.map +1 -0
- package/build/esm/prompts/promptOverwrite.test.js +55 -0
- package/build/esm/prompts/promptOverwrite.test.js.map +1 -0
- package/build/esm/prompts/promptProject.js +32 -0
- package/build/esm/prompts/promptProject.js.map +1 -0
- package/build/esm/prompts/promptProject.test.js +47 -0
- package/build/esm/prompts/promptProject.test.js.map +1 -0
- package/build/esm/prompts/promptTemplate.js +45 -0
- package/build/esm/prompts/promptTemplate.js.map +1 -0
- package/build/esm/prompts/promptTemplate.test.js +48 -0
- package/build/esm/prompts/promptTemplate.test.js.map +1 -0
- package/build/esm/run.js +132 -0
- package/build/esm/run.js.map +1 -0
- package/build/esm/templates.js +56 -0
- package/build/esm/templates.js.map +1 -0
- package/package.json +8 -10
- package/build/browser/esm-D3BAJ7G6.js +0 -456
- package/build/browser/esm-D3BAJ7G6.js.map +0 -1
- package/build/browser/esm-OBQZ3MUJ.js +0 -383
- package/build/browser/esm-OBQZ3MUJ.js.map +0 -1
- package/build/browser/esm-QBJCFCPI.js +0 -375
- package/build/browser/esm-QBJCFCPI.js.map +0 -1
- package/build/browser/esm-QPUX3UHH.js +0 -908
- package/build/browser/esm-QPUX3UHH.js.map +0 -1
- package/build/browser/esm-W6PA7H72.js +0 -1176
- package/build/browser/esm-W6PA7H72.js.map +0 -1
- package/build/browser/esm-Y4LEDX6D.js +0 -253
- package/build/browser/esm-Y4LEDX6D.js.map +0 -1
- package/build/esm/esm-D3BAJ7G6.js +0 -456
- package/build/esm/esm-D3BAJ7G6.js.map +0 -1
- package/build/esm/esm-OBQZ3MUJ.js +0 -383
- package/build/esm/esm-OBQZ3MUJ.js.map +0 -1
- package/build/esm/esm-QBJCFCPI.js +0 -375
- package/build/esm/esm-QBJCFCPI.js.map +0 -1
- package/build/esm/esm-QPUX3UHH.js +0 -908
- package/build/esm/esm-QPUX3UHH.js.map +0 -1
- package/build/esm/esm-W6PA7H72.js +0 -1176
- package/build/esm/esm-W6PA7H72.js.map +0 -1
- package/build/esm/esm-Y4LEDX6D.js +0 -253
- package/build/esm/esm-Y4LEDX6D.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
import fs from "node:fs";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { dirSync } from "tmp";
|
|
19
|
+
import { beforeEach, expect, test, vi } from "vitest";
|
|
20
|
+
import { cli } from "./cli.js";
|
|
21
|
+
import { TEMPLATES } from "./templates.js";
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
const tmpDir = dirSync({
|
|
24
|
+
unsafeCleanup: true
|
|
25
|
+
});
|
|
26
|
+
const tmpDirName = tmpDir.name;
|
|
27
|
+
vi.spyOn(process, "cwd").mockImplementation(() => tmpDirName);
|
|
28
|
+
return () => {
|
|
29
|
+
vi.restoreAllMocks();
|
|
30
|
+
tmpDir?.removeCallback();
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
for (const template of TEMPLATES) {
|
|
34
|
+
test(`CLI creates ${template.id}`, async () => {
|
|
35
|
+
await runTest({
|
|
36
|
+
project: `expected-${template.id}`,
|
|
37
|
+
template,
|
|
38
|
+
corsProxy: false
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
test(`CLI creates ${template.id} with CORS proxy`, async () => {
|
|
42
|
+
await runTest({
|
|
43
|
+
project: `expected-${template.id}-cors-proxy`,
|
|
44
|
+
template,
|
|
45
|
+
corsProxy: true
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async function runTest({
|
|
50
|
+
project,
|
|
51
|
+
template,
|
|
52
|
+
corsProxy
|
|
53
|
+
}) {
|
|
54
|
+
await cli(["npx", "@osdk/create-app", project, "--overwrite", "--template", template.id, "--foundryUrl", "https://example.palantirfoundry.com", "--applicationUrl", "https://app.example.palantirfoundry.com", "--application", "ri.third-party-applications.main.application.fake", "--clientId", "123", "--osdkPackage", "@fake/sdk", "--osdkRegistryUrl", "https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm", "--corsProxy", corsProxy.toString()]);
|
|
55
|
+
expect(fs.readdirSync(path.join(process.cwd(), project)).length).toBeGreaterThan(0);
|
|
56
|
+
expect(fs.existsSync(path.join(process.cwd(), project, "package.json"))).toBe(true);
|
|
57
|
+
expect(fs.existsSync(path.join(process.cwd(), project, "README.md"))).toBe(true);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=cli.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.test.js","names":["fs","path","dirSync","beforeEach","expect","test","vi","cli","TEMPLATES","tmpDir","unsafeCleanup","tmpDirName","name","spyOn","process","mockImplementation","restoreAllMocks","removeCallback","template","id","runTest","project","corsProxy","toString","readdirSync","join","cwd","length","toBeGreaterThan","existsSync","toBe"],"sources":["cli.test.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { dirSync } from \"tmp\";\nimport { beforeEach, expect, test, vi } from \"vitest\";\nimport { cli } from \"./cli.js\";\nimport { TEMPLATES } from \"./templates.js\";\nbeforeEach(() => {\n const tmpDir = dirSync({ unsafeCleanup: true });\n const tmpDirName = tmpDir.name;\n vi.spyOn(process, \"cwd\").mockImplementation(() => tmpDirName);\n return () => {\n vi.restoreAllMocks();\n tmpDir?.removeCallback();\n };\n});\nfor (const template of TEMPLATES) {\n test(`CLI creates ${template.id}`, async () => {\n await runTest({\n project: `expected-${template.id}`,\n template,\n corsProxy: false,\n });\n });\n test(`CLI creates ${template.id} with CORS proxy`, async () => {\n await runTest({\n project: `expected-${template.id}-cors-proxy`,\n template,\n corsProxy: true,\n });\n });\n}\nasync function runTest({ project, template, corsProxy }) {\n await cli([\n \"npx\",\n \"@osdk/create-app\",\n project,\n \"--overwrite\",\n \"--template\",\n template.id,\n \"--foundryUrl\",\n \"https://example.palantirfoundry.com\",\n \"--applicationUrl\",\n \"https://app.example.palantirfoundry.com\",\n \"--application\",\n \"ri.third-party-applications.main.application.fake\",\n \"--clientId\",\n \"123\",\n \"--osdkPackage\",\n \"@fake/sdk\",\n \"--osdkRegistryUrl\",\n \"https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm\",\n \"--corsProxy\",\n corsProxy.toString(),\n ]);\n expect(fs.readdirSync(path.join(process.cwd(), project)).length)\n .toBeGreaterThan(0);\n expect(fs.existsSync(path.join(process.cwd(), project, \"package.json\")))\n .toBe(true);\n expect(fs.existsSync(path.join(process.cwd(), project, \"README.md\")))\n .toBe(true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,EAAE,MAAM,SAAS;AACxB,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,OAAO,QAAQ,KAAK;AAC7B,SAASC,UAAU,EAAEC,MAAM,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AACrD,SAASC,GAAG,QAAQ,UAAU;AAC9B,SAASC,SAAS,QAAQ,gBAAgB;AAC1CL,UAAU,CAAC,MAAM;EACb,MAAMM,MAAM,GAAGP,OAAO,CAAC;IAAEQ,aAAa,EAAE;EAAK,CAAC,CAAC;EAC/C,MAAMC,UAAU,GAAGF,MAAM,CAACG,IAAI;EAC9BN,EAAE,CAACO,KAAK,CAACC,OAAO,EAAE,KAAK,CAAC,CAACC,kBAAkB,CAAC,MAAMJ,UAAU,CAAC;EAC7D,OAAO,MAAM;IACTL,EAAE,CAACU,eAAe,CAAC,CAAC;IACpBP,MAAM,EAAEQ,cAAc,CAAC,CAAC;EAC5B,CAAC;AACL,CAAC,CAAC;AACF,KAAK,MAAMC,QAAQ,IAAIV,SAAS,EAAE;EAC9BH,IAAI,CAAC,eAAea,QAAQ,CAACC,EAAE,EAAE,EAAE,YAAY;IAC3C,MAAMC,OAAO,CAAC;MACVC,OAAO,EAAE,YAAYH,QAAQ,CAACC,EAAE,EAAE;MAClCD,QAAQ;MACRI,SAAS,EAAE;IACf,CAAC,CAAC;EACN,CAAC,CAAC;EACFjB,IAAI,CAAC,eAAea,QAAQ,CAACC,EAAE,kBAAkB,EAAE,YAAY;IAC3D,MAAMC,OAAO,CAAC;MACVC,OAAO,EAAE,YAAYH,QAAQ,CAACC,EAAE,aAAa;MAC7CD,QAAQ;MACRI,SAAS,EAAE;IACf,CAAC,CAAC;EACN,CAAC,CAAC;AACN;AACA,eAAeF,OAAOA,CAAC;EAAEC,OAAO;EAAEH,QAAQ;EAAEI;AAAU,CAAC,EAAE;EACrD,MAAMf,GAAG,CAAC,CACN,KAAK,EACL,kBAAkB,EAClBc,OAAO,EACP,aAAa,EACb,YAAY,EACZH,QAAQ,CAACC,EAAE,EACX,cAAc,EACd,qCAAqC,EACrC,kBAAkB,EAClB,yCAAyC,EACzC,eAAe,EACf,mDAAmD,EACnD,YAAY,EACZ,KAAK,EACL,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,uHAAuH,EACvH,aAAa,EACbG,SAAS,CAACC,QAAQ,CAAC,CAAC,CACvB,CAAC;EACFnB,MAAM,CAACJ,EAAE,CAACwB,WAAW,CAACvB,IAAI,CAACwB,IAAI,CAACX,OAAO,CAACY,GAAG,CAAC,CAAC,EAAEL,OAAO,CAAC,CAAC,CAACM,MAAM,CAAC,CAC3DC,eAAe,CAAC,CAAC,CAAC;EACvBxB,MAAM,CAACJ,EAAE,CAAC6B,UAAU,CAAC5B,IAAI,CAACwB,IAAI,CAACX,OAAO,CAACY,GAAG,CAAC,CAAC,EAAEL,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CACnES,IAAI,CAAC,IAAI,CAAC;EACf1B,MAAM,CAACJ,EAAE,CAAC6B,UAAU,CAAC5B,IAAI,CAACwB,IAAI,CAACX,OAAO,CAACY,GAAG,CAAC,CAAC,EAAEL,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAChES,IAAI,CAAC,IAAI,CAAC;AACnB","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
import { consola as defaultConsola, createConsola } from "consola";
|
|
17
|
+
export const consola = createConsola({
|
|
18
|
+
// https://github.com/unjs/consola/issues/251
|
|
19
|
+
async prompt(...params) {
|
|
20
|
+
const response = await defaultConsola.prompt(...params);
|
|
21
|
+
if (typeof response === "symbol" && response.toString() === "Symbol(clack:cancel)") {
|
|
22
|
+
defaultConsola.fail("Operation cancelled");
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=consola.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consola.js","names":["consola","defaultConsola","createConsola","prompt","params","response","toString","fail","process","exit"],"sources":["consola.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { consola as defaultConsola, createConsola } from \"consola\";\nexport const consola = createConsola({\n // https://github.com/unjs/consola/issues/251\n async prompt(...params) {\n const response = (await defaultConsola.prompt(...params));\n if (typeof response === \"symbol\"\n && response.toString() === \"Symbol(clack:cancel)\") {\n defaultConsola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n return response;\n },\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,cAAc,EAAEC,aAAa,QAAQ,SAAS;AAClE,OAAO,MAAMF,OAAO,GAAGE,aAAa,CAAC;EACjC;EACA,MAAMC,MAAMA,CAAC,GAAGC,MAAM,EAAE;IACpB,MAAMC,QAAQ,GAAI,MAAMJ,cAAc,CAACE,MAAM,CAAC,GAAGC,MAAM,CAAE;IACzD,IAAI,OAAOC,QAAQ,KAAK,QAAQ,IACzBA,QAAQ,CAACC,QAAQ,CAAC,CAAC,KAAK,sBAAsB,EAAE;MACnDL,cAAc,CAACM,IAAI,CAAC,qBAAqB,CAAC;MAC1CC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACnB;IACA,OAAOJ,QAAQ;EACnB;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
export function generateEnvDevelopment({
|
|
17
|
+
envPrefix,
|
|
18
|
+
foundryUrl,
|
|
19
|
+
clientId,
|
|
20
|
+
corsProxy
|
|
21
|
+
}) {
|
|
22
|
+
return generateEnv({
|
|
23
|
+
envPrefix,
|
|
24
|
+
foundryUrl: corsProxy ? "http://localhost:8080" : foundryUrl,
|
|
25
|
+
applicationUrl: "http://localhost:8080",
|
|
26
|
+
clientId
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function generateEnvProduction({
|
|
30
|
+
envPrefix,
|
|
31
|
+
foundryUrl,
|
|
32
|
+
applicationUrl,
|
|
33
|
+
clientId
|
|
34
|
+
}) {
|
|
35
|
+
return generateEnv({
|
|
36
|
+
envPrefix,
|
|
37
|
+
foundryUrl,
|
|
38
|
+
applicationUrl,
|
|
39
|
+
clientId
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function generateEnv({
|
|
43
|
+
envPrefix,
|
|
44
|
+
foundryUrl,
|
|
45
|
+
applicationUrl,
|
|
46
|
+
clientId
|
|
47
|
+
}) {
|
|
48
|
+
return `${envPrefix}FOUNDRY_API_URL=${foundryUrl}\n` + `${applicationUrl == null ? "# " : ""}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl ?? "<Fill in the domain at which you deploy your application>"}/auth/callback\n` + `${envPrefix}FOUNDRY_CLIENT_ID=${clientId}\n`;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=generateEnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateEnv.js","names":["generateEnvDevelopment","envPrefix","foundryUrl","clientId","corsProxy","generateEnv","applicationUrl","generateEnvProduction"],"sources":["generateEnv.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nexport function generateEnvDevelopment({ envPrefix, foundryUrl, clientId, corsProxy, }) {\n return generateEnv({\n envPrefix,\n foundryUrl: corsProxy ? \"http://localhost:8080\" : foundryUrl,\n applicationUrl: \"http://localhost:8080\",\n clientId,\n });\n}\nexport function generateEnvProduction({ envPrefix, foundryUrl, applicationUrl, clientId, }) {\n return generateEnv({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId,\n });\n}\nfunction generateEnv({ envPrefix, foundryUrl, applicationUrl, clientId, }) {\n return `${envPrefix}FOUNDRY_API_URL=${foundryUrl}\\n`\n + `${applicationUrl == null ? \"# \" : \"\"}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl\n ?? \"<Fill in the domain at which you deploy your application>\"}/auth/callback\\n`\n + `${envPrefix}FOUNDRY_CLIENT_ID=${clientId}\\n`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,sBAAsBA,CAAC;EAAEC,SAAS;EAAEC,UAAU;EAAEC,QAAQ;EAAEC;AAAW,CAAC,EAAE;EACpF,OAAOC,WAAW,CAAC;IACfJ,SAAS;IACTC,UAAU,EAAEE,SAAS,GAAG,uBAAuB,GAAGF,UAAU;IAC5DI,cAAc,EAAE,uBAAuB;IACvCH;EACJ,CAAC,CAAC;AACN;AACA,OAAO,SAASI,qBAAqBA,CAAC;EAAEN,SAAS;EAAEC,UAAU;EAAEI,cAAc;EAAEH;AAAU,CAAC,EAAE;EACxF,OAAOE,WAAW,CAAC;IACfJ,SAAS;IACTC,UAAU;IACVI,cAAc;IACdH;EACJ,CAAC,CAAC;AACN;AACA,SAASE,WAAWA,CAAC;EAAEJ,SAAS;EAAEC,UAAU;EAAEI,cAAc;EAAEH;AAAU,CAAC,EAAE;EACvE,OAAO,GAAGF,SAAS,mBAAmBC,UAAU,IAAI,GAC9C,GAAGI,cAAc,IAAI,IAAI,GAAG,IAAI,GAAG,EAAE,GAAGL,SAAS,wBAAwBK,cAAc,IAClF,2DAA2D,kBAAkB,GAClF,GAAGL,SAAS,qBAAqBE,QAAQ,IAAI;AACvD","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
import { expect, test } from "vitest";
|
|
17
|
+
import { generateEnvDevelopment, generateEnvProduction } from "./generateEnv.js";
|
|
18
|
+
const expectedEnvDevelopment = `
|
|
19
|
+
PUBLIC_FOUNDRY_API_URL=https://example.palantirfoundry.com
|
|
20
|
+
PUBLIC_FOUNDRY_REDIRECT_URL=http://localhost:8080/auth/callback
|
|
21
|
+
PUBLIC_FOUNDRY_CLIENT_ID=123
|
|
22
|
+
`.trimStart();
|
|
23
|
+
const expectedEnvDevelopmentCorsProxy = `
|
|
24
|
+
PUBLIC_FOUNDRY_API_URL=http://localhost:8080
|
|
25
|
+
PUBLIC_FOUNDRY_REDIRECT_URL=http://localhost:8080/auth/callback
|
|
26
|
+
PUBLIC_FOUNDRY_CLIENT_ID=123
|
|
27
|
+
`.trimStart();
|
|
28
|
+
const expectedEnvProduction = `
|
|
29
|
+
PUBLIC_FOUNDRY_API_URL=https://example.palantirfoundry.com
|
|
30
|
+
PUBLIC_FOUNDRY_REDIRECT_URL=https://app.com/auth/callback
|
|
31
|
+
PUBLIC_FOUNDRY_CLIENT_ID=123
|
|
32
|
+
`.trimStart();
|
|
33
|
+
const expectedEnvProductionNoAppUrl = `
|
|
34
|
+
PUBLIC_FOUNDRY_API_URL=https://example.palantirfoundry.com
|
|
35
|
+
# PUBLIC_FOUNDRY_REDIRECT_URL=<Fill in the domain at which you deploy your application>/auth/callback
|
|
36
|
+
PUBLIC_FOUNDRY_CLIENT_ID=123
|
|
37
|
+
`.trimStart();
|
|
38
|
+
test("it generates .env.development", () => {
|
|
39
|
+
expect(generateEnvDevelopment({
|
|
40
|
+
envPrefix: "PUBLIC_",
|
|
41
|
+
foundryUrl: "https://example.palantirfoundry.com",
|
|
42
|
+
clientId: "123",
|
|
43
|
+
corsProxy: false
|
|
44
|
+
})).toEqual(expectedEnvDevelopment);
|
|
45
|
+
});
|
|
46
|
+
test("it generates .env.development assuming CORS proxy", () => {
|
|
47
|
+
expect(generateEnvDevelopment({
|
|
48
|
+
envPrefix: "PUBLIC_",
|
|
49
|
+
foundryUrl: "https://example.palantirfoundry.com",
|
|
50
|
+
clientId: "123",
|
|
51
|
+
corsProxy: true
|
|
52
|
+
})).toEqual(expectedEnvDevelopmentCorsProxy);
|
|
53
|
+
});
|
|
54
|
+
test("it generates .env.production", () => {
|
|
55
|
+
expect(generateEnvProduction({
|
|
56
|
+
envPrefix: "PUBLIC_",
|
|
57
|
+
foundryUrl: "https://example.palantirfoundry.com",
|
|
58
|
+
applicationUrl: "https://app.com",
|
|
59
|
+
clientId: "123"
|
|
60
|
+
})).toEqual(expectedEnvProduction);
|
|
61
|
+
});
|
|
62
|
+
test("it generates .env.production without app url", () => {
|
|
63
|
+
expect(generateEnvProduction({
|
|
64
|
+
envPrefix: "PUBLIC_",
|
|
65
|
+
foundryUrl: "https://example.palantirfoundry.com",
|
|
66
|
+
applicationUrl: undefined,
|
|
67
|
+
clientId: "123"
|
|
68
|
+
})).toEqual(expectedEnvProductionNoAppUrl);
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=generateEnv.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateEnv.test.js","names":["expect","test","generateEnvDevelopment","generateEnvProduction","expectedEnvDevelopment","trimStart","expectedEnvDevelopmentCorsProxy","expectedEnvProduction","expectedEnvProductionNoAppUrl","envPrefix","foundryUrl","clientId","corsProxy","toEqual","applicationUrl","undefined"],"sources":["generateEnv.test.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { expect, test } from \"vitest\";\nimport { generateEnvDevelopment, generateEnvProduction, } from \"./generateEnv.js\";\nconst expectedEnvDevelopment = `\nPUBLIC_FOUNDRY_API_URL=https://example.palantirfoundry.com\nPUBLIC_FOUNDRY_REDIRECT_URL=http://localhost:8080/auth/callback\nPUBLIC_FOUNDRY_CLIENT_ID=123\n`.trimStart();\nconst expectedEnvDevelopmentCorsProxy = `\nPUBLIC_FOUNDRY_API_URL=http://localhost:8080\nPUBLIC_FOUNDRY_REDIRECT_URL=http://localhost:8080/auth/callback\nPUBLIC_FOUNDRY_CLIENT_ID=123\n`.trimStart();\nconst expectedEnvProduction = `\nPUBLIC_FOUNDRY_API_URL=https://example.palantirfoundry.com\nPUBLIC_FOUNDRY_REDIRECT_URL=https://app.com/auth/callback\nPUBLIC_FOUNDRY_CLIENT_ID=123\n`.trimStart();\nconst expectedEnvProductionNoAppUrl = `\nPUBLIC_FOUNDRY_API_URL=https://example.palantirfoundry.com\n# PUBLIC_FOUNDRY_REDIRECT_URL=<Fill in the domain at which you deploy your application>/auth/callback\nPUBLIC_FOUNDRY_CLIENT_ID=123\n`.trimStart();\ntest(\"it generates .env.development\", () => {\n expect(generateEnvDevelopment({\n envPrefix: \"PUBLIC_\",\n foundryUrl: \"https://example.palantirfoundry.com\",\n clientId: \"123\",\n corsProxy: false,\n })).toEqual(expectedEnvDevelopment);\n});\ntest(\"it generates .env.development assuming CORS proxy\", () => {\n expect(generateEnvDevelopment({\n envPrefix: \"PUBLIC_\",\n foundryUrl: \"https://example.palantirfoundry.com\",\n clientId: \"123\",\n corsProxy: true,\n })).toEqual(expectedEnvDevelopmentCorsProxy);\n});\ntest(\"it generates .env.production\", () => {\n expect(generateEnvProduction({\n envPrefix: \"PUBLIC_\",\n foundryUrl: \"https://example.palantirfoundry.com\",\n applicationUrl: \"https://app.com\",\n clientId: \"123\",\n })).toEqual(expectedEnvProduction);\n});\ntest(\"it generates .env.production without app url\", () => {\n expect(generateEnvProduction({\n envPrefix: \"PUBLIC_\",\n foundryUrl: \"https://example.palantirfoundry.com\",\n applicationUrl: undefined,\n clientId: \"123\",\n })).toEqual(expectedEnvProductionNoAppUrl);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,QAAQ,QAAQ;AACrC,SAASC,sBAAsB,EAAEC,qBAAqB,QAAS,kBAAkB;AACjF,MAAMC,sBAAsB,GAAG;AAC/B;AACA;AACA;AACA,CAAC,CAACC,SAAS,CAAC,CAAC;AACb,MAAMC,+BAA+B,GAAG;AACxC;AACA;AACA;AACA,CAAC,CAACD,SAAS,CAAC,CAAC;AACb,MAAME,qBAAqB,GAAG;AAC9B;AACA;AACA;AACA,CAAC,CAACF,SAAS,CAAC,CAAC;AACb,MAAMG,6BAA6B,GAAG;AACtC;AACA;AACA;AACA,CAAC,CAACH,SAAS,CAAC,CAAC;AACbJ,IAAI,CAAC,+BAA+B,EAAE,MAAM;EACxCD,MAAM,CAACE,sBAAsB,CAAC;IAC1BO,SAAS,EAAE,SAAS;IACpBC,UAAU,EAAE,qCAAqC;IACjDC,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACf,CAAC,CAAC,CAAC,CAACC,OAAO,CAACT,sBAAsB,CAAC;AACvC,CAAC,CAAC;AACFH,IAAI,CAAC,mDAAmD,EAAE,MAAM;EAC5DD,MAAM,CAACE,sBAAsB,CAAC;IAC1BO,SAAS,EAAE,SAAS;IACpBC,UAAU,EAAE,qCAAqC;IACjDC,QAAQ,EAAE,KAAK;IACfC,SAAS,EAAE;EACf,CAAC,CAAC,CAAC,CAACC,OAAO,CAACP,+BAA+B,CAAC;AAChD,CAAC,CAAC;AACFL,IAAI,CAAC,8BAA8B,EAAE,MAAM;EACvCD,MAAM,CAACG,qBAAqB,CAAC;IACzBM,SAAS,EAAE,SAAS;IACpBC,UAAU,EAAE,qCAAqC;IACjDI,cAAc,EAAE,iBAAiB;IACjCH,QAAQ,EAAE;EACd,CAAC,CAAC,CAAC,CAACE,OAAO,CAACN,qBAAqB,CAAC;AACtC,CAAC,CAAC;AACFN,IAAI,CAAC,8CAA8C,EAAE,MAAM;EACvDD,MAAM,CAACG,qBAAqB,CAAC;IACzBM,SAAS,EAAE,SAAS;IACpBC,UAAU,EAAE,qCAAqC;IACjDI,cAAc,EAAEC,SAAS;IACzBJ,QAAQ,EAAE;EACd,CAAC,CAAC,CAAC,CAACE,OAAO,CAACL,6BAA6B,CAAC;AAC9C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
export function generateFoundryConfigJson({
|
|
17
|
+
foundryUrl,
|
|
18
|
+
application,
|
|
19
|
+
directory
|
|
20
|
+
}) {
|
|
21
|
+
return JSON.stringify({
|
|
22
|
+
foundryUrl,
|
|
23
|
+
site: {
|
|
24
|
+
application,
|
|
25
|
+
directory,
|
|
26
|
+
autoVersion: {
|
|
27
|
+
type: "git-describe",
|
|
28
|
+
tagPrefix: ""
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, null, 2) + "\n";
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=generateFoundryConfigJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFoundryConfigJson.js","names":["generateFoundryConfigJson","foundryUrl","application","directory","JSON","stringify","site","autoVersion","type","tagPrefix"],"sources":["generateFoundryConfigJson.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nexport function generateFoundryConfigJson({ foundryUrl, application, directory, }) {\n return JSON.stringify({\n foundryUrl,\n site: {\n application,\n directory,\n autoVersion: {\n type: \"git-describe\",\n tagPrefix: \"\",\n },\n },\n }, null, 2) + \"\\n\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,yBAAyBA,CAAC;EAAEC,UAAU;EAAEC,WAAW;EAAEC;AAAW,CAAC,EAAE;EAC/E,OAAOC,IAAI,CAACC,SAAS,CAAC;IAClBJ,UAAU;IACVK,IAAI,EAAE;MACFJ,WAAW;MACXC,SAAS;MACTI,WAAW,EAAE;QACTC,IAAI,EAAE,cAAc;QACpBC,SAAS,EAAE;MACf;IACJ;EACJ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
import { expect, test } from "vitest";
|
|
17
|
+
import { generateFoundryConfigJson } from "./generateFoundryConfigJson.js";
|
|
18
|
+
const expected = `
|
|
19
|
+
{
|
|
20
|
+
"foundryUrl": "https://example.palantirfoundry.com",
|
|
21
|
+
"site": {
|
|
22
|
+
"application": "ri.third-party-applications.main.application.fake",
|
|
23
|
+
"directory": "./dist",
|
|
24
|
+
"autoVersion": {
|
|
25
|
+
"type": "git-describe",
|
|
26
|
+
"tagPrefix": ""
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`.trimStart();
|
|
31
|
+
test("it generates foundry.config.json", () => {
|
|
32
|
+
expect(generateFoundryConfigJson({
|
|
33
|
+
foundryUrl: "https://example.palantirfoundry.com",
|
|
34
|
+
application: "ri.third-party-applications.main.application.fake",
|
|
35
|
+
directory: "./dist"
|
|
36
|
+
})).toEqual(expected);
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=generateFoundryConfigJson.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFoundryConfigJson.test.js","names":["expect","test","generateFoundryConfigJson","expected","trimStart","foundryUrl","application","directory","toEqual"],"sources":["generateFoundryConfigJson.test.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { expect, test } from \"vitest\";\nimport { generateFoundryConfigJson } from \"./generateFoundryConfigJson.js\";\nconst expected = `\n{\n \"foundryUrl\": \"https://example.palantirfoundry.com\",\n \"site\": {\n \"application\": \"ri.third-party-applications.main.application.fake\",\n \"directory\": \"./dist\",\n \"autoVersion\": {\n \"type\": \"git-describe\",\n \"tagPrefix\": \"\"\n }\n }\n}\n`.trimStart();\ntest(\"it generates foundry.config.json\", () => {\n expect(generateFoundryConfigJson({\n foundryUrl: \"https://example.palantirfoundry.com\",\n application: \"ri.third-party-applications.main.application.fake\",\n directory: \"./dist\",\n })).toEqual(expected);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,QAAQ,QAAQ;AACrC,SAASC,yBAAyB,QAAQ,gCAAgC;AAC1E,MAAMC,QAAQ,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAACC,SAAS,CAAC,CAAC;AACbH,IAAI,CAAC,kCAAkC,EAAE,MAAM;EAC3CD,MAAM,CAACE,yBAAyB,CAAC;IAC7BG,UAAU,EAAE,qCAAqC;IACjDC,WAAW,EAAE,mDAAmD;IAChEC,SAAS,EAAE;EACf,CAAC,CAAC,CAAC,CAACC,OAAO,CAACL,QAAQ,CAAC;AACzB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
export function generateNpmRc({
|
|
17
|
+
osdkPackage,
|
|
18
|
+
osdkRegistryUrl
|
|
19
|
+
}) {
|
|
20
|
+
// pnpm requires a trailing slash in .npmrc
|
|
21
|
+
// https://github.com/pnpm/pnpm/issues/5941
|
|
22
|
+
const withTrailingSlash = osdkRegistryUrl.endsWith("/") ? osdkRegistryUrl : osdkRegistryUrl + "/";
|
|
23
|
+
const withoutProtocol = withTrailingSlash.replace(/^https:\/\//, "");
|
|
24
|
+
const packageScope = osdkPackage.split("/")[0];
|
|
25
|
+
return `//${withoutProtocol}:_authToken=\${FOUNDRY_TOKEN}\n` + `${packageScope}:registry=${withTrailingSlash}\n`;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=generateNpmRc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateNpmRc.js","names":["generateNpmRc","osdkPackage","osdkRegistryUrl","withTrailingSlash","endsWith","withoutProtocol","replace","packageScope","split"],"sources":["generateNpmRc.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nexport function generateNpmRc({ osdkPackage, osdkRegistryUrl, }) {\n // pnpm requires a trailing slash in .npmrc\n // https://github.com/pnpm/pnpm/issues/5941\n const withTrailingSlash = osdkRegistryUrl.endsWith(\"/\")\n ? osdkRegistryUrl\n : osdkRegistryUrl + \"/\";\n const withoutProtocol = withTrailingSlash.replace(/^https:\\/\\//, \"\");\n const packageScope = osdkPackage.split(\"/\")[0];\n return `//${withoutProtocol}:_authToken=\\${FOUNDRY_TOKEN}\\n`\n + `${packageScope}:registry=${withTrailingSlash}\\n`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAAC;EAAEC,WAAW;EAAEC;AAAiB,CAAC,EAAE;EAC7D;EACA;EACA,MAAMC,iBAAiB,GAAGD,eAAe,CAACE,QAAQ,CAAC,GAAG,CAAC,GACjDF,eAAe,GACfA,eAAe,GAAG,GAAG;EAC3B,MAAMG,eAAe,GAAGF,iBAAiB,CAACG,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;EACpE,MAAMC,YAAY,GAAGN,WAAW,CAACO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC9C,OAAO,KAAKH,eAAe,iCAAiC,GACtD,GAAGE,YAAY,aAAaJ,iBAAiB,IAAI;AAC3D","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
import { expect, test } from "vitest";
|
|
17
|
+
import { generateNpmRc } from "./generateNpmRc.js";
|
|
18
|
+
const expected = `
|
|
19
|
+
//registry.com/:_authToken=\${FOUNDRY_TOKEN}
|
|
20
|
+
@myapp:registry=https://registry.com/
|
|
21
|
+
`.trimStart();
|
|
22
|
+
test("it generates .npmrc for package and registry", () => {
|
|
23
|
+
expect(generateNpmRc({
|
|
24
|
+
osdkPackage: "@myapp/sdk",
|
|
25
|
+
osdkRegistryUrl: "https://registry.com"
|
|
26
|
+
})).toEqual(expected);
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=generateNpmRc.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateNpmRc.test.js","names":["expect","test","generateNpmRc","expected","trimStart","osdkPackage","osdkRegistryUrl","toEqual"],"sources":["generateNpmRc.test.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { expect, test } from \"vitest\";\nimport { generateNpmRc } from \"./generateNpmRc.js\";\nconst expected = `\n//registry.com/:_authToken=\\${FOUNDRY_TOKEN}\n@myapp:registry=https://registry.com/\n`.trimStart();\ntest(\"it generates .npmrc for package and registry\", () => {\n expect(generateNpmRc({\n osdkPackage: \"@myapp/sdk\",\n osdkRegistryUrl: \"https://registry.com\",\n })).toEqual(expected);\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,QAAQ,QAAQ;AACrC,SAASC,aAAa,QAAQ,oBAAoB;AAClD,MAAMC,QAAQ,GAAG;AACjB;AACA;AACA,CAAC,CAACC,SAAS,CAAC,CAAC;AACbH,IAAI,CAAC,8CAA8C,EAAE,MAAM;EACvDD,MAAM,CAACE,aAAa,CAAC;IACjBG,WAAW,EAAE,YAAY;IACzBC,eAAe,EAAE;EACrB,CAAC,CAAC,CAAC,CAACC,OAAO,CAACJ,QAAQ,CAAC;AACzB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 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
|
+
import { colorize } from "consola/utils";
|
|
17
|
+
export function green(text) {
|
|
18
|
+
return colorize("green", text);
|
|
19
|
+
}
|
|
20
|
+
export function italic(text) {
|
|
21
|
+
return colorize("italic", text);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.js","names":["colorize","green","text","italic"],"sources":["highlight.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { colorize } from \"consola/utils\";\nexport function green(text) {\n return colorize(\"green\", text);\n}\nexport function italic(text) {\n return colorize(\"italic\", text);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,eAAe;AACxC,OAAO,SAASC,KAAKA,CAACC,IAAI,EAAE;EACxB,OAAOF,QAAQ,CAAC,OAAO,EAAEE,IAAI,CAAC;AAClC;AACA,OAAO,SAASC,MAAMA,CAACD,IAAI,EAAE;EACzB,OAAOF,QAAQ,CAAC,QAAQ,EAAEE,IAAI,CAAC;AACnC","ignoreList":[]}
|