Skip to content

Commit c22a8ef

Browse files
authored
fix(dist): import module error
1. fix(dist): import module Update outdated rollup-plugins. The dev-dependency rollup-plugin-node-resolve introduced a breaking change. Once the mainFields property had values, rollup.js worked again. Also set package.json#files to "dist", which ensures the distribution if much smaller, e.g., Also set package.json#files to "dist", which ensures the distribution if much smaller. Introduce two new npm-scripts to make pre-release testing easier: 1. bundle:clean - removes ./dist/ and *.tgz 2. prebundle: calls bundle:clean 3. postbundle - calls npm pack #38 2. build(env): add config values Add missing ENV VARS: - CODACY_PROJECT_TOKEN= - C_TEST_REPORTER_ID= #38 3. build(pkg): update all dependencies Update all dependencies while updating rollup-plugins for issue #38. #35 #36 #37 #39
1 parent ba7287b commit c22a8ef

File tree

22 files changed

+2858
-1858
lines changed

22 files changed

+2858
-1858
lines changed

.env.defaults

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@
88
## 🚫 Your production database should have a different password
99
## 🚫 than your development database.
1010

11+
# Codacy
12+
13+
CODACY_PROJECT_TOKEN=
14+
15+
# CodeClimate
16+
17+
CC_TEST_REPORTER_ID=
18+
1119
#
1220
# Product manifest (package.json) variables
1321
#
1422

23+
NODE_ENV=development
1524
NPM_PACKAGE_NAME=archetypes-rules
1625
NPM_PACKAGE_VERSION=
1726

@@ -69,16 +78,25 @@ JEST_JUNIT_ANCESTOR_SEPARATOR=
6978
# @default "false"
7079
JEST_USE_PATH_FOR_SUITE_NAME=
7180

81+
#
82+
# RollupJS
83+
84+
BUILD=production
85+
INCLUDE_DEPS=true
86+
7287
#
7388
# SonarCloud variable defaults
7489
#
7590

7691
# SonarCloud static code analysis
92+
93+
K8S_SECRET_SONAR_TOKEN=
94+
SONAR_BRANCH_NAME=
7795
SONAR_BRANCH_TARGET=master
7896
SONAR_HOST_URL=https://sonarcloud.io
7997
SONAR_ORGANIZATION=commonality
98+
SONAR_PROJECT_DESCRIPTION=
8099
SONAR_PROJECT_KEY=commonality_archetypes-rules
81100
SONAR_PROJECT_NAME=archetypes-rules
82-
SONAR_PROJECT_VERSION=$SONAR_PROJECT_VERSION
101+
SONAR_PROJECT_VERSION=
83102
SONAR_TOKEN=
84-
K8S_SECRET_SONAR_TOKEN=

.env.schema

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ JEST_JUNIT_ANCESTOR_SEPARATOR=
7878
# @default "false"
7979
JEST_USE_PATH_FOR_SUITE_NAME=
8080

81+
## Rollup.js
82+
83+
BUILD=
84+
INCLUDE_DEPS=
85+
8186
#
8287
# SonarCloud variables (CI/CD code analysis)
8388
#
@@ -89,18 +94,17 @@ JEST_USE_PATH_FOR_SUITE_NAME=
8994
# npm --loglevel silent run vars:git:branch:name
9095
# @see https://sonarcloud.io/documentation/branches/overview/
9196

92-
SONAR_BRANCH_NAME=
9397

9498
# The default branch of the repository; it should almost always
9599
# be "master".
96100

101+
SONAR_BRANCH_NAME=
102+
K8S_SECRET_SONAR_TOKEN=
97103
SONAR_BRANCH_TARGET=
98-
SONAR_DATA_LOSS_SIGNATURES_TOKEN=
99104
SONAR_HOST_URL=
100105
SONAR_ORGANIZATION=
101106
SONAR_PROJECT_DESCRIPTION=
102107
SONAR_PROJECT_KEY=
103108
SONAR_PROJECT_NAME=
104109
SONAR_PROJECT_VERSION=
105110
SONAR_TOKEN=
106-
K8S_SECRET_SONAR_TOKEN=

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock = false
2+
unsafe-perm = true

lib/__tests__/env-config.test.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ const envConfig = require('../env-config.js')
33
describe('envConfig', () => {
44
it('initializes all environment variables', () => {
55
const envConfigKeys = [
6-
'CODACY_PROJECT_TOKEN',
6+
'BUILD',
77
'CC_TEST_REPORTER_ID',
8+
'CODACY_PROJECT_TOKEN',
89
'GH_TOKEN',
910
'GITHUB_TOKEN',
1011
'GITLAB_ENDPOINT',
@@ -14,6 +15,7 @@ describe('envConfig', () => {
1415
'GITLAB_RESOLVE_BODY_ONLY',
1516
'GITLAB_RESOURCE',
1617
'GITLAB_TOKEN',
18+
'INCLUDE_DEPS',
1719
'JEST_JUNIT_ANCESTOR_SEPARATOR',
1820
'JEST_JUNIT_CLASSNAME',
1921
'JEST_JUNIT_OUTPUT',
@@ -25,20 +27,24 @@ describe('envConfig', () => {
2527
'JEST_USE_PATH_FOR_SUITE_NAME',
2628
'K8S_SECRET_GITLAB_TOKEN',
2729
'K8S_SECRET_SONAR_TOKEN',
30+
'NODE_ENV',
2831
'NPM_PACKAGE_NAME',
2932
'NPM_PACKAGE_VERSION',
3033
'NPM_TOKEN',
34+
'SONAR_BRANCH_NAME',
3135
'SONAR_BRANCH_TARGET',
3236
'SONAR_HOST_URL',
3337
'SONAR_ORGANIZATION',
38+
'SONAR_PROJECT_DESCRIPTION',
3439
'SONAR_PROJECT_KEY',
3540
'SONAR_PROJECT_NAME',
3641
'SONAR_PROJECT_VERSION',
3742
'SONAR_TOKEN',
3843
'SONAR_TOKEN_ARCHETYPES_RULES'
3944
]
4045
expect(envConfig).toBeDefined()
41-
expect(Object.keys(envConfig).length)
42-
.toBeLessThanOrEqual(envConfigKeys.length)
46+
expect(Object.keys(envConfig).length).toBeLessThanOrEqual(
47+
envConfigKeys.length
48+
)
4349
})
4450
})

lib/__tests__/invalid-rule-element-error.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const InvalidRuleElementError = require('../invalid-rule-element-error.js')
1+
const InvalidRuleElementError = require('../errors/invalid-rule-element-error')
22

33
describe('InvalidRuleElementError', () => {
44
it('represents an invalid or unrecognized RuleElement instance', () => {

lib/__tests__/rule-element.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable max-len */
2-
const RuleElement = require('../rule-element.js')
2+
const RuleElement = require('../rule-element/rule-element')
33

44
describe('RuleElement', () => {
55
describe('is an abstract representation of all properties common among Operators, Propositions, and Variables, with', () => {

lib/env-config.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
require('debug')('dls:envConfig')
1+
const debug = require('debug')('archetypes:rules:env-config')
22
const dotenvExtended = require('dotenv-extended')
33
const set = require('lodash.set')
4-
const topairs = require('lodash.topairs')
4+
const toPairs = require('lodash.topairs')
55

66
/**
77
* @description
@@ -14,17 +14,17 @@ const topairs = require('lodash.topairs')
1414
* @see https://git.io/fhV1h
1515
*/
1616

17-
const dotenvExtendedODefaults = {
18-
assignToProcessEnv: false,
17+
const dotenvExtendedDefaults = {
18+
assignToProcessEnv: true,
1919
defaults: '.env.defaults',
20-
errorOnMissing: false,
20+
errorOnMissing: true,
2121
includeProcessEnv: true,
2222
overrideProcessEnv: false,
2323
path: '.env',
2424
schema: '.env.schema'
2525
}
2626

27-
const initEnvDefaults = (options = dotenvExtendedODefaults) => ({
27+
const initEnvDefaults = (options = dotenvExtendedDefaults) => ({
2828
parsed: Object.assign(dotenvExtended.load(options))
2929
})
3030

@@ -34,7 +34,7 @@ const sortEnvVars = (envDefaults) => {
3434

3535
}
3636
}
37-
const keyValuePairs = topairs(envDefaults.parsed).sort()
37+
const keyValuePairs = toPairs(envDefaults.parsed).sort()
3838
const envVarMap = new Map(keyValuePairs)
3939
envVarMap.forEach((val, key) => {
4040
set(dotenvVars.parsed, key, val)
@@ -49,4 +49,6 @@ const createEnvConfig = () => {
4949

5050
const envConfig = createEnvConfig()
5151

52+
debug(envConfig)
53+
5254
module.exports = envConfig
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const assignTypeTo = require('./helpers/assign-type-to')
1+
const assignTypeTo = require('../helpers/assign-type-to')
22

33
class InvalidRuleElementError extends TypeError {
44
constructor (message) {

lib/factory/helpers/load-rule-elements.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const { isOperator } = require('../../operator/operator')
22
const { isProposition } = require('../../proposition/proposition')
33
const { isVariable } = require('../../variable/variable')
4-
const InvalidRuleElementError = require('../../invalid-rule-element-error')
4+
/* eslint-disable-next-line max-len */
5+
const InvalidRuleElementError = require('../../errors/invalid-rule-element-error')
56
const toArray = require('lodash.toarray')
67
const variableFactory = require('../../variable/variable-factory')
78

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const ArrayVariable = require('./variable/array-variable')
33
const DateVariable = require('./variable/date-variable')
44
const ErrorVariable = require('./variable/error-variable')
55
const Fact = require('./rule-context/fact')
6-
const InvalidRuleElementError = require('./invalid-rule-element-error')
6+
const InvalidRuleElementError = require('./errors/invalid-rule-element-error')
77
const factory = require('./factory/factory')
88
const MapVariable = require('./variable/map-variable')
99
const NumberVariable = require('./variable/number-variable')
@@ -12,7 +12,7 @@ const Operator = require('./operator/operator')
1212
const Proposition = require('./proposition/proposition')
1313
const Rule = require('./rule/rule')
1414
const RuleContext = require('./rule-context/rule-context')
15-
const RuleElement = require('./rule-element')
15+
const RuleElement = require('./rule-element/rule-element')
1616
const RuleOverride = require('./rule-override/rule-override')
1717
const RuleSet = require('./rule-set/rule-set')
1818
const SetVariable = require('./variable/set-variable')

0 commit comments

Comments
 (0)