-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from lucienbertin/schematics
dip - basic shematics integrated to this repo
- Loading branch information
Showing
14 changed files
with
202 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/*.js | ||
**/*.js.map | ||
**/*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Getting Started With Schematics | ||
|
||
This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM. | ||
|
||
### Testing | ||
|
||
To test locally, install `@angular-devkit/schematics-cli` globally and use the `schematics` command line tool. That tool acts the same as the `generate` command of the Angular CLI, but also has a debug mode. | ||
|
||
Check the documentation with | ||
```bash | ||
schematics --help | ||
``` | ||
|
||
### Unit Testing | ||
|
||
`npm run test` will run the unit tests, using Jasmine as a runner and test framework. | ||
|
||
### Publishing | ||
|
||
To publish, simply do: | ||
|
||
```bash | ||
npm run build | ||
npm publish | ||
``` | ||
|
||
That's it! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", | ||
"schematics": { | ||
"index": { | ||
"description": "Generate an index.ts file", | ||
"factory": "./index", | ||
"schema": "./index/schema.json" | ||
}, | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { strings } from '@angular-devkit/core'; | ||
import { | ||
Rule, | ||
SchematicContext, | ||
Tree, | ||
apply, | ||
url, | ||
template, | ||
move, | ||
chain, | ||
branchAndMerge, | ||
mergeWith } from '@angular-devkit/schematics'; | ||
import { getWorkspace } from '@schematics/angular/utility/config'; | ||
import { parseName } from '@schematics/angular/utility/parse-name'; | ||
import { IIndexOptions } from './schema'; | ||
|
||
export default function example(options: IIndexOptions): Rule { | ||
return (tree: Tree, _context: SchematicContext) => { | ||
const workspace = getWorkspace(tree); | ||
if (!options.project) { | ||
options.project = Object.keys(workspace.projects)[0]; | ||
} | ||
const project = workspace.projects[options.project]; | ||
|
||
if (options.path === undefined) { | ||
const projectDirName = project.projectType === 'application' ? 'app' : 'lib'; | ||
options.path = `/${project.root}/src/${projectDirName}`; | ||
} | ||
|
||
|
||
const parsedPath = parseName(options.path, options.name); | ||
options.name = parsedPath.name; | ||
options.path = `${parsedPath.path}/${parsedPath.name}`; | ||
|
||
const templateSource = apply(url('./files'), [ | ||
template({ | ||
...strings, | ||
...options | ||
}), | ||
move(options.path) | ||
]); | ||
const rule = chain([ | ||
branchAndMerge(chain([ | ||
mergeWith(templateSource), | ||
])) | ||
]); | ||
return rule(tree, _context); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"$schema": "http://json-schema.org/schema", | ||
"id": "SchemanticsForIndex", | ||
"title": "Index Schema", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"$default": { | ||
"$source": "argv", | ||
"index": 0 | ||
} | ||
}, | ||
"path": { | ||
"type": "string", | ||
"format": "path", | ||
"description": "The path to create the index file.", | ||
"visible": false | ||
}, | ||
"project": { | ||
"type": "string", | ||
"description": "The name of the project.", | ||
"$default": { | ||
"$source": "projectName" | ||
} | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { IOptions } from '../schema'; | ||
|
||
export interface IIndexOptions extends IOptions {} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "@meteo/schematics", | ||
"version": "0.0.0", | ||
"description": "schematics for meteo fiable", | ||
"keywords": [ | ||
"schematics" | ||
], | ||
"author": "lucien bertin <[email protected]>", | ||
"license": "MIT", | ||
"schematics": "./collection.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface IOptions { | ||
name: string; | ||
path?: string; | ||
project?: string; | ||
module?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "tsconfig", | ||
"lib": [ | ||
"es2017", | ||
"dom" | ||
], | ||
"declaration": true, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noEmitOnError": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"rootDir": "./", | ||
"skipDefaultLibCheck": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strictNullChecks": true, | ||
"target": "es6", | ||
"types": [ | ||
"jasmine", | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"**/*" | ||
], | ||
"exclude": [ | ||
"*/files/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ | |
"dist/models" | ||
], | ||
"@meteo/store": [ | ||
"dist/store" | ||
// "dist/store" | ||
"libraries/store/src/index" | ||
] | ||
} | ||
} | ||
|