Skip to content

Commit

Permalink
Merge pull request #1151 from Chia-Network/node-v20-build-functional
Browse files Browse the repository at this point in the history
Node v20 build functional
  • Loading branch information
TheLastCicada authored Aug 12, 2024
2 parents 38a2104 + 05b1352 commit 42248fa
Show file tree
Hide file tree
Showing 12 changed files with 2,566 additions and 709 deletions.
8 changes: 5 additions & 3 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const jsConfig = require('./jsconfig.json');
module.exports = {
include: [/src/, /node_modules/],
presets: ['@babel/preset-env'],
targets: {
node: "20.16"
},
plugins: [
[
'@babel/plugin-syntax-import-attributes',
['@babel/plugin-syntax-import-attributes',
{
deprecatedAssertSyntax: true,
},
Expand All @@ -16,6 +18,6 @@ module.exports = {
{
root: [path.resolve(jsConfig.compilerOptions.baseUrl)],
},
],
]
],
};
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node 18.x
- name: Setup Node 20.x
uses: actions/setup-node@v3
with:
node-version: '18.16'
node-version: '20.16'

- name: Install Husky
run: npm install --save-dev husky
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
- name: Build arm 64 dist
run: |
mkdir pkgcache
docker run --rm --platform linux/arm64 -v $(pwd):/app -w /app -e PKG_CACHE_PATH=pkgcache node:18.16 /bin/bash -c "npm pkg delete scripts.prepare && npm install && npm i -g @babel/cli @babel/preset-env pkg && npm run create-linux-arm64-dist"
docker run --rm --platform linux/arm64 -v $(pwd):/app -w /app -e PKG_CACHE_PATH=pkgcache node:20.16 /bin/bash -c "npm pkg delete scripts.prepare && npm install && npm i -g @babel/cli @babel/preset-env pkg && npm run create-linux-arm64-dist"
- name: Copy sqlite3
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: NPM Tests
runs-on: ubuntu-latest
container:
image: node:18.16
image: node:20.16

steps:
- uses: Chia-Network/actions/clean-workspace@main
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16
20.16
15 changes: 0 additions & 15 deletions babel.config.json

This file was deleted.

23 changes: 23 additions & 0 deletions change-build-package-type-commonjs.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const fs = require('fs');
const path = require('path');

const packageJsonPath = path.resolve(__dirname, './build/package.json');

fs.readFile(packageJsonPath, 'utf8', (err, data) => {
if (err) {
console.error('Error reading package.json:', err);
process.exit(1);
}

const packageJson = JSON.parse(data);
packageJson.type = 'commonjs';

fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8', (err) => {
if (err) {
console.error('Error writing package.json:', err);
process.exit(1);
}

console.log('build package.json type updated to commonjs');
});
});
Loading

0 comments on commit 42248fa

Please sign in to comment.