Skip to content

Commit 1f84ba7

Browse files
Merge branch 'master' into remove-module-paths
2 parents c1b2baa + cd830d1 commit 1f84ba7

Some content is hidden

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

55 files changed

+1371
-861
lines changed

package-lock.json

Lines changed: 971 additions & 588 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
],
4949
"devDependencies": {
5050
"@types/accept-language-parser": "1.5.2",
51-
"@types/async": "3.2.8",
51+
"@types/async": "3.2.9",
5252
"@types/colors": "1.2.1",
5353
"@types/cross-spawn": "6.0.2",
5454
"@types/errorhandler": "1.5.0",
@@ -58,24 +58,24 @@
5858
"@types/lodash": "4.14.176",
5959
"@types/morgan": "1.9.3",
6060
"@types/multer": "1.4.7",
61-
"@types/node": "16.11.3",
61+
"@types/node": "16.11.6",
6262
"@types/parse-author": "2.0.1",
6363
"@types/read": "0.0.29",
6464
"@types/response-time": "2.3.5",
6565
"@types/semver": "7.3.9",
6666
"@types/targz": "1.0.1",
6767
"@types/yargs": "17.0.4",
68-
"@typescript-eslint/eslint-plugin": "5.1.0",
69-
"@typescript-eslint/parser": "5.1.0",
68+
"@typescript-eslint/eslint-plugin": "5.2.0",
69+
"@typescript-eslint/parser": "5.2.0",
7070
"chai": "4.3.4",
7171
"chalk": "4.1.2",
72-
"eslint": "8.0.1",
72+
"eslint": "8.1.0",
7373
"eslint-config-prettier": "8.3.0",
7474
"eslint-plugin-prettier": "4.0.0",
7575
"glob": "7.2.0",
7676
"husky": "7.0.4",
7777
"injectr": "0.5.1",
78-
"lint-staged": "11.2.3",
78+
"lint-staged": "11.2.6",
7979
"minimist": "1.2.5",
8080
"mocha": "9.1.3",
8181
"node-emoji": "1.11.0",
@@ -84,7 +84,7 @@
8484
"semver-sort": "0.0.4",
8585
"simple-git": "2.47.0",
8686
"sinon": "11.1.2",
87-
"ts-node": "10.3.1",
87+
"ts-node": "10.4.0",
8888
"type-fest": "2.5.1",
8989
"typescript": "4.4.4"
9090
},
@@ -109,18 +109,18 @@
109109
"multer": "1.4.3",
110110
"nice-cache": "0.0.5",
111111
"oc-client": "4.0.1",
112-
"oc-client-browser": "1.5.4",
112+
"oc-client-browser": "1.5.5",
113113
"oc-empty-response-handler": "1.0.2",
114-
"oc-get-unix-utc-timestamp": "1.0.5",
115-
"oc-s3-storage-adapter": "1.1.6",
116-
"oc-storage-adapters-utils": "1.0.4",
117-
"oc-template-es6": "1.0.6",
118-
"oc-template-es6-compiler": "1.1.13",
119-
"oc-template-handlebars": "6.0.24",
120-
"oc-template-handlebars-compiler": "6.2.18",
121-
"oc-template-jade": "7.0.5",
122-
"oc-template-jade-compiler": "7.0.6",
123-
"open": "8.3.0",
114+
"oc-get-unix-utc-timestamp": "1.0.6",
115+
"oc-s3-storage-adapter": "1.2.0",
116+
"oc-storage-adapters-utils": "1.1.0",
117+
"oc-template-es6": "1.0.7",
118+
"oc-template-es6-compiler": "1.2.1",
119+
"oc-template-handlebars": "6.0.25",
120+
"oc-template-handlebars-compiler": "6.3.1",
121+
"oc-template-jade": "7.0.6",
122+
"oc-template-jade-compiler": "7.1.1",
123+
"open": "8.4.0",
124124
"parse-author": "2.0.0",
125125
"read": "1.0.7",
126126
"require-package-name": "2.0.1",

src/cli/domain/clean.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@ import path from 'path';
55

66
const getComponentsByDir = makeGetComponentsByDir();
77

8-
export function fetchList(dirPath: string, callback: Callback<string[]>): void {
8+
export function fetchList(
9+
dirPath: string,
10+
callback: (err: Error | null, data: string[]) => void
11+
): void {
912
return getComponentsByDir(dirPath, (err, list) => {
1013
if (err) return (callback as any)(err);
1114
if (list.length === 0) return callback(null, []);
1215

1316
const toRemove = list.map(folder => path.join(folder, 'node_modules'));
14-
const folderExists = (folder: string, cb: Callback<boolean>) =>
15-
fs.exists(folder, exists => cb(null, exists));
17+
const folderExists = (
18+
folder: string,
19+
cb: (err: Error | null, data: boolean) => void
20+
) => fs.exists(folder, exists => cb(null, exists));
1621

1722
async.filterSeries(toRemove, folderExists, callback as any);
1823
});
1924
}
2025

21-
export function remove(list: string[], callback: Callback<string>): void {
26+
export function remove(
27+
list: string[],
28+
callback: (err: Error | null, data: string) => void
29+
): void {
2230
return async.eachSeries(list, fs.remove, callback as any);
2331
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import path from 'path';
33
import { Component } from '../../types';
44

55
export default function getComponentsByDir() {
6-
return (componentsDir: string, callback: Callback<string[]>): void => {
6+
return (
7+
componentsDir: string,
8+
callback: (err: Error | null, data: string[]) => void
9+
): void => {
710
const isOcComponent = function (file: string) {
811
const filePath = path.resolve(componentsDir, file);
912
const packagePath = path.join(filePath, 'package.json');

src/cli/domain/get-mocked-plugins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const defaultRegister = (
4545
};
4646

4747
const registerStaticMocks = (
48-
mocks: Dictionary<string>,
48+
mocks: Record<string, string>,
4949
logger: Logger
5050
): PluginMock[] =>
5151
_.map(mocks, (mockedValue, pluginName) => {
@@ -62,7 +62,7 @@ const registerStaticMocks = (
6262

6363
const registerDynamicMocks = (
6464
ocJsonLocation: string,
65-
mocks: Dictionary<string>,
65+
mocks: Record<string, string>,
6666
logger: Logger
6767
) =>
6868
_.map(mocks, (source, pluginName) => {

src/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function ensureCompilerIsDeclaredAsDevDependency(
77
pkg: Component;
88
template: string;
99
},
10-
cb: Callback<string, string>
10+
cb: (err: string | null, data: string) => void
1111
): void {
1212
const { componentPath, pkg, template } = options;
1313
const compilerDep = `${template}-compiler`;

src/cli/domain/handle-dependencies/get-compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default function getCompiler(
1010
compilerDep: string;
1111
componentPath: string;
1212
logger: Logger;
13-
pkg: { devDependencies: Dictionary<string> };
13+
pkg: { devDependencies: Record<string, string> };
1414
},
15-
cb: Callback<Template, string | number>
15+
cb: (err: string | number | null, data: Template) => void
1616
): void {
1717
const { compilerDep, componentPath, logger, pkg } = options;
1818
const compilerPath = path.join(componentPath, 'node_modules', compilerDep);

src/cli/domain/handle-dependencies/index.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Component } from '../../../types';
1414

1515
const getComponentPackageJson = (
1616
componentPath: string,
17-
cb: Callback<Component>
17+
cb: (err: Error | null, data: Component) => void
1818
) => fs.readJson(path.join(componentPath, 'package.json'), cb);
1919

2020
const union = (a: ReadonlyArray<string>, b: ReadonlyArray<string>) => [
@@ -27,25 +27,25 @@ export default function handleDependencies(
2727
logger: Logger;
2828
useComponentDependencies?: boolean;
2929
},
30-
callback: Callback<
31-
{
30+
callback: (
31+
err: string | null,
32+
data: {
3233
modules: string[];
3334
templates: Array<(...args: unknown[]) => unknown>;
34-
},
35-
string
36-
>
35+
}
36+
) => void
3737
): void {
3838
const { components, logger, useComponentDependencies } = options;
3939

40-
const dependencies: Dictionary<string> = {};
41-
const addDependencies = (componentDependencies?: Dictionary<string>) =>
40+
const dependencies: Record<string, string> = {};
41+
const addDependencies = (componentDependencies?: Record<string, string>) =>
4242
Object.entries(componentDependencies || {}).forEach(
4343
([dependency, version]) => {
4444
dependencies[dependency] = version;
4545
}
4646
);
4747

48-
const templates: Dictionary<(...args: unknown[]) => unknown> = {};
48+
const templates: Record<string, (...args: unknown[]) => unknown> = {};
4949
const addTemplate = (
5050
templateName: string,
5151
template: (...args: unknown[]) => unknown
@@ -59,15 +59,19 @@ export default function handleDependencies(
5959
) =>
6060
async.waterfall(
6161
[
62-
(cb: Callback<Component>) => getComponentPackageJson(componentPath, cb),
62+
(cb: (err: Error | null, data: Component) => void) =>
63+
getComponentPackageJson(componentPath, cb),
6364
(
6465
pkg: Component,
65-
cb: Callback<{
66-
componentPath: string;
67-
logger: Logger;
68-
pkg: Component;
69-
template: string;
70-
}>
66+
cb: (
67+
err: Error | null,
68+
data: {
69+
componentPath: string;
70+
logger: Logger;
71+
pkg: Component;
72+
template: string;
73+
}
74+
) => void
7175
) => {
7276
addDependencies(pkg.dependencies);
7377

@@ -96,7 +100,7 @@ export default function handleDependencies(
96100
options: {
97101
componentPath: string;
98102
logger: Logger;
99-
pkg: Component & { devDependencies: Dictionary<string> };
103+
pkg: Component & { devDependencies: Record<string, string> };
100104
template: string;
101105
compilerDep: string;
102106
},

src/cli/domain/handle-dependencies/install-compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function installCompiler(
1212
dependency: string;
1313
logger: Logger;
1414
},
15-
cb: Callback<Template, string | number>
15+
cb: (err: string | number | null, data: Template) => void
1616
): void {
1717
const { compilerPath, componentPath, dependency, logger } = options;
1818

src/cli/domain/handle-dependencies/install-missing-dependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import strings from '../../../resources/index';
66
import { Logger } from '../../logger';
77

88
export default function installMissingDependencies(
9-
options: { dependencies: Dictionary<string>; logger: Logger },
9+
options: { dependencies: Record<string, string>; logger: Logger },
1010
callback: (err: string | null) => void
1111
): void {
1212
const { dependencies, logger } = options;

0 commit comments

Comments
 (0)