Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Commit 7070647

Browse files
committed
add snippets for mobile platform projects
1 parent e2769eb commit 7070647

File tree

4 files changed

+90
-2
lines changed

4 files changed

+90
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
66

77
## [Unreleased]
88

9+
## [0.2.0] - 2021-04-19
10+
### Added
11+
- Mobile platform snippets
12+
913
## [0.1.0] - 2020-05-29
1014
### Fixed
1115
- Extension Logo for VSCode marketplace :)

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "loadsmart-react-native",
33
"displayName": "Loadsmart React Native Extension Pack",
44
"description": "Set of plugins to start developing React Native applications at Loadsmart",
5-
"version": "0.1.0",
5+
"version": "0.2.0",
66
"publisher": "Loadsmart",
77
"preview": true,
88
"repository": {
@@ -16,6 +16,18 @@
1616
"categories": [
1717
"Extension Packs"
1818
],
19+
"contributes": {
20+
"snippets": [
21+
{
22+
"language": "typescriptreact",
23+
"path": "./typescriptreact.snippets.json"
24+
},
25+
{
26+
"language": "typescript",
27+
"path": "./typescript.snippets.json"
28+
}
29+
]
30+
},
1931
"extensionPack": [
2032
"christian-kohler.npm-intellisense",
2133
"esbenp.prettier-vscode",
@@ -36,4 +48,4 @@
3648
"dependencies": {
3749
"vsce": "^1.75.0"
3850
}
39-
}
51+
}

typescript.snippets.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"Mobile platform use case": {
3+
"prefix": "mpuc",
4+
"body": [
5+
"type ${TM_FILENAME/(.*?)\\..+/${1}/}Deps = {",
6+
"}",
7+
"",
8+
"export const ${TM_FILENAME/(.*?)\\..+/${1}/}Factory = (dependencies: ${TM_FILENAME/(.*?)\\..+/${1}/}Deps) => async () => {",
9+
"",
10+
"}",
11+
"",
12+
"export const ${TM_FILENAME/(.*?)\\..+/${1}/} = () => {",
13+
"}"
14+
],
15+
"description": "Boilerplate to use case"
16+
}
17+
}

typescriptreact.snippets.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"Mobile platform component test": {
3+
"prefix": "mpct",
4+
"body": [
5+
"import React from 'react'",
6+
"",
7+
"import { renderWithProviders } from '@test/renderWithProviders'",
8+
"",
9+
"import ${TM_FILENAME/(.*?)\\..+/${1}/} from './${TM_FILENAME/(.*?)\\..+/${1}/}'",
10+
"",
11+
"const defaultProps = {${1}}",
12+
"",
13+
"const setup = (props = {}) => renderWithProviders(<${TM_FILENAME/(.*?)\\..+/${1}/} {...defaultProps} {...props} />)",
14+
"",
15+
"describe('${TM_FILENAME/(.*?)\\..+/${1}/}', () => {",
16+
"\tit('should ${2: do something}', () => {",
17+
"\t\tconst {${3}} = setup()",
18+
"\t\t${4}",
19+
"\t})",
20+
"})"
21+
],
22+
"description": "Boilerplate to test React component"
23+
},
24+
"Test unit": {
25+
"prefix": "mpit",
26+
"body": [
27+
"it('should ${1:do something} ', () => {",
28+
"\tconst {${2}} = setup()",
29+
"\t${3}",
30+
"})"
31+
],
32+
"description": "Boilerplate to unit test"
33+
},
34+
"Mobile platform component": {
35+
"prefix": "mpc",
36+
"body": [
37+
"import React from 'react'",
38+
"",
39+
"import styled from 'styled-components/native'",
40+
"",
41+
"const Container = styled.View``",
42+
"",
43+
"const ${TM_FILENAME_BASE} = () => {",
44+
"\treturn (",
45+
"\t\t<Container>",
46+
"\t\t\t${1}",
47+
"\t\t</Container>",
48+
"\t)",
49+
"}",
50+
"",
51+
"export default ${TM_FILENAME_BASE}"
52+
],
53+
"description": "Boilerplate to React components"
54+
}
55+
}

0 commit comments

Comments
 (0)