@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.
- package/.husky/post-commit +1 -1
- package/.publish/README.md +20 -0
- package/index.cjs +5 -2
- package/package.json +6 -8
- package/.husky/post-commit.cjs +0 -8
- package/.husky/post-commit.mjs +0 -5
- package/babel.config.cjs +0 -38
package/.husky/post-commit
CHANGED
|
@@ -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
|
|
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:
|
|
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.
|
|
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 .
|
|
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
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
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": {
|
package/.husky/post-commit.cjs
DELETED
package/.husky/post-commit.mjs
DELETED
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
|
-
}
|