@vidavidorra/create-project 4.2.4 → 4.3.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/.github/lint-staged.js +1 -1
- package/README.md +2 -0
- package/dist/content/eslint-config.d.ts +8 -0
- package/dist/content/eslint-config.js +21 -0
- package/dist/content/files.js +2 -0
- package/dist/content/lint-staged.d.ts +1 -1
- package/dist/content/lint-staged.js +3 -3
- package/dist/content/package.d.ts +4 -6
- package/dist/content/package.js +4 -4
- package/dist/content/readme/badge.d.ts +1 -1
- package/dist/content/readme/badge.js +33 -28
- package/dist/content/readme/readme.js +1 -0
- package/package.json +6 -9
- package/src/scripts/postinstall.js +1 -1
package/.github/lint-staged.js
CHANGED
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Interactively create a project.
|
|
4
4
|
|
|
5
5
|
- Standardised project and repository setup.
|
|
6
|
+
- Linting using [**ESLint**](https://eslint.org/).
|
|
6
7
|
- Code style using [**XO**](https://github.com/xojs/xo).
|
|
7
8
|
- Code formatting using [**Prettier**](https://prettier.io/).
|
|
8
9
|
- Commit style using [**`commitlint`**](https://commitlint.js.org/).
|
|
@@ -53,6 +54,7 @@ Please [create an issue](https://github.com/vidavidorra/create-project/issues/ne
|
|
|
53
54
|
Refer to the [contributing guide](https://github.com/vidavidorra/.github/blob/main/CONTRIBUTING.md) for detailed information about other contributions, like pull requests.
|
|
54
55
|
|
|
55
56
|
[](https://conventionalcommits.org)
|
|
57
|
+
[](https://eslint.org/)
|
|
56
58
|
[](https://github.com/xojs/xo)
|
|
57
59
|
[](https://github.com/prettier/prettier)
|
|
58
60
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { File } from './file.js';
|
|
3
|
+
class EslintConfig extends File {
|
|
4
|
+
constructor(path, options) {
|
|
5
|
+
super(path, { ...options, format: true });
|
|
6
|
+
}
|
|
7
|
+
process() {
|
|
8
|
+
this._content = ts.createPrinter().printFile(this.sourceFile());
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
sourceFile() {
|
|
12
|
+
const statements = [
|
|
13
|
+
ts.factory.createExportDeclaration(undefined, false, ts.factory.createNamedExports([
|
|
14
|
+
ts.factory.createExportSpecifier(false, undefined, ts.factory.createIdentifier('default')),
|
|
15
|
+
]), ts.factory.createStringLiteral('@vidavidorra/eslint-config')),
|
|
16
|
+
];
|
|
17
|
+
return ts.factory.createSourceFile(statements, ts.factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { EslintConfig };
|
|
21
|
+
//# sourceMappingURL=eslint-config.js.map
|
package/dist/content/files.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CiCd } from './ci-cd.js';
|
|
2
|
+
import { EslintConfig } from './eslint-config.js';
|
|
2
3
|
import { File } from './file.js';
|
|
3
4
|
import { LintStaged } from './lint-staged.js';
|
|
4
5
|
import { Npmrc } from './npmrc.js';
|
|
@@ -15,6 +16,7 @@ function files(options) {
|
|
|
15
16
|
new File('.editorconfig', options),
|
|
16
17
|
new File('.gitignore', options),
|
|
17
18
|
new Npmrc('.npmrc', options),
|
|
19
|
+
new EslintConfig('eslint.config.js', options),
|
|
18
20
|
new File('LICENSE.md', options),
|
|
19
21
|
new Package('package.json', options),
|
|
20
22
|
new Readme('README.md', options),
|
|
@@ -8,8 +8,8 @@ class LintStaged extends File {
|
|
|
8
8
|
this._content = ts.createPrinter().printFile(this.sourceFile());
|
|
9
9
|
return this;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
return ts.factory.createStringLiteral('
|
|
11
|
+
eslint() {
|
|
12
|
+
return ts.factory.createStringLiteral('eslint --fix');
|
|
13
13
|
}
|
|
14
14
|
ava() {
|
|
15
15
|
return ts.factory.createArrowFunction(undefined, undefined, [], undefined, undefined, ts.factory.createStringLiteral('ava'));
|
|
@@ -20,7 +20,7 @@ class LintStaged extends File {
|
|
|
20
20
|
config() {
|
|
21
21
|
return ts.factory.createObjectLiteralExpression([
|
|
22
22
|
ts.factory.createPropertyAssignment(ts.factory.createStringLiteral('*.{ts,tsx,js,jsx}'), ts.factory.createArrayLiteralExpression([
|
|
23
|
-
this.
|
|
23
|
+
this.eslint(),
|
|
24
24
|
...(this._options.testing ? [this.ava()] : []),
|
|
25
25
|
])),
|
|
26
26
|
ts.factory.createPropertyAssignment(ts.factory.createStringLiteral('*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}'), this.prettier()),
|
|
@@ -25,14 +25,13 @@ declare const schema: z.ZodObject<{
|
|
|
25
25
|
build: z.ZodString;
|
|
26
26
|
format: z.ZodString;
|
|
27
27
|
'format:check': z.ZodString;
|
|
28
|
-
lint: z.ZodLiteral<"npm run format:check &&
|
|
29
|
-
'lint:fix': z.ZodLiteral<"npm run format &&
|
|
28
|
+
lint: z.ZodLiteral<"npm run format:check && eslint">;
|
|
29
|
+
'lint:fix': z.ZodLiteral<"npm run format && eslint --fix">;
|
|
30
30
|
postinstall: z.ZodOptional<z.ZodString>;
|
|
31
31
|
prepare: z.ZodLiteral<"husky .github/husky">;
|
|
32
32
|
test: z.ZodString;
|
|
33
33
|
}, z.core.$strict>;
|
|
34
34
|
commitlint: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
35
|
-
xo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
36
35
|
prettier: z.ZodLiteral<"@vidavidorra/prettier-config">;
|
|
37
36
|
release: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
38
37
|
ava: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -71,14 +70,13 @@ declare class Package extends File {
|
|
|
71
70
|
build: string;
|
|
72
71
|
format: string;
|
|
73
72
|
'format:check': string;
|
|
74
|
-
lint: "npm run format:check &&
|
|
75
|
-
'lint:fix': "npm run format &&
|
|
73
|
+
lint: "npm run format:check && eslint";
|
|
74
|
+
'lint:fix': "npm run format && eslint --fix";
|
|
76
75
|
prepare: "husky .github/husky";
|
|
77
76
|
test: string;
|
|
78
77
|
postinstall?: string | undefined;
|
|
79
78
|
};
|
|
80
79
|
commitlint: Record<string, unknown>;
|
|
81
|
-
xo: Record<string, unknown>;
|
|
82
80
|
prettier: "@vidavidorra/prettier-config";
|
|
83
81
|
release: Record<string, unknown>;
|
|
84
82
|
devDependencies: Record<string, string>;
|
package/dist/content/package.js
CHANGED
|
@@ -24,15 +24,14 @@ const schema = z.strictObject({
|
|
|
24
24
|
format: z.string().startsWith('prettier'),
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
26
26
|
'format:check': z.string().startsWith('prettier'),
|
|
27
|
-
lint: z.literal('npm run format:check &&
|
|
27
|
+
lint: z.literal('npm run format:check && eslint'),
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
-
'lint:fix': z.literal('npm run format &&
|
|
29
|
+
'lint:fix': z.literal('npm run format && eslint --fix'),
|
|
30
30
|
postinstall: z.string().optional(),
|
|
31
31
|
prepare: z.literal('husky .github/husky'),
|
|
32
32
|
test: z.string().min(1),
|
|
33
33
|
}),
|
|
34
34
|
commitlint: z.record(z.string(), z.unknown()),
|
|
35
|
-
xo: z.record(z.string(), z.unknown()),
|
|
36
35
|
prettier: z.literal('@vidavidorra/prettier-config'),
|
|
37
36
|
release: z.record(z.string(), z.unknown()),
|
|
38
37
|
ava: z.record(z.string(), z.unknown()).optional(),
|
|
@@ -84,12 +83,13 @@ class Package extends File {
|
|
|
84
83
|
'@semantic-release/exec',
|
|
85
84
|
'@semantic-release/git',
|
|
86
85
|
'@vidavidorra/commitlint-config',
|
|
86
|
+
'@vidavidorra/eslint-config',
|
|
87
87
|
'@vidavidorra/prettier-config',
|
|
88
|
+
'eslint',
|
|
88
89
|
'husky',
|
|
89
90
|
'lint-staged',
|
|
90
91
|
'prettier',
|
|
91
92
|
'semantic-release',
|
|
92
|
-
'xo',
|
|
93
93
|
];
|
|
94
94
|
if (this._options.typescript) {
|
|
95
95
|
this._package.files = [this._fullPackage.files[0]];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Options } from '../../options.js';
|
|
2
|
-
type Config = Record<'conventionalCommits' | '
|
|
2
|
+
type Config = Record<'codeCoverage' | 'conventionalCommits' | 'eslint' | 'license' | 'nodeJsVersion' | 'npmDownloads' | 'npmVersion' | 'prettier' | 'renovate' | 'semanticRelease' | 'xo', {
|
|
3
3
|
title: string;
|
|
4
4
|
url: string;
|
|
5
5
|
link: string;
|
|
@@ -14,15 +14,40 @@ class Badge {
|
|
|
14
14
|
}
|
|
15
15
|
get config() {
|
|
16
16
|
return {
|
|
17
|
+
codeCoverage: {
|
|
18
|
+
title: 'Code coverage',
|
|
19
|
+
url: `https://img.shields.io/codecov/c/github/${this.gitHubRepository}?logo=codecov`,
|
|
20
|
+
link: `https://codecov.io/gh/${this.gitHubRepository}`,
|
|
21
|
+
},
|
|
17
22
|
conventionalCommits: {
|
|
18
23
|
title: 'Conventional Commits: 1.0.0',
|
|
19
24
|
url: 'https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow',
|
|
20
25
|
link: 'https://conventionalcommits.org',
|
|
21
26
|
},
|
|
22
|
-
|
|
23
|
-
title: '
|
|
24
|
-
url: 'https://img.shields.io/badge/
|
|
25
|
-
link: 'https://
|
|
27
|
+
eslint: {
|
|
28
|
+
title: 'Linter',
|
|
29
|
+
url: 'https://img.shields.io/badge/Linter-ESLint-4B32C3?logo=eslint&style=flat-square',
|
|
30
|
+
link: 'https://eslint.org/',
|
|
31
|
+
},
|
|
32
|
+
license: {
|
|
33
|
+
title: 'License',
|
|
34
|
+
url: `https://img.shields.io/github/license/${this.gitHubRepository}`,
|
|
35
|
+
link: `LICENSE.md`,
|
|
36
|
+
},
|
|
37
|
+
nodeJsVersion: {
|
|
38
|
+
title: 'Node.js version support',
|
|
39
|
+
url: `https://img.shields.io/node/v/${this._options.package}?logo=node.js`,
|
|
40
|
+
link: `https://nodejs.org/en/about/releases/`,
|
|
41
|
+
},
|
|
42
|
+
npmDownloads: {
|
|
43
|
+
title: 'npm downloads',
|
|
44
|
+
url: `https://img.shields.io/npm/dm/${this._options.package}?logo=npm`,
|
|
45
|
+
link: `https://www.npmjs.com/package/${this._options.package}`,
|
|
46
|
+
},
|
|
47
|
+
npmVersion: {
|
|
48
|
+
title: 'npm version',
|
|
49
|
+
url: `https://img.shields.io/npm/v/${this._options.package}?logo=npm`,
|
|
50
|
+
link: `https://www.npmjs.com/package/${this._options.package}`,
|
|
26
51
|
},
|
|
27
52
|
prettier: {
|
|
28
53
|
title: 'Prettier code style',
|
|
@@ -39,30 +64,10 @@ class Badge {
|
|
|
39
64
|
url: 'https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079',
|
|
40
65
|
link: 'https://github.com/semantic-release/semantic-release',
|
|
41
66
|
},
|
|
42
|
-
|
|
43
|
-
title: '
|
|
44
|
-
url:
|
|
45
|
-
link:
|
|
46
|
-
},
|
|
47
|
-
license: {
|
|
48
|
-
title: 'License',
|
|
49
|
-
url: `https://img.shields.io/github/license/${this.gitHubRepository}`,
|
|
50
|
-
link: `LICENSE.md`,
|
|
51
|
-
},
|
|
52
|
-
npmVersion: {
|
|
53
|
-
title: 'npm version',
|
|
54
|
-
url: `https://img.shields.io/npm/v/${this._options.package}?logo=npm`,
|
|
55
|
-
link: `https://www.npmjs.com/package/${this._options.package}`,
|
|
56
|
-
},
|
|
57
|
-
npmDownloads: {
|
|
58
|
-
title: 'npm downloads',
|
|
59
|
-
url: `https://img.shields.io/npm/dm/${this._options.package}?logo=npm`,
|
|
60
|
-
link: `https://www.npmjs.com/package/${this._options.package}`,
|
|
61
|
-
},
|
|
62
|
-
nodeJsVersion: {
|
|
63
|
-
title: 'Node.js version support',
|
|
64
|
-
url: `https://img.shields.io/node/v/${this._options.package}?logo=node.js`,
|
|
65
|
-
link: `https://nodejs.org/en/about/releases/`,
|
|
67
|
+
xo: {
|
|
68
|
+
title: 'XO code style',
|
|
69
|
+
url: 'https://img.shields.io/badge/code_style-5ed9c7?logo=xo&labelColor=gray',
|
|
70
|
+
link: 'https://github.com/xojs/xo',
|
|
66
71
|
},
|
|
67
72
|
};
|
|
68
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidavidorra/create-project",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interactively create a GitHub project",
|
|
6
6
|
"keywords": [
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"format": "prettier --write \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
|
|
38
38
|
"format:check": "prettier --check \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
|
|
39
39
|
"postinstall": "node ./src/scripts/postinstall.js",
|
|
40
|
-
"lint": "npm run format:check &&
|
|
41
|
-
"lint:fix": "npm run format &&
|
|
40
|
+
"lint": "npm run format:check && eslint",
|
|
41
|
+
"lint:fix": "npm run format && eslint --fix",
|
|
42
42
|
"prepare": "husky .github/husky",
|
|
43
43
|
"test": "c8 ava"
|
|
44
44
|
},
|
|
@@ -47,10 +47,6 @@
|
|
|
47
47
|
"@vidavidorra"
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
|
-
"xo": {
|
|
51
|
-
"prettier": true,
|
|
52
|
-
"space": true
|
|
53
|
-
},
|
|
54
50
|
"prettier": "@vidavidorra/prettier-config",
|
|
55
51
|
"release": {
|
|
56
52
|
"branches": [
|
|
@@ -216,13 +212,14 @@
|
|
|
216
212
|
"@types/sinon": "21.0.0",
|
|
217
213
|
"@types/validate-npm-package-name": "4.0.2",
|
|
218
214
|
"@vidavidorra/commitlint-config": "7.1.6",
|
|
215
|
+
"@vidavidorra/eslint-config": "1.0.2",
|
|
219
216
|
"ava": "6.4.1",
|
|
220
217
|
"c8": "10.1.3",
|
|
218
|
+
"eslint": "9.39.2",
|
|
221
219
|
"husky": "9.1.7",
|
|
222
220
|
"lint-staged": "16.2.7",
|
|
223
221
|
"semantic-release": "25.0.2",
|
|
224
|
-
"sinon": "21.0.0"
|
|
225
|
-
"xo": "1.2.3"
|
|
222
|
+
"sinon": "21.0.0"
|
|
226
223
|
},
|
|
227
224
|
"engines": {
|
|
228
225
|
"node": ">=22"
|