revine 1.0.1 → 1.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProject.d.ts","sourceRoot":"","sources":["../../src/commands/createProject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createProject.d.ts","sourceRoot":"","sources":["../../src/commands/createProject.ts"],"names":[],"mappings":"AAsDA,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,iBA6E7B"}
|
|
@@ -10,6 +10,45 @@ import { copyTemplate } from "../utils/file.js";
|
|
|
10
10
|
import { logError, logInfo } from "../utils/logger.js";
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = path.dirname(__filename);
|
|
13
|
+
const GITIGNORE_CONTENT = `# Dependencies
|
|
14
|
+
node_modules/
|
|
15
|
+
dist/
|
|
16
|
+
dist-ssr/
|
|
17
|
+
|
|
18
|
+
# Vite cache
|
|
19
|
+
.vite/
|
|
20
|
+
*.local
|
|
21
|
+
|
|
22
|
+
# Environment files
|
|
23
|
+
.env
|
|
24
|
+
.env.local
|
|
25
|
+
.env.development.local
|
|
26
|
+
.env.test.local
|
|
27
|
+
.env.production.local
|
|
28
|
+
|
|
29
|
+
# Logs
|
|
30
|
+
npm-debug.log*
|
|
31
|
+
yarn-debug.log*
|
|
32
|
+
yarn-error.log*
|
|
33
|
+
|
|
34
|
+
# Editor/IDE
|
|
35
|
+
.vscode/
|
|
36
|
+
.idea/
|
|
37
|
+
*.swp
|
|
38
|
+
*.swo
|
|
39
|
+
|
|
40
|
+
# OS metadata
|
|
41
|
+
.DS_Store
|
|
42
|
+
Thumbs.db
|
|
43
|
+
|
|
44
|
+
# TypeScript build info
|
|
45
|
+
*.tsbuildinfo
|
|
46
|
+
|
|
47
|
+
# Optional
|
|
48
|
+
.cache/
|
|
49
|
+
.tmp/
|
|
50
|
+
.sass-cache/
|
|
51
|
+
`;
|
|
13
52
|
export async function createProject(projectName, options) {
|
|
14
53
|
// Calculate directories. This uses "../../template" for your template folder.
|
|
15
54
|
const templateDir = path.join(__dirname, "../../template");
|
|
@@ -21,6 +60,8 @@ export async function createProject(projectName, options) {
|
|
|
21
60
|
await fs.ensureDir(projectDir);
|
|
22
61
|
// This copies everything, including hidden directories like .revine
|
|
23
62
|
await copyTemplate(templateDir, projectDir, options.force);
|
|
63
|
+
// Explicitly write .gitignore because npm strips it from published tarballs
|
|
64
|
+
await fs.writeFile(path.join(projectDir, ".gitignore"), GITIGNORE_CONTENT);
|
|
24
65
|
// Derive final project name
|
|
25
66
|
const finalProjectName = isCurrentDir
|
|
26
67
|
? path.basename(projectDir)
|
|
@@ -28,12 +69,12 @@ export async function createProject(projectName, options) {
|
|
|
28
69
|
// Check if package.json exists after template copy
|
|
29
70
|
const packageJsonPath = path.join(projectDir, "package.json");
|
|
30
71
|
// Create basic package.json if it doesn't exist
|
|
31
|
-
if (!await fs.pathExists(packageJsonPath)) {
|
|
72
|
+
if (!(await fs.pathExists(packageJsonPath))) {
|
|
32
73
|
const basicPackageJson = {
|
|
33
74
|
name: finalProjectName,
|
|
34
75
|
version: "0.1.0",
|
|
35
76
|
private: true,
|
|
36
|
-
type: "module"
|
|
77
|
+
type: "module",
|
|
37
78
|
};
|
|
38
79
|
await fs.writeJSON(packageJsonPath, basicPackageJson, { spaces: 2 });
|
|
39
80
|
}
|
|
@@ -42,7 +83,7 @@ export async function createProject(projectName, options) {
|
|
|
42
83
|
await updatePackageJson(packageJsonPath, finalProjectName, { useTailwind });
|
|
43
84
|
// Check if README exists, create it if it doesn't
|
|
44
85
|
const readmePath = path.join(projectDir, "README.md");
|
|
45
|
-
if (!await fs.pathExists(readmePath)) {
|
|
86
|
+
if (!(await fs.pathExists(readmePath))) {
|
|
46
87
|
await fs.writeFile(readmePath, `# ${finalProjectName}\n\nCreated with Revine`);
|
|
47
88
|
}
|
|
48
89
|
// Update README with the project name
|
package/package.json
CHANGED
|
@@ -12,6 +12,46 @@ import { logError, logInfo } from "../utils/logger.js";
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
|
|
15
|
+
const GITIGNORE_CONTENT = `# Dependencies
|
|
16
|
+
node_modules/
|
|
17
|
+
dist/
|
|
18
|
+
dist-ssr/
|
|
19
|
+
|
|
20
|
+
# Vite cache
|
|
21
|
+
.vite/
|
|
22
|
+
*.local
|
|
23
|
+
|
|
24
|
+
# Environment files
|
|
25
|
+
.env
|
|
26
|
+
.env.local
|
|
27
|
+
.env.development.local
|
|
28
|
+
.env.test.local
|
|
29
|
+
.env.production.local
|
|
30
|
+
|
|
31
|
+
# Logs
|
|
32
|
+
npm-debug.log*
|
|
33
|
+
yarn-debug.log*
|
|
34
|
+
yarn-error.log*
|
|
35
|
+
|
|
36
|
+
# Editor/IDE
|
|
37
|
+
.vscode/
|
|
38
|
+
.idea/
|
|
39
|
+
*.swp
|
|
40
|
+
*.swo
|
|
41
|
+
|
|
42
|
+
# OS metadata
|
|
43
|
+
.DS_Store
|
|
44
|
+
Thumbs.db
|
|
45
|
+
|
|
46
|
+
# TypeScript build info
|
|
47
|
+
*.tsbuildinfo
|
|
48
|
+
|
|
49
|
+
# Optional
|
|
50
|
+
.cache/
|
|
51
|
+
.tmp/
|
|
52
|
+
.sass-cache/
|
|
53
|
+
`;
|
|
54
|
+
|
|
15
55
|
export async function createProject(
|
|
16
56
|
projectName: string,
|
|
17
57
|
options: { force?: boolean }
|
|
@@ -23,13 +63,16 @@ export async function createProject(
|
|
|
23
63
|
|
|
24
64
|
try {
|
|
25
65
|
logInfo(`Creating project in ${projectDir}...`);
|
|
26
|
-
|
|
66
|
+
|
|
27
67
|
// Ensure the project directory exists
|
|
28
68
|
await fs.ensureDir(projectDir);
|
|
29
|
-
|
|
69
|
+
|
|
30
70
|
// This copies everything, including hidden directories like .revine
|
|
31
71
|
await copyTemplate(templateDir, projectDir, options.force);
|
|
32
72
|
|
|
73
|
+
// Explicitly write .gitignore because npm strips it from published tarballs
|
|
74
|
+
await fs.writeFile(path.join(projectDir, ".gitignore"), GITIGNORE_CONTENT);
|
|
75
|
+
|
|
33
76
|
// Derive final project name
|
|
34
77
|
const finalProjectName = isCurrentDir
|
|
35
78
|
? path.basename(projectDir)
|
|
@@ -37,28 +80,31 @@ export async function createProject(
|
|
|
37
80
|
|
|
38
81
|
// Check if package.json exists after template copy
|
|
39
82
|
const packageJsonPath = path.join(projectDir, "package.json");
|
|
40
|
-
|
|
83
|
+
|
|
41
84
|
// Create basic package.json if it doesn't exist
|
|
42
|
-
if (!await fs.pathExists(packageJsonPath)) {
|
|
85
|
+
if (!(await fs.pathExists(packageJsonPath))) {
|
|
43
86
|
const basicPackageJson = {
|
|
44
87
|
name: finalProjectName,
|
|
45
88
|
version: "0.1.0",
|
|
46
89
|
private: true,
|
|
47
|
-
type: "module"
|
|
90
|
+
type: "module",
|
|
48
91
|
};
|
|
49
92
|
await fs.writeJSON(packageJsonPath, basicPackageJson, { spaces: 2 });
|
|
50
93
|
}
|
|
51
|
-
|
|
94
|
+
|
|
52
95
|
// Update package.json with the correct details
|
|
53
96
|
const useTailwind = await askForTailwindSetup();
|
|
54
97
|
await updatePackageJson(packageJsonPath, finalProjectName, { useTailwind });
|
|
55
98
|
|
|
56
99
|
// Check if README exists, create it if it doesn't
|
|
57
100
|
const readmePath = path.join(projectDir, "README.md");
|
|
58
|
-
if (!await fs.pathExists(readmePath)) {
|
|
59
|
-
await fs.writeFile(
|
|
101
|
+
if (!(await fs.pathExists(readmePath))) {
|
|
102
|
+
await fs.writeFile(
|
|
103
|
+
readmePath,
|
|
104
|
+
`# ${finalProjectName}\n\nCreated with Revine`
|
|
105
|
+
);
|
|
60
106
|
}
|
|
61
|
-
|
|
107
|
+
|
|
62
108
|
// Update README with the project name
|
|
63
109
|
await updateReadme(readmePath, finalProjectName);
|
|
64
110
|
|