Skip to content

Commit f8ebe9a

Browse files
committed
Added automatic gitignore
1 parent 2343f15 commit f8ebe9a

File tree

6 files changed

+68
-11
lines changed

6 files changed

+68
-11
lines changed

.changeset/eight-foxes-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'capkit': minor
3+
---
4+
5+
Added gitignore job, /ios, /android and temp files are now removed

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,4 @@ node_modules
77
.env.*
88
!.env.example
99
vite.config.js.timestamp-*
10-
vite.config.ts.timestamp-*
11-
12-
# Capacitor
13-
/android
14-
/ios
15-
capacitor.config.json.timestamp-*
16-
capacitor.config.json
10+
vite.config.ts.timestamp-*

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,25 @@ Before starting be aware that Capacitor will only work with [Adapter Static](htt
2020
To get started with the CLI you can simply go into your existing sveltekit project and run:
2121

2222
npm:
23+
2324
```bash
2425
npx capkit init
2526
```
27+
2628
pnpm:
29+
2730
```bash
2831
pnpm dlx capkit init
2932
```
33+
3034
yarn:
35+
3136
```bash
3237
yarn dlx capkit init
3338
```
39+
3440
bun:
41+
3542
```bash
3643
bunx capkit init
3744
```
@@ -47,37 +54,51 @@ Upon doing this, you will be guided through a series of questions to help you co
4754
When working with native applications and using their respective IDE's (Android Studio or Xcode) you can enable hot reloading by running:
4855

4956
npm:
57+
5058
```bash
5159
npm run dev:cap
5260
```
61+
5362
pnpm:
63+
5464
```bash
5565
pnpm dev:cap
5666
```
67+
5768
yarn:
69+
5870
```bash
5971
yarn dev:cap
6072
```
73+
6174
bun:
75+
6276
```bash
6377
bunx dev:cap
6478
```
6579

6680
If you are solely focusing on creating a progressive web app you can run:
6781

6882
npm:
83+
6984
```bash
7085
npm run dev
7186
```
87+
7288
pnpm:
89+
7390
```bash
7491
pnpm dev
7592
```
93+
7694
yarn:
95+
7796
```bash
7897
yarn dev
7998
```
99+
80100
bun:
101+
81102
```bash
82103
bunx dev
83104
```
@@ -87,40 +108,55 @@ bunx dev
87108
When building to native platforms you can use:
88109

89110
npm:
111+
90112
```bash
91113
npm run build:cap
92114
```
115+
93116
pnpm:
117+
94118
```bash
95119
pnpm build:cap
96120
```
121+
97122
yarn:
123+
98124
```bash
99125
yarn build:cap
100126
```
127+
101128
bun:
129+
102130
```bash
103131
bunx build:cap
104132
```
105133

106134
If you are solely focusing on building a progressive web app you can run:
107135

108136
npm:
137+
109138
```bash
110139
npm run build
111140
```
141+
112142
pnpm:
143+
113144
```bash
114145
pnpm build
115146
```
147+
116148
yarn:
149+
117150
```bash
118151
yarn build
119152
```
153+
120154
bun:
155+
121156
```bash
122157
bunx build
123158
```
159+
124160
---
125161

126162
## Capacitor
@@ -129,6 +165,13 @@ For further questions about Capacitor you can refer to the [Capacitor Docs](http
129165

130166
---
131167

168+
## Examples
169+
170+
Here is a example project of a SvelteKit app with Capacitor deployed to Vercel: https://capkit-vercel.vercel.app/
171+
Repository: https://github.com/Hugos68/capkit-vercel
172+
173+
---
174+
132175
## Issues
133176

134177
If you encounter any issues or have concerns, please take a moment to [report them](https://github.com/Hugos68/capkit/issues/new). Your feedback is greatly appreciated and improves the quality of CapKit.

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,19 @@ async function initializeProject({
238238
}
239239
});
240240

241+
if (existsSync(`${process.cwd()}/.gitignore`)) {
242+
jobs.push({
243+
start: `Configuring: "${kleur.cyan('.gitignore')}"`,
244+
stop: `Successfully configured: "${kleur.cyan('.gitignore')}"`,
245+
task: async () => {
246+
const gitignores = ['# Capacitor', '/android', '/ios', 'capacitor.config.json.timestamp-*'];
247+
const gitignore = await fs.readFile(`${process.cwd()}/.gitignore`, 'utf-8');
248+
const newGitignore = gitignore + '\n' + gitignores.join('\n');
249+
return fs.writeFile('.gitignore', newGitignore, 'utf-8');
250+
}
251+
});
252+
}
253+
241254
await executeJobs(jobs);
242255
}
243256

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
},
99
"scripts": {
1010
"format": "prettier . --write .",
11-
"release": "changeset publish --access public"
11+
"release": "changeset publish --access public",
12+
"dev:cap": "node ./scripts/hotreload.js && npx cap sync && node ./scripts/hotreload-cleanup.js && npm run build",
13+
"build:cap": "vite build && npx cap sync"
1214
},
1315
"repository": {
1416
"type": "git",
@@ -31,4 +33,4 @@
3133
"prettier": "^3.0.3"
3234
},
3335
"type": "module"
34-
}
36+
}

0 commit comments

Comments
 (0)