@vidavidorra/create-project 2.0.3 → 2.0.5
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/README.md +1 -1
- package/dist/content/files.js +2 -1
- package/dist/content/ts-config.d.ts +42 -0
- package/dist/content/ts-config.js +29 -0
- package/dist/scripts/postinstall.d.ts +3 -4
- package/dist/scripts/postinstall.js +2 -2
- package/package.json +5 -4
- package/src/scripts/postinstall.js +32 -0
- package/tsconfig.json +1 -0
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ Please refer to the [Security Policy on GitHub](https://github.com/vidavidorra/c
|
|
|
59
59
|
|
|
60
60
|
This project is licensed under the [GPLv3 license](https://www.gnu.org/licenses/gpl.html).
|
|
61
61
|
|
|
62
|
-
Copyright © 2023 Jeroen de Bruijn
|
|
62
|
+
Copyright © 2023-2024 Jeroen de Bruijn
|
|
63
63
|
|
|
64
64
|
<details><summary>License notice</summary>
|
|
65
65
|
<p>
|
package/dist/content/files.js
CHANGED
|
@@ -3,6 +3,7 @@ import { File } from './file.js';
|
|
|
3
3
|
import { LintStaged } from './lint-staged.js';
|
|
4
4
|
import { Package } from './package.js';
|
|
5
5
|
import { Readme } from './readme/index.js';
|
|
6
|
+
import { TsConfig } from './ts-config.js';
|
|
6
7
|
function files(options) {
|
|
7
8
|
return [
|
|
8
9
|
new File('.github/husky/commit-msg', { ...options, mode: 0o755 }),
|
|
@@ -16,7 +17,7 @@ function files(options) {
|
|
|
16
17
|
new File('LICENSE.md', options),
|
|
17
18
|
new Package('package.json', options),
|
|
18
19
|
new Readme('README.md', options),
|
|
19
|
-
new
|
|
20
|
+
new TsConfig('tsconfig.json', options),
|
|
20
21
|
];
|
|
21
22
|
}
|
|
22
23
|
export { files };
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
compilerOptions: z.ZodObject<{
|
|
6
|
+
allowJs: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
8
|
+
allowJs: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
10
|
+
allowJs: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
12
|
+
include: z.ZodArray<z.ZodString, "many">;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
compilerOptions: {
|
|
15
|
+
allowJs?: boolean | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
include: string[];
|
|
20
|
+
}, {
|
|
21
|
+
compilerOptions: {
|
|
22
|
+
allowJs?: boolean | undefined;
|
|
23
|
+
} & {
|
|
24
|
+
[k: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
include: string[];
|
|
27
|
+
}>;
|
|
28
|
+
type TsConfigJson = z.infer<typeof schema>;
|
|
29
|
+
declare class TsConfig extends File {
|
|
30
|
+
protected readonly _tsConfig: TsConfigJson;
|
|
31
|
+
constructor(path: string, options: Options);
|
|
32
|
+
get tsConfig(): {
|
|
33
|
+
compilerOptions: {
|
|
34
|
+
allowJs?: boolean | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
[k: string]: unknown;
|
|
37
|
+
};
|
|
38
|
+
include: string[];
|
|
39
|
+
};
|
|
40
|
+
process(): this;
|
|
41
|
+
}
|
|
42
|
+
export { TsConfig, type TsConfigJson };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { File } from './file.js';
|
|
3
|
+
const schema = z
|
|
4
|
+
.object({
|
|
5
|
+
compilerOptions: z
|
|
6
|
+
.object({
|
|
7
|
+
allowJs: z.boolean().optional(),
|
|
8
|
+
})
|
|
9
|
+
.passthrough(),
|
|
10
|
+
include: z.array(z.string()).min(1),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
class TsConfig extends File {
|
|
14
|
+
_tsConfig;
|
|
15
|
+
constructor(path, options) {
|
|
16
|
+
super(path, { ...options, format: true });
|
|
17
|
+
this._tsConfig = schema.required().parse(JSON.parse(this._content));
|
|
18
|
+
}
|
|
19
|
+
get tsConfig() {
|
|
20
|
+
return structuredClone(this._tsConfig);
|
|
21
|
+
}
|
|
22
|
+
process() {
|
|
23
|
+
delete this._tsConfig.compilerOptions.allowJs;
|
|
24
|
+
this._content = JSON.stringify(this._tsConfig, undefined, 2);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export { TsConfig };
|
|
29
|
+
//# sourceMappingURL=ts-config.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export const gitIgnore: string;
|
|
2
|
+
export const npmIgnore: string;
|
|
3
3
|
/**
|
|
4
4
|
* Workaround for [Rename `.gitignore` to `.npmignore` in package if no
|
|
5
5
|
* `.npmignore` found](https://github.com/npm/npm/issues/1862) and ['npm pack'/
|
|
@@ -9,5 +9,4 @@ declare const npmIgnore: string;
|
|
|
9
9
|
* the file to `.npmignore`. This script simply reverts that rename if it has
|
|
10
10
|
* occurred.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
export { gitIgnore, npmIgnore, postinstall };
|
|
12
|
+
export function postinstall(): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
2
|
import { fileURLToPath } from 'node:url';
|
|
4
3
|
import { argv } from 'node:process';
|
|
5
|
-
import
|
|
4
|
+
import { join, resolve, dirname } from 'node:path';
|
|
5
|
+
const rootPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../');
|
|
6
6
|
const gitIgnore = join(rootPath, '.gitignore');
|
|
7
7
|
const npmIgnore = join(rootPath, '.npmignore');
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidavidorra/create-project",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interactively create a GitHub project.",
|
|
6
6
|
"homepage": "https://github.com/vidavidorra/create-project#readme",
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"./dist/**/!(*.test).{js,d.ts,cjs}",
|
|
23
|
-
"./.github/",
|
|
24
23
|
"./.editorconfig",
|
|
24
|
+
"./.github/",
|
|
25
25
|
"./.gitignore",
|
|
26
26
|
"./.npmrc",
|
|
27
|
+
"./src/scripts/postinstall.js",
|
|
27
28
|
"./LICENSE.md",
|
|
28
29
|
"./tsconfig.json"
|
|
29
30
|
],
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"build": "tsc",
|
|
32
33
|
"format": "prettier --ignore-path .gitignore --write \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
|
|
33
34
|
"format:check": "prettier --ignore-path .gitignore --check \"**/*.{vue,css,less,scss,html,htm,json,md,markdown,yml,yaml}\" --log-level warn",
|
|
34
|
-
"postinstall": "node ./
|
|
35
|
+
"postinstall": "node ./src/scripts/postinstall.js",
|
|
35
36
|
"lint": "npm run format:check && xo",
|
|
36
37
|
"lint:fix": "npm run format && xo --fix",
|
|
37
38
|
"prepare": "husky install .github/husky",
|
|
@@ -209,7 +210,7 @@
|
|
|
209
210
|
"@semantic-release/changelog": "6.0.3",
|
|
210
211
|
"@semantic-release/exec": "6.0.3",
|
|
211
212
|
"@semantic-release/git": "10.0.1",
|
|
212
|
-
"@types/node": "20.10.
|
|
213
|
+
"@types/node": "20.10.6",
|
|
213
214
|
"@types/prettier": "2.7.3",
|
|
214
215
|
"@types/sinon": "17.0.2",
|
|
215
216
|
"@types/validate-npm-package-name": "4.0.2",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import {fileURLToPath} from 'node:url';
|
|
3
|
+
import {argv} from 'node:process';
|
|
4
|
+
import {join, resolve, dirname} from 'node:path';
|
|
5
|
+
|
|
6
|
+
const rootPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../');
|
|
7
|
+
const gitIgnore = join(rootPath, '.gitignore');
|
|
8
|
+
const npmIgnore = join(rootPath, '.npmignore');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Workaround for [Rename `.gitignore` to `.npmignore` in package if no
|
|
12
|
+
* `.npmignore` found](https://github.com/npm/npm/issues/1862) and ['npm pack'/
|
|
13
|
+
* `publish` option to not rename or keep a copy of `.gitignore` files](
|
|
14
|
+
* https://github.com/npm/npm/issues/7252) issues. With npm v9 or newer, the
|
|
15
|
+
* `npm pack` includes the `.gitignore` in the tarball and `npm install` renames
|
|
16
|
+
* the file to `.npmignore`. This script simply reverts that rename if it has
|
|
17
|
+
* occurred.
|
|
18
|
+
*/
|
|
19
|
+
function postinstall() {
|
|
20
|
+
if (fs.existsSync(npmIgnore) && !fs.existsSync(gitIgnore)) {
|
|
21
|
+
fs.renameSync(npmIgnore, gitIgnore);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (
|
|
26
|
+
import.meta.url.startsWith('file:') &&
|
|
27
|
+
fileURLToPath(import.meta.url) === argv.at(1)
|
|
28
|
+
) {
|
|
29
|
+
postinstall();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {gitIgnore, npmIgnore, postinstall};
|