Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement/upgrade Greenwood v0.31.0 #126

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
221 changes: 0 additions & 221 deletions .eslintrc.cjs

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on: [pull_request]
jobs:

build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

strategy:
matrix:
node: [18]
node: [22]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Installing project dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ on:
jobs:

build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

strategy:
matrix:
node-version: [18]
node-version: [22]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Installing project dependencies
Expand Down
3 changes: 2 additions & 1 deletion .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ ls:

ignore:
- .git
- node_modules
- node_modules
- public
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.20.2
22.13.0
32 changes: 32 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from '@eslint/js';
import globals from 'globals';

export default [
{
// https://github.com/eslint/eslint/discussions/18304#discussioncomment-9069706
ignores: [
'.greenwood/*',
'node_modules/*',
'public/*',
'reports/*'
]
},
{
languageOptions: {
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module'
},
globals: {
...globals.browser,
...globals.node,
...globals.mocha
}
},
rules: {
...js.configs.recommended.rules,
// turn this off for Prettier
'no-irregular-whitespace': 'off'
}
}
];
32 changes: 31 additions & 1 deletion greenwood.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@ import { greenwoodPluginGoogleAnalytics } from '@greenwood/plugin-google-analyti
import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw';
import { greenwoodPluginPolyfills } from '@greenwood/plugin-polyfills';
import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';
import { ResourceInterface } from '@greenwood/cli/src/lib/resource-interface.js';

class ProcessEnvReplaceResource extends ResourceInterface {
constructor(compilation) {
super();

this.compilation = compilation;
}

async shouldIntercept(url) {
return url.pathname.endsWith('redux.mjs');
}

async intercept(url, request, response) {
const body = await response.text();
const env = process.env.__GWD_COMMAND__ === 'develop' ? 'development' : 'production';
const contents = body.replace(/process.env.NODE_ENV/g, `"${env}"`);

return new Response(contents, {
headers: new Headers({
'Content-Type': 'text/javascript'
})
});
}
}

export default {
devServer: {
Expand All @@ -16,6 +41,11 @@ export default {
greenwoodPluginPolyfills(),
greenwoodPluginGoogleAnalytics({
analyticsId: 'G-0F85VEMETN'
})
}),
{
type: 'resource',
name: 'process-env-replace',
provider: (compilation) => new ProcessEnvReplaceResource(compilation)
}
]
};
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
skip_processing = true

[build.environment]
NODE_VERSION = "18.20.2"
NODE_VERSION = "22.x"

[[redirects]]
from = "/api/*"
Expand Down
Loading
Loading