Chore: Upgrade to AIK
& Massive Overhaul to internal processing #78
No reviewers
Labels
No Label
bug
chore
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
in progress
in review
invalid
npm
project: prep
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: MatthiesenXYZ/astro-ghostcms#78
Loading…
Reference in New Issue
No description provided.
Delete Branch "issue-77-Chore_Upgrade_to_utilize_AIK_&_Massive_integration_overhaul"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR is described under Issue #77
🦋 Changeset detected
Latest commit:
b6ba6fedc1
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@florian-lefebvre
Just a note, this PR is really only about
packages/astro-ghostcms
the 2 other packages just got Linted at the same time 😂 so no worry's about the other ones only the main one.the
astro-ghostcms
integration looks good! the only reviews i left are for minor things, nothing critical. btw I think you should create some little utility functions for the redundant tasks, like adding an integration and warning if verbose@ -63,0 +64,4 @@
// Config Options
ghostURL: "http://example.com", // Recommended to set here, Can also set in .env as CONTENT_API_URL
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
disableThemeProvider: false, // OPTIONAL - Default False
a matter of preferences i guess but i'd expect any property in the options to follow
camelCase
@ -0,0 +19,4 @@
const ghostUrl = CONF_URL || CONTENT_API_URL || "";
const version = "v5.0";
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
idk if you type this using a
.d.ts
file currently but fyi that's a nice dx improvementsame here
same here
same here
is there a reason for not importing it at the top of the file? if yes, I think you can use
resolve
fromcreateResolver
for the pathThis is simply to display any new version during dev-mode only... There is a check for latest version and it compares the local version :D
ah this pulls the version from the user's project?
@ -63,0 +64,4 @@
// Config Options
ghostURL: "http://example.com", // Recommended to set here, Can also set in .env as CONTENT_API_URL
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
disableThemeProvider: false, // OPTIONAL - Default False
"The first letter may or may not be capitalized in CamelCase. This difference is called UpperCamelCase and lowerCamelCase. PascalCase always has the first letter capitalized."
According the
camelCase
this convention is acceptable. I mainly switched to UpperCamelCase for the Arrays that handle multiple different things, such as theIntegations
Options that passes through to the internal integrations and theThemeProvider
which is going to become a much bigger internal entity to control how the theme system is going to work, the goal being to expand to more options for being able to add to an already built astro project or use a pre-built.@ -0,0 +19,4 @@
const ghostUrl = CONF_URL || CONTENT_API_URL || "";
const version = "v5.0";
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
Virtual config is just the first step(And yeah, I'm using a
virtual.d.ts
to keep track of types locally XD) , the New Theme Provider will have an entire virtual component system like howastro-blog
works(Future Plan), giving more flexibility on top of being able to do full theme takeover like current functionI ALWAYS FORGET YOU CAN DO
else if
vscode should complain if you do anelse { if()
lol@ -63,0 +64,4 @@
// Config Options
ghostURL: "http://example.com", // Recommended to set here, Can also set in .env as CONTENT_API_URL
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
disableThemeProvider: false, // OPTIONAL - Default False
as i said, only a matter of preferences!
i think if you have eslint you can enable such a rule
grabs the current installed one from
astro-ghostcms
local version and compares to the latestversion from NPM :P I did actually try to use theresolve()
util but that just grabbed the playgrounds package.json ironically...This could be called something like
verbose
orlogLevel
or something. Most devs would search forverbose
for verbose loggingInstead of all these manual checks for
verbose
you'd probably be better off with a util function which checks it instead.Or could be a Florian special and return a console log function:
added in new commit, since im not using console.log had to modify it for my usage a little
updated to verbose... i really don't know why i didn't call it that from the first place XD
lol there ya go... kind of shocked that worked as easily as it did
Okay i fixed that issue. Now using
resolve()
properly 😄@ -0,0 +40,4 @@
"https://ghost.org",
"1efedd9db174adee2d23d982:4b74dca0219bad629852191af326a45037346c2231240e0f7aec1f9371cc14e8",
// @ts-expect-error
"v4.0",
Are these live keys?? Might not want to commit these!
This logging function could also be extracted
Not a huge fan of this not being camel cased
You can probably resolve these paths instead of exporting it from your package?
@ -0,0 +22,4 @@
watchIntegration(resolve());
const SatoriLogger = logger.fork(
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.blue(
I'd love to see this string as a helper function too
Also might be good to have a different name in this package's logs instead of "Astro-GhostCMS". Just then if there's more specific errors for this package the user can pick those up much easier
@ -0,0 +40,4 @@
"https://ghost.org",
"1efedd9db174adee2d23d982:4b74dca0219bad629852191af326a45037346c2231240e0f7aec1f9371cc14e8",
// @ts-expect-error
"v4.0",
These are Ghosts public demo keys that ghost provides for testing purposes
@ -0,0 +22,4 @@
watchIntegration(resolve());
const SatoriLogger = logger.fork(
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.blue(
The full snippet actually includes a second name... so it appears in the log as
[Astro-GhostCMS/SatoriOG]
I was told that any Injected route had to be from an export.... I'd be interested in that alternative...
fixed... idk how that even happened... lol that must have been done by VSCode when i changed the name of the file 🤣
They did in the old days before
createResolver
❤️ it just can't be a virtual moduleUpdated...
Yeah.... Thats updated now across the board... and those exports for
/rss-routes
and/open-graph
are now moved toresolve()
@ -0,0 +19,4 @@
expect(result.errors).toBeDefined();
expect(result.errors).toHaveLength(1);
} else {
expect(result.data).toBeDefined();
You can also use
expect({}).toEqual({])
to deep check object equality@ -0,0 +1,4 @@
declare module "virtual:@matthiesenxyz/astro-ghostcms/config" {
const Config: import("./src/schemas/userconfig").GhostUserConfig;
export default Config;
Is this virtual file one that's copied to the user's project? Or is this an internal dev one? If it gets copied with like
injectDts
just make sure this relative path is ok@ -0,0 +1,4 @@
declare module "virtual:@matthiesenxyz/astro-ghostcms/config" {
const Config: import("./src/schemas/userconfig").GhostUserConfig;
export default Config;
internal dev. the virtual for config is not used for anything aside from grabbing the ghostURL for the API :P
@ -0,0 +19,4 @@
expect(result.errors).toBeDefined();
expect(result.errors).toHaveLength(1);
} else {
expect(result.data).toBeDefined();
The API Schemas are actually copied from the
ts-ghost
ones for local dev typing I just copied his tests over for sanity purposes... they succeed... thats about all i know about those onesThere 100% will be stuff that I've missed! But the integrations themselves look really nice, very clean. Seems to integrate with Starlight well and is generally using AIK to it's fullest!
I haven't tested anything works! But the code looks good 😂
@ -0,0 +32,4 @@
prerender: true,
});
};
const sanitisedRoute = options.route
Guhuhuhuhu it's so beautiful 😭 It's the best fucking line in this PR hands down. I can't believe how beautiful it is!