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
function myCustomRule(options: any): Rule { | |
return (host: Tree) => { | |
return host; | |
} | |
} |
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
function waitingRule(options: any): Rule { | |
return (host: Tree) => { | |
const observer = new Observable<Tree>((observer) => { | |
fetch('someUrl.com/') // any async operation | |
.then(res => res.json()) | |
.then(data => { | |
observer.next(host); | |
observer.complete(); | |
}) | |
.catch(function (err: any) { |
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
apiVersion: v1 | |
kind: ConfigMap # it is a config map | |
data: # key value pairs | |
NODE_ENV: "production" | |
SOME_VALUE: "my config value" | |
metadata: | |
name: basic-config # name to reference |
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
env: | |
- name: NODE_ENV | |
valueFrom: | |
configMapKeyRef: | |
name: basic-config # name of the configmap | |
key: NODE_ENV # key within the configmap | |
- name: SOME_VALUE | |
valueFrom: | |
configMapKeyRef: | |
name: basic-config |
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
... | |
ports: | |
- containerPort: 80 | |
volumeMounts: | |
# volumes to mount | |
- name: secret-volume # matches secret name | |
# path for this secret to be available at | |
mountPath: "/opt/firebase" | |
readOnly: true # no editing! | |
volumes: |
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
const angularCollectionPath = require.resolve( | |
'../../node_modules/@schematics/angular/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
let appTree: UnitTestTree; | |
beforeEach(() => { | |
appTree = testRunner.runExternalSchematic( | |
'@schematics/angular', 'workspace', workspaceOptions); | |
appTree = testRunner.runExternalSchematic( | |
'@schematics/angular', 'application', appOptions, appTree); | |
}); |
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
it('fails with missing tree', () => { | |
expect(() => testRunner.runSchematic( | |
'simple-schematic', | |
{name: "test"}, | |
Tree.empty())).toThrow(); | |
}); |
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
it('fails with missing params', () => { | |
expect(() => testRunner.runSchematic( | |
'simple-schematic', | |
{}, | |
appTree)).toThrowError(InvalidInputOptions, | |
'Schematic input does not validate against the Schema: {"spec":true,"flat":false}\n'+ | |
'Errors:\n\n'+ | |
' Data path "" should have required property \'name\'.'); | |
}); |
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
expect(tree.files).toContain("/projects/bar/src/app/test/test.spec.ts"); | |
expect(tree.files).toContain("/projects/bar/src/app/test/test.ts"); |