1
0
mirror of synced 2026-02-03 18:01:02 -05:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Dillon Raphael
4e9c1f60b6 pnpm lock 2022-06-07 11:36:45 -04:00
github-actions[bot]
508682c8f8 Version Packages (alpha) (#3400)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-07 11:35:42 -04:00
Dillon Raphael
962eb58af6 Migrate printEnvInfo to CLI (#3394)
* init printEnvInfo function

* changeset
2022-06-07 11:31:56 -04:00
Dillon Raphael
17669b3af8 pnpmlock 2022-06-07 11:06:31 -04:00
github-actions[bot]
ec6299c36a Version Packages (alpha) (#3399)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-07 11:05:15 -04:00
Dillon Raphael
6ac2d3412a Update generator template npmrc & next versions (#3398)
* add strict-peer-dependencies=false
side-effects-cache=false to npmrc generator template

* add comment to generated npmrc file

* update versions of next for full and minimal templates

* pinned next version to 12.1.6 in generator templates

* add next back to root package

* fix lock file

* add changeset

Co-authored-by: Aleksandra <alexsandra.sikora@gmail.com>
2022-06-07 10:59:28 -04:00
25 changed files with 801 additions and 344 deletions

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---
updated nextjs version in generator & npmrc file

View File

@@ -0,0 +1,5 @@
---
"blitz": patch
---
detailed print env info

View File

@@ -25,10 +25,12 @@
"dirty-monkeys-greet",
"empty-berries-rule",
"fair-wombats-sneeze",
"famous-kings-explain",
"fast-trainers-kneel",
"flat-bees-approve",
"four-meals-fry",
"great-months-train",
"healthy-rice-shout",
"hot-drinks-approve",
"lovely-colts-share",
"modern-cameras-pull",

View File

@@ -29,7 +29,7 @@
"@blitzjs/rpc": "workspace:*",
"@hookform/resolvers": "2.8.8",
"@prisma/client": "3.9.0",
"blitz": "workspace:2.0.0-alpha.27",
"blitz": "workspace:2.0.0-alpha.29",
"next": "12.1.6-canary.17",
"prisma": "3.9.0",
"react": "18.0.0",

View File

@@ -1,5 +1,18 @@
# @blitzjs/auth
## 2.0.0-alpha.29
### Patch Changes
- Updated dependencies [962eb58a]
- blitz@2.0.0-alpha.29
## 2.0.0-alpha.28
### Patch Changes
- blitz@2.0.0-alpha.28
## 2.0.0-alpha.27
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/auth",
"version": "2.0.0-alpha.27",
"version": "2.0.0-alpha.29",
"scripts": {
"build": "unbuild",
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts",
@@ -26,7 +26,7 @@
"@types/secure-password": "3.1.1",
"b64-lite": "1.4.0",
"bad-behavior": "1.0.1",
"blitz": "2.0.0-alpha.27",
"blitz": "2.0.0-alpha.29",
"cookie": "0.4.1",
"cookie-session": "2.0.0",
"debug": "4.3.3",
@@ -39,7 +39,7 @@
"url": "0.11.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.27",
"@blitzjs/config": "workspace:2.0.0-alpha.29",
"@testing-library/react": "13.0.0",
"@testing-library/react-hooks": "7.0.2",
"@types/cookie": "0.4.1",

View File

@@ -1,5 +1,17 @@
# @blitzjs/next
## 2.0.0-alpha.29
### Patch Changes
- @blitzjs/rpc@2.0.0-alpha.29
## 2.0.0-alpha.28
### Patch Changes
- @blitzjs/rpc@2.0.0-alpha.28
## 2.0.0-alpha.27
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/next",
"version": "2.0.0-alpha.27",
"version": "2.0.0-alpha.29",
"scripts": {
"build": "unbuild",
"dev": "pnpm predev && pnpm watch unbuild src --wait=0.2",
@@ -23,7 +23,7 @@
"eslint.js"
],
"dependencies": {
"@blitzjs/rpc": "2.0.0-alpha.27",
"@blitzjs/rpc": "2.0.0-alpha.29",
"@types/hoist-non-react-statics": "3.3.1",
"debug": "4.3.3",
"fs-extra": "10.0.1",
@@ -32,7 +32,7 @@
"superjson": "1.8.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.27",
"@blitzjs/config": "workspace:2.0.0-alpha.29",
"@testing-library/dom": "8.13.0",
"@testing-library/jest-dom": "5.16.3",
"@testing-library/react": "13.0.0",
@@ -43,7 +43,7 @@
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"@types/testing-library__react-hooks": "4.0.0",
"blitz": "2.0.0-alpha.27",
"blitz": "2.0.0-alpha.29",
"cross-spawn": "7.0.3",
"find-up": "4.1.0",
"lodash.frompairs": "4.0.1",

View File

@@ -1,5 +1,20 @@
# @blitzjs/rpc
## 2.0.0-alpha.29
### Patch Changes
- Updated dependencies [962eb58a]
- blitz@2.0.0-alpha.29
- @blitzjs/auth@2.0.0-alpha.29
## 2.0.0-alpha.28
### Patch Changes
- blitz@2.0.0-alpha.28
- @blitzjs/auth@2.0.0-alpha.28
## 2.0.0-alpha.27
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/rpc",
"version": "2.0.0-alpha.27",
"version": "2.0.0-alpha.29",
"scripts": {
"build": "unbuild",
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts && wait-on -d 250 ../blitz-auth/dist/index-browser.d.ts",
@@ -20,7 +20,7 @@
"dist/**"
],
"dependencies": {
"@blitzjs/auth": "2.0.0-alpha.27",
"@blitzjs/auth": "2.0.0-alpha.29",
"b64-lite": "1.4.0",
"bad-behavior": "1.0.1",
"chalk": "^4.1.0",
@@ -30,11 +30,11 @@
"zod": "3.10.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.27",
"@blitzjs/config": "workspace:2.0.0-alpha.29",
"@types/debug": "4.1.7",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-alpha.27",
"blitz": "2.0.0-alpha.29",
"next": "12.1.6-canary.17",
"react": "18.0.0",
"react-dom": "18.0.0",
@@ -43,7 +43,7 @@
"watch": "1.0.2"
},
"peerDependencies": {
"blitz": "2.0.0-alpha.27",
"blitz": "2.0.0-alpha.29",
"next": "*"
},
"publishConfig": {

View File

@@ -1,5 +1,19 @@
# blitz
## 2.0.0-alpha.29
### Patch Changes
- 962eb58a: detailed print env info
- @blitzjs/generator@2.0.0-alpha.29
## 2.0.0-alpha.28
### Patch Changes
- Updated dependencies [6ac2d341]
- @blitzjs/generator@2.0.0-alpha.28
## 2.0.0-alpha.27
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "blitz",
"version": "2.0.0-alpha.27",
"version": "2.0.0-alpha.29",
"scripts": {
"build": "unbuild",
"dev": "watch unbuild src --wait=0.2",
@@ -23,7 +23,7 @@
"blitz": "bin/blitz"
},
"dependencies": {
"@blitzjs/generator": "2.0.0-alpha.27",
"@blitzjs/generator": "2.0.0-alpha.29",
"arg": "5.0.1",
"chalk": "^4.1.0",
"console-table-printer": "2.10.0",
@@ -32,12 +32,14 @@
"detect-port": "1.3.0",
"dotenv": "16.0.0",
"dotenv-expand": "8.0.3",
"envinfo": "7.8.1",
"esbuild": "0.14.34",
"find-up": "4.1.0",
"fs-extra": "10.0.1",
"hasbin": "1.2.3",
"npm-which": "3.0.1",
"ora": "5.3.0",
"os-name": "5.0.1",
"p-event": "4.2.0",
"pkg-dir": "5.0.0",
"prompts": "2.4.2",
@@ -50,11 +52,12 @@
"watchpack": "2.1.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.27",
"@blitzjs/config": "workspace:2.0.0-alpha.29",
"@types/cookie": "0.4.1",
"@types/cross-spawn": "6.0.2",
"@types/debug": "4.1.7",
"@types/detect-port": "1.3.2",
"@types/envinfo": "7.8.1",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/hasbin": "1.2.0",

View File

@@ -4,6 +4,10 @@ import packageJson from "../../package.json"
import {loadEnvConfig} from "../env-utils"
import {getCommandBin} from "./utils/config"
import spawn from "cross-spawn"
import {readdirSync} from "fs-extra"
import resolveFrom from "resolve-from"
import pkgDir from "pkg-dir"
import {join} from "path"
const commonArgs = {
// Types
@@ -17,6 +21,9 @@ const commonArgs = {
"-h": "--help",
"-e": "--env",
}
const args = arg(commonArgs, {
permissive: true,
})
const defaultCommand = "dev"
export type CliCommand = (argv?: string[]) => void
@@ -29,84 +36,21 @@ const commands: {[command: string]: () => Promise<CliCommand>} = {
codegen: () => import("./commands/codegen").then((i) => i.codegen),
db: () => import("./commands/db").then((i) => i.db),
}
const args = arg(commonArgs, {
permissive: true,
})
if (args["--env"]) {
process.env.APP_ENV = args["--env"]
}
loadEnvConfig(process.cwd(), undefined, {error: console.error, info: console.info})
// Version is inlined into the file using taskr build pipeline
if (args["--version"]) {
console.log(`Blitz.js v${packageJson.version}`)
process.exit(0)
}
const foundCommand = Boolean(commands[args._[0] as string])
const command = foundCommand ? (args._[0] as string) : defaultCommand
const forwardedArgs = foundCommand ? args._.slice(1) : args._
if (args["--env"]) {
process.env.APP_ENV = args["--env"]
}
const globalBlitzPath = resolveFrom(__dirname, "blitz")
const localBlitzPath = resolveFrom.silent(process.cwd(), "blitz")
if (args["--help"]) {
forwardedArgs.push("--help")
}
const isInDevelopmentAsGloballyLinked = __dirname.includes("packages/blitz/dist")
// env variable should default to dev unless the command is build or start
const defaultEnv = command === "build" || command === "start" ? "production" : "development"
const standardEnv = ["production", "development", "test"]
if (process.env.NODE_ENV && !standardEnv.includes(process.env.NODE_ENV)) {
console.warn(NON_STANDARD_NODE_ENV)
}
;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv
// Make sure commands gracefully respect termination signals (e.g. from Docker)
process.on("SIGTERM", () => process.exit(0))
process.on("SIGINT", () => process.exit(0))
if (foundCommand) {
commands[command]?.()
.then((exec: any) => exec(forwardedArgs))
.then(() => {
if (command === "build") {
// ensure process exits after build completes so open handles/connections
// don't cause process to hang
process.exit(0)
}
})
.catch((err) => {
console.log(err)
})
let blitzPkgPath
if (isInDevelopmentAsGloballyLinked) {
blitzPkgPath = globalBlitzPath
} else {
if (args["--help"] && args._.length === 0) {
console.log(`
Usage
$ blitz <command>
Available commands
${Object.keys(commands).join(", ")}
Options
--env, -e App environment name
--version, -v Version number
--help, -h Displays this message
For more information run a command with the --help flag
$ blitz build --help
`)
process.exit(0)
} else {
// If the command is not found, we assume it is a command from the bin
void runCommandFromBin()
}
// localBlitzPath won't exist if used outside a blitz app directory
blitzPkgPath = localBlitzPath || globalBlitzPath
}
async function runCommandFromBin() {
@@ -125,3 +69,122 @@ async function runCommandFromBin() {
const result = spawn.sync(commandBin, process.argv.slice(3), {stdio: "inherit"})
process.exit(result.status || 0)
}
async function printEnvInfo() {
const osName = await import("os-name")
const envinfo = await import("envinfo")
const pkgManager = readdirSync(process.cwd()).includes("pnpm-lock.yaml")
? "pnpm"
: readdirSync(process.cwd()).includes("yarn-lock.yaml")
? "yarn"
: "npm"
const env = await envinfo.default.run(
{
System: ["OS", "CPU", "Memory", "Shell"],
Binaries: ["Node", "Yarn", "npm", "pnpm"],
npmPackages: [
"blitz",
"typescript",
"react",
"react-dom",
"prisma",
"@prisma/client",
"next",
],
},
{showNotFound: true},
)
const globalBlitzPkgJsonPath = pkgDir.sync(globalBlitzPath) as string
const localBlitzPkgJsonPath = pkgDir.sync(localBlitzPath)
if (globalBlitzPkgJsonPath !== localBlitzPkgJsonPath) {
// This branch won't run if user does `npx blitz` or `yarn blitz`
const globalVersion = require(join(globalBlitzPkgJsonPath, "package.json")).version
console.log(`Blitz version: ${globalVersion} (global)`)
}
if (localBlitzPkgJsonPath) {
const localVersion = require(join(localBlitzPkgJsonPath, "package.json")).version
console.log(`Blitz version: ${localVersion} (local)`)
}
console.log(
`${osName.default()} | ${process.platform}-${process.arch} | Node: ${process.version}\n`,
)
console.log(`\n Package manager: ${pkgManager}`)
console.log(env)
process.exit(0)
}
async function main() {
loadEnvConfig(process.cwd(), undefined, {error: console.error, info: console.info})
// Version is inlined into the file using taskr build pipeline
if (args["_"].length === 0 && args["--version"]) {
await printEnvInfo()
}
if (args["--env"]) {
process.env.APP_ENV = args["--env"]
}
if (args["--help"]) {
forwardedArgs.push("--help")
}
// env variable should default to dev unless the command is build or start
const defaultEnv = command === "build" || command === "start" ? "production" : "development"
const standardEnv = ["production", "development", "test"]
if (process.env.NODE_ENV && !standardEnv.includes(process.env.NODE_ENV)) {
console.warn(NON_STANDARD_NODE_ENV)
}
;(process.env as any).NODE_ENV = process.env.NODE_ENV || defaultEnv
// Make sure commands gracefully respect termination signals (e.g. from Docker)
process.on("SIGTERM", () => process.exit(0))
process.on("SIGINT", () => process.exit(0))
if (foundCommand) {
commands[command]?.()
.then((exec: any) => exec(forwardedArgs))
.then(() => {
if (command === "build") {
// ensure process exits after build completes so open handles/connections
// don't cause process to hang
process.exit(0)
}
})
.catch((err) => {
console.log(err)
})
} else {
if (args["--help"] && args._.length === 0) {
console.log(`
Usage
$ blitz <command>
Available commands
${Object.keys(commands).join(", ")}
Options
--env, -e App environment name
--version, -v Version number
--help, -h Displays this message
For more information run a command with the --help flag
$ blitz build --help
`)
process.exit(0)
} else {
// If the command is not found, we assume it is a command from the bin
void runCommandFromBin()
}
}
}
main().catch((e) => {
console.error(e)
})

View File

@@ -1,5 +1,9 @@
# @blitzjs/config
## 2.0.0-alpha.29
## 2.0.0-alpha.28
## 2.0.0-alpha.27
## 2.0.0-alpha.26

View File

@@ -1,7 +1,7 @@
{
"name": "@blitzjs/config",
"private": true,
"version": "2.0.0-alpha.27",
"version": "2.0.0-alpha.29",
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "5.9.1",

View File

@@ -1,5 +1,13 @@
# @blitzjs/generator
## 2.0.0-alpha.29
## 2.0.0-alpha.28
### Patch Changes
- 6ac2d341: updated nextjs version in generator & npmrc file
## 2.0.0-alpha.27
## 2.0.0-alpha.26

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/generator",
"version": "2.0.0-alpha.27",
"version": "2.0.0-alpha.29",
"scripts": {
"dev": "watch unbuild src --wait=0.2",
"build": "unbuild && pnpm build:templates",
@@ -45,7 +45,7 @@
"vinyl": "2.2.1"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-alpha.27",
"@blitzjs/config": "2.0.0-alpha.29",
"@juanm04/cpx": "2.0.1",
"@types/babel__core": "7.1.19",
"@types/diff": "5.0.2",

View File

@@ -1,7 +1,9 @@
save-exact=true
legacy-peer-deps=true
strict-peer-dependencies=false
side-effects-cache=false
public-hoist-pattern[]=next
public-hoist-pattern[]=secure-password
public-hoist-pattern[]=*jest*
public-hoist-pattern[]=@testing-library/*
# Needed for Blitz to work properly. Don't remove the lines above.

View File

@@ -27,7 +27,7 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "3.9.0",
"blitz": "alpha",
"next": "12.1.1",
"next": "12.1.6",
"prisma": "3.9.0",
"react": "18.0.0",
"react-dom": "18.0.0",

View File

@@ -27,7 +27,7 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "3.9.0",
"blitz": "alpha",
"next": "12.1.1",
"next": "12.1.6",
"prisma": "3.9.0",
"react": "18.0.0",
"react-dom": "18.0.0",

View File

@@ -1,7 +1,9 @@
save-exact=true
legacy-peer-deps=true
strict-peer-dependencies=false
side-effects-cache=false
public-hoist-pattern[]=next
public-hoist-pattern[]=secure-password
public-hoist-pattern[]=*jest*
public-hoist-pattern[]=@testing-library/*
# Needed for Blitz to work properly. Don't remove the lines above.

View File

@@ -20,7 +20,7 @@
"dependencies": {
"@blitzjs/next": "alpha",
"blitz": "alpha",
"next": "12.1.1",
"next": "12.1.6",
"react": "18.0.0",
"react-dom": "18.0.0",
"ts-node": "10.7.0"

View File

@@ -22,7 +22,7 @@
"dependencies": {
"@blitzjs/next": "alpha",
"blitz": "alpha",
"next": "12.1.1",
"next": "12.1.6",
"react": "18.0.0",
"react-dom": "18.0.0",
"ts-node": "10.7.0"

View File

@@ -25,7 +25,7 @@
"@typescript-eslint/parser": "5.9.1"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-alpha.27",
"@blitzjs/config": "2.0.0-alpha.29",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"react": "18.0.0",

803
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff