Skip to content

Commit

Permalink
Move things around a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Sep 8, 2024
1 parent e643258 commit a6d4d8c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 27 deletions.
9 changes: 3 additions & 6 deletions openrewrite/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json', // Adjust if your tsconfig file is named or located differently
},
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: 'tsconfig.json', // Adjust if your tsconfig file is named or located differently
}],
},
testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
Expand Down
24 changes: 23 additions & 1 deletion openrewrite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions openrewrite/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "openrewrite",
"name": "@openrewrite/rewrite",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
Expand All @@ -9,10 +9,12 @@
"test": "jest"
},
"dependencies": {
"@types/node": "^22.5.4"
"@types/node": "^22.5.4",
"uuid": "^10.0.0"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/uuid": "^10.0.0",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
Expand Down
1 change: 1 addition & 0 deletions openrewrite/src/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './tree';
18 changes: 18 additions & 0 deletions openrewrite/src/core/tree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { v4 as uuidv4 } from 'uuid';

type UUID = string;

export const random_id = (): UUID => {
return uuidv4();
}

class CompilationUnit {
constructor(
public readonly id: UUID
) {
}

withId(newId: UUID): CompilationUnit {
return newId == this.id ? this : new CompilationUnit(newId);
}
}
3 changes: 0 additions & 3 deletions openrewrite/src/utils/math.ts

This file was deleted.

7 changes: 7 additions & 0 deletions openrewrite/test/core/tree.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { random_id } from '../../src/core';

describe('tree utils', () => {
test('new random ID', () => {
expect(random_id()).toBeDefined();
});
});
15 changes: 0 additions & 15 deletions openrewrite/test/utils/math.test.ts

This file was deleted.

0 comments on commit a6d4d8c

Please sign in to comment.