Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .github/workflows/ci-loaders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
- name: Installing project dependencies
run: |
yarn install --frozen-lockfile
# use path installed by chromium-lib-install.sh
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-unstable"
- name: Test
run: |
yarn test:loaders
4 changes: 4 additions & 0 deletions .github/workflows/ci-win-loaders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
- name: Installing project dependencies
run: |
yarn install --frozen-lockfile --network-timeout 1000000
- name: Install Puppeteer Browser
# manually install chrome binary
run: |
npx puppeteer browsers install chrome
- name: Test
run: |
yarn test:loaders:win
4 changes: 4 additions & 0 deletions .github/workflows/ci-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
- name: Installing project dependencies
run: |
yarn install --frozen-lockfile --network-timeout 1000000
- name: Install Puppeteer Browser
# manually install chrome binary
run: |
npx puppeteer browsers install chrome
- name: Test
run: |
yarn test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
- name: Installing project dependencies
run: |
yarn install --frozen-lockfile
# use path installed by chromium-lib-install.sh
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-unstable"
- name: Lint
run: |
yarn lint
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.DS_Store
*.log
# ignore local chrome binary install folder for CI and Windows
.cache/
.greenwood/
.nyc_output/
.vscode/
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ To develop for the project, you'll want to follow these steps:
1. Clone the repository
1. For NVM users, run `nvm use`
1. Run `yarn install`
1. For Windows developers, run `npx puppeteer browsers install chrome`

## Feature Development

Expand Down
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default [
{
// https://github.com/eslint/eslint/discussions/18304#discussioncomment-9069706
ignores: [
// ignore local chrome binary install folder for CI and Windows
".cache/",
".greenwood/*",
"node_modules/*",
"public/*",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"format:check": "prettier . --check",
"prepare": "husky"
},
"resolutions": {
"yauzl": "3.3.1"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.25.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
rel="noreferrer noopener"
aria-label="open github page"
href="https://github.com/ProjectEvergreen/greenwood"
onclick="getOutboundLink('https://github.com/ProjectEvergreen/greenwood');"
onclick="getOutboundLink('https://github.com/ProjectEvergreen/greenwood')"
>
<!--?lit$849881805$--><svg
height="35"
Expand Down Expand Up @@ -124,7 +124,11 @@
rel="noreferrer noopener"
aria-label="slack"
href="https://join.slack.com/t/thegreenhouseio/shared_invite/enQtMzcyMzE2Mjk1MjgwLTU5YmM1MDJiMTg0ODk4MjA4NzUwNWFmZmMxNDY5MTcwM2I0MjYxN2VhOTEwNDU2YWQwOWQzZmY1YzY4MWRlOGI"
onclick="getOutboundLink('https://join.slack.com/t/thegreenhouseio/shared_invite/enQtMzcyMzE2Mjk1MjgwLTU5YmM1MDJiMTg0ODk4MjA4NzUwNWFmZmMxNDY5MTcwM2I0MjYxN2VhOTEwNDU2YWQwOWQzZmY1YzY4MWRlOGI')"
onclick="
getOutboundLink(
'https://join.slack.com/t/thegreenhouseio/shared_invite/enQtMzcyMzE2Mjk1MjgwLTU5YmM1MDJiMTg0ODk4MjA4NzUwNWFmZmMxNDY5MTcwM2I0MjYxN2VhOTEwNDU2YWQwOWQzZmY1YzY4MWRlOGI',
)
"
>
<!--?lit$849881805$--><svg
width="35"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe("Build Greenwood With: ", function () {
});

it("should contain one javascript file in the output directory", async function () {
expect(chunks.length).to.equal(15);
expect(chunks.length).to.equal(18);
});
});

Expand All @@ -225,7 +225,7 @@ describe("Build Greenwood With: ", function () {
});

it("should contain one javascript file in the output directory", async function () {
expect(chunks.length).to.equal(16);
expect(chunks.length).to.equal(19);
});
});
});
Expand Down
15,714 changes: 8,226 additions & 7,488 deletions packages/cli/test/cases/develop.default/import-map.snapshot.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ describe("Develop Greenwood With: ", function () {
it("should return the correct response body", function (done) {
const dom = new JSDOM(body);
const card = new JSDOM(
dom.window.document.querySelectorAll(
'app-card template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-card template[shadowrootmode="open"]')[0]
.innerHTML,
);
const heading = card.window.document.querySelector("h2");
const image = card.window.document.querySelector("img");
Expand Down Expand Up @@ -170,9 +169,8 @@ describe("Develop Greenwood With: ", function () {
it("should return the correct response body", function (done) {
const dom = new JSDOM(body);
const card = new JSDOM(
dom.window.document.querySelectorAll(
'app-card template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-card template[shadowrootmode="open"]')[0]
.innerHTML,
);
const heading = card.window.document.querySelector("h2");
const image = card.window.document.querySelector("img");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ describe("Serve Greenwood With: ", function () {

it("should have the expected SSR output in the HTML for an <h2> tag from JSON import", function (done) {
const hero = new JSDOM(
dom.window.document.querySelectorAll(
'app-hero template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-hero template[shadowrootmode="open"]')[0]
.innerHTML,
);
const headings = hero.window.document.querySelectorAll("div h2");

Expand All @@ -105,9 +104,8 @@ describe("Serve Greenwood With: ", function () {

it("should have the expected SSR output in the HTML for <a> tags", function (done) {
const hero = new JSDOM(
dom.window.document.querySelectorAll(
'app-hero template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-hero template[shadowrootmode="open"]')[0]
.innerHTML,
);
const links = hero.window.document.querySelectorAll("div a");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ describe("Serve Greenwood With: ", function () {
it("should return the correct response body", function (done) {
const dom = new JSDOM(body);
const card = new JSDOM(
dom.window.document.querySelectorAll(
'app-card template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-card template[shadowrootmode="open"]')[0]
.innerHTML,
);
const heading = card.window.document.querySelector("h2");
const image = card.window.document.querySelector("img");
Expand Down Expand Up @@ -142,9 +141,8 @@ describe("Serve Greenwood With: ", function () {
it("should return the correct response body", function (done) {
const dom = new JSDOM(body);
const card = new JSDOM(
dom.window.document.querySelectorAll(
'app-card template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-card template[shadowrootmode="open"]')[0]
.innerHTML,
);
const heading = card.window.document.querySelector("h2");
const image = card.window.document.querySelector("img");
Expand Down
5 changes: 3 additions & 2 deletions packages/init/src/template-base-ts/src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

<style>
:root {
--font-primary: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
--font-primary:
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

body {
Expand Down
5 changes: 3 additions & 2 deletions packages/init/src/template-base/src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

<style>
:root {
--font-primary: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
--font-primary:
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

body {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ query {
Or within your component:

```js
import gql from 'graphql-tag'; // comes with Greenwood
import { gql } from 'graphql-tag'; // comes with Greenwood

const query = gql`
{
Expand Down Expand Up @@ -290,7 +290,7 @@ Just create a _data/schema_ directory and then Greenwood will look for any files

For example, you could create a "gallery" schema that could be used to group and organize photos for your frontend using variable.
```js
import gql from 'graphql-tag';
import { gql } from 'graphql-tag';

const getGallery = async (root, query) => {
if (query.name === 'logos') {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-graphql/src/core/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { ApolloClient, HttpLink, InMemoryCache } from "@apollo/client";
import { checkResourceExists } from "@greenwood/cli/src/lib/resource-utils.js";
import fs from "node:fs/promises";
import gql from "graphql-tag";
import { gql } from "graphql-tag";
import { getQueryHash } from "./common.js";

/* Extract cache server-side */
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-graphql/src/schema/graph.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "graphql-tag";
import {
filterContentByCollection,
filterContentByRoute,
Expand Down Expand Up @@ -27,10 +27,10 @@ const getCollection = async (root, { name, orderBy }, context) => {
const sortCollection = (collection, orderBy) => {
const compare = (a, b) => {
if (orderBy === "title_asc" || orderBy === "title_desc") {
(a = a?.title), (b = b?.title);
((a = a?.title), (b = b?.title));
}
if (orderBy === "order_asc" || orderBy === "order_desc") {
(a = a?.data.order), (b = b?.data?.order);
((a = a?.data.order), (b = b?.data?.order));
}
if (orderBy === "title_asc" || orderBy === "order_asc") {
if (a < b) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-graphql/src/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { checkResourceExists } from "@greenwood/cli/src/lib/resource-utils.js";
import { makeExecutableSchema } from "@graphql-tools/schema";
import { graphTypeDefs, graphResolvers } from "./graph.js";
import fs from "node:fs/promises";
import gql from "graphql-tag";
import { gql } from "graphql-tag";

const createSchema = async (compilation) => {
const { graph } = compilation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "graphql-tag";

const getGallery = async (root, query) => {
if (query.name === "logos") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("Develop Greenwood With: ", function () {
new URL(importMap[entry].replace("/~/", "file://")).pathname.endsWith(".css"),
);

expect(cssEntries.length).to.equal(104);
expect(cssEntries.length).to.equal(170);
});

it("should have the expected number of CSS entries with `?type=raw in the import map", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ describe("Build Greenwood With Custom Lit Renderer for SSG prerendering: ", func

it("should have expected header <nav> content in the <body>", function () {
const wrapper = new JSDOM(
dom.window.document.querySelectorAll(
'app-header template[shadowrootmode="open"]',
)[0].innerHTML,
dom.window.document.querySelectorAll('app-header template[shadowrootmode="open"]')[0]
.innerHTML,
);
const nav = wrapper.window.document.querySelectorAll("header nav ul li");

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-renderer-puppeteer/src/lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
* Wraps Puppeteer's interface to Headless Chrome to expose high level rendering
* APIs that are able to handle web components and PWAs.
*/
import puppeteer from "puppeteer";
import { launch } from "puppeteer";

class BrowserRunner {
constructor() {
this.browser = {};
}

async init() {
this.browser = await puppeteer.launch({
this.browser = await launch({
args: ["--no-sandbox"],
});
}
Expand Down
22 changes: 22 additions & 0 deletions puppeteer.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// https://github.com/puppeteer/puppeteer/issues/10388#issuecomment-2323077561
const { join } = require("node:path");
const fs = require("node:fs");

const cacheDir = join(__dirname, ".cache", "puppeteer");

/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: process.env.CI ? cacheDir : undefined,
// In CI, use system Chrome to avoid download/cache issues
executablePath: (() => {
const systemChromePath = "/usr/bin/google-chrome-unstable";
if (process.env.CI && fs.existsSync(systemChromePath)) {
return systemChromePath;
}
// For local dev, let Puppeteer manage the browser automatically
return undefined;
})(),
};
2 changes: 1 addition & 1 deletion www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@evergreen-wc/eve-button": "^0.1.1",
"@evergreen-wc/eve-container": "^0.1.1",
"lit": "^3.1.0",
"lit": "^2.8.0",
"prismjs": "^1.21.0"
},
"devDependencies": {
Expand Down
Loading
Loading