Skip to content

Commit 97e4453

Browse files
committed
feat: add default .gitignore to tns-created apps (#72)
1 parent 22031f2 commit 97e4453

File tree

4 files changed

+49
-10
lines changed

4 files changed

+49
-10
lines changed

packages/template-tab-navigation-ng/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ npm-debug.log
33

44
*.js.map
55
vendor*.ts
6-
**/*.js
6+
*.js
77
!tools/*.js
8-
**/*.css
8+
*.css
99
hooks/
1010
lib/
1111
node_modules/
@@ -14,4 +14,4 @@ tmp/
1414
typings/
1515
.idea
1616
.cloud
17-
/.project
17+
.project
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# NativeScript
2+
hooks/
3+
node_modules/
4+
platforms/
5+
6+
# NativeScript Template
7+
*.js.map
8+
*.js
9+
!webpack.config.js
10+
*.css
11+
12+
# Logs
13+
logs
14+
*.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
19+
# General
20+
.DS_Store
21+
.AppleDouble
22+
.LSOverride
23+
.idea
24+
.cloud
25+
.project
26+
tmp/
27+
typings/
28+
29+
# Visual Studio Code
30+
.vscode/*
31+
!.vscode/settings.json
32+
!.vscode/tasks.json
33+
!.vscode/launch.json
34+
!.vscode/extensions.json

packages/template-tab-navigation-ng/tools/postinstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fs = require("fs");
22
const path = require("path");
33
const exec = require("child_process").exec;
44

5-
console.log("postinstall script running...");
5+
console.log("Postinstall script running...");
66

77
getPackageJson()
88
.then((packageJsonData) => {

packages/template-tab-navigation-ng/tools/preinstall.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@ const fs = require("fs");
22
const path = require("path");
33
const exec = require("child_process").exec;
44

5-
console.log("preinstall script running...");
5+
console.log("Preinstall script running...");
66

77
const tslintConfig = "tslint.json";
8+
const srcGitignore = "dot.gitignore";
9+
const destGitignore = ".gitignore";
810

911
getAppRootFolder()
10-
.then((appRootFolder) => copyConfig(tslintConfig, appRootFolder));
12+
.then((appRootFolder) => Promise.all([
13+
copyFile(appRootFolder, tslintConfig),
14+
copyFile(appRootFolder, srcGitignore, destGitignore)
15+
]));
1116

12-
function copyConfig(configFilename, appRootFolder) {
17+
function copyFile(appRootFolder, srcFilename, destFilename = srcFilename) {
1318
return new Promise((resolve, reject) => {
14-
const sourcePath = path.join(__dirname, configFilename);
15-
const destPath = path.join(appRootFolder, configFilename);
19+
const sourcePath = path.join(__dirname, srcFilename);
20+
const destPath = path.join(appRootFolder, destFilename);
1621

17-
console.log(`creating ${path.resolve(destPath)}...`);
22+
console.log(`Creating ${path.resolve(destPath)}...`);
1823
fs.rename(sourcePath, destPath, (err) => {
1924
if (err) {
2025
return reject(err);

0 commit comments

Comments
 (0)