-
Notifications
You must be signed in to change notification settings - Fork 2
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 #15 from wizsolucoes/release/update-env
feat: pipeline b2c login
- Loading branch information
Showing
9 changed files
with
14,466 additions
and
245 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,74 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { | ||
chain, | ||
Rule, | ||
SchematicContext, | ||
SchematicsException, | ||
Tree, | ||
} from '@angular-devkit/schematics'; | ||
|
||
function addPipelineDefault(): Rule { | ||
return (tree: Tree, context: SchematicContext) => { | ||
|
||
// eslint-disable-next-line no-debugger | ||
debugger | ||
context.logger.info('Adicionando o pipeline default...'); | ||
const angularJson = tree.read(`angular.json`)!.toString('utf-8'); | ||
|
||
if (!angularJson) { | ||
throw new SchematicsException('No package.json file found'); | ||
} | ||
|
||
const packageJsonObject = JSON.parse(angularJson.toString()); | ||
const projects = packageJsonObject.projects; | ||
|
||
for (const project in projects) { | ||
if ( | ||
projects[project].projectType === 'application' && | ||
projects[project].architect && | ||
projects[project].architect.build && | ||
projects[project].architect.build.configurations && | ||
projects[project].architect.build.configurations.sandbox | ||
) { | ||
// script para criar o arquivo environment.b2c.ts | ||
const sandboxConfig = projects[project].architect.build.configurations.sandbox; | ||
const local = sandboxConfig['fileReplacements'][0]['with']; | ||
const localSandbox = tree.read(local)!.toString('utf-8'); | ||
tree.create(local.replace('environment.sandbox.ts', 'environment.b2c.ts'), localSandbox); | ||
// script para adicionar no angular.json | ||
projects[project].architect.build.configurations['b2c'] = { | ||
...sandboxConfig, | ||
fileReplacements: [ | ||
{ | ||
replace: sandboxConfig['fileReplacements'][0]['replace'], | ||
with: local.replace('environment.sandbox.ts', 'environment.b2c.ts' ), | ||
}, | ||
], | ||
}; | ||
} | ||
} | ||
|
||
const newAngular = { | ||
...packageJsonObject, | ||
projects: projects, | ||
}; | ||
|
||
tree.overwrite(`angular.json`, JSON.stringify(newAngular, null, 2)); | ||
return tree | ||
}; | ||
} | ||
|
||
export default function (): Rule { | ||
return () => { | ||
return chain([ | ||
addPipelineDefault() | ||
]); | ||
}; | ||
} |
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,70 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema", | ||
"$id": "env-b2c", | ||
"title": "B2C Pipe", | ||
"type": "object", | ||
"description": "Generates a new basic application definition in the \"projects\" subfolder of the workspace.", | ||
"additionalProperties": false, | ||
"properties": { | ||
"inlineStyle": { | ||
"description": "Include styles inline in the root component.ts file. Only CSS styles can be included inline. Default is false, meaning that an external styles file is created and referenced in the root component.ts file.", | ||
"type": "boolean", | ||
"alias": "s", | ||
"x-user-analytics": 9 | ||
}, | ||
"inlineTemplate": { | ||
"description": "Include template inline in the root component.ts file. Default is false, meaning that an external template file is created and referenced in the root component.ts file. ", | ||
"type": "boolean", | ||
"alias": "t", | ||
"x-user-analytics": 10 | ||
}, | ||
"viewEncapsulation": { | ||
"description": "The view encapsulation strategy to use in the new application.", | ||
"enum": ["Emulated", "None", "ShadowDom"], | ||
"type": "string", | ||
"x-user-analytics": 11 | ||
}, | ||
"style": { | ||
"description": "The file extension or preprocessor to use for style files.", | ||
"type": "string", | ||
"default": "scss", | ||
"enum": ["css", "scss", "sass", "less"] | ||
}, | ||
"skipTests": { | ||
"description": "Do not create \"spec.ts\" test files for the application.", | ||
"type": "boolean", | ||
"default": false, | ||
"alias": "S", | ||
"x-user-analytics": 12 | ||
}, | ||
"skipPackageJson": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Do not add dependencies to the \"package.json\" file." | ||
}, | ||
"minimal": { | ||
"description": "Create a bare-bones project without any testing frameworks. (Use for learning purposes only.)", | ||
"type": "boolean", | ||
"default": false, | ||
"x-user-analytics": 14 | ||
}, | ||
"skipInstall": { | ||
"description": "Skip installing dependency packages.", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"strict": { | ||
"description": "Creates an application with stricter bundle budgets settings.", | ||
"type": "boolean", | ||
"default": true, | ||
"x-user-analytics": 7 | ||
}, | ||
"routing": { | ||
"description": "Generate a routing module.", | ||
"type": "boolean", | ||
"default": true, | ||
"alias": "r", | ||
"x-user-analytics": 8 | ||
} | ||
} | ||
} |
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
Oops, something went wrong.