Skip to content

Commit

Permalink
build(topsort): migrate to nx
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Sep 11, 2023
1 parent 5e8248b commit c57ca9b
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 69 deletions.
28 changes: 28 additions & 0 deletions packages/topsort/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["packages/topsort/tsconfig.*?.json"]
},
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
1 change: 0 additions & 1 deletion packages/topsort/.npmignore

This file was deleted.

Empty file removed packages/topsort/dist/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion packages/topsort/dist/esm/package.json

This file was deleted.

12 changes: 12 additions & 0 deletions packages/topsort/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Config } from 'jest';

export default {
displayName: 'topsort',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/topsort',
} as Config;
30 changes: 1 addition & 29 deletions packages/topsort/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,9 @@
"version": "1.0.1-alpha.89",
"description": "High-Performance topological sort / dependency resolver with optional grouping algorithm for Typescript",
"type": "commonjs",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/cjs/index.d.ts",
"exports": {
".": {
"types": "./dist/cjs/index.d.ts",
"require": "./dist/cjs/index.js",
"default": "./dist/esm/index.js"
}
},
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "echo '{\"type\": \"module\"}' > ./dist/esm/package.json"
},
"repository": "https://github.com/deepkit/deepkit-framework",
"author": "Marc J. Schmidt <[email protected]>",
"license": "MIT",
"jest": {
"testEnvironment": "node",
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"moduleNameMapper": {
"(.+)\\.js": "$1"
},
"testMatch": [
"**/tests/**/*.spec.ts"
]
},
"gitHead": "56081823b559bb68b77a8781957af5d9c2e019a7"
"types": "./src/index.d.ts"
}
51 changes: 51 additions & 0 deletions packages/topsort/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "topsort",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/topsort/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/{projectRoot}",
"main": "{projectRoot}/src/index.ts",
"tsConfig": "{projectRoot}/tsconfig.lib.json",
"rollupConfig": "packages/rollup.config.js",
"project": "{projectRoot}/package.json",
"format": ["esm", "cjs"],
"generateExportsField": true,
"external": "all",
"compiler": "tsc"
}
},
"release": {
"command": "release-it --config={projectRoot}/.release-it.json"
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/topsort/**/*.ts",
"packages/topsort/package.json"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/topsort/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": ["topsort"]
}
6 changes: 3 additions & 3 deletions packages/topsort/index.ts → packages/topsort/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
* You should have received a copy of the MIT License along with this program.
*/

export * from './src/array-sort.js';
export * from './src/group-array-sort.js';
export * from './src/base.js';
export * from './lib/array-sort.js';
export * from './lib/group-array-sort.js';
export * from './lib/base.js';
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/topsort/tests/group-sort.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@jest/globals';
import { GroupArraySort } from '../src/group-array-sort.js';
import { CircularDependencyException, ElementNotFoundException } from '../src/base.js';
import { GroupArraySort } from '../src/lib/group-array-sort.js';
import { CircularDependencyException, ElementNotFoundException } from '../src/lib/base.js';
import { bench } from './utils.js';
import { fail } from 'assert';

Expand Down
4 changes: 2 additions & 2 deletions packages/topsort/tests/sort.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from '@jest/globals';
import { ArraySort } from '../src/array-sort.js';
import { ArraySort } from '../src/lib/array-sort.js';
import { bench } from './utils.js';
import { CircularDependencyException, ElementNotFoundException } from '../src/base.js';
import { CircularDependencyException, ElementNotFoundException } from '../src/lib/base.js';
import { fail } from 'assert';

function getElementsFlat(count: number) {
Expand Down
8 changes: 0 additions & 8 deletions packages/topsort/tsconfig.esm.json

This file was deleted.

35 changes: 12 additions & 23 deletions packages/topsort/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
{
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "node",
"target": "es2018",
"module": "CommonJS",
"esModuleInterop": true,
"baseUrl": ".",
"outDir": "./dist/cjs",
"declaration": true,
"composite": true
},
"include": [
"src",
"tests",
"index.ts"
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"references": []
}
"reflection": true
}
11 changes: 11 additions & 0 deletions packages/topsort/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"],
"reflection": true
}
18 changes: 18 additions & 0 deletions packages/topsort/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"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",
"tests/**/*.test.ts",
"tests/**/*.spec.ts",
"tests/**/*.d.ts"
],
"reflection": true
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@deepkit/sqlite": ["packages/sqlite/src/index.ts"],
"@deepkit/stopwatch": ["packages/stopwatch/src/index.ts"],
"@deepkit/template": ["packages/template/src/index.ts"],
"@deepkit/topsort": ["packages/topsort/src/index.ts"],
"@deepkit/type": ["packages/type/src/index.ts"],
"@deepkit/type-compiler": ["packages/type-compiler/src/index.ts"],
"@deepkit/type-spec": ["packages/type-spec/src/index.ts"],
Expand Down

0 comments on commit c57ca9b

Please sign in to comment.