-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interactive pages publish prompts (#891)
* Store account_id and project_name in config cache * Interactive prompts for 'wrangler pages publish' and related commands * Use logger instead of console * Fix grep for current git branch * Truncate file hashing to 32 chars * Add changeset for interactive prompts * Fix tests for 'wrangler pages publish'
- Loading branch information
1 parent
b77aa38
commit bae5ba4
Showing
7 changed files
with
294 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,7 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
feat: Adds interactive prompts for the 'wrangler pages publish' and related commands. | ||
|
||
Additionally, those commands now read from `node_modules/.cache/wrangler/pages.json` to persist users' account IDs and project names. |
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 |
---|---|---|
@@ -1,31 +1,36 @@ | ||
import { getConfigCache, saveToConfigCache } from "../config-cache"; | ||
import { runInTempDir } from "./helpers/run-in-tmp"; | ||
|
||
interface PagesConfigCache { | ||
account_id: string; | ||
pages_project_name: string; | ||
} | ||
|
||
describe("config cache", () => { | ||
runInTempDir(); | ||
|
||
const pagesConfigCacheFilename = "pages-config-cache.json"; | ||
|
||
it("should return an empty config if no file exists", () => { | ||
expect(getConfigCache(pagesConfigCacheFilename)).toMatchInlineSnapshot( | ||
`Object {}` | ||
); | ||
expect( | ||
getConfigCache<PagesConfigCache>(pagesConfigCacheFilename) | ||
).toMatchInlineSnapshot(`Object {}`); | ||
}); | ||
|
||
it("should read and write values without overriding old ones", () => { | ||
saveToConfigCache(pagesConfigCacheFilename, { | ||
saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, { | ||
account_id: "some-account-id", | ||
pages_project_name: "foo", | ||
}); | ||
expect(getConfigCache(pagesConfigCacheFilename).account_id).toEqual( | ||
"some-account-id" | ||
); | ||
expect( | ||
getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id | ||
).toEqual("some-account-id"); | ||
|
||
saveToConfigCache(pagesConfigCacheFilename, { | ||
saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, { | ||
pages_project_name: "bar", | ||
}); | ||
expect(getConfigCache(pagesConfigCacheFilename).account_id).toEqual( | ||
"some-account-id" | ||
); | ||
expect( | ||
getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id | ||
).toEqual("some-account-id"); | ||
}); | ||
}); |
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
Oops, something went wrong.