Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[legacy-framework] Extract out display package #589

Merged
merged 5 commits into from May 31, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/package.json
Expand Up @@ -31,6 +31,7 @@
"/lib"
],
"dependencies": {
"@blitzjs/display": "0.12.0",
"@blitzjs/repl": "0.12.0",
"@oclif/command": "1.5.20",
"@oclif/config": "1.15.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/console.ts
Expand Up @@ -3,7 +3,7 @@ import {Command} from '@oclif/command'
import path from 'path'
import fs from 'fs'
import pkgDir from 'pkg-dir'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import chalk from 'chalk'

import {setupTsnode} from '../utils/setup-ts-node'
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/db.ts
@@ -1,4 +1,5 @@
import {resolveBinAsync, log} from '@blitzjs/server'
import {resolveBinAsync} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {Command, flags} from '@oclif/command'
import chalk from 'chalk'
import {spawn} from 'cross-spawn'
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/generate.ts
Expand Up @@ -11,7 +11,7 @@ import {
FormGenerator /* ModelGenerator */,
} from '@blitzjs/generator'
import {PromptAbortedError} from '../errors/prompt-aborted'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import camelCase from 'camelcase'
import pkgDir from 'pkg-dir'
const debug = require('debug')('blitz:generate')
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/install.ts
Expand Up @@ -2,7 +2,7 @@ import {Command} from '../command'
import * as path from 'path'
import {Installer} from '@blitzjs/installer'
import _got from 'got'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {dedent} from '../utils/dedent'
import {Stream} from 'stream'
import {promisify} from 'util'
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/new.ts
Expand Up @@ -4,7 +4,7 @@ import {Command} from '../command'
import {AppGenerator} from '@blitzjs/generator'
import chalk from 'chalk'
import hasbin from 'hasbin'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
const debug = require('debug')('blitz:new')

import {PromptAbortedError} from '../errors/prompt-aborted'
Expand Down
4 changes: 4 additions & 0 deletions packages/display/.gitignore
@@ -0,0 +1,4 @@
*.log
.DS_Store
node_modules
dist
3 changes: 3 additions & 0 deletions packages/display/README.md
@@ -0,0 +1,3 @@
# `display`

This package houses all files related to Blitz commandline output.
44 changes: 44 additions & 0 deletions packages/display/package.json
@@ -0,0 +1,44 @@
{
"name": "@blitzjs/display",
"version": "0.12.0",
"description": "Display package for the Blitz CLI",
"homepage": "https://github.com/blitz-js/blitz#readme",
"license": "MIT",
"scripts": {
"dev": "tsdx watch --verbose",
"build": "tsdx build",
"test": "tsdx test",
"test:watch": "tsdx test --watch",
"lint": "tsdx lint"
},
"author": {
"name": "Brandon Bayer",
"email": "b@bayer.ws",
"url": "https://twitter.com/flybayer"
},
"main": "dist/index.js",
"module": "dist/installer.esm.js",
"types": "dist/packages/display/src/index.d.ts",
"files": [
"dist"
],
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
}
},
"keywords": [
"blitz",
"display"
],
"repository": {
"type": "git",
"url": "git+https://github.com/blitz-js/blitz.git"
},
"dependencies": {
"chalk": "4.0.0",
"ora": "4.0.4",
"readline": "1.3.0"
},
"devDependencies": {}
}
3 changes: 3 additions & 0 deletions packages/display/src/index.test.ts
@@ -0,0 +1,3 @@
it('should do nothing', () => {
expect(true).toBe(true)
})
File renamed without changes.
13 changes: 13 additions & 0 deletions packages/display/tsconfig.json
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "types", "test"],
"exclude": ["node_modules"],
"compilerOptions": {
"baseUrl": "./",
"declarationDir": "./dist",
"downlevelIteration": true,
"paths": {
"*": ["src/*", "node_modules/*"]
}
}
}
5 changes: 2 additions & 3 deletions packages/generator/package.json
Expand Up @@ -42,6 +42,7 @@
"dependencies": {
"@babel/core": "7.9.0",
"@babel/plugin-transform-typescript": "7.9.4",
"@blitzjs/display": "0.12.0",
"ast-types": "0.13.3",
"chalk": "4.0.0",
"cross-spawn": "7.0.2",
Expand All @@ -56,8 +57,6 @@
"username": "5.1.0",
"vinyl": "2.2.0"
},
"devDependencies": {
"@blitzjs/server": "0.12.0"
},
"devDependencies": {},
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922"
}
2 changes: 1 addition & 1 deletion packages/generator/src/generator.ts
Expand Up @@ -4,7 +4,7 @@ import {EventEmitter} from 'events'
import {create as createStore, Store} from 'mem-fs'
import {create as createEditor, Editor} from 'mem-fs-editor'
import Enquirer from 'enquirer'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import readDirRecursive from 'fs-readdir-recursive'
import * as babel from '@babel/core'
// @ts-ignore TS wants types for this module but none exist
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/app-generator.ts
Expand Up @@ -5,7 +5,7 @@ import username from 'username'
import {readJSONSync, writeJson} from 'fs-extra'
import {resolve, join} from 'path'
import {fetchLatestVersionsFor} from '../utils/fetch-latest-version-for'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {getBlitzDependencyVersion} from '../utils/get-blitz-dependency-version'

export interface AppGeneratorOptions extends GeneratorOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/utils/get-latest-version.ts
@@ -1,5 +1,5 @@
import {fetchAllVersions, fetchLatestDistVersion} from './npm-fetch'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {Fallbackable} from './fallbackable'
import chalk from 'chalk'

Expand Down
4 changes: 2 additions & 2 deletions packages/generator/test/generators/app-generator.test.ts
@@ -1,5 +1,5 @@
import spawn from 'cross-spawn'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'

import {AppGenerator} from '../../src/generators/app-generator'

Expand All @@ -8,7 +8,7 @@ jest.spyOn(process, 'chdir').mockImplementation(() => true)
jest.spyOn(global.console, 'log').mockImplementation()
// Mocks the log output
jest.mock(
'@blitzjs/server',
'@blitzjs/display',
jest.fn(() => {
return {
log: {
Expand Down
2 changes: 1 addition & 1 deletion packages/installer/package.json
Expand Up @@ -39,8 +39,8 @@
"dependencies": {
"@babel/core": "7.9.0",
"@babel/plugin-transform-typescript": "7.9.4",
"@blitzjs/display": "0.12.0",
"@blitzjs/generator": "0.12.0",
"@blitzjs/server": "0.12.0",
"ast-types": "0.13.3",
"chokidar": "3.3.1",
"cross-spawn": "7.0.2",
Expand Down
Expand Up @@ -2,7 +2,7 @@ import {BaseExecutor, executorArgument, getExecutorArgument} from './executor'
import * as fs from 'fs-extra'
import * as path from 'path'
import spawn from 'cross-spawn'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'

interface NpmPackage {
name: string
Expand Down
2 changes: 1 addition & 1 deletion packages/installer/src/executors/executor.ts
@@ -1,4 +1,4 @@
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'

export interface BaseExecutor {
stepId: string | number
Expand Down
@@ -1,7 +1,7 @@
import {BaseExecutor, executorArgument, getExecutorArgument} from './executor'
import {filePrompt} from './file-prompt'
import {transform, Transformer} from '../utils/transform'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {waitForConfirmation} from '../utils/wait-for-confirmation'
import {createPatch} from 'diff'
import chokidar from 'chokidar'
Expand Down
2 changes: 1 addition & 1 deletion packages/installer/src/executors/new-file-executor.ts
@@ -1,6 +1,6 @@
import {BaseExecutor, executorArgument, getExecutorArgument} from './executor'
import {Generator, GeneratorOptions} from '@blitzjs/generator'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {waitForConfirmation} from '../utils/wait-for-confirmation'

export interface NewFileExecutor extends BaseExecutor {
Expand Down
2 changes: 1 addition & 1 deletion packages/installer/src/installer.ts
Expand Up @@ -9,7 +9,7 @@ import {
isFileTransformExecutor,
fileTransformExecutor,
} from './executors/file-transform-executor'
import {log} from '@blitzjs/server'
import {log} from '@blitzjs/display'
import {logExecutorFrontmatter} from './executors/executor'
import {waitForConfirmation} from './utils/wait-for-confirmation'

Expand Down
1 change: 1 addition & 0 deletions packages/server/package.json
Expand Up @@ -32,6 +32,7 @@
"module": "dist/webpack.esm.js",
"types": "dist/packages/server/src/index.d.ts",
"dependencies": {
"@blitzjs/display": "0.12.0",
"cross-spawn": "7.0.2",
"detect-port": "1.3.0",
"fast-glob": "3.2.2",
Expand Down
1 change: 0 additions & 1 deletion packages/server/src/index.ts
Expand Up @@ -6,5 +6,4 @@ export {Manifest} from './synchronizer/pipeline/rules/manifest'
export {ManifestLoader} from './synchronizer/manifest-loader'
export {enhance} from './config'
export {resolveBinAsync} from './resolve-bin-async'
export {log} from './log'
export * from './rpc'
2 changes: 1 addition & 1 deletion packages/server/src/rpc.ts
@@ -1,5 +1,5 @@
import {BlitzApiRequest, BlitzApiResponse} from '@blitzjs/core'
import {log} from './log'
import {log} from '@blitzjs/display'
import {serializeError} from 'serialize-error'

export function rpcHandler(
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/synchronizer/display.ts
@@ -1,6 +1,6 @@
import {through} from './streams'
import File from 'vinyl'
import {log} from '../log'
import {log} from '@blitzjs/display'
import chalk from 'chalk'
import {Event, FILE_WRITTEN, INIT, ERROR_THROWN, READY} from './events'

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/synchronizer/errors.ts
@@ -1,4 +1,4 @@
import {log} from '../log'
import {log} from '@blitzjs/display'
import {through} from './streams'
import {Writable} from 'stream'
import {ERROR_THROWN} from './events'
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Expand Up @@ -13632,6 +13632,11 @@ readdirp@~3.4.0:
dependencies:
picomatch "^2.2.1"

readline@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/readline/-/readline-1.3.0.tgz#c580d77ef2cfc8752b132498060dc9793a7ac01c"
integrity sha1-xYDXfvLPyHUrEySYBg3JeTp6wBw=

realpath-native@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c"
Expand Down