8000 chore: set up repo dev tools (prettier, commitlint, husky, ...) · hackpirodev/nativescript-vue@fda7405 · GitHub
[go: up one dir, main page]

Skip to content

Commit fda7405

Browse files
heywhyrigor789
authored andcommitted
chore: set up repo dev tools (prettier, commitlint, husky, ...)
1 parent f171c05 commit fda7405

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4629
-12223
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

.husky/commit-msg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
echo "\n---- Commit Lint ----\n";
5+
npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
echo "\n---- Lint Staged ----\n";
5+
npx --no-install lint-staged --config=package.json

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
demo/hooks
2+
demo/platforms
3+
demo/App_Resources
4+
dist/

.vscode/settings.json

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
{
2-
"files.exclude": {
3-
"**/.git": true,
4-
"**/.svn": true,
5-
"**/.hg": true,
6-
"**/CVS": true,
7-
"**/.DS_Store": true,
8-
"**/Thumbs.db": true,
9-
"**/*.js": {
10-
"when": "$(basename).ts"
11-
},
12-
"**/*.map": true,
13-
"**/.idea": false,
14-
"**/.tscache": true,
15-
"**/node_modules": false
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.svn": true,
5+
"**/.hg": true,
6+
"**/CVS": true,
7+
"**/.DS_Store": true,
8+
"**/Thumbs.db": true,
9+
"**/*.js": {
10+
"when": "$(basename).ts"
1611
},
12+
"**/*.map": true,
13+
"**/.idea": false,
14+
"**/.tscache": true,
15+
"**/node_modules": false
16+
},
1717

18-
"html.customData": [
19-
"./test.json"
20-
]
21-
}
18+
"html.customData": ["./test.json"]
19+
}

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
<h1 align="center">NativeScript-Vue3 Beta</h1>
66

7-
87
<p align="center">
98
<a href="https://www.npmjs.com/package/nativescript-vue">
109
<img src="https://img.shields.io/npm/v/nativescript-vue/beta.svg" alt="npm">
@@ -14,7 +13,6 @@
1413
</a>
1514
</p>
1615

17-
1816
NativeScript-Vue with Vue3 support now in beta!
1917

2018
## Quick start
@@ -38,7 +36,6 @@ If you encounter any issues, please open a new issue with as much detail as poss
3836

3937
- [Join Discord](https://nativescript.org/discord)
4038

41-
4239
## Looking for V2?
4340

4441
The V2 version has been moved to the [v2 branch](https://github.com/nativescript-vue/nativescript-vue/tree/v2)

build.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import path from "path";
2-
import { fileURLToPath } from "url";
3-
import { build } from "esbuild";
1+
import path from 'path';
2+
import { fileURLToPath } from 'url';
3+
import { build } from 'esbuild';
44

55
const __filename = fileURLToPath(import.meta.url);
66
const __dirname = path.dirname(__filename);
@@ -9,17 +9,17 @@ try {
99
await build({
1010
bundle: true,
1111
sourcemap: true,
12-
format: "cjs",
12+
format: 'cjs',
1313
// target: "node",
14-
external: ["@nativescript/core"],
15-
entryPoints: [path.join(__dirname, "src", "index.ts")],
16-
outdir: path.join(__dirname, "dist"),
14+
external: ['@nativescript/core'],
15+
entryPoints: [path.join(__dirname, 'src', 'index.ts')],
16+
outdir: path.join(__dirname, 'dist'),
1717
// outExtension: { ".js": ".mjs" },
1818
define: {
1919
__VUE_OPTIONS_API__: true,
20-
__VUE_PROD_DEVTOOLS__: true
21-
}
20+
__VUE_PROD_DEVTOOLS__: true,
21+
},
2222
});
2323
} catch {
2424
process.exitCode = 1;
25-
}
25+
}

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

demo/App_Resources/iOS/Podfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1+
platform :ios, '13.0'
2+
13
pod 'FPSCounter', '~> 4.1'
4+
5+
post_install do |installer|
6+
installer.pods_project.targets.each do |target|
7+
target.build_configurations.each do |config|
8+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
9+
end
10+
end
11+
end

demo/App_Resources/iOS/build.xcconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// You can add custom settings here
22
// for example you can uncomment the following line to force distribution code signing
3-
// CODE_SIGN_IDENTITY = iPhone Distribution
3+
// CODE_SIGN_IDENTITY = iPhone Distribution
44
// To build for device with XCode you need to specify your development team.
55
// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
66
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
77

88
DEVELOPMENT_TEAM = 3462C7DLZZ
9+
10+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;

demo/app/app.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import { createApp } from "vue";
1+
import { createApp } from 'nativescript-vue';
22

3-
// @ts-ignore
4-
global.window = global;
5-
// import Home from './components/Home.vue'
6-
7-
import App from "./components/demo_ListView.vue";
3+
import App from './components/demo_ListView.vue';
84

95
createApp(App)
106
.use(() => {
11-
console.log("test1");
7+
console.log('test1');
128
})
139
.start();

demo/app/components/Bench.vue

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
show: false,
77
iter: 0,
88
9-
times: [],
9+
times: [] as number[],
1010
};
1111
},
1212
methods: {
@@ -24,11 +24,11 @@ export default {
2424
2525
10000 if (this.iter < 5) {
2626
setTimeout(() => {
27-
console.log("hide now");
27+
console.log('hide now');
2828
this.show = false;
2929
3030
setTimeout(() => {
31-
console.log("and. start.");
31+
console.log('and. start.');
3232
this.start();
3333
}, 5000);
3434
}, 2000);
@@ -62,12 +62,8 @@ export default {
6262
/>
6363

6464
<template v-if="show">
65-
<Label
66-
v-for="i in 2000"
67-
:key="this.iter + 'item' + i"
68-
text="Hello World"
69-
/>
70-
<Label @loaded="end" :key="this.iter + 'end'" text="End" />
65+
<Label v-for="i in 2000" :key="iter + 'item' + i" text="Hello World" />
66+
<Label @loaded="end" :key="iter + 'end'" text="End" />
7167
</template>
7268
</GridLayout>
7369
</Page>

demo/app/components/GH1010.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
<!-- https://github.com/nativescript-vue/nativescript-vue/issues/1010 -->
22
<script lang="ts" setup>
3-
import { ref } from "vue";
3+
import { EventData } from '@nativescript/core';
4+
import { ref } from 'nativescript-vue';
45
56
const tapCount = ref(0);
67
78
function onTap() {
89
tapCount.value++;
9-
console.trace("Tapped!", tapCount.value);
10+
console.trace('Tapped!', tapCount.value);
1011
}
1112
12-
function onLoaded(args) {
13-
console.log("STACK LOADED")
13+
function onLoaded(_args: EventData) {
14+
console.log('STACK LOADED');
1415
}
1516
</script>
1617

1718
<template>
1819
<StackLayout @loaded="onLoaded" @LOADED="onLoaded" @lOaD="onLoaded">
1920
<Label>Tap count: {{ tapCount }}</Label>
20-
<Button @tap="(tapCount = 0)">Reset</Button>
21+
<Button @tap="tapCount = 0">Reset</Button>
2122

2223
<!-- correct: fires only once -->
2324
<Button @tap="onTap">Tap: Button</Button>
@@ -26,4 +27,3 @@ function onLoaded(args) {
2627
<Label @tap="onTap">Tap: Label</Label>
2728
</StackLayout>
2829
</template>
29-

demo/app/components/GH1010.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
appId: org.nativescript.demo
22
---
33
- launchApp
4-
- assertVisible: "Tap Count: 0"
5-
- tapOn: "Tap: Button"
6-
- assertVisible: "Tap Count: 1"
7-
- tapOn: "Tap: Label"
8-
- assertVisible: "Tap Count: 2"
4+
- assertVisible: 'Tap Count: 0'
5+
- tapOn: 'Tap: Button'
6+
- assertVisible: 'Tap Count: 1'
7+
- tapOn: 'Tap: Label'
8+
- assertVisible: 'Tap Count: 2'

demo/app/components/GH1011.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
text="Test text"
55
class="text-2xl m-6"
66
backgroundColor="yellow"
7-
style="background-color: red;"
7+
style="background-color: red"
88
></Label>
99
</template>

demo/app/components/GH1012.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<script lang="ts" setup>
2-
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
2+
import type { Button, EventData } from '@nativescript/core';
3+
import { Color } from '@nativescript/core';
34
4-
async function animateIn(args) {
5-
console.log("ANIMATE")
5+
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
6+
7+
async function animateIn(args: EventData) {
8+
console.log('ANIMATE');
69
await wait(1);
7-
const view = args.object;
8-
view.color = "green";
10+
const view = args.object as Button;
11+
view.color = new Color('green');
912
view.scaleX = 0;
1013
view.scaleY = 0;
1114
@@ -19,7 +22,7 @@ async function animateIn(args) {
1922
duration: 3000,
2023
})
2124
.then(() => {
22-
view.color = "red";
25+
view.color = new Color('red');
2326
})
2427
.catch((err) => console.log(err));
2528
}

demo/app/components/Home.vue

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<script setup lang="ts">
2-
import Test from "./Test.vue";
3-
import { goHome } from "~/composables/goHome";
4-
import { onUnmounted } from "vue";
5-
import { ListItem } from "../../../src";
2+
import Test from './Test.vue';
3+
import { goHome } from '~/composables/goHome';
4+
import { onUnmounted } from 'nativescript-vue';
5+
import { ListItem } from 'nativescript-vue';
66
7-
defineProps<{
8-
depth?: number;
9-
}>();
7+
defineProps({
8+
depth: {
9+
type: Number,
10+
default: 0,
11+
},
12+
});
1013
11-
const message = "Hello World!";
14+
const message = 'Hello World!';
1215
1316
interface Test {
1417
name: string;
@@ -25,11 +28,11 @@ const items: Test[] = Array(1000)
2528
}));
2629
2730
function selector(item: ListItem<Test>) {
28-
return item.even ? "default" : "odd";
31+
return item.even ? 'default' : 'odd';
2932
}
3033
3134
onUnmounted(() => {
32-
console.log("UNMOUNTED HOME");
35+
console.log('UNMOUNTED HOME');
3336
});
3437
</script>
3538

demo/app/components/Test.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<template>
2-
<Label>Hello I'm a label...</Label>
2+
<Label>Hello I'm a label...</Label>
33
</template>

0 commit comments

Comments
 (0)
0