From c473aa1c3678f75bd12b3e030694df7bd287c111 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Wed, 23 Nov 2022 20:36:23 -0500 Subject: [PATCH 1/4] upgrade node 18 --- .github/workflows/ci-exp.yml | 2 +- .github/workflows/ci-win-exp.yml | 2 +- .github/workflows/ci-win.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/master.yml | 2 +- .github/workflows/release.yml | 2 +- .nvmrc | 2 +- netlify.toml | 2 +- packages/cli/package.json | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-exp.yml b/.github/workflows/ci-exp.yml index 24b429750..b01b1a192 100644 --- a/.github/workflows/ci-exp.yml +++ b/.github/workflows/ci-exp.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node: [16] + node: [18] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/ci-win-exp.yml b/.github/workflows/ci-win-exp.yml index 2d44f8e86..b398782fd 100644 --- a/.github/workflows/ci-win-exp.yml +++ b/.github/workflows/ci-win-exp.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node: [16] + node: [18] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index d77469e15..36fe33b60 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node: [14, 16] + node: [18] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58faed016..56d8639aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node: [14, 16] + node: [18] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 33587f150..f18c95568 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node: [14] + node: [18] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df303ab7c..a75e96b94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [14] + node-version: [18] steps: - uses: actions/checkout@v1 diff --git a/.nvmrc b/.nvmrc index 975215f45..72c7744b3 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.17.0 \ No newline at end of file +18.12.1 \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index 5c42cda2e..3db7ff18d 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,7 +6,7 @@ skip_processing = true [build.environment] - NODE_VERSION = "14.16.0" + NODE_VERSION = "18.12.1" [[redirects]] from = "/docs/tech-stack/" diff --git a/packages/cli/package.json b/packages/cli/package.json index c8d5f82d9..7c42bfb0e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -12,7 +12,7 @@ "Web Components" ], "engines": { - "node": ">=14" + "node": ">=18.12.1" }, "bin": { "greenwood": "./src/index.js" From 1828e1e46e7b6022f9e8cfcfd2700084a7bc8b7f Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Wed, 23 Nov 2022 20:36:49 -0500 Subject: [PATCH 2/4] update node version documentation --- www/pages/docs/server-rendering.md | 2 +- www/pages/getting-started/index.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/www/pages/docs/server-rendering.md b/www/pages/docs/server-rendering.md index 67165b030..e4905e38a 100644 --- a/www/pages/docs/server-rendering.md +++ b/www/pages/docs/server-rendering.md @@ -218,7 +218,7 @@ console.log(json); // { status: 200, message: 'some data' } ``` **Steps** -1. Make sure you are using Node `v16.17.0` +1. Make sure you are using Node `v18.12.1` 1. Run the Greenwood CLI using the `--experimental-loaders` flag and pass Greenwood's custom loader ```shell $ node --experimental-loader ./node_modules/@greenwood/cli/src/loader.js ./node_modules/.bin/greenwood diff --git a/www/pages/getting-started/index.md b/www/pages/getting-started/index.md index b4e397f65..9b4264875 100644 --- a/www/pages/getting-started/index.md +++ b/www/pages/getting-started/index.md @@ -36,10 +36,10 @@ $ npm -v # for example $ node -v -v14.16.0 +v18.12.1 $ npm -v -6.4.1 +8.19.2 ``` Along with this, familiarity of the command line / terminal is also assumed as Greenwood is a command line tool, and so all examples will assume a bash / shell like environment. Example commands used in this guide are: From 8059d4b853b9abceaa605252628a967e2df8fcea Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Wed, 23 Nov 2022 21:18:56 -0500 Subject: [PATCH 3/4] adopt native fetch --- package.json | 2 +- packages/cli/package.json | 1 - packages/cli/src/loader.js | 6 ++---- packages/cli/src/plugins/resource/plugin-dev-proxy.js | 1 - .../build.default.ssr-static-export/src/pages/artists.js | 2 -- .../cli/test/cases/build.default.ssr/src/pages/artists.js | 2 -- .../cli/test/cases/build.default.ssr/src/pages/users.js | 1 - packages/cli/test/cases/develop.ssr/src/pages/artists.js | 2 -- packages/init/package.json | 1 - packages/init/src/index.js | 1 - packages/plugin-graphql/package.json | 3 +-- packages/plugin-graphql/src/core/cache.js | 1 - www/pages/docs/server-rendering.md | 1 - yarn.lock | 2 +- 14 files changed, 5 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 5e1bdf14e..543f885ed 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build": "cross-env __GWD_ROLLUP_MODE__=strict node . build", "serve": "node . serve", "develop": "node . develop", - "test": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict c8 mocha --exclude \"./packages/**/test/cases/exp-*/**\" \"./packages/**/**/*.spec.js\"", + "test": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 c8 mocha --exclude \"./packages/**/test/cases/exp-*/**\" \"./packages/**/**/*.spec.js\"", "test:exp": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --experimental-loader $(pwd)/test/test-loader.js ./node_modules/mocha/bin/mocha \"./packages/**/**/*.spec.js\"", "test:exp:win": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --experimental-loader file:\\\\%cd%\\test\\test-loader.js ./node_modules/mocha/bin/mocha --exclude \"./packages/init/test/cases/**\" \"./packages/**/**/*.spec.js\"", "test:tdd": "yarn test --watch", diff --git a/packages/cli/package.json b/packages/cli/package.json index 7c42bfb0e..b05a3c273 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -36,7 +36,6 @@ "koa": "^2.13.0", "livereload": "^0.9.1", "markdown-toc": "^1.2.0", - "node-fetch": "^2.6.1", "node-html-parser": "^1.2.21", "rehype-raw": "^5.0.0", "rehype-stringify": "^8.0.0", diff --git a/packages/cli/src/loader.js b/packages/cli/src/loader.js index 8e139c353..dc1f1c1e1 100644 --- a/packages/cli/src/loader.js +++ b/packages/cli/src/loader.js @@ -1,4 +1,3 @@ -// Node ^16.17.0 import path from 'path'; import { readAndMergeConfig as initConfig } from './lifecycles/config.js'; import { URL, fileURLToPath } from 'url'; @@ -10,12 +9,11 @@ const plugins = config.plugins.filter(plugin => plugin.type === 'resource' && !p } })); -// TODO need to polyfill original URL header instead of extensions? function getCustomLoaderPlugins(url, body, headers) { return plugins.filter(plugin => plugin.extensions.includes(path.extname(url)) && (plugin.shouldServe(url, body, headers) || plugin.shouldIntercept(url, body, headers))); } -// https://nodejs.org/docs/latest-v16.x/api/esm.html#resolvespecifier-context-nextresolve +// https://nodejs.org/docs/latest-v18.x/api/esm.html#resolvespecifier-context-nextresolve export function resolve(specifier, context, defaultResolve) { const { baseURL } = context; @@ -29,7 +27,7 @@ export function resolve(specifier, context, defaultResolve) { return defaultResolve(specifier, context, defaultResolve); } -// https://nodejs.org/docs/latest-v16.x/api/esm.html#loadurl-context-nextload +// https://nodejs.org/docs/latest-v18.x/api/esm.html#loadurl-context-nextload export async function load(source, context, defaultLoad) { const resourcePlugins = getCustomLoaderPlugins(source); const extension = path.extname(source).replace('.', ''); diff --git a/packages/cli/src/plugins/resource/plugin-dev-proxy.js b/packages/cli/src/plugins/resource/plugin-dev-proxy.js index ee9d031ad..20dd4c2bd 100644 --- a/packages/cli/src/plugins/resource/plugin-dev-proxy.js +++ b/packages/cli/src/plugins/resource/plugin-dev-proxy.js @@ -3,7 +3,6 @@ * Manages routing devServer.proxy entries to their destination. * */ -import fetch from 'node-fetch'; import { ResourceInterface } from '../../lib/resource-interface.js'; class DevProxyResource extends ResourceInterface { diff --git a/packages/cli/test/cases/build.default.ssr-static-export/src/pages/artists.js b/packages/cli/test/cases/build.default.ssr-static-export/src/pages/artists.js index 28b8aad9c..43a81868b 100644 --- a/packages/cli/test/cases/build.default.ssr-static-export/src/pages/artists.js +++ b/packages/cli/test/cases/build.default.ssr-static-export/src/pages/artists.js @@ -1,5 +1,3 @@ -import fetch from 'node-fetch'; - async function getTemplate(compilation, route) { return ` diff --git a/packages/cli/test/cases/build.default.ssr/src/pages/artists.js b/packages/cli/test/cases/build.default.ssr/src/pages/artists.js index 229252a54..46a4b4c4d 100644 --- a/packages/cli/test/cases/build.default.ssr/src/pages/artists.js +++ b/packages/cli/test/cases/build.default.ssr/src/pages/artists.js @@ -1,5 +1,3 @@ -import fetch from 'node-fetch'; - async function getTemplate(compilation, route) { return ` diff --git a/packages/cli/test/cases/build.default.ssr/src/pages/users.js b/packages/cli/test/cases/build.default.ssr/src/pages/users.js index f40a25706..91a1afc82 100644 --- a/packages/cli/test/cases/build.default.ssr/src/pages/users.js +++ b/packages/cli/test/cases/build.default.ssr/src/pages/users.js @@ -1,4 +1,3 @@ -import fetch from 'node-fetch'; import '../components/card.js'; export default class UsersPage extends HTMLElement { diff --git a/packages/cli/test/cases/develop.ssr/src/pages/artists.js b/packages/cli/test/cases/develop.ssr/src/pages/artists.js index cd1884f91..db9d9ac8a 100644 --- a/packages/cli/test/cases/develop.ssr/src/pages/artists.js +++ b/packages/cli/test/cases/develop.ssr/src/pages/artists.js @@ -1,5 +1,3 @@ -import fetch from 'node-fetch'; - async function getTemplate(compilation, route) { return ` diff --git a/packages/init/package.json b/packages/init/package.json index 3b668a632..f13f25510 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -26,7 +26,6 @@ "chalk": "^4.1.2", "commander": "^8.2.0", "inquirer": "^8.2.0", - "node-fetch": "^2.6.7", "simple-git": "^2.48.0" } } diff --git a/packages/init/src/index.js b/packages/init/src/index.js index 18f231dbc..df4982da3 100755 --- a/packages/init/src/index.js +++ b/packages/init/src/index.js @@ -16,7 +16,6 @@ import chalk from 'chalk'; import simpleGit from 'simple-git'; import commander from 'commander'; import { copyFolder } from './copy-folder.js'; -import fetch from 'node-fetch'; import fs from 'fs'; import inquirer from 'inquirer'; import os from 'os'; diff --git a/packages/plugin-graphql/package.json b/packages/plugin-graphql/package.json index e43ae7259..5e0c89f97 100644 --- a/packages/plugin-graphql/package.json +++ b/packages/plugin-graphql/package.json @@ -28,8 +28,7 @@ "@rollup/plugin-alias": "^3.1.2", "apollo-server": "^2.21.0", "graphql": "^15.5.0", - "graphql-tag": "^2.10.1", - "node-fetch": "^2.6.1" + "graphql-tag": "^2.10.1" }, "devDependencies": { "@greenwood/cli": "^0.27.2" diff --git a/packages/plugin-graphql/src/core/cache.js b/packages/plugin-graphql/src/core/cache.js index 564c1345a..b3f070149 100644 --- a/packages/plugin-graphql/src/core/cache.js +++ b/packages/plugin-graphql/src/core/cache.js @@ -1,5 +1,4 @@ import ApolloCore from '@apollo/client/core/core.cjs.js'; -import fetch from 'node-fetch'; import fs from 'fs'; import { gql } from 'apollo-server'; import { getQueryHash } from './common.js'; diff --git a/www/pages/docs/server-rendering.md b/www/pages/docs/server-rendering.md index e4905e38a..eb43c1fb2 100644 --- a/www/pages/docs/server-rendering.md +++ b/www/pages/docs/server-rendering.md @@ -64,7 +64,6 @@ export { When using `export default`, Greenwood supports providing a custom element as the export for your page content. It uses [**WCC**](https://github.com/ProjectEvergreen/wcc) by default which also includes support for rendering [Declarative Shadow DOM](https://web.dev/declarative-shadow-dom/). ```js -import fetch from 'node-fetch'; import '../components/card/card.js'; // export default class UsersPage extends HTMLElement { diff --git a/yarn.lock b/yarn.lock index c19b0ac1c..a246e608b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8254,7 +8254,7 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" -node-fetch@2.6.7, node-fetch@^2.5.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: +node-fetch@2.6.7, node-fetch@^2.5.0, node-fetch@^2.6.0, node-fetch@^2.6.1: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== From 2b03ac0648073d5acbc147435d63172bb12649ed Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Thu, 1 Dec 2022 21:28:34 -0500 Subject: [PATCH 4/4] upgrade Ubuntu version for Linux GitHub Actions --- .github/workflows/ci-exp.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-exp.yml b/.github/workflows/ci-exp.yml index b01b1a192..e70ccf359 100644 --- a/.github/workflows/ci-exp.yml +++ b/.github/workflows/ci-exp.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: matrix: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56d8639aa..f066490ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: matrix: