Skip to content

Commit 0a64d68

Browse files
committed
initial commit
0 parents  commit 0a64d68

26 files changed

+724
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
out
2+
node_modules

.vscode/launch.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
{
3+
"version": "0.1.0",
4+
"configurations": [
5+
{
6+
"name": "Launch Extension",
7+
"type": "extensionHost",
8+
"request": "launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
11+
"stopOnEntry": false,
12+
"sourceMaps": true,
13+
"outDir": "${workspaceRoot}/out/src",
14+
"preLaunchTask": "npm"
15+
},
16+
{
17+
"name": "Launch Tests",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
"runtimeExecutable": "${execPath}",
21+
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
22+
"stopOnEntry": false,
23+
"sourceMaps": true,
24+
"outDir": "${workspaceRoot}/out/test",
25+
"preLaunchTask": "npm"
26+
}
27+
]
28+
}

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"search.exclude": {
7+
"out": true // set this to false to include "out" folder in search results
8+
},
9+
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
10+
}

.vscode/tasks.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Available variables which can be used inside of strings.
2+
// ${workspaceRoot}: the root folder of the team
3+
// ${file}: the current opened file
4+
// ${fileBasename}: the current opened file's basename
5+
// ${fileDirname}: the current opened file's dirname
6+
// ${fileExtname}: the current opened file's extension
7+
// ${cwd}: the current working directory of the spawned process
8+
9+
// A task runner that calls a custom npm script that compiles the extension.
10+
{
11+
"version": "0.1.0",
12+
13+
// we want to run npm
14+
"command": "npm",
15+
16+
// the command is a shell script
17+
"isShellCommand": true,
18+
19+
// show the output window only if unrecognized errors occur.
20+
"showOutput": "silent",
21+
22+
// we run the custom script "compile" as defined in package.json
23+
"args": ["run", "compile", "--loglevel", "silent"],
24+
25+
// The tsc compiler is started in watching mode
26+
"isWatching": true,
27+
28+
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
29+
"problemMatcher": "$tsc-watch"
30+
}

.vscodeignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode/**
2+
.vscode-test/**
3+
out/test/**
4+
test/**
5+
src/**
6+
**/*.map
7+
.gitignore
8+
tsconfig.json
9+
vsc-extension-quickstart.md

LICENCE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Copyright (c) Microsoft Corporation
2+
3+
All rights reserved.
4+
5+
MIT License
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
8+
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
9+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
10+
is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
16+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
17+
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Angular2 Component Generation Extension for VS CODE
2+
3+
## Description
4+
Extension automatically creates folder for angular2 component containing :
5+
- `component.ts`
6+
- `module.ts`
7+
- `component.html`
8+
- `component.css`
9+
10+
## Usage
11+
12+
- Right click on on the file or folder in the explorer
13+
- Select "New Angular2 Component"
14+
- Enter component name in the pop up in camelCase
15+
16+
![Use Extension](assets/tutorial/createComponent.gif)
17+
18+
## Configuration
19+
- create true / false - (controls weather to generate this file or not)
20+
- extension - extension of generated file (e.g. you might want to change "scss" to just plain "css")
21+
- template - path to the custom template for the generated file
22+
- {selector} -> replaced with `lower case, dash separated string`
23+
- {templateUrl} -> replaced with `${selector}.component.html`
24+
- {styleUrls} -> replaced with `${selector}.component.css`
25+
- {className} -> replaced with `componentName in PascalCase`
26+
27+
Use the "template" key to override default templates for the extension
28+
29+
```json
30+
{
31+
"files": {
32+
"component": {
33+
"create": true,
34+
"extension": "ts",
35+
"template": "${workspaceRoot}/myComponent.template"
36+
},
37+
"css": {
38+
"create": true,
39+
"extension": "scss"
40+
},
41+
"html": {
42+
"create": true,
43+
"extension": "html"
44+
},
45+
"module": {
46+
"create": true,
47+
"extension": "ts"
48+
}
49+
}
50+
}
51+
```
52+
![Config Extension](assets/tutorial/customTemplate.gif)
53+
54+
## Bugs
55+
56+
Please report [here](https://github.com/dbaikov/vscode-angular2-component-generator/issues)

assets/config/config.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files": {
3+
"component": {
4+
"create": true,
5+
"extension": "ts"
6+
},
7+
"css": {
8+
"create": true,
9+
"extension": "scss"
10+
},
11+
"html": {
12+
"create": true,
13+
"extension": "html"
14+
},
15+
"module": {
16+
"create": true,
17+
"extension": "ts"
18+
}
19+
}
20+
}

assets/images/icon.png

18.1 KB
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: '{selector}',
6+
templateUrl: '{templateUrl}',
7+
styleUrls: ['{styleUrls}']
8+
})
9+
export class {className}Component {
10+
11+
}

0 commit comments

Comments
 (0)