@dword-design/base 14.0.6 → 14.1.0
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/dist/commands/lint/index.js +1 -0
- package/dist/commands/lint/lint-packagejson.d.ts +1 -0
- package/dist/commands/lint/lint-packagejson.js +15 -0
- package/dist/commands/test-raw/index.d.ts +1 -1
- package/dist/commands/test-raw/index.js +2 -19
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -0
- package/package.json +1 -1
- package/dist/commands/test-raw/package-json-schema.d.ts +0 -67
- package/dist/commands/test-raw/package-json-schema.js +0 -68
|
@@ -6,6 +6,7 @@ export default async function (optionsInput) {
|
|
|
6
6
|
stderr: "inherit",
|
|
7
7
|
...optionsInput
|
|
8
8
|
};
|
|
9
|
+
this.lintPackagejson();
|
|
9
10
|
const packageName = parsePackagejsonName(this.packageConfig.name).fullName;
|
|
10
11
|
if (this.config.git !== void 0 && packageName !== this.config.git.project) {
|
|
11
12
|
throw new Error(`Package name '${packageName}' has to be equal to repository name '${this.config.git.project}'`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
import endent from "endent";
|
|
3
|
+
import packageJsonSchema from "./package-json-schema.js";
|
|
4
|
+
const ajv = new Ajv({
|
|
5
|
+
allowUnionTypes: true
|
|
6
|
+
});
|
|
7
|
+
const validatePackageJson = ajv.compile(packageJsonSchema);
|
|
8
|
+
export default function () {
|
|
9
|
+
if (!validatePackageJson(this.packageConfig)) {
|
|
10
|
+
throw new Error(endent`
|
|
11
|
+
package.json invalid
|
|
12
|
+
${ajv.errorsText(validatePackageJson.errors)}
|
|
13
|
+
`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (options: any):
|
|
1
|
+
export default function (options: any): import("execa").ResultPromise<{}>;
|
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
import Ajv from "ajv";
|
|
2
1
|
import packageName from "depcheck-package-name";
|
|
3
|
-
import endent from "endent";
|
|
4
2
|
import { execa } from "execa";
|
|
5
3
|
import isCI from "./is-ci.js";
|
|
6
|
-
|
|
7
|
-
const ajv = new Ajv({
|
|
8
|
-
allowUnionTypes: true
|
|
9
|
-
});
|
|
10
|
-
const validatePackageJson = ajv.compile(packageJsonSchema);
|
|
11
|
-
export default async function (options) {
|
|
4
|
+
export default function (options) {
|
|
12
5
|
options = {
|
|
13
6
|
log: process.env.NODE_ENV !== "test",
|
|
14
7
|
patterns: [],
|
|
15
8
|
stderr: "inherit",
|
|
16
9
|
...options
|
|
17
10
|
};
|
|
18
|
-
if (options.patterns.length === 0) {
|
|
19
|
-
if (!validatePackageJson(this.packageConfig)) {
|
|
20
|
-
throw new Error(endent`
|
|
21
|
-
package.json invalid
|
|
22
|
-
${ajv.errorsText(validatePackageJson.errors)}
|
|
23
|
-
`);
|
|
24
|
-
}
|
|
25
|
-
await this.lint(options);
|
|
26
|
-
await this.depcheck(options);
|
|
27
|
-
}
|
|
28
11
|
const runDockerTests = !isCI({
|
|
29
12
|
cwd: this.cwd
|
|
30
13
|
}) || !["win32", "darwin"].includes(process.platform);
|
|
31
|
-
return execa(packageName`c8`, ["playwright", "test", "--pass-with-no-tests", ...(runDockerTests ? [] : ["--grep-invert", "@usesdocker"]), ...(options.updateSnapshots ? ["--update-snapshots"] : []), ...(options.ui ? ["--ui"] : []), ...(options.uiHost ? ["--ui-host", options.uiHost] : []), ...(options.grep ? ["--grep", options.grep] : []), "--trace", "retain-on-failure", ...(isCI({
|
|
14
|
+
return execa(packageName`c8`, ["--exclude", "fixtures", "--exclude", "test-results", "--exclude", "playwright.config.ts", "playwright", "test", "--pass-with-no-tests", ...(runDockerTests ? [] : ["--grep-invert", "@usesdocker"]), ...(options.updateSnapshots ? ["--update-snapshots"] : []), ...(options.ui ? ["--ui"] : []), ...(options.uiHost ? ["--ui-host", options.uiHost] : []), ...(options.grep ? ["--grep", options.grep] : []), "--trace", "retain-on-failure", ...(isCI({
|
|
32
15
|
cwd: this.cwd
|
|
33
16
|
}) ? ["--forbid-only"] : []),
|
|
34
17
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -22,12 +22,12 @@ type Config = {
|
|
|
22
22
|
git?: GitHost;
|
|
23
23
|
gitignore: string[];
|
|
24
24
|
hasTypescriptConfigRootAlias: boolean;
|
|
25
|
-
lint: (optionsInput?: CommandOptionsInput) =>
|
|
25
|
+
lint: (optionsInput?: CommandOptionsInput) => unknown;
|
|
26
26
|
macos: boolean;
|
|
27
27
|
minNodeVersion: number;
|
|
28
28
|
nodeVersion: number;
|
|
29
29
|
preDeploySteps: string[];
|
|
30
|
-
prepare: (optionsInput?: CommandOptionsInput) =>
|
|
30
|
+
prepare: (optionsInput?: CommandOptionsInput) => unknown;
|
|
31
31
|
readmeInstallString: string;
|
|
32
32
|
seeAlso: Array<{
|
|
33
33
|
description: string;
|
|
@@ -49,6 +49,7 @@ type ConfigObjectInput = Omit<Partial<Config>, 'commands'> & {
|
|
|
49
49
|
};
|
|
50
50
|
type ConfigObjectOrFunctionInput = ConfigObjectInput | ((this: Base, Config: any) => ConfigObjectInput);
|
|
51
51
|
type ConfigInput = ConfigObjectOrFunctionInput | string | null;
|
|
52
|
+
export declare const defineBaseConfig: (configInput: ConfigInput) => ConfigInput;
|
|
52
53
|
declare class Base {
|
|
53
54
|
config: Config;
|
|
54
55
|
packageConfig: PackageJson;
|
|
@@ -59,6 +60,7 @@ declare class Base {
|
|
|
59
60
|
};
|
|
60
61
|
commit(...args: any[]): ResultPromise;
|
|
61
62
|
lint(...args: any[]): ResultPromise;
|
|
63
|
+
lintPackagejson(...args: any[]): void;
|
|
62
64
|
typecheck(...args: any[]): ResultPromise;
|
|
63
65
|
verify(...args: any[]): ResultPromise;
|
|
64
66
|
prepare(...args: any[]): void;
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import checkUnknownFiles from "./commands/check-unknown-files/index.js";
|
|
|
14
14
|
import commit from "./commands/commit/index.js";
|
|
15
15
|
import depcheckMethod from "./commands/depcheck/index.js";
|
|
16
16
|
import lint from "./commands/lint/index.js";
|
|
17
|
+
import lintPackagejson from "./commands/lint/lint-packagejson.js";
|
|
17
18
|
import prepare from "./commands/prepare/index.js";
|
|
18
19
|
import test from "./commands/test/index.js";
|
|
19
20
|
import testDocker from "./commands/test-docker/index.js";
|
|
@@ -38,6 +39,7 @@ import getTypescriptConfig from "./get-generated-files/get-typescript/index.js";
|
|
|
38
39
|
import getVscodeConfig from "./get-generated-files/get-vscode/index.js";
|
|
39
40
|
import githubCodespacesConfig from "./get-generated-files/github-codespaces.js";
|
|
40
41
|
import getGitInfo from "./get-git-info/index.js";
|
|
42
|
+
export const defineBaseConfig = configInput => configInput;
|
|
41
43
|
const mergeConfigs = createDefu((obj, key, value) => {
|
|
42
44
|
if (key === "supportedNodeVersions") {
|
|
43
45
|
obj[key] = value;
|
|
@@ -57,6 +59,9 @@ class Base {
|
|
|
57
59
|
lint(...args) {
|
|
58
60
|
return lint.call(this, ...args);
|
|
59
61
|
}
|
|
62
|
+
lintPackagejson(...args) {
|
|
63
|
+
return lintPackagejson.call(this, ...args);
|
|
64
|
+
}
|
|
60
65
|
typecheck(...args) {
|
|
61
66
|
return typecheck.call(this, ...args);
|
|
62
67
|
}
|
package/package.json
CHANGED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
properties: {
|
|
3
|
-
baseConfig: {
|
|
4
|
-
properties: {
|
|
5
|
-
depcheckConfig: {
|
|
6
|
-
type: string;
|
|
7
|
-
};
|
|
8
|
-
name: {
|
|
9
|
-
type: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
type: string[];
|
|
13
|
-
};
|
|
14
|
-
bin: {
|
|
15
|
-
additionalProperties: {
|
|
16
|
-
pattern: string;
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
pattern: string;
|
|
20
|
-
type: string[];
|
|
21
|
-
};
|
|
22
|
-
dependencies: {
|
|
23
|
-
additionalProperties: {
|
|
24
|
-
type: string;
|
|
25
|
-
};
|
|
26
|
-
type: string;
|
|
27
|
-
};
|
|
28
|
-
description: {
|
|
29
|
-
type: string;
|
|
30
|
-
};
|
|
31
|
-
devDependencies: {
|
|
32
|
-
additionalProperties: {
|
|
33
|
-
type: string;
|
|
34
|
-
};
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
keywords: {
|
|
38
|
-
items: {
|
|
39
|
-
type: string;
|
|
40
|
-
};
|
|
41
|
-
type: string;
|
|
42
|
-
};
|
|
43
|
-
name: {
|
|
44
|
-
pattern: string;
|
|
45
|
-
type: string;
|
|
46
|
-
};
|
|
47
|
-
packageManager: {
|
|
48
|
-
type: string;
|
|
49
|
-
};
|
|
50
|
-
pnpm: {
|
|
51
|
-
properties: {
|
|
52
|
-
overrides: {
|
|
53
|
-
additionalProperties: {
|
|
54
|
-
type: string;
|
|
55
|
-
};
|
|
56
|
-
type: string;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
type: string;
|
|
60
|
-
};
|
|
61
|
-
version: {
|
|
62
|
-
type: string;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
type: string;
|
|
66
|
-
};
|
|
67
|
-
export default _default;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import packageNameRegex from "package-name-regex";
|
|
2
|
-
const distPattern = /^\.\/dist\//;
|
|
3
|
-
export default {
|
|
4
|
-
properties: {
|
|
5
|
-
baseConfig: {
|
|
6
|
-
properties: {
|
|
7
|
-
depcheckConfig: {
|
|
8
|
-
type: "object"
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: "string"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
type: ["string", "object"]
|
|
15
|
-
},
|
|
16
|
-
bin: {
|
|
17
|
-
additionalProperties: {
|
|
18
|
-
pattern: distPattern.source,
|
|
19
|
-
type: "string"
|
|
20
|
-
},
|
|
21
|
-
pattern: distPattern.source,
|
|
22
|
-
type: ["object", "string"]
|
|
23
|
-
},
|
|
24
|
-
dependencies: {
|
|
25
|
-
additionalProperties: {
|
|
26
|
-
type: "string"
|
|
27
|
-
},
|
|
28
|
-
type: "object"
|
|
29
|
-
},
|
|
30
|
-
description: {
|
|
31
|
-
type: "string"
|
|
32
|
-
},
|
|
33
|
-
devDependencies: {
|
|
34
|
-
additionalProperties: {
|
|
35
|
-
type: "string"
|
|
36
|
-
},
|
|
37
|
-
type: "object"
|
|
38
|
-
},
|
|
39
|
-
keywords: {
|
|
40
|
-
items: {
|
|
41
|
-
type: "string"
|
|
42
|
-
},
|
|
43
|
-
type: "array"
|
|
44
|
-
},
|
|
45
|
-
name: {
|
|
46
|
-
pattern: packageNameRegex.source,
|
|
47
|
-
type: "string"
|
|
48
|
-
},
|
|
49
|
-
packageManager: {
|
|
50
|
-
type: "string"
|
|
51
|
-
},
|
|
52
|
-
pnpm: {
|
|
53
|
-
properties: {
|
|
54
|
-
overrides: {
|
|
55
|
-
additionalProperties: {
|
|
56
|
-
type: "string"
|
|
57
|
-
},
|
|
58
|
-
type: "object"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
type: "object"
|
|
62
|
-
},
|
|
63
|
-
version: {
|
|
64
|
-
type: "string"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
type: "object"
|
|
68
|
-
};
|