@signageos/lib 16.3.0 → 17.0.0-master.3227

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 CHANGED
@@ -7,8 +7,7 @@ observables, async iterators and a lot more.
7
7
  It's published as an npm library @signageos/lib that can be used in any project that requires and is using those technologies to simplify
8
8
  the business logic.
9
9
 
10
- The library could be potentially separated into more libraries with a single purpose in the future. Currently, keeping the library in one
11
- package is still more practical than maintaining it separately.
10
+ Contents of this library should eventually be migrated into more granular packages in this repo.
12
11
 
13
12
  > :information_source: If you are not logged in, run
14
13
  > `docker login https://registry.gitlab.com/ -u YOUR_USERNAME@signageos.io -p YOUR_PERSONAL_ACCESS_TOKEN`
@@ -30,7 +29,7 @@ EOF
30
29
  3. `npm test`
31
30
 
32
31
  # Limitations
33
- This repository shouldn't have any `@signageos` dependencies. Otherwise there will be problem cyclic dependencies
32
+ This repository shouldn't have any `@signageos` dependencies. Otherwise there will be problem with cyclic dependencies
34
33
 
35
34
  <!-- TODO: Remove when replaced with secret manager -->
36
35
  ## Tests
package/package.json CHANGED
@@ -1,139 +1,131 @@
1
1
  {
2
- "name": "@signageos/lib",
3
- "version": "16.3.0",
4
- "main": "./dist",
5
- "files": [
6
- "tools",
7
- "package.json"
8
- ],
9
- "repository": {
10
- "url": "git@gitlab.com:signageos/lib",
11
- "type": "git"
12
- },
13
- "bin": {
14
- "lib": "./tools/lib",
15
- "npm-login": "./tools/npm-login"
16
- },
17
- "scripts": {
18
- "build": "npm run build-es5 && npm run build-es6",
19
- "build-es5": "tsc --target es5 --outDir dist && npm run escheck:5",
20
- "build-es6": "tsc --target es6 --outDir es6 && npm run escheck:6",
21
- "lint": "eslint --ext .ts,.tsx,.js ./src/ ./config ./tests ./tools",
22
- "lint:prettier:fix": "prettier \"**/*.(ts|tsx|json|js)\" --write",
23
- "clean-build": "rm -rf dist/* && npm run build",
24
- "test": "NODE_ENV=test mocha",
25
- "test:coverage": "c8 npm run test",
26
- "test-connections": "NODE_ENV=test mocha --allow-uncaught --config .mocharc.connections.js",
27
- "test-rabbit-connection": "NODE_ENV=test mocha --config .mocharc.connections-rabbit.js",
28
- "watch": "tsc --watch",
29
- "check": "npm run depcheck && tools/check-deps.js",
30
- "check:forbidden-dependencies": "node tools/check-forbidden-dependencies.js",
31
- "depcheck": "depcheck --config .depcheckrc.json",
32
- "escheck:5": "es-check --module es5 dist/**/*.js",
33
- "escheck:6": "es-check --module es6 es6/**/*.js"
34
- },
35
- "author": "Michael Zabka <zabka.michael@gmail.com>",
36
- "license": "MIT",
37
- "dependencies": {},
38
- "optionalDependencies": {
39
- "esbuild": "0.19.3"
40
- },
41
- "optionalPeerDependencies": {
42
- "@aws-sdk/client-s3": "3.489.0",
43
- "aws-sdk": "^2.1472.0",
44
- "@influxdata/influxdb-client": "1.16.0",
45
- "@sentry/node": ">=5.15.5",
46
- "@sentry/browser": ">=5.15.5",
47
- "@swc/core": ">=1.4.12",
48
- "amqp10": "~3.5.0",
49
- "mocha": "^3.1.2",
50
- "npm": "^8.19.4",
51
- "pg": "7.12.1",
52
- "pg-promise": "^10.11.0",
53
- "redis": "^3.1.2",
54
- "mongoose": "^8.0.0",
55
- "mongodb": "6.2.0",
56
- "sinon": "15.2.0",
57
- "webpack": "4.41.2",
58
- "ws": "^6.0.0",
59
- "zen-observable": "0.8.14"
60
- },
61
- "engines": {
62
- "node": "20",
63
- "npm": ">=10"
64
- },
65
- "devDependencies": {
66
- "@aws-sdk/client-s3": "3.489.0",
67
- "@aws-sdk/types": "^3.489.0",
68
- "@faker-js/faker": "8.3.1",
69
- "@influxdata/influxdb-client": "1.16.0",
70
- "@istanbuljs/nyc-config-typescript": "1.0.2",
71
- "@signageos/codestyle": "0.3.0",
72
- "@swc/core": "1.4.12",
73
- "@types/amqplib": "0.5.13",
74
- "@types/async-lock": "1.4.2",
75
- "@types/basic-auth": "1.1.8",
76
- "@types/css-tree": "2.3.5",
77
- "@types/debug": "0.0.29",
78
- "@types/express": "4.17.21",
79
- "@types/fs-extra": "11.0.4",
80
- "@types/glob": "8.1.0",
81
- "@types/http-status": "0.2.30",
82
- "@types/lodash": "4.14.158",
83
- "@types/mocha": "10.0.6",
84
- "@types/node": "20.14.9",
85
- "@types/node-fetch": "2.6.4",
86
- "@types/on-finished": "2.3.4",
87
- "@types/path-browserify": "1.0.2",
88
- "@types/qs": "6.9.14",
89
- "@types/raven": "2.5.7",
90
- "@types/redis": "2.8.32",
91
- "@types/rsync": "0.4.30",
92
- "@types/semver": "7.5.6",
93
- "@types/should": "8.3.0",
94
- "@types/sinon": "10.0.16",
95
- "@types/socket.io": "1.4.38",
96
- "@types/socket.io-client": "1.4.32",
97
- "@types/supertest": "2.0.7",
98
- "@types/tar": "6.1.10",
99
- "@types/tmp": "0.0.33",
100
- "@types/webpack": "5.28.1",
101
- "@types/ws": "8.5.10",
102
- "amqplib": "0.10.3",
103
- "assert": "2.1.0",
104
- "aws-sdk": "2.1472.0",
105
- "buffer": "6.0.3",
106
- "c8": "8.0.1",
107
- "depcheck": "1.4.7",
108
- "es-check": "7.1.1",
109
- "eslint-plugin-prettier": "5.1.3",
110
- "minio": "7.1.3",
111
- "mocha": "10.2.0",
112
- "mongodb": "6.2.0",
113
- "mongoose": "8.0.0",
114
- "npm": "8.19.4",
115
- "path-browserify": "1.0.1",
116
- "pg": "7.12.1",
117
- "pg-promise": "10.11.0",
118
- "redis": "3.1.2",
119
- "should": "11.2.1",
120
- "should-sinon": "0.0.6",
121
- "sinon": "15.2.0",
122
- "socket.io": "2.5.0",
123
- "socket.io-client": "4.7.2",
124
- "supertest": "3.4.2",
125
- "ts-node": "10.9.2",
126
- "typescript": "4.9.4",
127
- "util": "0.12.5",
128
- "verdaccio": "5.29.0",
129
- "verdaccio-auth-memory": "10.2.2",
130
- "verdaccio-memory": "10.3.2",
131
- "webpack": "5.84.0",
132
- "ws": "8.17.1",
133
- "zen-observable": "0.8.14"
134
- },
135
- "publishConfig": {
136
- "registry": "https://registry.npmjs.org/",
137
- "access": "public"
138
- }
2
+ "name": "@signageos/lib",
3
+ "version": "17.0.0-master.3227",
4
+ "main": "./dist",
5
+ "type": "commonjs",
6
+ "files": [
7
+ "tools",
8
+ "package.json"
9
+ ],
10
+ "repository": {
11
+ "url": "git@gitlab.com:signageos/lib",
12
+ "type": "git"
13
+ },
14
+ "bin": {
15
+ "lib": "./tools/lib",
16
+ "npm-login": "./tools/npm-login"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run build-es5 && npm run build-es6",
20
+ "build-es5": "tsc --target es5 --outDir dist && npm run escheck:5",
21
+ "build-es6": "tsc --target es6 --outDir es6 && npm run escheck:6",
22
+ "lint": "eslint --ext .ts,.tsx,.js ./src/ ./config ./tests ./tools",
23
+ "lint:prettier:fix": "prettier \"**/*.(ts|tsx|json|js)\" --write",
24
+ "clean-build": "rm -rf dist/* && npm run build",
25
+ "test": "NODE_ENV=test mocha",
26
+ "test:coverage": "c8 npm run test",
27
+ "test-connections": "NODE_ENV=test mocha --allow-uncaught --config .mocharc.connections.js",
28
+ "test-rabbit-connection": "NODE_ENV=test mocha --config .mocharc.connections-rabbit.js",
29
+ "watch": "tsc --watch",
30
+ "check": "npm run depcheck && ../../tools/check-deps",
31
+ "check:forbidden-dependencies": "node ../../tools/check-forbidden-dependencies",
32
+ "depcheck": "depcheck --config .depcheckrc.json",
33
+ "escheck:5": "es-check --module es5 dist/**/*.js",
34
+ "escheck:6": "es-check --module es6 es6/**/*.js",
35
+ "check-types": "tsc --noEmit"
36
+ },
37
+ "author": "Michael Zabka <zabka.michael@gmail.com>",
38
+ "license": "MIT",
39
+ "dependencies": {},
40
+ "optionalPeerDependencies": {
41
+ "@aws-sdk/client-s3": "3.489.0",
42
+ "aws-sdk": "^2.1472.0",
43
+ "@influxdata/influxdb-client": "1.16.0",
44
+ "@sentry/node": ">=5.15.5",
45
+ "@sentry/browser": ">=5.15.5",
46
+ "amqp10": "~3.5.0",
47
+ "mocha": "^3.1.2",
48
+ "pg": "7.12.1",
49
+ "pg-promise": "^10.11.0",
50
+ "redis": "^3.1.2",
51
+ "mongoose": "^8.0.0",
52
+ "mongodb": "6.2.0",
53
+ "sinon": "15.2.0",
54
+ "webpack": "4.41.2",
55
+ "ws": "^6.0.0",
56
+ "zen-observable": "0.8.14"
57
+ },
58
+ "engines": {
59
+ "node": "20",
60
+ "npm": ">=10"
61
+ },
62
+ "devDependencies": {
63
+ "@aws-sdk/client-s3": "3.489.0",
64
+ "@aws-sdk/types": "^3.489.0",
65
+ "@faker-js/faker": "8.3.1",
66
+ "@influxdata/influxdb-client": "1.16.0",
67
+ "@istanbuljs/nyc-config-typescript": "1.0.2",
68
+ "@types/amqplib": "0.5.13",
69
+ "@types/async-lock": "1.4.2",
70
+ "@types/basic-auth": "1.1.8",
71
+ "@types/css-tree": "2.3.5",
72
+ "@types/debug": "0.0.29",
73
+ "@types/express": "4.17.21",
74
+ "@types/fs-extra": "11.0.4",
75
+ "@types/glob": "8.1.0",
76
+ "@types/http-status": "0.2.30",
77
+ "@types/lodash": "4.14.158",
78
+ "@types/mocha": "10.0.6",
79
+ "@types/node": "20.14.9",
80
+ "@types/node-fetch": "2.6.4",
81
+ "@types/on-finished": "2.3.4",
82
+ "@types/path-browserify": "1.0.2",
83
+ "@types/qs": "6.9.14",
84
+ "@types/raven": "2.5.7",
85
+ "@types/redis": "2.8.32",
86
+ "@types/rsync": "0.4.30",
87
+ "@types/semver": "7.5.6",
88
+ "@types/should": "8.3.0",
89
+ "@types/sinon": "10.0.16",
90
+ "@types/socket.io": "1.4.38",
91
+ "@types/socket.io-client": "1.4.32",
92
+ "@types/supertest": "2.0.7",
93
+ "@types/tar": "6.1.10",
94
+ "@types/tmp": "0.0.33",
95
+ "@types/webpack": "5.28.1",
96
+ "@types/ws": "8.5.10",
97
+ "amqplib": "0.10.3",
98
+ "assert": "2.1.0",
99
+ "aws-sdk": "2.1472.0",
100
+ "buffer": "6.0.3",
101
+ "c8": "8.0.1",
102
+ "depcheck": "1.4.7",
103
+ "es-check": "7.1.1",
104
+ "eslint-plugin-prettier": "5.1.3",
105
+ "minio": "7.1.3",
106
+ "mocha": "10.2.0",
107
+ "mongodb": "6.2.0",
108
+ "mongoose": "8.0.0",
109
+ "pg": "7.12.1",
110
+ "pg-promise": "10.11.0",
111
+ "redis": "3.1.2",
112
+ "should": "11.2.1",
113
+ "should-sinon": "0.0.6",
114
+ "sinon": "15.2.0",
115
+ "socket.io": "2.5.0",
116
+ "socket.io-client": "4.7.2",
117
+ "supertest": "3.4.2",
118
+ "ts-node": "10.9.2",
119
+ "util": "0.12.5",
120
+ "verdaccio": "5.29.0",
121
+ "verdaccio-auth-memory": "10.2.2",
122
+ "verdaccio-memory": "10.3.2",
123
+ "webpack": "5.84.0",
124
+ "ws": "8.17.1",
125
+ "zen-observable": "0.8.14"
126
+ },
127
+ "publishConfig": {
128
+ "registry": "https://registry.npmjs.org/",
129
+ "access": "public"
130
+ }
139
131
  }
package/tools/lib CHANGED
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- process.argv = [...process.argv];
3
+ process.stderr.write(`DEPRECATION WARNING: use @signageos/lib-ci for running CI scripts instead of @signageos/lib.\n`);
4
4
 
5
- const command = process.argv[2]
6
- process.argv.shift();
7
-
8
- require(`./${command}`);
5
+ require(`@signageos/lib-ci`);
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const semver = require('semver');
4
- const fs = require('fs');
5
-
6
- const packagePath = process.cwd() + '/package.json';
7
- const package = require(packagePath);
8
-
9
- const ignorePath = process.cwd() + '/.check-depsignore';
10
- let ignore = [];
11
- try {
12
- ignore = fs.readFileSync(ignorePath).toString().split('\n');
13
- console.log(`Ignoring packages from ${ignorePath}`);
14
- } catch (_error) {
15
- console.log('No ignore file found');
16
- }
17
-
18
- const runControlPath = process.cwd() + '/.check-depsrc.json';
19
- let runControl = {};
20
- try {
21
- runControl = require(runControlPath);
22
- console.log(`Using run control from ${runControlPath}`);
23
- if (runControl.ignore) {
24
- ignore = ignore.concat(runControl.ignore);
25
- }
26
- } catch (error) {
27
- console.log('No Run Control file found');
28
- }
29
-
30
- const includeRegExp = new RegExp(process.argv[2] || '.+');
31
- const excludeRegExp = new RegExp(process.argv[3] || '^$');
32
-
33
- const deps = { ...(package.dependencies || {}), ...(package.devDependencies || {}) };
34
-
35
- const depNames = Object.keys(deps);
36
-
37
- const matchedDepNames = depNames.filter((depName) => includeRegExp.test(depName) && !excludeRegExp.test(depName));
38
-
39
- const prereleaseDepNames = [];
40
- const inexactDepNames = [];
41
- const expectedRangeDepNames = [];
42
-
43
- function isExpectedRangeValid(depName, version) {
44
- return version.startsWith(runControl.expectRanges[depName]);
45
- }
46
-
47
- for (const depName of matchedDepNames) {
48
- if (ignore.includes(depName)) {
49
- continue;
50
- }
51
- const depVersion = deps[depName];
52
- if (semver.prerelease(semver.minVersion(depVersion)) !== null) {
53
- prereleaseDepNames.push(depName);
54
- }
55
- if (runControl.expectRanges && depName in runControl.expectRanges) {
56
- if (!isExpectedRangeValid(depName, depVersion)) {
57
- expectedRangeDepNames.push(depName);
58
- }
59
- } else {
60
- if (!semver.valid(depVersion)) {
61
- // Check inexact only when not expected range
62
- inexactDepNames.push(depName);
63
- }
64
- }
65
- }
66
-
67
- if (prereleaseDepNames.length > 0) {
68
- const prereleaseDeps = {};
69
- prereleaseDepNames.forEach((depName) => {
70
- prereleaseDeps[depName] = deps[depName];
71
- });
72
- console.error(`Some packages has prerelease tags in version in package.json deps`, prereleaseDepNames.join(', '), prereleaseDeps);
73
- }
74
-
75
- if (expectedRangeDepNames.length > 0) {
76
- const expectedRangeDeps = {};
77
- expectedRangeDepNames.forEach((depName) => {
78
- expectedRangeDeps[depName] = deps[depName];
79
- });
80
- console.error(
81
- `Some packages has expectation of range of versions specified in package.json deps`,
82
- expectedRangeDepNames.map((depName) => `${depName}->"${runControl.expectRanges[depName]}"`).join(', '),
83
- expectedRangeDeps,
84
- );
85
- }
86
-
87
- if (inexactDepNames.length > 0) {
88
- const inexactDeps = {};
89
- inexactDepNames.forEach((depName) => {
90
- inexactDeps[depName] = deps[depName];
91
- });
92
- console.error(`Some packages has not exact version specified in package.json deps`, inexactDepNames.join(', '), inexactDeps);
93
- }
94
-
95
- if (prereleaseDepNames.length > 0 || expectedRangeDepNames.length > 0 || inexactDepNames.length > 0) {
96
- process.exit(1);
97
- }
@@ -1,17 +0,0 @@
1
- const packageJson = require('../package.json');
2
- const dependencies = packageJson.dependencies || {};
3
- const devDependencies = packageJson.devDependencies || {};
4
-
5
- const whitelist = ['@signageos/codestyle'];
6
- const packages = Object.keys(dependencies).concat(Object.keys(devDependencies));
7
-
8
- let forbiddenPackages = packages.filter((package) => package.match('@signageos/*'));
9
- forbiddenPackages = forbiddenPackages.filter((package) => !whitelist.includes(package));
10
-
11
- if (forbiddenPackages.length > 0) {
12
- console.error(` Forbidden packages ${forbiddenPackages.join(', ')} found in package.json.
13
- @signageos/* modules can't be used as dependencies because they are private while this module is public and may only use public dependencies.
14
- Only exceptions are whitelisted dependencies: ${whitelist.join(', ')}
15
- `);
16
- process.exit(1);
17
- }
@@ -1,32 +0,0 @@
1
- const { getPipedInput, getGroupedChangeLog } = require('./helper');
2
-
3
- const allChangeTypes = ['Changed', 'Removed', 'Added', 'Fixed', 'Security', 'Deprecated'];
4
-
5
- (async function () {
6
- const changeLog = await getPipedInput();
7
- const groupedLog = getGroupedChangeLog(changeLog);
8
- const changedTypes = Object.keys(groupedLog.Unreleased || {});
9
- switch (true) {
10
- case changedTypes.indexOf('Changed') !== -1:
11
- case changedTypes.indexOf('Removed') !== -1:
12
- process.stdout.write('major');
13
- break;
14
- case changedTypes.indexOf('Added') !== -1:
15
- process.stdout.write('minor');
16
- break;
17
- case changedTypes.indexOf('Fixed') !== -1:
18
- case changedTypes.indexOf('Security') !== -1:
19
- case changedTypes.indexOf('Deprecated') !== -1:
20
- process.stdout.write('patch');
21
- break;
22
- case changedTypes.length === 0:
23
- process.stdout.write('patch');
24
- break;
25
- default:
26
- throw new Error(`Unknown type of change: ${changedTypes.join(', ')} Only following values are allowed: ${allChangeTypes.join(', ')}`);
27
- }
28
- })();
29
-
30
- process.on('unhandledRejection', (error) => {
31
- throw error;
32
- });
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
-
5
- function exactDepsMutable(deps, lock) {
6
- deps = deps || {};
7
- const depNames = Object.keys(deps);
8
- for (const depName of depNames) {
9
- const lockDep = lock.dependencies[depName];
10
- const currentVersion = lockDep.version;
11
- deps[depName] = currentVersion;
12
- }
13
- }
14
-
15
- const packagePath = process.cwd() + '/package.json';
16
- const packageLockPath = process.cwd() + '/package-lock.json';
17
- const package = require(packagePath);
18
- const packageLock = require(packageLockPath);
19
-
20
- exactDepsMutable(package.dependencies, packageLock);
21
- exactDepsMutable(package.devDependencies, packageLock);
22
-
23
- fs.writeFileSync(packagePath, JSON.stringify(package, undefined, 2) + '\n');
@@ -1,25 +0,0 @@
1
- const { getPipedInput, getGroupedChangeLog } = require('./helper');
2
-
3
- const version = process.argv[2] || 'Unreleased';
4
- const outputType = process.argv[3] || 'text';
5
-
6
- (async function () {
7
- const changeLog = await getPipedInput();
8
- const groupedLog = getGroupedChangeLog(changeLog);
9
- let output;
10
- if (outputType === 'text') {
11
- const changedTypes = Object.keys(groupedLog[version] || {});
12
- const releaseNotes = changedTypes.reduce(
13
- (notes, changeType) => [...notes, `${changeType}:`, ...groupedLog[version][changeType].map((note) => `- ${note}`), ''],
14
- [],
15
- );
16
- output = releaseNotes.join('\n');
17
- } else if (outputType === 'groups') {
18
- output = typeof groupedLog[version] !== 'undefined' ? groupedLog[version] : {};
19
- }
20
- process.stdout.write(JSON.stringify(output));
21
- })();
22
-
23
- process.on('unhandledRejection', (error) => {
24
- throw error;
25
- });
package/tools/helper.js DELETED
@@ -1,73 +0,0 @@
1
- const VERSION_HEADER = '## ';
2
- const CHANGES_HEADER = '### ';
3
- const LOG_LINE = '- ';
4
-
5
- exports.getPipedInput = function () {
6
- return new Promise((resolve, reject) => {
7
- let inputData;
8
- process.stdin.resume();
9
- process.stdin.setEncoding('utf8');
10
- process.stdin.on('data', (chunk) => (inputData += chunk));
11
- process.stdin.on('end', () => resolve(inputData));
12
- process.stdin.on('error', (error) => reject(error));
13
- });
14
- };
15
-
16
- exports.getGroupedChangeLog = function (changeLog) {
17
- const newLines = changeLog
18
- .split(/\n|\r/)
19
- .filter((line) => line.startsWith(VERSION_HEADER) || line.startsWith(CHANGES_HEADER) || line.startsWith(LOG_LINE));
20
- const { groupedLog } = newLines.reduce(
21
- (reduction, line) => {
22
- if (line.startsWith(VERSION_HEADER)) {
23
- const version = line
24
- .substring(VERSION_HEADER.length)
25
- .match(/^\[?(([\d\w\.\-\+])+)\]?/)[1]
26
- .trim();
27
- if (reduction.groupedLog[version] !== undefined) {
28
- throw new Error(`The version "${version}" is duplicated in CHANGELOG`);
29
- }
30
- return {
31
- ...reduction,
32
- lastVersion: version,
33
- groupedLog: {
34
- ...reduction.groupedLog,
35
- [version]: reduction.groupedLog[version] || {},
36
- },
37
- };
38
- } else if (line.startsWith(CHANGES_HEADER)) {
39
- const type = line.substring(CHANGES_HEADER.length).trim();
40
- if (reduction.groupedLog[reduction.lastVersion] === undefined) {
41
- throw new Error(`The type "${type}" is not under any version section in CHANGELOG`);
42
- }
43
- if (reduction.groupedLog[reduction.lastVersion][type] !== undefined) {
44
- throw new Error(`The type "${type}" is duplicated at version "${reduction.lastVersion}" in CHANGELOG`);
45
- }
46
- return {
47
- ...reduction,
48
- lastType: type,
49
- groupedLog: {
50
- ...reduction.groupedLog,
51
- [reduction.lastVersion]: {
52
- ...reduction.groupedLog[reduction.lastVersion],
53
- [type]: reduction.groupedLog[reduction.lastVersion][type] || [],
54
- },
55
- },
56
- };
57
- } else {
58
- return {
59
- ...reduction,
60
- groupedLog: {
61
- ...reduction.groupedLog,
62
- [reduction.lastVersion]: {
63
- ...reduction.groupedLog[reduction.lastVersion],
64
- [reduction.lastType]: [...reduction.groupedLog[reduction.lastVersion][reduction.lastType], line.substring(LOG_LINE.length)],
65
- },
66
- },
67
- };
68
- }
69
- },
70
- { groupedLog: {}, lastType: null, lastVersion: null },
71
- );
72
- return groupedLog;
73
- };
@@ -1,28 +0,0 @@
1
- const fs = require('fs');
2
-
3
- const packagePath = process.cwd() + '/package.json';
4
- const packageLockPath = process.cwd() + '/package-lock.json';
5
- const package = require(packagePath);
6
- let packageLock;
7
- try {
8
- packageLock = require(packageLockPath);
9
- } catch (error) {
10
- // overlook if doesn't exist
11
- }
12
-
13
- const nextVersion = process.argv[2];
14
- if (!nextVersion) {
15
- throw new Error('No version specified');
16
- }
17
- package.version = nextVersion;
18
- if (packageLock) {
19
- packageLock.version = nextVersion;
20
- if (packageLock.packages && packageLock.packages['']) {
21
- packageLock.packages[''].version = nextVersion;
22
- }
23
- }
24
-
25
- fs.writeFileSync(packagePath, JSON.stringify(package, null, 2) + '\n');
26
- if (packageLock) {
27
- fs.writeFileSync(packageLockPath, JSON.stringify(packageLock, null, 2) + '\n');
28
- }