Skip to content

Commit e749109

Browse files
Merge pull request #104 from ngx-builders/feat-add-project-option
Feat add project option
2 parents 9f03164 + c0e040f commit e749109

File tree

5 files changed

+46
-27
lines changed

5 files changed

+46
-27
lines changed

.github/workflows/nodejs.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
working-directory: ./src
19+
strategy:
20+
matrix:
21+
node-version: [12.x]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Use Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
- run: npm install
30+
- run: npm run build
31+
env:
32+
CI: true

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v8.3.0 or greater.
99

1010
### Steps:
11-
1. run ```ng add @netlify-builder/deploy``` to add necessary dependencies. Once, it get installed,you will be prompted to enter (a) Site Id and (b) Netlify Token
11+
1. run `ng add @netlify-builder/deploy`
12+
OR `ng add @netlify-builder/deploy --project={projectName}` to add necessary dependencies. Once, it get installed,you will be prompted to enter (a) Site Id and (b) Netlify Token
1213
![Screenshot](screenshots/step-1.png)
1314
2. run ```ng deploy``` assuming that you have [Angular CLI](https://github.com/angular/angular-cli) installed globally
1415

src/ng-add/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { addPackageJsonDependency, NodeDependency, NodeDependencyType } from 'sc
44

55
function addPackageJsonDependencies(): Rule {
66
return (host: Tree, context: SchematicContext) => {
7-
7+
88
// always add the package under dev dependencies
99
const dependencies: NodeDependency[] = [
1010
{ type: NodeDependencyType.Dev, version: '~3.1.0', name: '@netlify-builder/deploy' }
1111
];
12-
12+
1313
dependencies.forEach(dependency => {
1414
addPackageJsonDependency(host, dependency);
1515
context.logger.log('info', `✅️ Added "${dependency.name}" into ${dependency.type}`);
@@ -22,7 +22,7 @@ function addPackageJsonDependencies(): Rule {
2222
function getWorkspace(host: Tree): { path: string; workspace: experimental.workspace.WorkspaceSchema } {
2323
const possibleFiles = ['/angular.json', './angular.json'];
2424
const path = possibleFiles.find(path => host.exists(path));
25-
const configBuffer = host.read(path);
25+
const configBuffer = path ? host.read(path) : undefined;
2626

2727
if (!path || !configBuffer) {
2828
throw new SchematicsException(`Could not find angular.json`);

src/ng-add/schema.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
"title": "Netlify Builder ng-add schematic",
55
"type": "object",
66
"properties": {
7+
"project": {
8+
"type": "string",
9+
"description": "The name of the project.",
10+
"$default": {
11+
"$source": "projectName"
12+
}
13+
},
714
"siteID": {
815
"type": "string",
916
"description": "You can find the Site ID on Netlify Settings/General",
@@ -15,7 +22,5 @@
1522
"x-prompt": "Personal Access Tokens of Netlify Account (required)"
1623
}
1724
},
18-
"required": [
19-
"netlifyToken"
20-
]
21-
}
25+
"required": ["netlifyToken"]
26+
}

0 commit comments

Comments
 (0)