-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
9edaa28
commit ff0a502
Showing
37 changed files
with
3,665 additions
and
3,015 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
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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,13 +2,15 @@ | |
"name": "@kronos/monorepo", | ||
"private": true, | ||
"version": "0.1.0", | ||
"packageManager": "[email protected]", | ||
"description": "Monorepo for kronos", | ||
"type": "module", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"test": "vitest run", | ||
"test:watch": "vitest -w", | ||
"preinstall": "npx only-allow pnpm", | ||
"watch": "tsc --build ./tsconfig.ws.json --watch", | ||
"build": "pnpm -r run build", | ||
|
@@ -36,19 +38,19 @@ | |
}, | ||
"homepage": "https://github.com/timotheeguerin/kronos#readme", | ||
"devDependencies": { | ||
"@cadl-lang/prettier-plugin-cadl": "^0.5.15", | ||
"cspell": "^6.8.1", | ||
"eslint": "^8.23.1", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-unicorn": "^43.0.2", | ||
"jest": "^29.3.1", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"syncpack": "^8.2.4", | ||
"ts-jest": "^29.0.0", | ||
"typescript": "^4.9.3" | ||
"cspell": "^8.3.2", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-unicorn": "^50.0.1", | ||
"prettier": "^3.2.4", | ||
"rimraf": "^5.0.5", | ||
"syncpack": "^12.3.0", | ||
"typescript": "^5.3.3" | ||
}, | ||
"syncpack": { | ||
"workspace": false | ||
}, | ||
"dependencies": { | ||
"vitest": "^1.2.2" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
require("@cadl-lang/eslint-config-cadl/patch/modern-module-resolution"); | ||
|
||
module.exports = { | ||
plugins: [], | ||
extends: ["@cadl-lang/eslint-config-cadl"], | ||
parserOptions: { tsconfigRootDir: __dirname }, | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
ignorePatterns: ["dist", ".eslintrc.cjs"], | ||
parser: "@typescript-eslint/parser", | ||
rules: { | ||
"no-console": "warn", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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
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,10 @@ | ||
import { NodeKronosHost } from "../../utils/node-host.js"; | ||
import { createPnpmWorkspaceManager } from "../../workspace-manager/pnpm.js"; | ||
|
||
export async function addChangeset(cwd: string): Promise<void> { | ||
const host = NodeKronosHost; | ||
const pnpm = createPnpmWorkspaceManager(host); | ||
const packages = await pnpm.load(cwd); | ||
// eslint-disable-next-line no-console | ||
console.log("Packages", packages); | ||
} |
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
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
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,48 @@ | ||
import type { GlobOptions, KronosHost } from "../utils/host.js"; | ||
import micromatch from "micromatch"; | ||
import { getDirectoryPath } from "../utils/path-utils.js"; | ||
|
||
export interface TestHost { | ||
host: KronosHost; | ||
addFile(path: string, content: string): void; | ||
} | ||
|
||
export function createTestHost(files: Record<string, string> = {}): TestHost { | ||
const fs: Record<string, string> = files; | ||
const host: KronosHost = { | ||
readFile: (path: string) => { | ||
const content = fs[path]; | ||
return Promise.resolve({ path, content }); | ||
}, | ||
writeFile: (path: string, content: string) => { | ||
fs[path] = content; | ||
return Promise.resolve(); | ||
}, | ||
access: (path: string) => { | ||
return path in fs ? Promise.resolve() : Promise.reject(new Error(`VFS: File ${path} does not exist`)); | ||
}, | ||
glob: (pattern: string, options?: GlobOptions) => { | ||
const baseDir = (options?.baseDir ?? "") + "/"; | ||
const filesInBaseDir = Object.keys(fs) | ||
.filter((x) => x.startsWith(baseDir)) | ||
.map((x) => x.substring(baseDir.length)); | ||
|
||
const content = new Set<string>(); | ||
|
||
for (const file of filesInBaseDir) { | ||
let current = file; | ||
while (current !== getDirectoryPath(current)) { | ||
content.add(current); | ||
current = getDirectoryPath(current); | ||
} | ||
} | ||
return Promise.resolve([...content].filter((x) => micromatch.isMatch(x, pattern))); | ||
}, | ||
}; | ||
return { | ||
host, | ||
addFile: (path: string, content: string) => { | ||
fs[path] = content; | ||
}, | ||
}; | ||
} |
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 class KronosError extends 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
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,30 @@ | ||
import { getDirectoryPath } from "./path-utils.js"; | ||
import type { KronosHost } from "./host.js"; | ||
|
||
export async function isPathAccessible(host: KronosHost, path: string): Promise<boolean> { | ||
try { | ||
await host.access(path); | ||
return true; | ||
} catch { | ||
return false; | ||
} | ||
} | ||
/** | ||
* Look in parent directories using the given callback to test for success. | ||
* Callback can return a string of another path that was match, true to accept the current path or false to keep traversing up. | ||
*/ | ||
export async function lookup( | ||
startDir: string, | ||
callback: (currentDir: string) => string | boolean | Promise<string | boolean>, | ||
): Promise<string | undefined> { | ||
let last = undefined; | ||
let current = startDir; | ||
while (last !== current) { | ||
if (callback(current)) { | ||
return current; | ||
} | ||
last = current; | ||
current = getDirectoryPath(startDir); | ||
} | ||
return undefined; | ||
} |
Oops, something went wrong.