Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion greenwood.config.test-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const config: Config = {
greenwoodPluginGraphQL(),
greenwoodPluginImportCommonJs(),
greenwoodPluginImportJsx(),
greenwoodPluginImportRaw,
greenwoodPluginImportRaw(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this doesn't error out? Even putting in a string here seems to bork out plugins, but just plugins it seems?
Screenshot 2025-06-28 at 9 36 33 AM

But in a standalone project, it does work as expected
Screenshot 2025-06-27 at 8 20 45 PM

greenwoodPluginIncludeHTML(),
greenwoodPluginPolyfills(),
greenwoodPluginPostCss(),
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/data/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const PRERENDER = globalThis.__CONTENT_OPTIONS__?.PRERENDER === "true";
const PORT = globalThis?.__CONTENT_OPTIONS__?.PORT ?? 1984;
const BASE_PATH = globalThis?.__GWD_BASE_PATH__ ?? "";

/** @type {import('../types/content.d.ts').Graph} */
async function getContentAsData(key = "") {
if (CONTENT_STATE && PRERENDER) {
// fetch customized query files when a user has opted-in for prerendering with active content
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/loader.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { readAndMergeConfig } from "./lifecycles/config.js";
import { initContext } from "./lifecycles/context.js";
import { mergeResponse } from "./lib/resource-utils.js";
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/plugins/resource/plugin-typescript.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/*
*
* Manages resource related operations for TypeScript.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/types/plugins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface Plugin {
// https://greenwoodjs.dev/docs/reference/plugins-api/#adapter
export interface AdapterPlugin extends Plugin {
type: Extract<PLUGIN_TYPES, "adapter">;
provider: (compilation: Compilation) => Promise<Function>;
provider: (compilation: Compilation) => Promise;
}

// https://greenwoodjs.dev/docs/reference/plugins-api/#context
Expand Down
19 changes: 9 additions & 10 deletions packages/init/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const PACKAGE_MANAGERS = [
async function init() {
try {
const CWD = process.cwd();
const packageJson = (
await import(new URL("../package.json", import.meta.url), { with: { type: "json" } })
).default;
const packageJson = // @ts-expect-error see https://github.com/microsoft/TypeScript/issues/42866
(await import(new URL("../package.json", import.meta.url), { with: { type: "json" } }))
.default;
const { name, version } = packageJson;

console.log(
Expand All @@ -50,18 +50,17 @@ async function init() {
.option("-y, --yes", "Accept all default options")
.option("--name <name>", "Name and directory location to scaffold your application with")
.addOption(
new Option(
"--ts [choice]",
"Optionally configure your project with TypeScript",
DEFAULTS.ts,
).choices(["yes", "no"]),
new Option("--ts [choice]", "Optionally configure your project with TypeScript")
.choices(["yes", "no"])
.default(DEFAULTS.ts),
)
.addOption(
new Option(
"-i, --install <choice>",
"Install dependencies with the package manager of your choice",
DEFAULTS.install,
).choices(PACKAGE_MANAGERS.map((manager) => manager.name.toLowerCase()).concat("no")),
)
.choices(PACKAGE_MANAGERS.map((manager) => manager.name.toLowerCase()).concat("no"))
.default(DEFAULTS.install),
)
.parse(process.argv)
.opts();
Expand Down
2 changes: 1 addition & 1 deletion packages/init/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function setupPackageJson(outputDirUrl, { name, version }) {
console.log("setting up package.json...");

const packageJsonOutputUrl = new URL("./package.json", outputDirUrl);
const pkgJson = JSON.parse(fs.readFileSync(packageJsonOutputUrl));
const pkgJson = JSON.parse(fs.readFileSync(packageJsonOutputUrl, "utf-8"));
const json = {};

// setup standard fields
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-css-modules/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/*
*
* A plugin for enabling CSS Modules. :tm:
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-google-analytics/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GoogleAnalyticsResource {
}

/** @type {import('./types/index.d.ts').GoogleAnalyticsPlugin} */
const greenwoodPluginGoogleAnalytics = (options = {}) => {
const greenwoodPluginGoogleAnalytics = (options) => {
return [
{
type: "resource",
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-import-commonjs/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/*
*
* Detects and fully resolves import requests for CommonJS files in node_modules.
Expand Down
15 changes: 15 additions & 0 deletions patches/wc-compiler+0.17.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/node_modules/wc-compiler/src/index.d.ts b/node_modules/wc-compiler/src/index.d.ts
index 3c32133..5d24936 100644
--- a/node_modules/wc-compiler/src/index.d.ts
+++ b/node_modules/wc-compiler/src/index.d.ts
@@ -16,4 +16,7 @@ export type renderFromHTML = (html: string, elementURLs: URL[]) => Promise<{
metadata: Metadata
}>

-declare module "wc-compiler" { }
\ No newline at end of file
+declare module "wc-compiler" {
+ export const renderToString: renderToString;
+ export const renderFromHTML: renderFromHTML;
+}
\ No newline at end of file
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"skipLibCheck": true,
"types": ["acorn", "acorn-walk", "mocha"]
},
"include": ["./packages/*/src/types/*.d.ts", "./*.ts"],
"exclude": [
".greenwood/",
"coverage/",
"public/",
"./packages/init/src/template-base/src/components/logo/logo.js",
"./packages/cli/test/cases/develop.config.polyfills-import-attributes/src/components/hero.js",
"./packages/**/test/**",
"./test/**",
Expand Down
Loading