-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
67aabfc
commit a83ab34
Showing
23 changed files
with
578 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@osdk/generator-utils": patch | ||
--- | ||
|
||
Introduces generator utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@osdk/foundry-sdk-generator": patch | ||
--- | ||
|
||
Generated packages should have proper package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@osdk/foundry-sdk-generator": patch | ||
--- | ||
|
||
Generated packages now use ^ dependencies on @osdk/api and @osdk/client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "@osdk/generator-utils", | ||
"version": "0.0.0", | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/palantir/osdk-ts.git" | ||
}, | ||
"exports": { | ||
".": { | ||
"browser": "./build/browser/index.js", | ||
"import": "./build/esm/index.js" | ||
}, | ||
"./*": { | ||
"browser": "./build/browser/public/*.js", | ||
"import": "./build/esm/public/*.js" | ||
} | ||
}, | ||
"scripts": { | ||
"check-attw": "monorepo.tool.attw esm", | ||
"check-spelling": "cspell --quiet .", | ||
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo", | ||
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)", | ||
"lint": "eslint . && dprint check --config $(find-up dprint.json)", | ||
"transpile": "monorepo.tool.transpile" | ||
}, | ||
"dependencies": { | ||
"find-up": "^7.0.0", | ||
"tiny-invariant": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"@osdk/monorepo.api-extractor": "workspace:~", | ||
"@osdk/monorepo.tsconfig": "workspace:~", | ||
"@osdk/monorepo.tsup": "workspace:~", | ||
"@types/node": "^18.0.0", | ||
"@types/tmp": "^0.2.6", | ||
"tmp": "^0.2.3", | ||
"typescript": "~5.5.4" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"files": [ | ||
"build/cjs", | ||
"build/esm", | ||
"build/browser", | ||
"CHANGELOG.md", | ||
"package.json", | ||
"templates", | ||
"*.d.ts" | ||
], | ||
"module": "./build/esm/index.js", | ||
"types": "./build/esm/index.d.ts", | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2024 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { describe, expect, it } from "vitest"; | ||
import { changeVersionPrefix } from "./changeVersionPrefix.js"; | ||
|
||
describe(changeVersionPrefix, () => { | ||
const expectedPrefix = "^"; | ||
it.each(["1.2.3", "~1.2.3", "^1.2.3"])( | ||
`replaces "%s" with "${expectedPrefix}1.2.3"`, | ||
async (version) => { | ||
const result = await changeVersionPrefix(version, expectedPrefix); | ||
expect(result).toEqual(`${expectedPrefix}1.2.3`); | ||
}, | ||
); | ||
|
||
it.each(["workspace:1.2.3", "workspace:~1.2.3", "workspace:^1.2.3"])( | ||
`replaces "%s" with "${expectedPrefix}1.2.3"`, | ||
async (version) => { | ||
const result = await changeVersionPrefix(version, expectedPrefix); | ||
expect(result).toEqual(`workspace:${expectedPrefix}1.2.3`); | ||
}, | ||
); | ||
|
||
it.each(["workspace:*", "workspace:^", "workspace:~"])( | ||
`replaces "%s" with "workspace:${expectedPrefix}"`, | ||
async (version) => { | ||
const result = await changeVersionPrefix(version, expectedPrefix); | ||
expect(result).toEqual(`workspace:${expectedPrefix}`); | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2024 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export function changeVersionPrefix( | ||
version: string, | ||
prefix: "^" | "~" | "", | ||
): string { | ||
const isWorkspaceProtocol = version.startsWith("workspace:"); | ||
if (isWorkspaceProtocol) { | ||
version = version.slice("workspace:".length); | ||
} | ||
if (version[0] === "^" || version[0] === "~" || version[0] === "*") { | ||
version = version.slice(1); | ||
} | ||
|
||
return `${isWorkspaceProtocol ? "workspace:" : ""}${prefix}${version}`; | ||
} |
Oops, something went wrong.