mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-20 15:00:42 -07:00
chore: update to Node.js LTS
This commit is contained in:
@@ -22,7 +22,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: 'latest'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: 'latest'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Test
|
- name: Test
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: 'latest'
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: 'latest'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Lint
|
- name: Lint
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: 'latest'
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -7,20 +7,10 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
timezone: [Etc/GMT, Asia/Shanghai, America/New_York]
|
timezone: [Etc/GMT, Asia/Shanghai, America/New_York]
|
||||||
node-version: [22]
|
node-version: [latest]
|
||||||
include:
|
include:
|
||||||
- os: macos-latest
|
|
||||||
timezone: America/New_York
|
|
||||||
node-versoin: 22
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
timezone: Etc/GMT
|
node-version: lts/*
|
||||||
node-version: 20
|
|
||||||
- os: ubuntu-latest
|
|
||||||
timezone: Asia/Shanghai
|
|
||||||
node-version: 18
|
|
||||||
- os: ubuntu-latest
|
|
||||||
timezone: Asia/Shanghai
|
|
||||||
node-version: 16
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -39,7 +29,7 @@ jobs:
|
|||||||
name: dist-${{ matrix.os }}
|
name: dist-${{ matrix.os }}
|
||||||
path: dist
|
path: dist
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
run: TZ=${{ matrix.timezone }} npm test
|
run: TZ=${{ matrix.timezone || 'Etc/GMT' }} npm test
|
||||||
- name: Archive npm failure logs
|
- name: Archive npm failure logs
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: failure()
|
if: failure()
|
||||||
@@ -57,7 +47,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: latest
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
Generated
+1
-1
@@ -64,7 +64,7 @@
|
|||||||
"typescript": "^4.5.3"
|
"typescript": "^4.5.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint \"**/*.mjs\" \"**/*.ts\" .",
|
"lint": "eslint \"**/*.mjs\" \"**/*.ts\" .",
|
||||||
|
|||||||
+4
-4
@@ -89,7 +89,7 @@ const nodeEsm = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
versionInjection,
|
versionInjection,
|
||||||
replace(esmRequire),
|
replace(esmRequire),
|
||||||
typescript(tsconfig('es6'))
|
typescript(tsconfig('ES2020'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
@@ -108,7 +108,7 @@ const browserEsm = {
|
|||||||
replace(browserBase64),
|
replace(browserBase64),
|
||||||
replace(browserCrypto),
|
replace(browserCrypto),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
typescript(tsconfig('es6'))
|
typescript(tsconfig('ES2020'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
@@ -128,7 +128,7 @@ const browserUmd = {
|
|||||||
replace(browserBase64),
|
replace(browserBase64),
|
||||||
replace(browserCrypto),
|
replace(browserCrypto),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
typescript(tsconfig('es5'))
|
typescript(tsconfig('ES2020'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
input
|
input
|
||||||
@@ -148,7 +148,7 @@ const browserMin = {
|
|||||||
replace(browserBase64),
|
replace(browserBase64),
|
||||||
replace(browserCrypto),
|
replace(browserCrypto),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
typescript(tsconfig('es5')),
|
typescript(tsconfig('ES2020')),
|
||||||
uglify()
|
uglify()
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ import * as base64 from './base64-impl-browser'
|
|||||||
import { JSDOM } from 'jsdom'
|
import { JSDOM } from 'jsdom'
|
||||||
|
|
||||||
describe('base64-impl/browser', function () {
|
describe('base64-impl/browser', function () {
|
||||||
if (+(process.version.match(/^v(\d+)/) as RegExpMatchArray)[1] < 8) {
|
|
||||||
console.info('jsdom not supported, skipping base64-impl-browser...')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const dom = new JSDOM(``, {
|
const dom = new JSDOM(``, {
|
||||||
url: 'https://example.com/',
|
url: 'https://example.com/',
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ import * as sinon from 'sinon'
|
|||||||
import { JSDOM } from 'jsdom'
|
import { JSDOM } from 'jsdom'
|
||||||
|
|
||||||
describe('fs/browser', function () {
|
describe('fs/browser', function () {
|
||||||
if (+(process.version.match(/^v(\d+)/) as RegExpMatchArray)[1] < 8) {
|
|
||||||
console.info('jsdom not supported, skipping template-browser...')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
const dom = new JSDOM(``, {
|
const dom = new JSDOM(``, {
|
||||||
url: 'https://example.com/foo/bar/',
|
url: 'https://example.com/foo/bar/',
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function * sort_natural<T> (this: FilterImpl, arr: T[], property?: string
|
|||||||
return yield * sortBy.call(this, arr, property, caseInsensitiveCompare)
|
return yield * sortBy.call(this, arr, property, caseInsensitiveCompare)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const size = (v: string | any[]) => (v && v.length) || 0
|
export const size = (v: string | any[]) => v?.length || 0
|
||||||
|
|
||||||
export function * map (this: FilterImpl, arr: Scope[], property: string): IterableIterator<unknown> {
|
export function * map (this: FilterImpl, arr: Scope[], property: string): IterableIterator<unknown> {
|
||||||
const results = []
|
const results = []
|
||||||
|
|||||||
@@ -204,11 +204,11 @@ export const defaultOptions: NormalizedFullOptions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function normalize (options: LiquidOptions): NormalizedFullOptions {
|
export function normalize (options: LiquidOptions): NormalizedFullOptions {
|
||||||
if (options.hasOwnProperty('root')) {
|
if ('root' in options) {
|
||||||
if (!options.hasOwnProperty('partials')) options.partials = options.root
|
if (!('partials' in options)) options.partials = options.root
|
||||||
if (!options.hasOwnProperty('layouts')) options.layouts = options.root
|
if (!('layouts' in options)) options.layouts = options.root
|
||||||
}
|
}
|
||||||
if (options.hasOwnProperty('cache')) {
|
if ('cache' in options) {
|
||||||
let cache: LiquidCache | undefined
|
let cache: LiquidCache | undefined
|
||||||
if (typeof options.cache === 'number') cache = options.cache > 0 ? new LRU(options.cache) : undefined
|
if (typeof options.cache === 'number') cache = options.cache > 0 ? new LRU(options.cache) : undefined
|
||||||
else if (typeof options.cache === 'object') cache = options.cache
|
else if (typeof options.cache === 'object') cache = options.cache
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { Drop } from '../drop/drop'
|
import { Drop } from '../drop/drop'
|
||||||
|
|
||||||
export const toString = Object.prototype.toString
|
export const toString = Object.prototype.toString
|
||||||
|
export const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||||
const toLowerCase = String.prototype.toLowerCase
|
const toLowerCase = String.prototype.toLowerCase
|
||||||
|
|
||||||
export const hasOwnProperty = Object.hasOwnProperty
|
|
||||||
|
|
||||||
export function isString (value: any): value is string {
|
export function isString (value: any): value is string {
|
||||||
return typeof value === 'string'
|
return typeof value === 'string'
|
||||||
}
|
}
|
||||||
@@ -90,8 +89,7 @@ export function isUndefined (value: any): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isArray (value: any): value is any[] {
|
export function isArray (value: any): value is any[] {
|
||||||
// be compatible with IE 8
|
return Array.isArray(value)
|
||||||
return toString.call(value) === '[object Array]'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isArrayLike (value: any): value is any[] {
|
export function isArrayLike (value: any): value is any[] {
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "ES2020",
|
||||||
"module":"CommonJS",
|
"module":"ES2020",
|
||||||
"lib": ["es2015", "es2016", "es2017", "dom"],
|
"lib": ["ES2020", "dom"],
|
||||||
|
"moduleResolution": "node",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user