diff --git a/packages/nx-ktlint/.eslintrc.json b/packages/nx-ktlint/.eslintrc.json new file mode 100644 index 000000000..adbe7ae2d --- /dev/null +++ b/packages/nx-ktlint/.eslintrc.json @@ -0,0 +1,25 @@ +{ + "extends": ["../../.eslintrc.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" + } + } + ] +} diff --git a/packages/nx-ktlint/README.md b/packages/nx-ktlint/README.md new file mode 100644 index 000000000..5ba7825ff --- /dev/null +++ b/packages/nx-ktlint/README.md @@ -0,0 +1,11 @@ +# nx-ktlint + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build nx-ktlint` to build the library. + +## Running unit tests + +Run `nx test nx-ktlint` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/packages/nx-ktlint/jest.config.ts b/packages/nx-ktlint/jest.config.ts new file mode 100644 index 000000000..c341c7ec0 --- /dev/null +++ b/packages/nx-ktlint/jest.config.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +export default { + displayName: 'nx-ktlint', + preset: '../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/packages/nx-ktlint', +}; diff --git a/packages/nx-ktlint/package.json b/packages/nx-ktlint/package.json new file mode 100644 index 000000000..9abf8aa57 --- /dev/null +++ b/packages/nx-ktlint/package.json @@ -0,0 +1,10 @@ +{ + "name": "@jnxplus/nx-ktlint", + "version": "0.0.1", + "dependencies": { + "tslib": "^2.3.0" + }, + "type": "commonjs", + "main": "./src/index.js", + "typings": "./src/index.d.ts" +} diff --git a/packages/nx-ktlint/project.json b/packages/nx-ktlint/project.json new file mode 100644 index 000000000..10465204e --- /dev/null +++ b/packages/nx-ktlint/project.json @@ -0,0 +1,47 @@ +{ + "name": "nx-ktlint", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/nx-ktlint/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/packages/nx-ktlint", + "main": "packages/nx-ktlint/src/index.ts", + "tsConfig": "packages/nx-ktlint/tsconfig.lib.json", + "assets": ["packages/nx-ktlint/*.md"] + } + }, + "publish": { + "command": "node tools/scripts/publish.mjs nx-ktlint {args.ver} {args.tag}", + "dependsOn": ["build"] + }, + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/nx-ktlint/**/*.ts", + "packages/nx-ktlint/package.json" + ] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/nx-ktlint/jest.config.ts", + "passWithNoTests": true + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + } + } + }, + "tags": [] +} diff --git a/packages/nx-ktlint/src/index.ts b/packages/nx-ktlint/src/index.ts new file mode 100644 index 000000000..843cbbc04 --- /dev/null +++ b/packages/nx-ktlint/src/index.ts @@ -0,0 +1 @@ +export * from './lib/nx-ktlint'; diff --git a/packages/nx-ktlint/src/lib/nx-ktlint.spec.ts b/packages/nx-ktlint/src/lib/nx-ktlint.spec.ts new file mode 100644 index 000000000..f0147e992 --- /dev/null +++ b/packages/nx-ktlint/src/lib/nx-ktlint.spec.ts @@ -0,0 +1,7 @@ +import { nxKtlint } from './nx-ktlint'; + +describe('nxKtlint', () => { + it('should work', () => { + expect(nxKtlint()).toEqual('nx-ktlint'); + }); +}); diff --git a/packages/nx-ktlint/src/lib/nx-ktlint.ts b/packages/nx-ktlint/src/lib/nx-ktlint.ts new file mode 100644 index 000000000..b82bc0d10 --- /dev/null +++ b/packages/nx-ktlint/src/lib/nx-ktlint.ts @@ -0,0 +1,3 @@ +export function nxKtlint(): string { + return 'nx-ktlint'; +} diff --git a/packages/nx-ktlint/tsconfig.json b/packages/nx-ktlint/tsconfig.json new file mode 100644 index 000000000..f5b85657a --- /dev/null +++ b/packages/nx-ktlint/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/nx-ktlint/tsconfig.lib.json b/packages/nx-ktlint/tsconfig.lib.json new file mode 100644 index 000000000..33eca2c2c --- /dev/null +++ b/packages/nx-ktlint/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/packages/nx-ktlint/tsconfig.spec.json b/packages/nx-ktlint/tsconfig.spec.json new file mode 100644 index 000000000..9b2a121d1 --- /dev/null +++ b/packages/nx-ktlint/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index d1b0ebe10..8ef00af5d 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -22,6 +22,7 @@ "@jnxplus/internal/testing": ["packages/internal/testing/src/index.ts"], "@jnxplus/nx-checkstyle": ["packages/nx-checkstyle/src/index.ts"], "@jnxplus/nx-gradle": ["packages/nx-gradle/src/index.ts"], + "@jnxplus/nx-ktlint": ["packages/nx-ktlint/src/index.ts"], "@jnxplus/nx-maven": ["packages/nx-maven/src/index.ts"], "@jnxplus/xml": ["packages/xml/src/index.ts"] }