Skip to content

Commit b76559c

Browse files
Merge branch 'master' into improve-type-url-funcs
2 parents b61a0a1 + c758547 commit b76559c

Some content is hidden

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

44 files changed

+179
-165
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"no-useless-constructor": "error",
6060
"no-useless-return": "error",
6161
"no-warning-comments": "error",
62+
"one-var": ["error", "never"],
6263
"prefer-promise-reject-errors": "error",
6364
"require-await": "error",
6465
"symbol-description": "error"

package.json

Lines changed: 2 additions & 0 deletions
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",

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)