-
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.
- Loading branch information
Showing
155 changed files
with
13,794 additions
and
1,216 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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,42 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": ["**/*"], | ||
"plugins": ["@nx"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"extends": ["plugin:@nx/typescript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"extends": ["plugin:@nx/javascript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], | ||
"env": { | ||
"jest": true | ||
}, | ||
"rules": {} | ||
} | ||
] | ||
} |
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,39 @@ | ||
{ | ||
"ignorePatterns": ["**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], | ||
"env": { | ||
"jest": true | ||
}, | ||
"rules": {} | ||
} | ||
], | ||
"extends": ["./.eslintrc.base.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,4 @@ | ||
# Add files here to ignore them from prettier formatting | ||
/dist | ||
/coverage | ||
/.nx/cache |
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 @@ | ||
{ | ||
"singleQuote": true | ||
} |
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 @@ | ||
# path to a directory with all packages | ||
storage: ../tmp/local-registry/storage | ||
|
||
# a list of other known repositories we can talk to | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
maxage: 60m | ||
|
||
packages: | ||
'**': | ||
# give all users (including non-authenticated users) full access | ||
# because it is a local registry | ||
access: $all | ||
publish: $all | ||
unpublish: $all | ||
|
||
# if package is not available locally, proxy requests to npm registry | ||
proxy: npmjs | ||
|
||
# log settings | ||
logs: | ||
type: stdout | ||
format: pretty | ||
level: warn | ||
|
||
publish: | ||
allow_offline: true # set offline to true to allow publish offline |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
|
||
"nrwl.angular-console", | ||
"esbenp.prettier-vscode" | ||
"esbenp.prettier-vscode", | ||
"firsttris.vscode-jest-runner" | ||
] | ||
} |
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,5 @@ | ||
import { getJestProjectsAsync } from '@nx/jest'; | ||
|
||
export default async () => ({ | ||
projects: await getJestProjectsAsync(), | ||
}); |
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 @@ | ||
const nxPreset = require('@nx/jest/preset').default; | ||
|
||
module.exports = { ...nxPreset }; |
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,25 @@ | ||
{ | ||
"extends": ["../../.eslintrc.base.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nx/dependency-checks": "error" | ||
} | ||
} | ||
] | ||
} |
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 @@ | ||
# ngx-schematics-buddy | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Building | ||
|
||
Run `nx build ngx-schematics-buddy` to build the library. | ||
|
||
## Running unit tests | ||
|
||
Run `nx test ngx-schematics-buddy` to execute the unit tests via [Jest](https://jestjs.io). |
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 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'ngx-schematics-buddy', | ||
preset: '../../jest.preset.js', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }], | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/libs/ngx-schematics-buddy', | ||
}; |
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,22 @@ | ||
{ | ||
"name": "ngx-schematics-buddy", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"@angular/cli": "^17.3.6", | ||
"@angular/compiler": "^17.3.6", | ||
"@angular-devkit/core": "^17.3.6", | ||
"@angular-devkit/schematics": "^17.3.6", | ||
"@angular-eslint/bundled-angular-compiler": "^17.3.0", | ||
"@phenomnomnominal/tsquery": "^6.1.3", | ||
"ng-morph": "^4.1.2", | ||
"shelljs": "^0.8.5", | ||
"typescript": "^5.4.5", | ||
"tslib": "^2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/shelljs": "^0.8.15" | ||
}, | ||
"type": "commonjs", | ||
"main": "./src/index.js", | ||
"typings": "./src/index.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,32 @@ | ||
{ | ||
"name": "ngx-schematics-buddy", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/ngx-schematics-buddy/src", | ||
"projectType": "library", | ||
"release": { | ||
"version": { | ||
"generatorOptions": { | ||
"packageRoot": "dist/{projectRoot}", | ||
"currentVersionResolver": "git-tag" | ||
} | ||
} | ||
}, | ||
"tags": [], | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/js:tsc", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/libs/ngx-schematics-buddy", | ||
"main": "libs/ngx-schematics-buddy/src/index.ts", | ||
"tsConfig": "libs/ngx-schematics-buddy/tsconfig.lib.json", | ||
"assets": ["libs/ngx-schematics-buddy/*.md"] | ||
} | ||
}, | ||
"nx-release-publish": { | ||
"options": { | ||
"packageRoot": "dist/{projectRoot}" | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
export * from './lib/ngx-schematics-buddy'; |
67 changes: 67 additions & 0 deletions
67
libs/ngx-schematics-buddy/src/lib/migration-api-test/schematic-test-helper.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,67 @@ | ||
import { getSystemPath, normalize, virtualFs } from '@angular-devkit/core'; | ||
import { TempScopedNodeJsSyncHost } from '@angular-devkit/core/node/testing'; | ||
import { HostTree } from '@angular-devkit/schematics'; | ||
import { | ||
SchematicTestRunner, | ||
UnitTestTree, | ||
} from '@angular-devkit/schematics/testing'; | ||
import * as shell from 'shelljs'; | ||
|
||
export class SchematicTestHelper { | ||
runner!: SchematicTestRunner; | ||
host!: TempScopedNodeJsSyncHost; | ||
tree!: UnitTestTree; | ||
|
||
tmpDirPath!: string; | ||
previousWorkingDir!: string; | ||
|
||
constructor( | ||
readonly migrationCollectionPath = require.resolve( | ||
'./test-migrations/migration-api-test-collection.json' | ||
) | ||
) { | ||
// TODO refactor | ||
// @ts-ignore | ||
beforeEach(() => { | ||
this.beforeEach(); | ||
}); | ||
|
||
// TODO refactor | ||
// @ts-ignore | ||
afterEach(() => { | ||
this.afterEach(); | ||
}); | ||
} | ||
|
||
beforeEach() { | ||
this.runner = new SchematicTestRunner( | ||
'testCollection', | ||
this.migrationCollectionPath | ||
); | ||
this.host = new TempScopedNodeJsSyncHost(); | ||
this.tree = new UnitTestTree(new HostTree(this.host)); | ||
|
||
this.previousWorkingDir = shell.pwd(); | ||
this.tmpDirPath = getSystemPath(this.host.root); | ||
|
||
// Switch into the temporary directory path. This allows us to run | ||
// the schematic against our custom unit test tree. | ||
shell.cd(this.tmpDirPath); | ||
} | ||
|
||
afterEach() { | ||
shell.cd(this.previousWorkingDir); | ||
shell.rm('-r', this.tmpDirPath); | ||
} | ||
|
||
writeFile(filePath: string, contents: string) { | ||
this.host.sync.write( | ||
normalize(filePath), | ||
virtualFs.stringToFileBuffer(contents) | ||
); | ||
} | ||
|
||
async runMigration(schematicName: string) { | ||
return this.runner.runSchematic(schematicName, {}, this.tree); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...hematics-buddy/src/lib/migration-api-test/test-migrations/add-attribute-test-migration.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,19 @@ | ||
import { Rule } from '@angular-devkit/schematics'; | ||
import { AddAttributeAction } from '../../migrations-api/actions/add-attribute-action'; | ||
import { getRules } from '../../migrations-api/get-rules'; | ||
import { isNamed } from '../../migrations-api/template-action-condition'; | ||
|
||
export default function (): Rule { | ||
return getRules([ | ||
new AddAttributeAction({ | ||
attribute: 'class', | ||
value: 'row', | ||
conditions: [isNamed('div')], | ||
}), | ||
new AddAttributeAction({ | ||
attribute: '[value]', | ||
value: `'aString'`, | ||
conditions: [isNamed('input')], | ||
}), | ||
]); | ||
} |
13 changes: 13 additions & 0 deletions
13
...x-schematics-buddy/src/lib/migration-api-test/test-migrations/add-class-test-migration.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,13 @@ | ||
import { Rule } from '@angular-devkit/schematics'; | ||
import { AddClassAction } from '../../migrations-api/actions/add-class-action'; | ||
import { getRules } from '../../migrations-api/get-rules'; | ||
import { isNamed } from '../../migrations-api/template-action-condition'; | ||
|
||
export default function (): Rule { | ||
return getRules([ | ||
new AddClassAction({ | ||
className: 'foo', | ||
conditions: [isNamed('div')], | ||
}), | ||
]); | ||
} |
12 changes: 12 additions & 0 deletions
12
...matics-buddy/src/lib/migration-api-test/test-migrations/add-closing-tag-test-migration.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,12 @@ | ||
import { Rule } from '@angular-devkit/schematics'; | ||
import { AddClosingTagAction } from '../../migrations-api/actions/add-closing-tag-action'; | ||
import { getRules } from '../../migrations-api/get-rules'; | ||
import { isNamed } from '../../migrations-api/template-action-condition'; | ||
|
||
export default function (): Rule { | ||
return getRules([ | ||
new AddClosingTagAction({ | ||
conditions: [isNamed('lib-text-input')], | ||
}), | ||
]); | ||
} |
17 changes: 17 additions & 0 deletions
17
...-buddy/src/lib/migration-api-test/test-migrations/add-migration-comment-test-migration.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,17 @@ | ||
import { Rule } from '@angular-devkit/schematics'; | ||
import { AddMigrationCommentAction } from '../../migrations-api/actions/add-migration-comment-action'; | ||
import { getRules } from '../../migrations-api/get-rules'; | ||
import { isNamed, or } from '../../migrations-api/template-action-condition'; | ||
|
||
export const migrationCommentText = | ||
'This is some text that should describe parts where e.g. a full migration is not possible'; | ||
|
||
export default function (): Rule { | ||
return getRules([ | ||
new AddMigrationCommentAction({ | ||
migrationCommentVersion: 6, | ||
migrationCommentText, | ||
conditions: [or(isNamed('lib-dropdown'), isNamed('lib-text-input'))], | ||
}), | ||
]); | ||
} |
14 changes: 14 additions & 0 deletions
14
...-buddy/src/lib/migration-api-test/test-migrations/add-pipe-to-attribute-test-migration.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,14 @@ | ||
import { Rule } from '@angular-devkit/schematics'; | ||
import { AddPipeToAttributeAction } from '../../migrations-api/actions/add-pipe-to-attribute-action'; | ||
import { getRules } from '../../migrations-api/get-rules'; | ||
import { isNamed } from '../../migrations-api/template-action-condition'; | ||
|
||
export default function (): Rule { | ||
return getRules([ | ||
new AddPipeToAttributeAction({ | ||
attributeName: 'dataKey', | ||
pipeName: 'resolveFieldFn', | ||
conditions: [isNamed('lib-table')], | ||
}), | ||
]); | ||
} |
Oops, something went wrong.