Skip to content

Commit 1d1bb29

Browse files
Merge branch 'master' into simplify-log-parameter-names
2 parents dcb7689 + 6681ef1 commit 1d1bb29

File tree

79 files changed

+499
-409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+499
-409
lines changed

.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"env": {
44
"browser": true,
55
"es6": true,
6-
"node": true
6+
"node": true,
7+
"mocha": true
78
},
89
"extends": [
910
"eslint:recommended",
@@ -59,6 +60,7 @@
5960
"no-useless-constructor": "error",
6061
"no-useless-return": "error",
6162
"no-warning-comments": "error",
63+
"one-var": ["error", "never"],
6264
"prefer-promise-reject-errors": "error",
6365
"require-await": "error",
6466
"symbol-description": "error"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"scripts": {
1111
"lint": "eslint src",
12+
"prebuild": "rimraf dist",
1213
"build": "npm run lint && tsc && node tasks/build.js",
1314
"git-stage-and-push": "node tasks/git-stage-and-push.js",
1415
"npm-publish": "node tasks/npm-publish.js",
@@ -79,6 +80,7 @@
7980
"mocha": "9.1.2",
8081
"node-emoji": "1.11.0",
8182
"prettier": "2.4.1",
83+
"rimraf": "^3.0.2",
8284
"semver-sort": "0.0.4",
8385
"simple-git": "2.46.0",
8486
"sinon": "11.1.2",
@@ -90,7 +92,6 @@
9092
"accept-language-parser": "1.5.0",
9193
"async": "3.2.1",
9294
"basic-auth-connect": "1.0.0",
93-
"body-parser": "1.19.0",
9495
"builtin-modules": "3.2.0",
9596
"chokidar": "3.5.2",
9697
"colors": "1.4.0",

src/cli/domain/get-components-by-dir.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Component } from '../../types';
55
export default function getComponentsByDir() {
66
return (componentsDir: string, callback: Callback<string[]>): void => {
77
const isOcComponent = function (file: string) {
8-
const filePath = path.resolve(componentsDir, file),
9-
packagePath = path.join(filePath, 'package.json');
8+
const filePath = path.resolve(componentsDir, file);
9+
const packagePath = path.join(filePath, 'package.json');
1010
let content: Component;
1111

1212
try {

src/cli/domain/package-components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const packageComponents =
6060
compiler: true,
6161
componentPath
6262
});
63-
ocTemplate.compile!(compileOptions, callback);
63+
ocTemplate.compile(compileOptions, callback);
6464
} catch (err) {
6565
return callback(err as any, undefined as any);
6666
}

src/cli/domain/registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import * as urlParser from '../domain/url-parser';
1010
import { RegistryCli } from '../../types';
1111

1212
const getOcVersion = (): string => {
13-
const ocPackagePath = path.join(__dirname, '../../../package.json'),
14-
ocInfo = fs.readJsonSync(ocPackagePath);
13+
const ocPackagePath = path.join(__dirname, '../../../package.json');
14+
const ocInfo = fs.readJsonSync(ocPackagePath);
1515

1616
return ocInfo.version;
1717
};

src/cli/domain/url-parser.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ export function parse(parsed: {
2020
requestVersion: string;
2121
href: string;
2222
}): UrlParsed {
23-
const requestedVersion = parsed.requestVersion,
24-
href = url.parse(parsed.href),
25-
relativePath = removeFinalSlashes(href.pathname || ''),
26-
withoutVersion = removeFinalSlashes(
27-
relativePath.replace(requestedVersion, '')
28-
),
29-
componentName = withoutVersion.substr(withoutVersion.lastIndexOf('/') + 1),
30-
withoutComponent = removeFinalSlashes(
31-
withoutVersion.replace(componentName, '')
32-
),
33-
registryUrl = href.protocol + '//' + href.host + withoutComponent + '/';
23+
const requestedVersion = parsed.requestVersion;
24+
const href = url.parse(parsed.href);
25+
const relativePath = removeFinalSlashes(href.pathname || '');
26+
const withoutVersion = removeFinalSlashes(
27+
relativePath.replace(requestedVersion, '')
28+
);
29+
const componentName = withoutVersion.substr(
30+
withoutVersion.lastIndexOf('/') + 1
31+
);
32+
const withoutComponent = removeFinalSlashes(
33+
withoutVersion.replace(componentName, '')
34+
);
35+
const registryUrl = href.protocol + '//' + href.host + withoutComponent + '/';
3436

3537
return {
3638
clientHref: registryUrl + 'oc-client/client.js',

src/cli/facade/clean.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,3 @@ const clean = ({
7373
};
7474

7575
export default clean;
76-
77-
module.exports = clean;

src/cli/facade/dev.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import _ from 'lodash';
77

88
import getMockedPlugins from '../domain/get-mocked-plugins';
99
import handleDependencies from '../domain/handle-dependencies';
10-
import oc from '../../index';
10+
import * as oc from '../../index';
1111
import strings from '../../resources/index';
1212
import watch from '../domain/watch';
1313
import { Logger } from '../logger';
@@ -234,5 +234,3 @@ const dev =
234234
};
235235

236236
export default dev;
237-
238-
module.exports = dev;

src/cli/facade/init.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,3 @@ const init =
5050
};
5151

5252
export default init;
53-
54-
module.exports = init;

src/cli/facade/mock.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ const mock =
1717
};
1818

1919
export default mock;
20-
21-
module.exports = mock;

0 commit comments

Comments
 (0)