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

chore(cli): add deprecation message for introspect command #8763

Merged
merged 16 commits into from Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from 9 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
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -226,12 +226,6 @@ Changes to `query.ts` will then be reflected when running `fixtures/blog/main.ts
1. `cd packages/migrate/fixtures/blog`
1. `ts-node ../../src/bin.ts dev`

### Developing `prisma init` Command

1. `cd packages/introspection`
1. `mkdir test && cd test`
1. `ts-node ../src/bin.ts`

### Developing `prisma` CLI

1. `cd packages/cli`
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/.gitignore
Expand Up @@ -26,4 +26,4 @@ write-test
prisma-cli*.tgz
pnpm-lock.yaml

/src/__tests__/version-test-engines
version-test-engines
2 changes: 0 additions & 2 deletions packages/cli/fixtures/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion packages/cli/fixtures/introspection-warnings/.gitignore

This file was deleted.

51 changes: 0 additions & 51 deletions packages/cli/fixtures/introspection-warnings/schema.prisma

This file was deleted.

Binary file not shown.
5 changes: 0 additions & 5 deletions packages/cli/fixtures/project/package.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/cli/fixtures/project/subdir/dynamic-denylist.prisma

This file was deleted.

134 changes: 0 additions & 134 deletions packages/cli/fixtures/test.sh

This file was deleted.

5 changes: 1 addition & 4 deletions packages/cli/package.json
Expand Up @@ -113,10 +113,7 @@
"scripts": {
"dev": "DEV=true node helpers/build.js",
"build": "node helpers/build.js",
"test:commands": "./fixtures/test.sh && jest --maxConcurrency=1",
"test-update": "pnpm run test:commands -- -u",
"test": "pnpm run test:commands",
"jest": "jest",
"test": "jest --maxConcurrency=1 --verbose",
"install": "node scripts/install-entry.js",
"format": "prettier --write .",
"lint": "eslint --cache --fix --ext .ts .",
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/CLI.ts
Expand Up @@ -7,6 +7,7 @@ import {
format,
HelpError,
unknownCommand,
logger,
} from '@prisma/sdk'
import { Version } from './Version'
import { link } from '@prisma/sdk'
Expand Down Expand Up @@ -53,13 +54,29 @@ export class CLI implements Command {

// check if we have that subcommand
const cmdName = args._[0]
// Throw if "lift"
if (cmdName === 'lift') {
throw new Error(
`${chalk.red('prisma lift')} has been renamed to ${chalk.green(
'prisma migrate',
)}`,
)
}
// warn if "introspect"
else if (cmdName === 'introspect') {
logger.warn('')
logger.warn(
`${chalk.bold(
`${chalk.underline(
'prisma introspect',
)} command is deprecated. It has been renamed to ${chalk.green(
'prisma db pull',
)}`,
)}`,
)
Jolg42 marked this conversation as resolved.
Show resolved Hide resolved
logger.warn('')
}

const cmd = this.cmds[cmdName]
if (cmd) {
// if we have that subcommand, let's ensure that the binary is there in case the command needs it
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/Init.ts
Expand Up @@ -15,7 +15,7 @@ import dotenv from 'dotenv'
import fs from 'fs'
import path from 'path'
import { isError } from 'util'
import { printError } from './prompt/utils/print'
import { printError } from './utils/prompt/utils/print'

export const defaultSchema = (provider: ConnectorType = 'postgresql') => {
if (provider === 'sqlserver' || provider === 'mongodb') {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/Studio.ts
Expand Up @@ -109,7 +109,7 @@ ${chalk.bold('Examples')}
args['--port'] || (await getPort({ port: getPort.makeRange(5555, 5600) }))
const browser = args['--browser'] || process.env.BROWSER

const staticAssetDir = path.resolve(__dirname, '../build/public')
const staticAssetDir = path.resolve(__dirname, '../../build/public')
Jolg42 marked this conversation as resolved.
Show resolved Hide resolved

const studio = new StudioServer({
schemaPath,
Expand All @@ -120,7 +120,7 @@ ${chalk.bold('Examples')}
resolve: {
'@prisma/client': path.resolve(
__dirname,
'../prisma-client/index.js',
'../../prisma-client/index.js',
Jolg42 marked this conversation as resolved.
Show resolved Hide resolved
),
'@prisma/engines': require.resolve('@prisma/engines'),
},
Expand Down
15 changes: 11 additions & 4 deletions packages/cli/src/__tests__/__helpers__/snapshotSerializer.ts
Expand Up @@ -39,6 +39,11 @@ function normalizeRustError(str) {
function normalizeTmpDir(str) {
return str.replace(/\/tmp\/([a-z0-9]+)\//g, '/tmp/dir/')
}

function normalizeMs(str) {
return str.replace(/\d{1,3}ms/g, 'XXms')
}

const serializer = {
test(value) {
return typeof value === 'string' || value instanceof Error
Expand All @@ -53,10 +58,12 @@ const serializer = {
return prepareSchemaForSnapshot(
normalizeGithubLinks(
normalizeRustError(
normalizeTmpDir(
normalizeGithubLinks(
normalizeToUnixPaths(
removePlatforms(trimErrorPaths(stripAnsi(message))),
normalizeMs(
normalizeTmpDir(
normalizeGithubLinks(
normalizeToUnixPaths(
removePlatforms(trimErrorPaths(stripAnsi(message))),
),
),
),
),
Expand Down
@@ -1,5 +1,5 @@
import { Doctor } from '../Doctor'
import { consoleContext, Context } from './__helpers__/context'
import { Doctor } from '../../Doctor'
import { consoleContext, Context } from '../__helpers__/context'

const ctx = Context.new().add(consoleContext()).assemble()

Expand Down
@@ -1,6 +1,6 @@
import fs from 'fs-jetpack'
import { Format } from '../Format'
import { Context } from './__helpers__/context'
import { Format } from '../../Format'
import { Context } from '../__helpers__/context'

const ctx = Context.new().assemble()

Expand Down