@modernpoacher/nunjucks 3.2.9 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,6 @@ has_package_changes () {
14
14
  if has_package_changes;
15
15
  then
16
16
  git clone https://github.com/modernpoacher/hooks.git .husky/hooks
17
- npx cross-env DEBUG=@modernpoacher/hooks* node .husky/post-commit.mjs
17
+ npx cross-env DEBUG=@modernpoacher/hooks* node .husky/hooks/post-commit.mjs
18
18
  rm -rf .husky/hooks
19
19
  fi
@@ -0,0 +1,20 @@
1
+ # Publish to NPM
2
+
3
+ For CircleCI or the shell
4
+
5
+ If you need an _authentication token_ to publish then you should resolve that before executing this script
6
+
7
+ ```bash
8
+ echo ".publish/publish.sh" >> .npmignore
9
+ git clone https://github.com/modernpoacher/publish.git .publish
10
+ .publish/publish.sh
11
+ ```
12
+
13
+ A Gist with the same content as `publish.sh` may need an additional step
14
+
15
+ ```bash
16
+ echo ".publish/publish.sh" >> .npmignore
17
+ git clone https://gist.github.com/efd85e2b8da1ee830dd637f134994a9d.git .publish
18
+ chmod +x .publish/publish.sh
19
+ .publish/publish.sh
20
+ ```
package/index.cjs CHANGED
@@ -11,7 +11,8 @@ let ENVIRONMENT
11
11
  function compile (src, options = {}, next = null) {
12
12
  log('compile')
13
13
 
14
- const template = Nunjucks.compile(src, ENVIRONMENT || (ENVIRONMENT = options.environment), (Reflect.has(options, 'filename') ? Reflect.get(options, 'filename') : null))
14
+ const fileName = ('filename' in options ? options.filename : null)
15
+ const template = Nunjucks.compile(src, ENVIRONMENT || (ENVIRONMENT = options.environment), fileName)
15
16
 
16
17
  return (next instanceof Function)
17
18
  ? next(null, (context, options, next) => template.render(context, next))
@@ -28,7 +29,9 @@ function prepare (options = {}, next = () => {}) {
28
29
 
29
30
  options.compileOptions = {
30
31
  ...compileOptions,
31
- environment: ENVIRONMENT || configure(path, { watch: false })
32
+ environment: (
33
+ ENVIRONMENT || configure(path, { watch: false })
34
+ )
32
35
  }
33
36
 
34
37
  return next()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/nunjucks",
3
- "version": "3.2.9",
3
+ "version": "3.3.0",
4
4
  "description": "Nunjucks for Hapi",
5
5
  "keywords": [
6
6
  "hapi",
@@ -22,19 +22,17 @@
22
22
  "url": "git+https://github.com/modernpoacher/nunjucks.git"
23
23
  },
24
24
  "scripts": {
25
- "lint": "eslint . --ext .cjs,.mjs",
25
+ "lint": "eslint .",
26
26
  "lint:fix": "npm run lint -- --fix"
27
27
  },
28
28
  "dependencies": {
29
29
  "debug": "^4.4.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@babel/core": "^7.26.10",
33
- "@babel/eslint-parser": "^7.26.10",
34
- "@babel/preset-env": "^7.26.9",
35
- "core-js": "^3.41.0",
36
- "eslint": "8.57.1",
37
- "eslint-config-standard": "^17.1.0",
32
+ "@sequencemedia/eslint-config-standard": "^0.2.44",
33
+ "@types/debug": "^4.1.12",
34
+ "eslint": "^9.23.0",
35
+ "globals": "^16.0.0",
38
36
  "husky": "^9.1.7"
39
37
  },
40
38
  "peerDependencies": {
@@ -1,8 +0,0 @@
1
- module.exports = (
2
- import('./hooks/index.mjs')
3
- .then(({
4
- postCommit
5
- }) => (
6
- postCommit()
7
- ))
8
- )
@@ -1,5 +0,0 @@
1
- import {
2
- postCommit
3
- } from './hooks/index.mjs'
4
-
5
- export default postCommit()
package/babel.config.cjs DELETED
@@ -1,38 +0,0 @@
1
- const debug = require('debug')
2
-
3
- const log = debug('@modernpoacher/nunjucks')
4
-
5
- const {
6
- env: {
7
- NODE_ENV = 'development'
8
- }
9
- } = process
10
-
11
- log('`@modernpoacher/nunjucks` is awake')
12
-
13
- function env () {
14
- log({ NODE_ENV })
15
-
16
- return (
17
- NODE_ENV === 'production'
18
- )
19
- }
20
-
21
- module.exports = (api) => {
22
- if (api) api.cache.using(env)
23
-
24
- return {
25
- presets: [
26
- [
27
- '@babel/env',
28
- {
29
- targets: {
30
- node: 'current'
31
- },
32
- useBuiltIns: 'usage',
33
- corejs: 3
34
- }
35
- ]
36
- ]
37
- }
38
- }