render-script 0.0.4 → 0.0.8

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/README.md ADDED
@@ -0,0 +1 @@
1
+ # render-script
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "render-script",
3
- "version": "0.0.4",
3
+ "version": "0.0.8",
4
4
  "main": "./lib/index.cjs",
5
5
  "type": "module",
6
6
  "author": {
@@ -17,10 +17,11 @@
17
17
  "lint": "eslint . --ext .cjs --ext .mjs",
18
18
  "lint:fix": "npm run lint -- --fix",
19
19
  "test": "cross-env NODE_ENV=test mocha test --recursive --verbose --color",
20
+ "gulp": "gulp --color",
20
21
  "clean": "rimraf lib",
21
22
  "build": "npm run babel",
22
23
  "babel": "babel src -d lib --out-file-extension .cjs",
23
- "pre-commit": "npm run lint && npm run build && git add lib",
24
+ "pre-commit": "npm run lint && npm run build && git add lib && npm run gulp -- pre-commit",
24
25
  "prepublishOnly": "npm run build",
25
26
  "prebuild": "npm run clean"
26
27
  },
@@ -43,10 +44,14 @@
43
44
  "eslint-plugin-mocha": "^9.0.0",
44
45
  "eslint-plugin-node": "^11.1.0",
45
46
  "eslint-plugin-promise": "^5.1.0",
47
+ "gulp": "^4.0.2",
46
48
  "husky": "^7.0.2",
47
49
  "mocha": "^9.1.3",
48
50
  "rimraf": "^3.0.2"
49
51
  },
52
+ "imports": {
53
+ "#build/gulp/*": "./build/gulp/*.mjs"
54
+ },
50
55
  "exports": {
51
56
  "import": "./src/index.mjs",
52
57
  "require": "./lib/index.cjs"
@@ -1,58 +0,0 @@
1
- version: 2.1
2
-
3
- jobs:
4
- publish:
5
- docker:
6
- - image: circleci/node:lts
7
- steps:
8
- - checkout
9
- - run:
10
- name: Publish to NPM
11
- command: |
12
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
13
-
14
- PATTERN="([0-9]+)\.([0-9]+)\.([0-9]+)"
15
- NAME=$(node -p "require('./package').name")
16
- VERSION=$(node -p "require('./package').version")
17
- PUBLISHED_VERSION=$(npm view $NAME version)
18
-
19
- echo Version is $VERSION
20
- echo Published version is $PUBLISHED_VERSION
21
-
22
- [[ $VERSION =~ $PATTERN ]]
23
-
24
- VERSION_MAJOR="${BASH_REMATCH[1]}"
25
- VERSION_MINOR="${BASH_REMATCH[2]}"
26
- VERSION_PATCH="${BASH_REMATCH[3]}"
27
-
28
- [[ $PUBLISHED_VERSION =~ $PATTERN ]]
29
-
30
- PUBLISHED_VERSION_MAJOR="${BASH_REMATCH[1]}"
31
- PUBLISHED_VERSION_MINOR="${BASH_REMATCH[2]}"
32
- PUBLISHED_VERSION_PATCH="${BASH_REMATCH[3]}"
33
-
34
- if [ $VERSION_MAJOR -gt $PUBLISHED_VERSION_MAJOR ] || [ $VERSION_MINOR -gt $PUBLISHED_VERSION_MINOR ] || [ $VERSION_PATCH -gt $PUBLISHED_VERSION_PATCH ]
35
- then
36
- set +e
37
-
38
- npm ci
39
- npm publish
40
-
41
- if [[ $? != 0 ]];
42
- then
43
- echo Version $VERSION was not published
44
- else
45
- echo Published version $VERSION
46
- fi
47
- fi
48
-
49
- workflows:
50
- version: 2
51
- commit-workflow:
52
- jobs:
53
- - publish:
54
- filters:
55
- branches:
56
- only: master
57
- tags:
58
- only: /^v.*/
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- .circleci
2
- lib
package/.eslintrc DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "standard",
3
- "parser": "@babel/eslint-parser",
4
- "parserOptions": {
5
- "ecmaVersion": 2020,
6
- "sourceType": "module"
7
- },
8
- "settings": {
9
- "import/extensions": [
10
- ".mjs",
11
- ".cjs"
12
- ],
13
- "import/resolver": {
14
- "babel-module": {}
15
- }
16
- }
17
- }
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npm run pre-commit
package/babel.config.cjs DELETED
@@ -1,54 +0,0 @@
1
- const debug = require('debug')
2
-
3
- const log = debug('render-script')
4
-
5
- const {
6
- env: {
7
- NODE_ENV = 'development'
8
- }
9
- } = process
10
-
11
- log('`render-script` is awake')
12
-
13
- function env () {
14
- log({ NODE_ENV })
15
-
16
- return (
17
- NODE_ENV === 'production'
18
- )
19
- }
20
-
21
- const presets = [
22
- [
23
- '@babel/env', {
24
- useBuiltIns: 'usage',
25
- targets: {
26
- node: 'current'
27
- },
28
- corejs: 3
29
- }
30
- ]
31
- ]
32
-
33
- const plugins = [
34
- [
35
- 'module-resolver', {
36
- root: ['.'],
37
- cwd: 'babelrc',
38
- alias: {
39
- '~': './src'
40
- }
41
- }
42
- ]
43
- ]
44
-
45
- module.exports = (api) => {
46
- if (api) api.cache.using(env)
47
-
48
- return {
49
- compact: true,
50
- comments: false,
51
- presets,
52
- plugins
53
- }
54
- }
package/test/.eslintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "env": {
3
- "mocha": true
4
- }
5
- }
@@ -1,302 +0,0 @@
1
- import {
2
- expect
3
- } from 'chai'
4
-
5
- import evaluate, {
6
- evaluateRuleForConfiguration,
7
- getRuleMap,
8
- getConfigurationMap,
9
- getEvaluation
10
- } from 'render-script'
11
-
12
- describe('~', () => {
13
- describe('`evaluate`', () => {
14
- it('is a function', () => {
15
- return expect(evaluate)
16
- .to.be.a('function')
17
- })
18
- })
19
-
20
- describe('`evaluateRuleForConfiguration`', () => {
21
- it('is a function', () => {
22
- return expect(evaluateRuleForConfiguration)
23
- .to.be.a('function')
24
- })
25
- })
26
-
27
- describe('`getRuleMap`', () => {
28
- it('is a function', () => {
29
- return expect(getRuleMap)
30
- .to.be.a('function')
31
- })
32
- })
33
-
34
- describe('`getConfigurationMap`', () => {
35
- it('is a function', () => {
36
- return expect(getConfigurationMap)
37
- .to.be.a('function')
38
- })
39
- })
40
-
41
- describe('`getEvaluation`', () => {
42
- it('is a function', () => {
43
- return expect(getEvaluation)
44
- .to.be.a('function')
45
- })
46
- })
47
-
48
- describe('`evaluate()`', () => {
49
- describe('`rule` has rules', () => {
50
- describe('`configuration` has configuration', () => {
51
- describe('`configuration` has a match', () => {
52
- it('returns true', () => {
53
- return expect(evaluate('+A', '+A'))
54
- .to.be.true
55
- })
56
- })
57
-
58
- describe('`configuration` does not have a match', () => {
59
- it('returns false', () => {
60
- return expect(evaluate('+B', '+A'))
61
- .to.be.false
62
- })
63
- })
64
-
65
- describe('Every rule must be true', () => {
66
- describe('`configuration` has a combination match', () => {
67
- it('returns true', () => {
68
- return expect(evaluate('+1/2/3+A+4/5/6+B', '+1+6+A+B'))
69
- .to.be.true
70
- })
71
- })
72
-
73
- describe('`configuration` does not have a combination match', () => {
74
- it('returns false', () => {
75
- return expect(evaluate('+1/2/3+A+4/5/6+B', '+6+A'))
76
- .to.be.false
77
- })
78
- })
79
-
80
- describe('`configuration` has a negation match', () => {
81
- it('returns false', () => {
82
- return expect(evaluate('+1/2/3+A+4/5/6+!B', '+1+6+A+B'))
83
- .to.be.false
84
- })
85
- })
86
-
87
- describe('`configuration` does not have a negation match', () => {
88
- it('returns true', () => {
89
- return expect(evaluate('+1/2/3+A+4/5/6+!C', '+1+6+A+B'))
90
- .to.be.true
91
- })
92
- })
93
- })
94
-
95
- describe('At least one rule must be true', () => {
96
- describe('`configuration` has a combination match', () => {
97
- it('returns true', () => {
98
- return expect(evaluate('+1/2/3+A;+4/5/6+B', '+6+B'))
99
- .to.be.true
100
- })
101
- })
102
-
103
- describe('`configuration` does not have a combination match', () => {
104
- it('returns false', () => {
105
- return expect(evaluate('+1/2/3+A;+4/5/6+B', '+6+A'))
106
- .to.be.false
107
- })
108
- })
109
-
110
- describe('`configuration` has a negation match', () => {
111
- it('returns false', () => {
112
- return expect(evaluate('+!A;+!B', '+1+6+A+B'))
113
- .to.be.false
114
- })
115
- })
116
-
117
- describe('`configuration` does not have a negation match', () => {
118
- it('returns true', () => {
119
- return expect(evaluate('+1/2/3+A;!B', '+1+6+A+B'))
120
- .to.be.true
121
- })
122
- })
123
-
124
- describe('`configuration` has a negation match in combination', () => {
125
- it('returns false', () => {
126
- return expect(evaluate('+1/2/3+A;+4/5/6+B;+7/8/9+C;+!A+!B+!C', '+C'))
127
- .to.be.false
128
- })
129
- })
130
-
131
- describe('`configuration` does not have a negation match in combination', () => {
132
- it('returns true', () => {
133
- return expect(evaluate('+1/2/3+A;+4/5/6+B;+7/8/9+C;+!A+!B+!C;', '+9+C'))
134
- .to.be.true
135
- })
136
- })
137
- })
138
- })
139
-
140
- describe('`configuration` does not have configuration', () => {
141
- it('returns false', () => {
142
- return expect(evaluate('+A'))
143
- .to.be.false
144
- })
145
- })
146
- })
147
-
148
- describe('`rule` does not have rules', () => {
149
- describe('`configuration` has configuration', () => {
150
- it('returns false', () => {
151
- return expect(evaluate('', '+A'))
152
- .to.be.false
153
- })
154
- })
155
-
156
- describe('`configuration` does not have configuration', () => {
157
- it('returns false', () => {
158
- return expect(evaluate())
159
- .to.be.false
160
- })
161
- })
162
- })
163
- })
164
-
165
- describe('`getRuleMap()`', () => {
166
- it('is a `Map`', () => {
167
- return expect(getRuleMap())
168
- .to.be.an.instanceof(Map)
169
- })
170
- })
171
-
172
- describe('`getConfigurationMap`', () => {
173
- it('is a `Map`', () => {
174
- return expect(getConfigurationMap())
175
- .to.be.an.instanceof(Map)
176
- })
177
- })
178
-
179
- describe('`getEvaluation`', () => {
180
- it('returns false', () => {
181
- return expect(getEvaluation())
182
- .to.be.false
183
- })
184
- })
185
-
186
- describe('`evaluateRuleForConfiguration()`', () => {
187
- describe('`rule` has rules', () => {
188
- describe('`configuration` has configuration', () => {
189
- describe('`configuration` has a match', () => {
190
- it('returns true', () => {
191
- return expect(evaluateRuleForConfiguration('+A', '+A'))
192
- .to.be.true
193
- })
194
- })
195
-
196
- describe('`configuration` does not have a match', () => {
197
- it('returns false', () => {
198
- return expect(evaluateRuleForConfiguration('+B', '+A'))
199
- .to.be.false
200
- })
201
- })
202
-
203
- describe('Every rule must be true', () => {
204
- describe('`configuration` has a combination match', () => {
205
- it('returns true', () => {
206
- return expect(evaluateRuleForConfiguration('+1/2/3+A+4/5/6+B', '+1+6+A+B'))
207
- .to.be.true
208
- })
209
- })
210
-
211
- describe('`configuration` does not have a combination match', () => {
212
- it('returns false', () => {
213
- return expect(evaluateRuleForConfiguration('+1/2/3+A+4/5/6+B', '+6+A'))
214
- .to.be.false
215
- })
216
- })
217
-
218
- describe('`configuration` has a negation match', () => {
219
- it('returns false', () => {
220
- return expect(evaluateRuleForConfiguration('+1/2/3+A+4/5/6+!B', '+1+6+A+B'))
221
- .to.be.false
222
- })
223
- })
224
-
225
- describe('`configuration` does not have a negation match', () => {
226
- it('returns true', () => {
227
- return expect(evaluateRuleForConfiguration('+1/2/3+A+4/5/6+!C', '+1+6+A+B'))
228
- .to.be.true
229
- })
230
- })
231
- })
232
-
233
- describe('At least one rule must be true', () => {
234
- describe('`configuration` has a combination match', () => {
235
- it('returns true', () => {
236
- return expect(evaluateRuleForConfiguration('+1/2/3+A;+4/5/6+B', '+6+B'))
237
- .to.be.true
238
- })
239
- })
240
-
241
- describe('`configuration` does not have a combination match', () => {
242
- it('returns false', () => {
243
- return expect(evaluateRuleForConfiguration('+1/2/3+A;+4/5/6+B', '+6+A'))
244
- .to.be.false
245
- })
246
- })
247
-
248
- describe('`configuration` has a negation match', () => {
249
- it('returns false', () => {
250
- return expect(evaluateRuleForConfiguration('+!A;+!B', '+1+6+A+B'))
251
- .to.be.false
252
- })
253
- })
254
-
255
- describe('`configuration` does not have a negation match', () => {
256
- it('returns true', () => {
257
- return expect(evaluateRuleForConfiguration('+1/2/3+A;!B', '+1+6+A+B'))
258
- .to.be.true
259
- })
260
- })
261
-
262
- describe('`configuration` has a negation match in combination', () => {
263
- it('returns false', () => {
264
- return expect(evaluateRuleForConfiguration('+1/2/3+A;+4/5/6+B;+7/8/9+C;+!A+!B+!C', '+C'))
265
- .to.be.false
266
- })
267
- })
268
-
269
- describe('`configuration` does not have a negation match in combination', () => {
270
- it('returns true', () => {
271
- return expect(evaluateRuleForConfiguration('+1/2/3+A;+4/5/6+B;+7/8/9+C;+!A+!B+!C;', '+9+C'))
272
- .to.be.true
273
- })
274
- })
275
- })
276
- })
277
-
278
- describe('`configuration` does not have configuration', () => {
279
- it('returns false', () => {
280
- return expect(evaluateRuleForConfiguration('+A'))
281
- .to.be.false
282
- })
283
- })
284
- })
285
-
286
- describe('`rule` does not have rules', () => {
287
- describe('`configuration` has configuration', () => {
288
- it('returns false', () => {
289
- return expect(evaluateRuleForConfiguration('', '+A'))
290
- .to.be.false
291
- })
292
- })
293
-
294
- describe('`configuration` does not have configuration', () => {
295
- it('returns false', () => {
296
- return expect(evaluateRuleForConfiguration())
297
- .to.be.false
298
- })
299
- })
300
- })
301
- })
302
- })