Skip to content

Commit c6e8448

Browse files
committed
refactor(plugin): ✨ update npmignore handling and add template
1 parent 9de53c2 commit c6e8448

File tree

4 files changed

+36
-20
lines changed

4 files changed

+36
-20
lines changed
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
/src/*
2-
!/src/app
3-
!/src/app/**
4-
!/src/app_admin
5-
!/src/app_admin/**
6-
!/src/locales
7-
!/src/locales/**
8-
9-
/node_modules
10-
/.turbo
11-
/tsconfig.json
12-
/.swcrc
13-
/components.json
14-
/global.d.ts
15-
/tsup.config.ts
16-
/vitest.config.ts
17-
/tsconfig.json
18-
/scripts
19-
/config
1+
This file intentionally left here for reference; actual ignore rules live in npmignore.template and will be renamed by the CLI.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/src/*
2+
!/src/app
3+
!/src/app/**
4+
!/src/app_admin
5+
!/src/app_admin/**
6+
!/src/locales
7+
!/src/locales/**
8+
9+
/node_modules
10+
/.turbo
11+
/tsconfig.json
12+
/.swcrc
13+
/components.json
14+
/global.d.ts
15+
/tsup.config.ts
16+
/vitest.config.ts
17+
/tsconfig.json
18+
/scripts
19+
/config

packages/create-vitnode-app/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
"bin": {
1515
"create-vitnode-app": "dist/src/index.js"
1616
},
17+
"files": [
18+
"dist",
19+
"copy-of-vitnode-app",
20+
"copy-of-vitnode-plugin",
21+
"README.md",
22+
"eslint",
23+
"eslint-react"
24+
],
1725
"scripts": {
1826
"build:scripts": "tsc && node dist/src/prepare/prepare.js",
1927
"start:scripts": "node dist/src/index.js",

packages/create-vitnode-app/src/plugin/create/create-plugin-vitnode.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { existsSync } from "fs";
2-
import { cp, mkdir } from "fs/promises";
2+
import { cp, mkdir, rename } from "fs/promises";
33
import ora from "ora";
44
import { dirname, join } from "path";
55
import color from "picocolors";
@@ -56,6 +56,13 @@ export const createPluginVitNode = async ({
5656
spinner.text = "Preparing the plugin structure...";
5757
await cp(templatePath, pluginPath, { recursive: true });
5858

59+
// Rename template npmignore to .npmignore in the generated plugin
60+
const npmIgnoreTemplatePath = join(pluginPath, "npmignore.template");
61+
const dotNpmIgnorePath = join(pluginPath, ".npmignore");
62+
if (existsSync(npmIgnoreTemplatePath)) {
63+
await rename(npmIgnoreTemplatePath, dotNpmIgnorePath);
64+
}
65+
5966
spinner.text = "Creating package.json...";
6067
await createPluginPackageJSON({
6168
pluginName,

0 commit comments

Comments
 (0)