Skip to content

Commit

Permalink
Update create-app to use FOUNDRY_TOKEN in templates (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzyl committed Feb 8, 2024
1 parent 139cdaf commit bcc9be9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/create-app/changelog/@unreleased/pr-40.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Update create-app to use FOUNDRY_TOKEN in templates instead of FOUNDRY_SDK_AUTH_TOKEN
links:
- https://github.com/palantir/osdk-ts/pull/40
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
//example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm:_authToken=${FOUNDRY_SDK_AUTH_TOKEN}
//example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm:_authToken=${FOUNDRY_TOKEN}
@fake:registry=https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
//example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm:_authToken=${FOUNDRY_SDK_AUTH_TOKEN}
//example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm:_authToken=${FOUNDRY_TOKEN}
@fake:registry=https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
//example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm:_authToken=${FOUNDRY_SDK_AUTH_TOKEN}
//example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm:_authToken=${FOUNDRY_TOKEN}
@fake:registry=https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.fake/contents/release/npm
2 changes: 1 addition & 1 deletion packages/create-app/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export async function cli(args: string[] = process.argv) {
message: `Done! Run the following commands to get started:\n`
+ `\n`
+ ` \`cd ${cdRelative}\`\n`
+ ` \`export FOUNDRY_SDK_AUTH_TOKEN=<token>\`\n`
+ ` \`export FOUNDRY_TOKEN=<token>\`\n`
+ ` \`npm install\`\n`
+ ` \`npm run dev\``,
style: {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/src/generate/generateNpmRc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { expect, test } from "vitest";
import { generateNpmRc } from "./generateNpmRc.js";

const expected = `
//registry.com:_authToken=\${FOUNDRY_SDK_AUTH_TOKEN}
//registry.com:_authToken=\${FOUNDRY_TOKEN}
@myapp:registry=https://registry.com
`.trimStart();

Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/src/generate/generateNpmRc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export function generateNpmRc({
osdkRegistryUrl: string;
}): string {
const withoutProtocol = osdkRegistryUrl.replace(/^https:\/\//, "");
return `//${withoutProtocol}:_authToken=\${FOUNDRY_SDK_AUTH_TOKEN}\n`
return `//${withoutProtocol}:_authToken=\${FOUNDRY_TOKEN}\n`
+ `${osdkPackage.split("/")[0]}:registry=${osdkRegistryUrl}\n`;
}

0 comments on commit bcc9be9

Please sign in to comment.