diff --git a/prototype/libs/babel.ts b/prototype/libs/babel.ts deleted file mode 100644 index 23c12dedd30..00000000000 --- a/prototype/libs/babel.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Task, TaskUserOptions } from '../types'; - -export interface BuildOptions { - copyFiles?: boolean; - extensions?: string[]; - outputDir: string; -} - -export function build( - options: TaskUserOptions, - { copyFiles = true, extensions, outputDir }: BuildOptions, -): Task { - const args = ['@in(0)', '--out-dir', '@out(0)']; - - if (copyFiles) { - args.push('--copy-files'); - } - - if (Array.isArray(extensions)) { - args.push('--extensions', extensions.join(',')); - } - - return { - args, - binary: 'babel', - inputs: ['@root(sources)', '.babelrc.*', '/babel.config.*'], - options: { - ...options, - debugOption: '--verbose', - }, - outputs: [outputDir], - type: 'build', - }; -} diff --git a/prototype/libs/eslint.ts b/prototype/libs/eslint.ts deleted file mode 100644 index c05ded83242..00000000000 --- a/prototype/libs/eslint.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Task, TaskUserOptions } from '../types'; - -export interface TestOptions { - cache?: boolean; - extensions?: string[]; -} - -export function test(options: TaskUserOptions, { cache = true, extensions }: TestOptions): Task { - const args = ['@in(0)', '@in(1)', '--report-unused-disable-directives']; - - if (cache) { - args.push('--cache', '--cache-location', '@cache(.eslintcache)'); - } - - if (Array.isArray(extensions)) { - args.push('--ext', extensions.join(',')); - } - - return { - args, - binary: 'eslint', - inputs: ['@root(sources)', '@root(tests)', '.eslintrc.*', '/.eslintrc.*', '/.eslintignore'], - options: { - ...options, - debugOption: '--debug', - }, - outputs: [], - type: 'test', - }; -} - -export interface RunOptions { - fix?: boolean; - extensions?: string[]; -} - -export function run(options: TaskUserOptions, { fix, extensions }: RunOptions): Task { - const task = test(options, { cache: false, extensions }); - - task.type = 'run'; - - if (fix) { - task.args.push('--fix'); - } - - return task; -} diff --git a/prototype/libs/jest.ts b/prototype/libs/jest.ts deleted file mode 100644 index 179ef704603..00000000000 --- a/prototype/libs/jest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Task, TaskUserOptions } from '../types'; - -export interface TestOptions { - cache?: boolean; - extensions?: string[]; -} - -export function test(options: TaskUserOptions, { cache = true, extensions }: TestOptions): Task { - const args = ['--testMatch', '@in(1)']; - - if (cache) { - args.push('--cache', '--cacheDirectory', '@cache(jest/)'); - } - - return { - args, - binary: 'eslint', - inputs: ['@root(sources)', '@root(tests)', 'jest.config.*', '/jest.config.*'], - options: { - ...options, - debugOption: '--debug', - watchOption: '--watch', - }, - outputs: [], - type: 'test', - }; -} diff --git a/prototype/libs/prettier.ts b/prototype/libs/prettier.ts deleted file mode 100644 index 2e4a18022de..00000000000 --- a/prototype/libs/prettier.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Task, TaskType, TaskUserOptions } from '../types'; - -function createTask(type: TaskType, options: TaskUserOptions, args: string[]): Task { - return { - args: ['@in(0)', '@in(1)', ...args], - binary: 'prettier', - inputs: ['@glob(sources)', '@glob(tests)', '/prettier.config.*', '/.prettierignore'], - options: { - ...options, - debugOption: ['--loglevel', 'debug'], - }, - outputs: [], - type, - }; -} - -export function run(options: TaskUserOptions): Task { - return createTask('run', options, ['--write']); -} - -export function test(options: TaskUserOptions): Task { - return createTask('test', options, ['--check']); -} diff --git a/prototype/libs/typescript.ts b/prototype/libs/typescript.ts deleted file mode 100644 index 6fabb595d4d..00000000000 --- a/prototype/libs/typescript.ts +++ /dev/null @@ -1,52 +0,0 @@ -import path from 'path'; -import { Task, TaskUserOptions } from '../types'; - -export interface BuildOptions { - declarationDir?: string; - inputDir?: string; - outputDir: string; -} - -export function build( - options: TaskUserOptions, - { declarationDir, inputDir, outputDir }: BuildOptions, -): Task { - return { - args: ['--build', '--pretty', inputDir ? path.join('@pid', inputDir) : '@pid'], - binary: 'tsc', - inputs: [ - '@glob(sources)', - '@glob(tests)', - inputDir ? path.join(inputDir, 'tsconfig.json') : 'tsconfig.json', - '/tsconfig.json', - '/tsconfig.*.json', - ], - metadata: { - declarationDir: declarationDir || outputDir, - inputDir, - outputDir, - }, - options: { - ...options, - debugOption: ['--extendedDiagnostics', '--listFiles', '--verbose'], - watchOption: ['--watch'], - }, - outputs: [outputDir], - type: 'build', - }; -} - -export function test(options: TaskUserOptions): Task { - return { - args: ['--noEmit', '--pretty'], - binary: 'tsc', - inputs: ['/tsconfig.json', '/tsconfig.*.json'], - options: { - ...options, - debugOption: ['--extendedDiagnostics', '--listFiles'], - watchOption: ['--watch'], - }, - outputs: [], - type: 'test', - }; -} diff --git a/prototype/tasks.ts b/prototype/tasks.ts deleted file mode 100644 index f040a81e65e..00000000000 --- a/prototype/tasks.ts +++ /dev/null @@ -1,13 +0,0 @@ -abstract class Task { - args: string[] = []; - - binary: string; - - constructor(binary: string) { - this.binary = binary; - } -} - -class BuildTask extends Task {} - -export function createBuildTask(bin: string, args: string[]) {} diff --git a/prototype/types.ts b/prototype/types.ts deleted file mode 100644 index 6186e6791ab..00000000000 --- a/prototype/types.ts +++ /dev/null @@ -1,29 +0,0 @@ -export type FileGroup = 'sources' | 'tests' | 'assets' | 'resources'; - -export type FileGroupOperator = 'glob' | 'root' | 'dirs' | 'files'; - -export type FileGroupInput = `${FileGroup}:${FileGroupOperator}`; - -export type Target = string & { __brand: 'target' }; - -export type TaskType = 'build' | 'test' | 'run'; - -export interface TaskUserOptions { - dependsOn?: Target[]; - retryCount?: number; -} - -export interface TaskOptions extends TaskUserOptions { - debugOption?: string | string[]; // --debug - watchOption?: string | string[]; // --watch -} - -export interface Task { - args: string[]; - binary: string; - inputs: string[]; - metadata?: Record; - options: TaskOptions; - outputs: string[]; - type: TaskType; -}