Skip to content

Commit

Permalink
enhancement/upgrade greenwood v0.31.0 (#100)
Browse files Browse the repository at this point in the history
* upgrade greenwood v0.31.0-alpha.0

* process.env.NODE_ENV work around

* upgrade greenwood v0.31.0-alpha.1

* upgrade greenwood v0.31.0-alpha.2

* bump to v0.31.0-alpha.5 and bump to Node 22

* ESLint and Stylelint upgrades

* upgrade greenwood v0.31.0-alpha.6

* bump to greenwood v0.31.0
  • Loading branch information
thescientist13 authored Jan 27, 2025
1 parent fac8efd commit c389b3b
Show file tree
Hide file tree
Showing 30 changed files with 5,885 additions and 3,484 deletions.
225 changes: 0 additions & 225 deletions .eslintrc.cjs

This file was deleted.

8 changes: 4 additions & 4 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
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Installing project dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ on:
jobs:

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

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

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- 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
5 changes: 5 additions & 0 deletions .postcssrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: [
require('postcss-nested') // eslint-disable-line @typescript-eslint/no-require-imports
]
}; // eslint-disable-line @typescript-eslint/no-unused-expressions
37 changes: 37 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import js from "@eslint/js";
import globals from "globals";
import noOnlyTests from "eslint-plugin-no-only-tests";
import tseslint from "typescript-eslint";

export default tseslint.config(
{
// https://github.com/eslint/eslint/discussions/18304#discussioncomment-9069706
ignores: [
".greenwood/*",
"node_modules/*",
"public/*",
"reports/*",
"storybook-static/**",
"patches/**",
],
},
{
languageOptions: {
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
globals: {
...globals.browser,
...globals.mocha,
...globals.chai,
...globals.node,
},
},
plugins: {
"no-only-tests": noOnlyTests,
},
},
js.configs.recommended,
tseslint.configs.recommended,
);
31 changes: 29 additions & 2 deletions greenwood.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
import { greenwoodPluginFontAwesome } from '@analogstudiosri/greenwood-plugin-font-awesome';
import { greenwoodPluginGoogleAnalytics } from '@greenwood/plugin-google-analytics';
import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript';
import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';
import analyze from 'rollup-plugin-analyzer';
import { visualizer } from 'rollup-plugin-visualizer';
import dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';
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 {
optimization: 'inline',
Expand All @@ -18,7 +42,6 @@ export default {
},
plugins: [
greenwoodPluginPostCss(),
greenwoodPluginFontAwesome(),
greenwoodPluginTypeScript(),
// https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
greenwoodPluginGoogleAnalytics({
Expand Down Expand Up @@ -55,6 +78,10 @@ export default {
})
];
}
}, {
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

0 comments on commit c389b3b

Please sign in to comment.