Skip to content

Commit

Permalink
Merge pull request #369 from linzjs/node-upgrade
Browse files Browse the repository at this point in the history
upgrade node to the latest lts version
  • Loading branch information
allanchau committed Feb 21, 2024
2 parents fda1345 + 18daff7 commit 9eeaa14
Show file tree
Hide file tree
Showing 144 changed files with 5,800 additions and 6,581 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[*.jade]
[*.pug]
indent_style = space
indent_size = 4

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/buildandrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: lts/*
Expand All @@ -25,8 +25,8 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: lts/*
Expand Down
96 changes: 48 additions & 48 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,63 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '30 9 * * 3'
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '30 9 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
strategy:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
8 changes: 4 additions & 4 deletions .github/workflows/docusaurus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Test Build
run: |
if [ -e yarn.lock ]; then
Expand All @@ -27,8 +27,8 @@ jobs:
gh-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Add key to allow access to repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

## v1.0.0-19.0.0 - 2024-02-21

### Changed

- Node.js v20 compatibility.
- Mongoose v8 compatibility.
- MongoDB v7 compatibility.

## v1.0.0-18.9.3 - 2022-03-15

### Fixed
Expand Down Expand Up @@ -350,7 +358,7 @@
- `utils.js` has been move back into the head. Client-side scripts can now make use of `linz.loadScript` and `linz.addLoadEvent` once again.
- Added a new default `mongoose options` which can be used to control the options passed to Mongoose when making a connection. Provides support for Mongoose `4.11.x` in which the default connection logic has been removed.
- By allowing the results of record/overview actions to return the `.modal-dialog` div, you have more flexibility on the size of the modal (i.e. `<div class="modal-dialog modal-lg">` renders a large modal).
- Removed `.modal-dialog .modal-content` from the modal divs in `layout.jade`. They should now be included in the HTML returned from any record/overview actions that specify the use of a modal.
- Removed `.modal-dialog .modal-content` from the modal divs in `layout.pug`. They should now be included in the HTML returned from any record/overview actions that specify the use of a modal.
- You can now use `req.flash('linz-notification', linz.api.views.notification({ text: 'Hi' }))` to have Linz show a notification for you on redirect.
- You can now use `req.linz.notifications.push(linz.api.views.notification({ text: 'Hi' }))` to have Linz show a notification for you.
- Notifications are now shown in models list, model create, model list, record edit and record overview pages.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.0-alpine
FROM node:20.11.1-alpine

# Setup dockerize.
# Keep bash and curl to run the codecov bash script.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.0-alpine
FROM node:20.11.1-alpine

# Setup dockerize.
# Keep bash and curl to run the codecov bash script.
Expand Down
14 changes: 7 additions & 7 deletions app/models/mtOrg/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"use strict";
'use strict';

const linz = require("linz");
const linz = require('linz');
const mtOrgSchema = require('./schema');

// add the formtools plugin
mtOrgSchema.plugin(linz.formtools.plugins.document, require('./formtools'));

mtOrgSchema.pre("save", function(next, callback, req) {
if (req && req.user) {
this.modifiedBy = req.user.username;
mtOrgSchema.pre('save', function(next) {
if (this.user) {
this.modifiedBy = this.user.username;
}

return next(callback, req);
return next();
});

module.exports = linz.mongoose.model("mtOrg", mtOrgSchema);
module.exports = linz.mongoose.model('mtOrg', mtOrgSchema);
21 changes: 11 additions & 10 deletions app/models/mtUser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,27 @@ mtUserSchema.plugin(linz.formtools.plugins.document, require('./formtools'));
// Add versions plugin
mtUserSchema.plugin(linz.versions.plugin, require('./versions'));

mtUserSchema.plugin(linz.concurrencyControl.plugin, require('./concurrency-control'));
mtUserSchema.plugin(
linz.concurrencyControl.plugin,
require('./concurrency-control')
);

mtUserSchema.virtual('hasAdminAccess').get(function () {
mtUserSchema.virtual('hasAdminAccess').get(function() {
return this.bAdmin === true;
});

mtUserSchema.methods.verifyPassword = function (candidatePassword, callback) {
mtUserSchema.methods.verifyPassword = function(candidatePassword, callback) {
return callback(null, this.password === candidatePassword);
}
};

mtUserSchema.pre('save', function (next, callback, req) {

if (req && req.user) {
this.modifiedBy = req.user.username;
mtUserSchema.pre('save', function(next) {
if (this.user) {
this.modifiedBy = this.username;
}

this.increment();

return next(callback, req);

return next();
});

module.exports = linz.mongoose.model('mtUser', mtUserSchema);

0 comments on commit 9eeaa14

Please sign in to comment.