@vidavidorra/create-project 2.0.4 → 2.0.6

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.
@@ -5,6 +5,7 @@ declare const schema: z.ZodObject<{
5
5
  name: z.ZodString;
6
6
  version: z.ZodString;
7
7
  description: z.ZodString;
8
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
8
9
  private: z.ZodOptional<z.ZodBoolean>;
9
10
  homepage: z.ZodString;
10
11
  bugs: z.ZodObject<{
@@ -113,6 +114,7 @@ declare const schema: z.ZodObject<{
113
114
  engines: {
114
115
  node: ">=18";
115
116
  };
117
+ keywords?: string[] | undefined;
116
118
  private?: boolean | undefined;
117
119
  exports?: string | undefined;
118
120
  bin?: Record<string, unknown> | undefined;
@@ -156,6 +158,7 @@ declare const schema: z.ZodObject<{
156
158
  engines: {
157
159
  node: ">=18";
158
160
  };
161
+ keywords?: string[] | undefined;
159
162
  private?: boolean | undefined;
160
163
  exports?: string | undefined;
161
164
  bin?: Record<string, unknown> | undefined;
@@ -205,6 +208,7 @@ declare class Package extends File {
205
208
  engines: {
206
209
  node: ">=18";
207
210
  };
211
+ keywords?: string[] | undefined;
208
212
  private?: boolean | undefined;
209
213
  exports?: string | undefined;
210
214
  bin?: Record<string, unknown> | undefined;
@@ -6,6 +6,7 @@ const schema = z
6
6
  name: z.string().min(1),
7
7
  version: z.string().min('0.0.0'.length),
8
8
  description: z.string(),
9
+ keywords: z.array(z.string()).min(1).optional(),
9
10
  private: z.boolean().optional(),
10
11
  homepage: z.string().url(),
11
12
  bugs: z
@@ -77,6 +78,7 @@ class Package extends File {
77
78
  ...this._package.devDependencies,
78
79
  ...this._package.dependencies,
79
80
  };
81
+ delete this._package.keywords;
80
82
  delete this._package.bin;
81
83
  delete this._package.dependencies;
82
84
  delete this._package.scripts.postinstall;
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@vidavidorra/create-project",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "private": false,
5
- "description": "Interactively create a GitHub project.",
5
+ "description": "Interactively create a GitHub project",
6
+ "keywords": [
7
+ "create",
8
+ "project"
9
+ ],
6
10
  "homepage": "https://github.com/vidavidorra/create-project#readme",
7
11
  "bugs": {
8
12
  "url": "https://github.com/vidavidorra/create-project/issues"
@@ -20,10 +24,11 @@
20
24
  },
21
25
  "files": [
22
26
  "./dist/**/!(*.test).{js,d.ts,cjs}",
23
- "./.github/",
24
27
  "./.editorconfig",
28
+ "./.github/",
25
29
  "./.gitignore",
26
30
  "./.npmrc",
31
+ "./src/scripts/postinstall.js",
27
32
  "./LICENSE.md",
28
33
  "./tsconfig.json"
29
34
  ],
@@ -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};