@vidavidorra/create-project 1.0.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.
Files changed (40) hide show
  1. package/.editorconfig +12 -0
  2. package/.github/husky/commit-msg +4 -0
  3. package/.github/husky/pre-commit +4 -0
  4. package/.github/lint-staged.js +6 -0
  5. package/.github/renovate.json +4 -0
  6. package/.github/workflows/ci-cd.yml +36 -0
  7. package/.gitignore +355 -0
  8. package/.npmrc +1 -0
  9. package/LICENSE.md +619 -0
  10. package/README.md +76 -0
  11. package/dist/content/ci-cd.d.ts +246 -0
  12. package/dist/content/ci-cd.js +112 -0
  13. package/dist/content/file.d.ts +36 -0
  14. package/dist/content/file.js +52 -0
  15. package/dist/content/files.d.ts +4 -0
  16. package/dist/content/files.js +23 -0
  17. package/dist/content/index.d.ts +1 -0
  18. package/dist/content/index.js +2 -0
  19. package/dist/content/lint-staged.d.ts +12 -0
  20. package/dist/content/lint-staged.js +40 -0
  21. package/dist/content/package.d.ts +211 -0
  22. package/dist/content/package.js +122 -0
  23. package/dist/content/readme/badge.d.ts +15 -0
  24. package/dist/content/readme/badge.js +75 -0
  25. package/dist/content/readme/index.d.ts +1 -0
  26. package/dist/content/readme/index.js +2 -0
  27. package/dist/content/readme/readme.d.ts +17 -0
  28. package/dist/content/readme/readme.js +129 -0
  29. package/dist/content/readme/readme.js.map +1 -0
  30. package/dist/content/readme/readme.test.d.ts +1 -0
  31. package/dist/content/readme/readme.test.js +35 -0
  32. package/dist/content/readme/readme.test.js.map +1 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +62 -0
  35. package/dist/options.d.ts +43 -0
  36. package/dist/options.js +52 -0
  37. package/dist/root-path.d.ts +2 -0
  38. package/dist/root-path.js +5 -0
  39. package/package.json +226 -0
  40. package/tsconfig.json +14 -0
@@ -0,0 +1,211 @@
1
+ import { z } from 'zod';
2
+ import { type Options } from '../options.js';
3
+ import { File } from './file.js';
4
+ declare const schema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ version: z.ZodString;
7
+ description: z.ZodString;
8
+ private: z.ZodOptional<z.ZodBoolean>;
9
+ homepage: z.ZodString;
10
+ bugs: z.ZodObject<{
11
+ url: z.ZodString;
12
+ }, "strict", z.ZodTypeAny, {
13
+ url: string;
14
+ }, {
15
+ url: string;
16
+ }>;
17
+ repository: z.ZodObject<{
18
+ type: z.ZodLiteral<"git">;
19
+ url: z.ZodString;
20
+ }, "strict", z.ZodTypeAny, {
21
+ type: "git";
22
+ url: string;
23
+ }, {
24
+ type: "git";
25
+ url: string;
26
+ }>;
27
+ license: z.ZodLiteral<"GPL-3.0-or-later">;
28
+ author: z.ZodString;
29
+ type: z.ZodLiteral<"module">;
30
+ exports: z.ZodOptional<z.ZodString>;
31
+ files: z.ZodOptional<z.ZodTuple<[z.ZodLiteral<"./dist/**/!(*.test).{js,d.ts,cjs}">], z.ZodString>>;
32
+ scripts: z.ZodObject<{
33
+ build: z.ZodString;
34
+ format: z.ZodString;
35
+ 'format:check': z.ZodString;
36
+ lint: z.ZodLiteral<"npm run format:check && xo">;
37
+ 'lint:fix': z.ZodLiteral<"npm run format && xo --fix">;
38
+ prepare: z.ZodLiteral<"husky install .github/husky">;
39
+ test: z.ZodString;
40
+ }, "strict", z.ZodTypeAny, {
41
+ format: string;
42
+ lint: "npm run format:check && xo";
43
+ build: string;
44
+ test: string;
45
+ 'format:check': string;
46
+ 'lint:fix': "npm run format && xo --fix";
47
+ prepare: "husky install .github/husky";
48
+ }, {
49
+ format: string;
50
+ lint: "npm run format:check && xo";
51
+ build: string;
52
+ test: string;
53
+ 'format:check': string;
54
+ 'lint:fix': "npm run format && xo --fix";
55
+ prepare: "husky install .github/husky";
56
+ }>;
57
+ commitlint: z.ZodRecord<z.ZodString, z.ZodUnknown>;
58
+ xo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
59
+ prettier: z.ZodRecord<z.ZodString, z.ZodUnknown>;
60
+ release: z.ZodRecord<z.ZodString, z.ZodUnknown>;
61
+ ava: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
62
+ c8: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
63
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
64
+ devDependencies: z.ZodRecord<z.ZodString, z.ZodString>;
65
+ engines: z.ZodObject<{
66
+ node: z.ZodLiteral<">=18">;
67
+ }, "strict", z.ZodTypeAny, {
68
+ node: ">=18";
69
+ }, {
70
+ node: ">=18";
71
+ }>;
72
+ publishConfig: z.ZodObject<{
73
+ access: z.ZodLiteral<"public">;
74
+ }, "strict", z.ZodTypeAny, {
75
+ access: "public";
76
+ }, {
77
+ access: "public";
78
+ }>;
79
+ }, "strict", z.ZodTypeAny, {
80
+ type: "module";
81
+ description: string;
82
+ author: string;
83
+ name: string;
84
+ release: Record<string, unknown>;
85
+ version: string;
86
+ homepage: string;
87
+ bugs: {
88
+ url: string;
89
+ };
90
+ repository: {
91
+ type: "git";
92
+ url: string;
93
+ };
94
+ license: "GPL-3.0-or-later";
95
+ prettier: Record<string, unknown>;
96
+ scripts: {
97
+ format: string;
98
+ lint: "npm run format:check && xo";
99
+ build: string;
100
+ test: string;
101
+ 'format:check': string;
102
+ 'lint:fix': "npm run format && xo --fix";
103
+ prepare: "husky install .github/husky";
104
+ };
105
+ commitlint: Record<string, unknown>;
106
+ xo: Record<string, unknown>;
107
+ devDependencies: Record<string, string>;
108
+ engines: {
109
+ node: ">=18";
110
+ };
111
+ publishConfig: {
112
+ access: "public";
113
+ };
114
+ private?: boolean | undefined;
115
+ exports?: string | undefined;
116
+ files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
117
+ ava?: Record<string, unknown> | undefined;
118
+ c8?: Record<string, unknown> | undefined;
119
+ dependencies?: Record<string, string> | undefined;
120
+ }, {
121
+ type: "module";
122
+ description: string;
123
+ author: string;
124
+ name: string;
125
+ release: Record<string, unknown>;
126
+ version: string;
127
+ homepage: string;
128
+ bugs: {
129
+ url: string;
130
+ };
131
+ repository: {
132
+ type: "git";
133
+ url: string;
134
+ };
135
+ license: "GPL-3.0-or-later";
136
+ prettier: Record<string, unknown>;
137
+ scripts: {
138
+ format: string;
139
+ lint: "npm run format:check && xo";
140
+ build: string;
141
+ test: string;
142
+ 'format:check': string;
143
+ 'lint:fix': "npm run format && xo --fix";
144
+ prepare: "husky install .github/husky";
145
+ };
146
+ commitlint: Record<string, unknown>;
147
+ xo: Record<string, unknown>;
148
+ devDependencies: Record<string, string>;
149
+ engines: {
150
+ node: ">=18";
151
+ };
152
+ publishConfig: {
153
+ access: "public";
154
+ };
155
+ private?: boolean | undefined;
156
+ exports?: string | undefined;
157
+ files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
158
+ ava?: Record<string, unknown> | undefined;
159
+ c8?: Record<string, unknown> | undefined;
160
+ dependencies?: Record<string, string> | undefined;
161
+ }>;
162
+ type PackageJson = z.infer<typeof schema>;
163
+ declare class Package extends File {
164
+ protected readonly _fullPackage: Required<PackageJson>;
165
+ protected readonly _package: PackageJson;
166
+ constructor(path: string, options: Options);
167
+ get package(): {
168
+ type: "module";
169
+ description: string;
170
+ author: string;
171
+ name: string;
172
+ release: Record<string, unknown>;
173
+ version: string;
174
+ homepage: string;
175
+ bugs: {
176
+ url: string;
177
+ };
178
+ repository: {
179
+ type: "git";
180
+ url: string;
181
+ };
182
+ license: "GPL-3.0-or-later";
183
+ prettier: Record<string, unknown>;
184
+ scripts: {
185
+ format: string;
186
+ lint: "npm run format:check && xo";
187
+ build: string;
188
+ test: string;
189
+ 'format:check': string;
190
+ 'lint:fix': "npm run format && xo --fix";
191
+ prepare: "husky install .github/husky";
192
+ };
193
+ commitlint: Record<string, unknown>;
194
+ xo: Record<string, unknown>;
195
+ devDependencies: Record<string, string>;
196
+ engines: {
197
+ node: ">=18";
198
+ };
199
+ publishConfig: {
200
+ access: "public";
201
+ };
202
+ private?: boolean | undefined;
203
+ exports?: string | undefined;
204
+ files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
205
+ ava?: Record<string, unknown> | undefined;
206
+ c8?: Record<string, unknown> | undefined;
207
+ dependencies?: Record<string, string> | undefined;
208
+ };
209
+ process(): this;
210
+ }
211
+ export { Package, type PackageJson };
@@ -0,0 +1,122 @@
1
+ import { z } from 'zod';
2
+ import { sortPackageJson } from 'sort-package-json';
3
+ import { File } from './file.js';
4
+ const schema = z
5
+ .object({
6
+ name: z.string().min(1),
7
+ version: z.string().min('0.0.0'.length),
8
+ description: z.string(),
9
+ private: z.boolean().optional(),
10
+ homepage: z.string().url(),
11
+ bugs: z
12
+ .object({
13
+ url: z.string().url(),
14
+ })
15
+ .strict(),
16
+ repository: z
17
+ .object({
18
+ type: z.literal('git'),
19
+ url: z.string().url(),
20
+ })
21
+ .strict(),
22
+ license: z.literal('GPL-3.0-or-later'),
23
+ author: z.string().min(1),
24
+ type: z.literal('module'),
25
+ exports: z.string().min(1).optional(),
26
+ files: z
27
+ .tuple([z.literal('./dist/**/!(*.test).{js,d.ts,cjs}')])
28
+ .rest(z.string().min(1))
29
+ .optional(),
30
+ scripts: z
31
+ .object({
32
+ build: z.string().min(1),
33
+ format: z.string().startsWith('prettier'),
34
+ // eslint-disable-next-line @typescript-eslint/naming-convention
35
+ 'format:check': z.string().startsWith('prettier'),
36
+ lint: z.literal('npm run format:check && xo'),
37
+ // eslint-disable-next-line @typescript-eslint/naming-convention
38
+ 'lint:fix': z.literal('npm run format && xo --fix'),
39
+ prepare: z.literal('husky install .github/husky'),
40
+ test: z.string().min(1),
41
+ })
42
+ .strict(),
43
+ commitlint: z.record(z.unknown()),
44
+ xo: z.record(z.unknown()),
45
+ prettier: z.record(z.unknown()),
46
+ release: z.record(z.unknown()),
47
+ ava: z.record(z.unknown()).optional(),
48
+ c8: z.record(z.unknown()).optional(),
49
+ dependencies: z.record(z.string()).optional(),
50
+ devDependencies: z.record(z.string()),
51
+ engines: z.object({ node: z.literal('>=18') }).strict(),
52
+ publishConfig: z.object({ access: z.literal('public') }).strict(),
53
+ })
54
+ .strict();
55
+ class Package extends File {
56
+ _fullPackage;
57
+ _package;
58
+ constructor(path, options) {
59
+ super(path, { ...options, format: true });
60
+ this._fullPackage = schema.required().parse(JSON.parse(this._content));
61
+ this._package = structuredClone(this._fullPackage);
62
+ }
63
+ get package() {
64
+ return structuredClone(this._package);
65
+ }
66
+ process() {
67
+ this._package.name = this._options.package;
68
+ this._package.version = '0.1.0';
69
+ this._package.description = this._options.description;
70
+ this._package.author = this._options.author;
71
+ this._package.devDependencies = {
72
+ ...this._package.devDependencies,
73
+ ...this._package.dependencies,
74
+ };
75
+ delete this._package.dependencies;
76
+ if (this._options.public) {
77
+ delete this._package.private;
78
+ }
79
+ else {
80
+ this._package.private = true;
81
+ }
82
+ const devDependencies = [
83
+ '@commitlint/cli',
84
+ '@semantic-release/changelog',
85
+ '@semantic-release/exec',
86
+ '@semantic-release/git',
87
+ '@vidavidorra/commitlint-config',
88
+ 'husky',
89
+ 'lint-staged',
90
+ 'semantic-release',
91
+ 'xo',
92
+ ];
93
+ if (this._options.typescript) {
94
+ this._package.files = [this._fullPackage.files[0]];
95
+ devDependencies.push('typescript');
96
+ }
97
+ else {
98
+ this._package.scripts.build = '';
99
+ delete this._package.exports;
100
+ delete this._package.files;
101
+ }
102
+ if (this._options.testing) {
103
+ devDependencies.push('@ava/typescript', 'ava', 'c8');
104
+ }
105
+ else {
106
+ this._package.scripts.test = '';
107
+ delete this._package.ava;
108
+ delete this._package.c8;
109
+ }
110
+ for (const dependency of Object.keys(this._package.devDependencies)) {
111
+ if (!devDependencies.includes(dependency)) {
112
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
113
+ delete this._package.devDependencies[dependency];
114
+ }
115
+ }
116
+ sortPackageJson(this._package);
117
+ this._content = JSON.stringify(this._package, undefined, 2);
118
+ return this;
119
+ }
120
+ }
121
+ export { Package };
122
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1,15 @@
1
+ import { type Options } from '../../options.js';
2
+ type Config = Record<'conventionalCommits' | 'xo' | 'prettier' | 'renovate' | 'semanticRelease' | 'codeCoverage' | 'license' | 'npmVersion' | 'npmDownloads' | 'nodeJsVersion', {
3
+ title: string;
4
+ url: string;
5
+ link: string;
6
+ }>;
7
+ declare class Badge {
8
+ private readonly _options;
9
+ constructor(options: Options);
10
+ markdown(key: keyof Config): string;
11
+ get badges(): Array<keyof Config>;
12
+ private get config();
13
+ private get gitHubRepository();
14
+ }
15
+ export { Badge };
@@ -0,0 +1,75 @@
1
+ class Badge {
2
+ _options;
3
+ constructor(options) {
4
+ this._options = options;
5
+ }
6
+ markdown(key) {
7
+ const config = this.config[key];
8
+ const url = new URL(config.url);
9
+ url.searchParams.append('style', 'flat-square');
10
+ return `[![${config.title}](${url.toString()})](${config.link})`;
11
+ }
12
+ get badges() {
13
+ return Object.keys(this.config);
14
+ }
15
+ get config() {
16
+ return {
17
+ conventionalCommits: {
18
+ title: 'Conventional Commits: 1.0.0',
19
+ url: 'https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow',
20
+ link: 'https://conventionalcommits.org',
21
+ },
22
+ xo: {
23
+ title: 'XO code style',
24
+ url: 'https://img.shields.io/badge/code_style-5ed9c7?logo=xo&labelColor=gray',
25
+ link: 'https://github.com/xojs/xo',
26
+ },
27
+ prettier: {
28
+ title: 'Prettier code style',
29
+ url: 'https://img.shields.io/badge/code_style-Prettier-ff69b4?logo=prettier',
30
+ link: 'https://github.com/prettier/prettier',
31
+ },
32
+ renovate: {
33
+ title: 'Renovate',
34
+ url: 'https://img.shields.io/badge/Renovate-enabled-brightgreen?logo=renovatebot&logoColor',
35
+ link: 'https://renovatebot.com',
36
+ },
37
+ semanticRelease: {
38
+ title: 'semantic-release',
39
+ url: 'https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079',
40
+ link: 'https://github.com/semantic-release/semantic-release',
41
+ },
42
+ codeCoverage: {
43
+ title: 'Code coverage',
44
+ url: `https://img.shields.io/codecov/c/github${this.gitHubRepository}?logo=codecov`,
45
+ link: `https://codecov.io/gh/${this.gitHubRepository}`,
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/`,
66
+ },
67
+ };
68
+ }
69
+ get gitHubRepository() {
70
+ const { githubOwner, githubRepository } = this._options;
71
+ return `${githubOwner}/${githubRepository}`;
72
+ }
73
+ }
74
+ export { Badge };
75
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ export { Readme } from './readme.js';
@@ -0,0 +1,2 @@
1
+ export { Readme } from './readme.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ import { type Options } from '../../options.js';
2
+ import { File } from '../file.js';
3
+ declare class Readme extends File {
4
+ private readonly _badge;
5
+ constructor(path: string, options: Options);
6
+ process(): this;
7
+ private badges;
8
+ private tableOfContents;
9
+ private install;
10
+ private usage;
11
+ private contributing;
12
+ private securityPolicy;
13
+ private license;
14
+ private dedent;
15
+ private gitHubUrl;
16
+ }
17
+ export { Readme };
@@ -0,0 +1,129 @@
1
+ import { File } from '../file.js';
2
+ import { Badge } from './badge.js';
3
+ class Readme extends File {
4
+ _badge;
5
+ constructor(path, options) {
6
+ super(path, { ...options, format: true });
7
+ this._badge = new Badge(options);
8
+ }
9
+ process() {
10
+ this._content = [
11
+ `# ${this.options.project} <!-- omit in toc -->`,
12
+ `${this.options.description}`,
13
+ '---',
14
+ this.badges(),
15
+ this.tableOfContents(),
16
+ this.install(),
17
+ this.usage(),
18
+ this.contributing(),
19
+ this.securityPolicy(),
20
+ this.license(),
21
+ ].join('\n\n');
22
+ return this;
23
+ }
24
+ badges() {
25
+ return [
26
+ this._options.public ? this._badge.markdown('npmVersion') : undefined,
27
+ this._options.public ? this._badge.markdown('npmDownloads') : undefined,
28
+ this._options.public ? this._badge.markdown('nodeJsVersion') : undefined,
29
+ this._badge.markdown('renovate'),
30
+ this._badge.markdown('semanticRelease'),
31
+ this._options.reportCodeCoverage
32
+ ? this._badge.markdown('codeCoverage')
33
+ : undefined,
34
+ this._badge.markdown('license'),
35
+ ].join('\n');
36
+ }
37
+ tableOfContents() {
38
+ return this.dedent(`- [Install](#install)
39
+ - [Usage](#usage)
40
+ - [Contributing](#contributing)
41
+ - [Security policy](#security-policy)
42
+ - [License](#license)`);
43
+ }
44
+ install() {
45
+ return this.dedent(`## Install
46
+
47
+ ...`);
48
+ }
49
+ usage() {
50
+ return this.dedent(`## Usage
51
+
52
+ ...`);
53
+ }
54
+ contributing() {
55
+ const contributingGuide = this.gitHubUrl('blob/main/CONTRIBUTING.md', '.github');
56
+ return this.dedent(`## Contributing
57
+
58
+ ${[
59
+ `Please [create an issue](${this.gitHubUrl('issues/new/choose')})`,
60
+ 'if you have a bug report or feature proposal, or',
61
+ `[create a discussion](${this.gitHubUrl('discussions')} if you have a`,
62
+ 'question. If you like this project, please consider giving it a star',
63
+ '⭐ to support my work.',
64
+ ].join(' ')}
65
+
66
+ ${[
67
+ `Refer to the, [contributing guide](${contributingGuide})`,
68
+ 'for detailed information about other contributions, like pull',
69
+ 'requests.',
70
+ ].join(' ')}
71
+
72
+ ${this._badge.markdown('conventionalCommits')}
73
+ ${this._badge.markdown('xo')}
74
+ ${this._badge.markdown('prettier')}`);
75
+ }
76
+ securityPolicy() {
77
+ return this.dedent(`## Security policy
78
+ ${[
79
+ 'Please refer to the',
80
+ `[Security Policy on GitHub](${this.gitHubUrl('security')})`,
81
+ 'for the security policy.',
82
+ ].join(' ')}`);
83
+ }
84
+ license() {
85
+ return this.dedent(`## License
86
+
87
+ ${[
88
+ 'This project is licensed under the',
89
+ '[GPLv3 license](https://www.gnu.org/licenses/gpl.html).',
90
+ ].join(' ')}
91
+
92
+ Copyright © ${new Date().getFullYear()} ${this.options.author}
93
+
94
+ <details><summary>License notice</summary>
95
+ <p>
96
+
97
+ This program is free software: you can redistribute it and/or modify
98
+ it under the terms of the GNU General Public License as published by
99
+ the Free Software Foundation, either version 3 of the License, or
100
+ (at your option) any later version.
101
+
102
+ This program is distributed in the hope that it will be useful,
103
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
104
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
105
+ GNU General Public License for more details.
106
+
107
+ You should have received a copy of the GNU General Public License
108
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
109
+
110
+ ${[
111
+ 'The full text of the license is available in the',
112
+ '[LICENSE](LICENSE.md) file in this repository and',
113
+ '[online](https://www.gnu.org/licenses/gpl.html)',
114
+ ].join(' ')}
115
+
116
+ </details>
117
+
118
+ <!-- References -->`);
119
+ }
120
+ dedent(value) {
121
+ return value.replaceAll(/^ +/gm, '');
122
+ }
123
+ gitHubUrl(path, repository) {
124
+ const { githubOwner: owner, githubRepository } = this._options;
125
+ return new URL(path, `https://github.com/${`${owner}/${repository ?? githubRepository}`}/`).toString();
126
+ }
127
+ }
128
+ export { Readme };
129
+ //# sourceMappingURL=readme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readme.js","sourceRoot":"","sources":["../../../src/content/readme/readme.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjC,MAAM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,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAEO,OAAO;QACb,OAAO,IAAI,CAAC,MAAM,CAAC;;QAEf;YACA,oCAAoC;YACpC,yDAAyD;SAC1D,CAAC,IAAI,CAAC,GAAG,CAAC;;oBAEG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;;;;;;;;;;;;;;;;;;QAkB3D;YACA,kDAAkD;YAClD,mDAAmD;YACnD,iDAAiD;SAClD,CAAC,IAAI,CAAC,GAAG,CAAC;;;;0BAIS,CAAC,CAAC;IAC1B,CAAC;IAEO,MAAM,CAAC,KAAa;QAC1B,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,SAAS,CAAC,IAAY,EAAE,UAAmB;QACjD,MAAM,EAAC,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7D,OAAO,IAAI,GAAG,CACZ,IAAI,EACJ,sBAAsB,GAAG,KAAK,IAAI,UAAU,IAAI,gBAAgB,EAAE,GAAG,CACtE,CAAC,QAAQ,EAAE,CAAC;IACf,CAAC;CACF;AAED,OAAO,EAAC,MAAM,EAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import test from 'ava';
2
+ import { options } from '../../_options.test.js';
3
+ import { Readme } from './readme.js';
4
+ const path = '.github/lint-staged.js';
5
+ test('enables the "format" option', (t) => {
6
+ t.true(new Readme(path, options).options.format);
7
+ });
8
+ test('starts with project title, omitted in the table of contents', (t) => {
9
+ const file = new Readme(path, options).process();
10
+ t.is(file.content.split('\n').at(0), `# ${options.project} <!-- omit in toc -->`);
11
+ });
12
+ const includesBadge = test.macro({
13
+ exec(t, include, option, value) {
14
+ const file = new Readme(path, { ...options, [option]: include }).process();
15
+ (include ? t.regex : t.notRegex)(file.content, new RegExp(value));
16
+ },
17
+ title: (_, include, option, value) => [
18
+ `${include ? 'includes' : 'does not include'} "${value}"`,
19
+ `${include ? 'with' : 'without'} "${option}" option`,
20
+ ].join(' '),
21
+ });
22
+ test(includesBadge, true, 'public', 'npm version');
23
+ test(includesBadge, false, 'public', 'npm version');
24
+ test(includesBadge, true, 'public', 'npm downloads');
25
+ test(includesBadge, false, 'public', 'npm downloads');
26
+ test(includesBadge, true, 'public', 'Node.js version support');
27
+ test(includesBadge, false, 'public', 'Node.js version support');
28
+ test(includesBadge, true, 'reportCodeCoverage', 'Code coverage');
29
+ test(includesBadge, false, 'reportCodeCoverage', 'Code coverage');
30
+ test('contains a copyright with the current year and author', (t) => {
31
+ const file = new Readme(path, options).process();
32
+ const year = new Date().getFullYear();
33
+ t.regex(file.content, new RegExp(`Copyright © ${year} ${options.author}`));
34
+ });
35
+ //# sourceMappingURL=readme.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readme.test.js","sourceRoot":"","sources":["../../../src/content/readme/readme.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,MAAM,IAAI,GAAG,wBAAwB,CAAC;AAEtC,IAAI,CAAC,6BAA6B,EAAE,CAAC,CAAC,EAAE,EAAE;IACxC,CAAC,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,6DAA6D,EAAE,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;IACjD,CAAC,CAAC,EAAE,CACF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI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