Switch from tsdx to preconstruct for DX/perf improvements (meta) (#2013)
* switch to preconstruct - still some issues * working! * cleanup * updates * use preconstruct for blitz package * most tests working * fix tests * cleanup * fix build script * remove lodash from core * fix * fix example tests * cleanup lodash * cleanup * clenaup * fix another way * fix lint
This commit is contained in:
@@ -6,7 +6,7 @@ module.exports = {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
project: `./tsconfig.json`,
|
||||
project: `./tsconfig.eslint.json`,
|
||||
},
|
||||
plugins: ["@typescript-eslint", "import", "unicorn", "simple-import-sort"],
|
||||
extends: ["react-app"],
|
||||
|
||||
24
babel.config.js
Normal file
24
babel.config.js
Normal file
@@ -0,0 +1,24 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
"@babel/preset-typescript",
|
||||
"@babel/preset-react",
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
modules: false,
|
||||
loose: true,
|
||||
exclude: [
|
||||
"@babel/plugin-transform-async-to-generator",
|
||||
"@babel/plugin-transform-regenerator",
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
plugins: [
|
||||
"babel-plugin-annotate-pure-calls",
|
||||
"babel-plugin-dev-expression",
|
||||
["@babel/plugin-proposal-class-properties", {loose: true}],
|
||||
"babel-plugin-macros",
|
||||
// ["babel-plugin-polyfill-regenerator", {method: "usage-pure"}],
|
||||
],
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import {resolver} from "blitz"
|
||||
import db from "db"
|
||||
import * as z from "zod"
|
||||
|
||||
const __Name__ = z
|
||||
.object({
|
||||
id: z.number(),
|
||||
})
|
||||
.nonstrict()
|
||||
|
||||
export default resolver.pipe(resolver.zod(__Name__), resolver.authorize(), async (input) => {
|
||||
// Do your stuff :)
|
||||
})
|
||||
@@ -3,6 +3,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||
enabled: process.env.ANALYZE === "true",
|
||||
})
|
||||
|
||||
// withPreconstruct only needed for our internal monorepo
|
||||
module.exports = withBundleAnalyzer({
|
||||
middleware: [
|
||||
sessionMiddleware({
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"cy:open": "cypress open",
|
||||
"cy:run": "cypress run || cypress run",
|
||||
"test": "prisma generate && yarn test:jest && yarn test:e2e",
|
||||
"test:jest": "jest",
|
||||
"test:jest": "jest --color",
|
||||
"test:server": "cross-env NODE_ENV=test blitz prisma migrate deploy --preview-feature && blitz build && cross-env NODE_ENV=test blitz start -p 3099",
|
||||
"test:e2e": "cross-env NODE_ENV=test start-server-and-test test:server http://localhost:3099 cy:run"
|
||||
},
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
"jsx": "preserve"
|
||||
},
|
||||
"exclude": ["node_modules", "cypress"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
"include": ["**/*.ts", "**/*.tsx"]
|
||||
}
|
||||
|
||||
1
examples/auth/types
Symbolic link
1
examples/auth/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
1
examples/custom-server/types
Symbolic link
1
examples/custom-server/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
1
examples/fauna/types
Symbolic link
1
examples/fauna/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
1
examples/no-prisma/types
Symbolic link
1
examples/no-prisma/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
1
examples/store/types
Symbolic link
1
examples/store/types
Symbolic link
@@ -0,0 +1 @@
|
||||
../../types
|
||||
@@ -1,16 +1,24 @@
|
||||
const {resolveAliases} = require("@blitzjs/config")
|
||||
|
||||
module.exports = {
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "node",
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "json"],
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
modulePathIgnorePatterns: ["<rootDir>/tmp", "<rootDir>/dist", "<rootDir>/templates"],
|
||||
moduleNameMapper: {
|
||||
...resolveAliases.node,
|
||||
moduleNameMapper: {},
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
|
||||
transform: {
|
||||
".(ts|tsx)$": require.resolve("ts-jest/dist"),
|
||||
".(js|jsx)$": require.resolve("babel-jest"), // jest's default
|
||||
},
|
||||
transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"],
|
||||
testMatch: ["<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}"],
|
||||
testURL: "http://localhost",
|
||||
watchPlugins: [
|
||||
require.resolve("jest-watch-typeahead/filename"),
|
||||
require.resolve("jest-watch-typeahead/testname"),
|
||||
],
|
||||
coverageReporters: ["json", "lcov", "text", "clover"],
|
||||
// collectCoverage: !!`Boolean(process.env.CI)`,
|
||||
collectCoverageFrom: ["src/**/*.ts"],
|
||||
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
|
||||
coveragePathIgnorePatterns: ["/templates/"],
|
||||
// coverageThreshold: {
|
||||
// global: {
|
||||
@@ -20,4 +28,10 @@ module.exports = {
|
||||
// statements: 100,
|
||||
// },
|
||||
// },
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: __dirname + "/tsconfig.test.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
63
package.json
63
package.json
@@ -12,40 +12,55 @@
|
||||
"**/@prisma/**"
|
||||
]
|
||||
},
|
||||
"preconstruct": {
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"!packages/cli",
|
||||
"!packages/eslint-config"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "npm rebuild husky && patch-package",
|
||||
"predev": "lerna run clean --no-private --stream --parallel",
|
||||
"dev": "lerna run dev --no-private --stream --parallel",
|
||||
"postinstall": "npm rebuild husky",
|
||||
"waitfortypes": "wait-on packages/core/dist/blitzjs-core.esm.js && wait-on packages/server/dist/blitzjs-server.esm.js",
|
||||
"dev:preconstruct": "preconstruct watch",
|
||||
"dev:tsc": "yarn waitfortypes && tsc --watch --pretty --preserveWatchOutput",
|
||||
"dev:cli": "yarn waitfortypes && yarn workspace @blitzjs/cli dev",
|
||||
"dev:templates": "yarn waitfortypes && yarn workspace @blitzjs/generator dev",
|
||||
"dev": "concurrently --names \"BUILD,TYPES,CLI,TEMPLATES\" -c \"blue,magenta,yellow,green\" \"npm:dev:preconstruct\" \"npm:dev:tsc\" \"npm:dev:cli\" \"npm:dev:templates\"",
|
||||
"build": "preconstruct build && lerna run build --scope @blitzjs/* && tsc",
|
||||
"lint": "eslint --ignore-path .gitignore --ignore-pattern types --ext \".js,.ts,.tsx\" .",
|
||||
"link-cli": "yarn workspace blitz link",
|
||||
"unlink-cli": "yarn workspace blitz unlink",
|
||||
"build": "lerna run build --no-private --stream",
|
||||
"lint": "eslint --ignore-path .gitignore --ext \".js,.ts,.tsx\" .",
|
||||
"test": "yarn run lint && yarn run build && lerna run test --stream",
|
||||
"test:packages": "yarn run build && yarn testonly:packages",
|
||||
"test:examples": "yarn run build && yarn testonly:examples",
|
||||
"testonly": "yarn test:packages && yarn test:examples",
|
||||
"testonly:packages": "lerna run test --scope blitz && lerna run test --stream --scope @blitzjs/*",
|
||||
"testonly:packages": "lerna run test --scope blitz && lerna run test --stream --parallel --scope @blitzjs/*",
|
||||
"testonly:examples": "lerna run test --stream --scope @examples/* --concurrency 1",
|
||||
"reset": "rimraf node_modules && git clean -xfd packages && yarn",
|
||||
"publish-prep": "lerna run clean && yarn && yarn build",
|
||||
"prepack": "cpy README.md packages/blitz/",
|
||||
"publish-prep": "yarn && yarn build",
|
||||
"prepack": "cpx README.md packages/blitz/",
|
||||
"postpack": "rimraf packages/blitz/README.md",
|
||||
"publish-local": "yarn workspaces run yalc publish",
|
||||
"publish-canary": "yarn run publish-prep && lerna publish --force-publish --preid canary --pre-dist-tag canary",
|
||||
"publish-latest": "yarn run publish-prep && lerna publish --force-publish",
|
||||
"publish-danger": "lerna publish --canary --pre-dist-tag danger --preid danger.$(git rev-parse --short HEAD) --allow-branch * --force-publish",
|
||||
"danger:push-all": "git push --no-verify && git push --no-verify --tags"
|
||||
"prerelease": "patch-package",
|
||||
"release": "release"
|
||||
},
|
||||
"resolutions-NOTE1": "typescript and ts-jest pinned to here overside tsdx included versions",
|
||||
"resolutions": {
|
||||
"typescript": "4.1.3",
|
||||
"ts-jest": "26.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dependencies": {
|
||||
"@babel/core": "7.13.1",
|
||||
"@babel/plugin-proposal-class-properties": "7.13.0",
|
||||
"@babel/preset-env": "7.13.5",
|
||||
"@babel/preset-react": "7.12.13",
|
||||
"@babel/preset-typescript": "7.13.0",
|
||||
"@manypkg/cli": "0.17.0",
|
||||
"@preconstruct/cli": "2.0.5",
|
||||
"@rollup/pluginutils": "4.1.0",
|
||||
"@size-limit/preset-small-lib": "4.9.2",
|
||||
"@testing-library/jest-dom": "5.11.9",
|
||||
"@testing-library/react": "11.2.3",
|
||||
"@testing-library/react-hooks": "4.0.1",
|
||||
@@ -64,19 +79,20 @@
|
||||
"@types/gulp-if": "0.0.33",
|
||||
"@types/ink-spinner": "3.0.0",
|
||||
"@types/jest": "26.0.20",
|
||||
"@types/module-alias": "2.0.0",
|
||||
"@types/jsonwebtoken": "8.5.0",
|
||||
"@types/lodash": "4.14.168",
|
||||
"@types/mem-fs": "1.1.2",
|
||||
"@types/mem-fs-editor": "7.0.0",
|
||||
"@types/merge-stream": "1.1.2",
|
||||
"@types/mock-fs": "4.13.0",
|
||||
"@types/module-alias": "2.0.0",
|
||||
"@types/node": "14.14.22",
|
||||
"@types/node-fetch": "2.5.8",
|
||||
"@types/parallel-transform": "1.1.0",
|
||||
"@types/passport": "1.0.5",
|
||||
"@types/pluralize": "0.0.29",
|
||||
"@types/prettier": "2.1.6",
|
||||
"@types/progress": "^2.0.3",
|
||||
"@types/pump": "1.1.0",
|
||||
"@types/pumpify": "1.4.1",
|
||||
"@types/react": "17.0.0",
|
||||
@@ -94,8 +110,11 @@
|
||||
"@wessberg/rollup-plugin-ts": "1.3.8",
|
||||
"babel-eslint": "10.x",
|
||||
"babel-jest": "26.6.3",
|
||||
"concurrently": "5.3.0",
|
||||
"cpy-cli": "3.1.1",
|
||||
"babel-plugin-annotate-pure-calls": "0.4.0",
|
||||
"babel-plugin-dev-expression": "0.2.2",
|
||||
"babel-plugin-macros": "3.0.1",
|
||||
"concurrently": "6.0.0",
|
||||
"cpx": "1.5.0",
|
||||
"cross-env": "7.0.3",
|
||||
"cypress": "6.2.1",
|
||||
"debug": "4.3.1",
|
||||
@@ -113,9 +132,8 @@
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"eslint-plugin-simple-import-sort": "7.0.0",
|
||||
"eslint-plugin-unicorn": "26.0.1",
|
||||
"eslint_d": "10.0.0",
|
||||
"husky": "4.3.8",
|
||||
"@size-limit/preset-small-lib": "4.9.2",
|
||||
"size-limit": "4.9.2",
|
||||
"jest": "26.6.3",
|
||||
"jest-environment-jsdom-sixteen": "1.0.3",
|
||||
"lerna": "3.22.1",
|
||||
@@ -139,15 +157,14 @@
|
||||
"rollup-plugin-node-resolve": "5.2.0",
|
||||
"rollup-plugin-peer-deps-external": "2.2.4",
|
||||
"semver": "7.3.4",
|
||||
"size-limit": "4.9.2",
|
||||
"stdout-stderr": "0.1.13",
|
||||
"test-listen": "1.1.0",
|
||||
"ts-jest": "26.5.0",
|
||||
"tsdx": "0.14.1",
|
||||
"tslib": "2.1.0",
|
||||
"typescript": "4.1.3",
|
||||
"wait-on": "5.2.1",
|
||||
"yalc": "1.0.0-pre.49",
|
||||
"eslint_d": "10.0.0"
|
||||
"yalc": "1.0.0-pre.49"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
@@ -2,29 +2,24 @@
|
||||
"name": "@blitzjs/babel-preset",
|
||||
"version": "0.30.6",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "jest --passWithNoTests --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"module": "dist/blitzjs-babel-preset.esm.js",
|
||||
"main": "dist/blitzjs-babel-preset.cjs.js",
|
||||
"typings": "dist/blitzjs-babel-preset.cjs.d.ts",
|
||||
"author": "Brandon Bayer",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --passWithNoTests",
|
||||
"test:watch": "tsdx test --watch --passWithNoTests",
|
||||
"size": "size-limit",
|
||||
"analyze": "size-limit --why"
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"author": "Brandon Bayer",
|
||||
"module": "dist/babel-preset.esm.js",
|
||||
"size-limit": [
|
||||
{
|
||||
"path": "dist/babel-preset.cjs.production.min.js",
|
||||
@@ -36,6 +31,10 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-plugin-superjson-next": "0.2.2"
|
||||
"babel-plugin-superjson-next": "0.2.2",
|
||||
"@babel/helper-module-imports": "^7.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ if (process.env.INSPECT_BRK === 'true') {
|
||||
}
|
||||
|
||||
try {
|
||||
const cliBin = require.resolve('../dist/cli')
|
||||
const cliBin = require.resolve('../cli/dist/blitz-cli.cjs')
|
||||
const binArgs = process.argv.slice(2)
|
||||
const result = spawn.sync('node', [...nodeOpts, cliBin, ...binArgs], { stdio: 'inherit' })
|
||||
process.exit(result.status)
|
||||
|
||||
4
packages/blitz/cli/package.json
Normal file
4
packages/blitz/cli/package.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "dist/blitz-cli.cjs.js",
|
||||
"module": "dist/blitz-cli.esm.js"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
const path = require("path")
|
||||
const {pathsToModuleNameMapper} = require("ts-jest/utils")
|
||||
const {getProjectRoot, resolveAliases} = require("@blitzjs/config")
|
||||
const {getProjectRoot} = require("@blitzjs/config")
|
||||
const projectRoot = getProjectRoot()
|
||||
const {compilerOptions} = require(path.join(projectRoot, "tsconfig"))
|
||||
|
||||
@@ -27,7 +27,6 @@ const common = {
|
||||
// Ignore the build directories
|
||||
modulePathIgnorePatterns: ["<rootDir>/.blitz", "<rootDir>/.next"],
|
||||
moduleNameMapper: {
|
||||
...resolveAliases.node,
|
||||
// This ensures any path aliases in tsconfig also work in jest
|
||||
...pathsToModuleNameMapper(compilerOptions.paths || {}),
|
||||
"\\.(css|less|sass|scss)$": path.resolve(__dirname, "./jest-preset/identity-obj-proxy.js"),
|
||||
|
||||
3
packages/blitz/jest.config.js
Normal file
3
packages/blitz/jest.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
}
|
||||
@@ -4,25 +4,29 @@
|
||||
"version": "0.30.6",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"predev": "wait-on ../core/dist/packages/core/src/index.d.ts && wait-on ../server/dist/packages/server/src/index.d.ts && wait-on ../generator/dist/packages/generator/src/index.d.ts && wait-on ../cli/lib/src/index.js",
|
||||
"dev": "rollup -c rollup.config.js --watch",
|
||||
"build": "rollup -c rollup.config.js",
|
||||
"test": "tsdx test"
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"preconstruct": {
|
||||
"entrypoints": [
|
||||
"index.ts",
|
||||
"cli.ts"
|
||||
]
|
||||
},
|
||||
"bin": {
|
||||
"blitz": "./bin/blitz"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"main": "dist/blitz.cjs.js",
|
||||
"module": "dist/blitz.esm.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"types": "dist/blitz.cjs.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"cli",
|
||||
"jest-preset.js",
|
||||
"jest-preset",
|
||||
"babel.js"
|
||||
@@ -55,6 +59,7 @@
|
||||
"@testing-library/react": "^11.2.3",
|
||||
"@testing-library/react-hooks": "^4.0.1",
|
||||
"@types/jest": "^26.0.20",
|
||||
"chalk": "^4.1.0",
|
||||
"envinfo": "^7.7.3",
|
||||
"eslint-config-blitz": "0.30.6",
|
||||
"jest": "^26.6.3",
|
||||
|
||||
@@ -2,7 +2,7 @@ import chalk from "chalk"
|
||||
import * as path from "path"
|
||||
import pkgDir from "pkg-dir"
|
||||
import resolveFrom from "resolve-from"
|
||||
import {parseSemver} from "../utils/parse-semver"
|
||||
import {parseSemver} from "./utils/parse-semver"
|
||||
|
||||
async function main() {
|
||||
const options = require("minimist")(process.argv.slice(2))
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
// collectCoverage: !!`Boolean(process.env.CI)`,
|
||||
modulePathIgnorePatterns: ["<rootDir>/tmp", "<rootDir>/lib"],
|
||||
modulePathIgnorePatterns: ["<rootDir>/tmp", "<rootDir>/lib", "<rootDir>/commands/.test"],
|
||||
testPathIgnorePatterns: ["src/commands/test.ts"],
|
||||
testTimeout: 30000,
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: "test/tsconfig.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,16 +4,9 @@
|
||||
"version": "0.30.6",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"b": "./bin/run",
|
||||
"clean": "rimraf lib",
|
||||
"predev": "yarn wait:installer && yarn wait:server && yarn wait:generator && yarn wait:repl",
|
||||
"wait:generator": "wait-on ../generator/dist/packages/generator/src/index.d.ts",
|
||||
"wait:server": "wait-on ../server/dist/packages/server/src/index.d.ts",
|
||||
"wait:installer": "wait-on ../installer/dist/packages/installer/src/index.d.ts",
|
||||
"wait:repl": "wait-on ../repl/dist/packages/repl/src/index.d.ts",
|
||||
"dev": "rimraf lib && tsc --watch --preserveWatchOutput",
|
||||
"build": "rimraf lib && tsc",
|
||||
"test": "tsdx test",
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch",
|
||||
"cypress:open": "cypress open",
|
||||
"cypress:run": "cypress run"
|
||||
|
||||
@@ -142,8 +142,9 @@ export class New extends Command {
|
||||
const {"dry-run": dryRun, "skip-install": skipInstall, npm} = flags
|
||||
const needsInstall = dryRun || skipInstall
|
||||
const postInstallSteps = [`cd ${args.name}`]
|
||||
const AppGenerator = require("@blitzjs/generator").AppGenerator
|
||||
|
||||
const generator = new (require("@blitzjs/generator").AppGenerator)({
|
||||
const generator = new AppGenerator({
|
||||
destinationRoot,
|
||||
appName,
|
||||
dryRun,
|
||||
|
||||
@@ -3,10 +3,6 @@ const cacheFile = require("path").join(__dirname, ".blitzjs-cli-cache")
|
||||
const lazyLoad = require("@salesforce/lazy-require").default.create(cacheFile)
|
||||
lazyLoad.start()
|
||||
import {run as oclifRun} from "@oclif/command"
|
||||
import moduleAlias from "module-alias"
|
||||
import {resolveAliases} from "@blitzjs/config"
|
||||
|
||||
moduleAlias.addAliases(resolveAliases.node)
|
||||
|
||||
// Load the .env environment variable so it's available for all commands
|
||||
require("dotenv-expand")(require("dotenv-flow").config({silent: true}))
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"types": ["jest"],
|
||||
"target": "es6"
|
||||
},
|
||||
"references": [{"path": ".."}]
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2015",
|
||||
"lib": ["dom", "dom.iterable", "ES2018"],
|
||||
"rootDir": ".",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"rootDir": ".",
|
||||
"outDir": "lib",
|
||||
"declaration": false,
|
||||
"sourceMap": false,
|
||||
"esModuleInterop": true,
|
||||
"types": [],
|
||||
"isolatedModules": false,
|
||||
"noEmit": false,
|
||||
"lib": ["dom", "dom.iterable", "ES2018"]
|
||||
"incremental": true
|
||||
},
|
||||
"include": ["src/**/*", "types", "../../types"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": ["src/**/*", "types", "../../types"]
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = {}
|
||||
@@ -4,25 +4,15 @@
|
||||
"description": "Loads the blitz app config",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --env=jest-environment-jsdom-sixteen --passWithNoTests",
|
||||
"test:watch": "tsdx test --watch --env=jest-environment-jsdom-sixteen"
|
||||
"test": "jest --passWithNoTests",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"browser": "index-browser.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/config.esm.js",
|
||||
"types": "dist/packages/config/src/index.d.ts",
|
||||
"main": "dist/blitzjs-config.cjs.js",
|
||||
"module": "dist/blitzjs-config.esm.js",
|
||||
"types": "dist/blitzjs-config.cjs.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"index-browser.js"
|
||||
"dist"
|
||||
],
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest.setup.js"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"next.config.js",
|
||||
"blitz.config.js",
|
||||
@@ -35,6 +25,8 @@
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922",
|
||||
"dependencies": {
|
||||
"fs-extra": "9.1.0",
|
||||
"pkg-dir": "^5.0.0",
|
||||
"module-alias": "2.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {readJSONSync} from "fs-extra"
|
||||
import {existsSync, readJSONSync} from "fs-extra"
|
||||
import {join} from "path"
|
||||
import path from "path"
|
||||
import pkgDir from "pkg-dir"
|
||||
@@ -7,20 +7,18 @@ export function getProjectRoot() {
|
||||
return pkgDir.sync() || process.cwd()
|
||||
}
|
||||
|
||||
const projectRoot = getProjectRoot()
|
||||
export function getConfigFilePath() {
|
||||
const projectRoot = getProjectRoot()
|
||||
const bConfig = path.join(projectRoot, "blitz.config.js")
|
||||
const nConfig = path.join(projectRoot, "next.config.js")
|
||||
|
||||
export const resolveAliases = {
|
||||
node: {
|
||||
"__blitz__/config-file": path.join(projectRoot, "blitz.config.js"),
|
||||
},
|
||||
webpack: {
|
||||
// In webpack build, next.config.js is always present which wraps blitz.config.js
|
||||
"__blitz__/config-file": path.join(projectRoot, "next.config.js"),
|
||||
},
|
||||
if (existsSync(nConfig)) {
|
||||
return nConfig
|
||||
} else {
|
||||
return bConfig
|
||||
}
|
||||
}
|
||||
|
||||
require("module-alias").addAliases(resolveAliases.node)
|
||||
|
||||
export interface BlitzConfig extends Record<string, unknown> {
|
||||
target?: string
|
||||
experimental?: {
|
||||
@@ -65,7 +63,7 @@ export const getConfig = (reload?: boolean): BlitzConfig => {
|
||||
let loadedConfig = {}
|
||||
try {
|
||||
// eslint-disable-next-line no-eval -- block webpack from following this module path
|
||||
file = eval("require")("__blitz__/config-file")
|
||||
file = eval("require")(getConfigFilePath())
|
||||
if (typeof file === "function") {
|
||||
const phase =
|
||||
process.env.NODE_ENV === "production" ? PHASE_PRODUCTION_SERVER : PHASE_DEVELOPMENT_SERVER
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
module.exports = {
|
||||
rollup(config, options) {
|
||||
config.onwarn = (warning, warn) => {
|
||||
if (warning.code === "EVAL" && /[/\\](index.ts)$/.test(warning.loc.file)) {
|
||||
return
|
||||
}
|
||||
warn(warning)
|
||||
}
|
||||
return config
|
||||
},
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
testEnvironment: "jest-environment-jsdom-sixteen",
|
||||
}
|
||||
|
||||
@@ -4,43 +4,22 @@
|
||||
"version": "0.30.6",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"wait:display": "wait-on ../display/dist/packages/display/src/index.d.ts",
|
||||
"predev": "yarn wait:display",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --env=jest-environment-jsdom-sixteen",
|
||||
"test:watch": "tsdx test --watch --env=jest-environment-jsdom-sixteen"
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Michael Edelman",
|
||||
"email": "michael@fabulas.io",
|
||||
"url": "https://twitter.com/edelman215"
|
||||
}
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/core.esm.js",
|
||||
"types": "dist/packages/core/src/index.d.ts",
|
||||
"main": "dist/blitzjs-core.cjs.js",
|
||||
"module": "dist/blitzjs-core.esm.js",
|
||||
"types": "dist/blitzjs-core.cjs.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest.setup.js"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/blitz-js/blitz"
|
||||
},
|
||||
"repository": "https://github.com/blitz-js/blitz",
|
||||
"dependencies": {
|
||||
"@blitzjs/display": "0.30.6",
|
||||
"@types/htmlescape": "^1.1.1",
|
||||
"@types/secure-password": "3.1.0",
|
||||
"b64-lite": "^1.4.0",
|
||||
@@ -48,8 +27,7 @@
|
||||
"cookie-session": "^1.4.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"htmlescape": "^1.1.1",
|
||||
"lodash": "^4.17.20",
|
||||
"lodash-es": "^4.17.20",
|
||||
"lodash.frompairs": "4.0.1",
|
||||
"npm-which": "^3.0.1",
|
||||
"passport": "0.4.1",
|
||||
"react-query": "2.5.12",
|
||||
@@ -57,5 +35,12 @@
|
||||
"superjson": "1.7.2",
|
||||
"zod": ">=1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blitzjs/config": "0.30.6",
|
||||
"@blitzjs/display": "0.30.6",
|
||||
"nanoid": "*",
|
||||
"next": "*",
|
||||
"react": "*"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ export {withBlitzAppRoot} from "./blitz-app-root"
|
||||
export {useQuery, usePaginatedQuery, useInfiniteQuery} from "./use-query-hooks"
|
||||
export {getQueryKey, invalidateQuery, setQueryData} from "./utils/react-query-utils"
|
||||
export {useParam, useParams} from "./use-params"
|
||||
export {withRouter, RouterContext, BlitzRouter} from "./with-router"
|
||||
export {withRouter, RouterContext} from "./with-router"
|
||||
export type {BlitzRouter} from "./with-router"
|
||||
export {useRouter} from "./use-router"
|
||||
export {useRouterQuery} from "./use-router-query"
|
||||
export {passportAuth} from "./passport-adapter"
|
||||
@@ -15,22 +16,24 @@ export {getIsomorphicEnhancedResolver} from "./rpc"
|
||||
export {useMutation} from "./use-mutation"
|
||||
export {invoke, invokeWithMiddleware} from "./invoke"
|
||||
export {getBlitzRuntimeData} from "./blitz-data"
|
||||
export {resolver, AuthenticatedMiddlewareCtx} from "./resolver"
|
||||
export {resolver} from "./resolver"
|
||||
export type {AuthenticatedMiddlewareCtx} from "./resolver"
|
||||
export {paginate} from "./server-utils"
|
||||
|
||||
export {
|
||||
getAllMiddlewareForModule,
|
||||
handleRequestWithMiddleware,
|
||||
connectMiddleware,
|
||||
Ctx,
|
||||
DefaultCtx,
|
||||
} from "./middleware"
|
||||
export type {Ctx, DefaultCtx} from "./middleware"
|
||||
export {
|
||||
getAntiCSRFToken,
|
||||
useSession,
|
||||
useAuthenticatedSession,
|
||||
useAuthorize,
|
||||
useRedirectAuthenticated,
|
||||
} from "./supertokens"
|
||||
export type {
|
||||
SessionConfig,
|
||||
SessionContext,
|
||||
AuthenticatedSessionContext,
|
||||
|
||||
@@ -3,23 +3,20 @@
|
||||
// --------------------
|
||||
export {default as Head} from "next/head"
|
||||
|
||||
export {default as Link, LinkProps} from "next/link"
|
||||
export {default as Link} from "next/link"
|
||||
export type {LinkProps} from "next/link"
|
||||
|
||||
export {default as Router} from "next/router"
|
||||
|
||||
export {default as Image, ImageProps} from "next/image"
|
||||
export {default as Image} from "next/image"
|
||||
export type {ImageProps} from "next/image"
|
||||
|
||||
export {
|
||||
default as Document,
|
||||
Html,
|
||||
Head as DocumentHead,
|
||||
Main,
|
||||
DocumentContext,
|
||||
DocumentInitialProps,
|
||||
} from "next/document"
|
||||
export {default as Document, Html, Head as DocumentHead, Main} from "next/document"
|
||||
export type {DocumentContext, DocumentInitialProps} from "next/document"
|
||||
|
||||
export {default as dynamic} from "next/dynamic"
|
||||
|
||||
export {default as ErrorComponent, ErrorProps} from "next/error"
|
||||
export {default as ErrorComponent} from "next/error"
|
||||
export type {ErrorProps} from "next/error"
|
||||
|
||||
export {default as getConfig} from "next/config"
|
||||
|
||||
@@ -14,7 +14,7 @@ import {BlitzRuntimeData} from "./blitz-data"
|
||||
import {useParams} from "./use-params"
|
||||
import {useRouterQuery} from "./use-router-query"
|
||||
|
||||
export {
|
||||
export type {
|
||||
GetServerSideProps,
|
||||
GetServerSidePropsResult,
|
||||
GetStaticPaths,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {fromPairs} from "lodash"
|
||||
import fromPairs from "lodash.frompairs"
|
||||
import {useRouter} from "next/router"
|
||||
import {useMemo} from "react"
|
||||
import {Dict, ParsedUrlQuery, ParsedUrlQueryValue} from "./types"
|
||||
|
||||
@@ -8,10 +8,10 @@ import {
|
||||
usePaginatedQuery as usePaginatedReactQuery,
|
||||
useQuery as useReactQuery,
|
||||
} from "react-query"
|
||||
import {isClient} from "./utils"
|
||||
import {useSession} from "./supertokens"
|
||||
import {FirstParam, PromiseReturnType, QueryFn} from "./types"
|
||||
import {useRouter} from "./use-router"
|
||||
import {isClient} from "./utils"
|
||||
import {
|
||||
emptyQueryFn,
|
||||
getQueryCacheFunctions,
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface BlitzRouter extends NextRouter {
|
||||
params: ReturnType<typeof extractRouterParams>
|
||||
}
|
||||
|
||||
interface WithRouterProps {
|
||||
export interface WithRouterProps {
|
||||
router: BlitzRouter
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types", "test", "../../types"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
rollup(config, options) {
|
||||
return config
|
||||
},
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = {}
|
||||
3
packages/display/jest.config.js
Normal file
3
packages/display/jest.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
}
|
||||
@@ -5,26 +5,19 @@
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"wait:config": "wait-on ../config/dist/packages/config/src/index.d.ts",
|
||||
"predev": "yarn wait:config",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test",
|
||||
"test:watch": "tsdx test --watch"
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"browser": "index-browser.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/display.esm.js",
|
||||
"types": "dist/packages/display/src/index.d.ts",
|
||||
"main": "dist/blitzjs-display.cjs.js",
|
||||
"module": "dist/blitzjs-display.esm.js",
|
||||
"types": "dist/blitzjs-display.cjs.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"index-browser.js"
|
||||
"dist"
|
||||
],
|
||||
"keywords": [
|
||||
"blitz",
|
||||
@@ -39,6 +32,10 @@
|
||||
"chalk": "^4.1.0",
|
||||
"console-table-printer": "^2.7.5",
|
||||
"ora": "^5.3.0",
|
||||
"readline": "1.3.0",
|
||||
"tslog": "^3.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blitzjs/config": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export {}
|
||||
|
||||
it("should do nothing", () => {
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
"description": "Blitz.js eslint config",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"test": "echo \"No tests\""
|
||||
},
|
||||
"files": [
|
||||
|
||||
3
packages/file-pipeline/jest.config.js
Normal file
3
packages/file-pipeline/jest.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
}
|
||||
0
packages/file-pipeline/jest.setup.js
Normal file
0
packages/file-pipeline/jest.setup.js
Normal file
@@ -5,21 +5,17 @@
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"wait:display": "wait-on ../display/dist/packages/display/src/index.d.ts",
|
||||
"predev": "yarn wait:display",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test",
|
||||
"test:watch": "tsdx test --watch"
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/file-pipeline.esm.js",
|
||||
"types": "dist/packages/file-pipeline/src/index.d.ts",
|
||||
"main": "dist/blitzjs-file-pipeline.cjs.js",
|
||||
"module": "dist/blitzjs-file-pipeline.esm.js",
|
||||
"types": "dist/blitzjs-file-pipeline.cjs.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
@@ -32,14 +28,15 @@
|
||||
"url": "git+https://github.com/blitz-js/blitz.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/display": "0.30.6",
|
||||
"chalk": "^4.1.0",
|
||||
"chokidar": "3.5.1",
|
||||
"flush-write-stream": "2.0.0",
|
||||
"from2": "2.3.0",
|
||||
"fs-extra": "^9.1.0",
|
||||
"gulp-if": "3.0.0",
|
||||
"lodash": "^4.0.0",
|
||||
"merge-stream": "2.0.0",
|
||||
"micromatch": "4.0.2",
|
||||
"parallel-transform": "1.2.0",
|
||||
"pump": "3.0.0",
|
||||
"pumpify": "2.0.1",
|
||||
@@ -48,5 +45,8 @@
|
||||
"vinyl": "2.2.1",
|
||||
"vinyl-file": "3.0.0",
|
||||
"vinyl-fs": "3.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blitzjs/display": "0.30.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
export {transformFiles} from "./transform-files"
|
||||
export {Stage, PipelineItem, RouteCacheEntry} from "./types"
|
||||
export * from "./events"
|
||||
export {transform} from "./transform"
|
||||
export {FileCache} from "./helpers/file-cache"
|
||||
export {RouteCache} from "./helpers/route-cache"
|
||||
export {rimraf} from "./helpers/rimraf-promise"
|
||||
|
||||
export * from "./types"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: "test/tsconfig.json",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
0
packages/generator/jest.setup.js
Normal file
0
packages/generator/jest.setup.js
Normal file
@@ -4,27 +4,24 @@
|
||||
"description": "File generation for the Blitz CLI",
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"predev": "wait-on ../server/dist/packages/server/src/index.d.ts",
|
||||
"dev": "run-p watch build:templates",
|
||||
"watch": "tsdx watch --verbose",
|
||||
"build": "tsdx build && yarn build:templates",
|
||||
"build:templates": "wait-on dist/index.js && rimraf dist/templates/** && rimraf templates/**/node_modules && cpy --dot --parents '!/node_modules/' templates dist",
|
||||
"test": "tsdx test",
|
||||
"test:watch": "tsdx test --watch"
|
||||
"dev": "yarn build:templates --watch",
|
||||
"build": "yarn build:templates",
|
||||
"build:templates": "cpx --clean \"templates/**/{.*,*}\" dist/templates",
|
||||
"test": "jest --color --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/generator.esm.js",
|
||||
"types": "dist/packages/generator/src/index.d.ts",
|
||||
"main": "dist/blitzjs-generator.cjs.js",
|
||||
"module": "dist/blitzjs-generator.esm.js",
|
||||
"types": "dist/blitzjs-generator.cjs.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"keywords": [
|
||||
"blitz",
|
||||
"generator"
|
||||
@@ -54,5 +51,8 @@
|
||||
"username": "^5.1.0",
|
||||
"vinyl": "2.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"prettier": "*"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922"
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import getBabelOptions, {Overrides} from "recast/parsers/_babel_options"
|
||||
import * as babelParser from "recast/parsers/babel"
|
||||
import {ConflictChecker} from "./conflict-checker"
|
||||
import {pipe} from "./utils/pipe"
|
||||
const debug = require("debug")("blitz:generator")
|
||||
|
||||
export const customTsParser = {
|
||||
parse(source: string, options?: Overrides) {
|
||||
@@ -136,6 +137,7 @@ export abstract class Generator<
|
||||
constructor(protected readonly options: T) {
|
||||
super()
|
||||
|
||||
this.options = options
|
||||
this.store = createStore()
|
||||
this.fs = createEditor(this.store)
|
||||
this.enquirer = new Enquirer()
|
||||
@@ -188,6 +190,7 @@ export abstract class Generator<
|
||||
templateValues: any,
|
||||
prettierOptions: import("prettier").Options | undefined,
|
||||
): string | Buffer {
|
||||
debug("Generator.process...")
|
||||
if (new RegExp(`${ignoredExtensions.join("|")}$`).test(pathEnding)) {
|
||||
return input
|
||||
}
|
||||
@@ -225,6 +228,7 @@ export abstract class Generator<
|
||||
}
|
||||
|
||||
async write(): Promise<void> {
|
||||
debug("Generator.write...")
|
||||
const paths = readDirRecursive(this.sourcePath(), (name) => {
|
||||
const additionalFilesToIgnore = this.filesToIgnore()
|
||||
return ![...alwaysIgnoreFiles, ...additionalFilesToIgnore].includes(name)
|
||||
@@ -275,6 +279,7 @@ export abstract class Generator<
|
||||
}
|
||||
|
||||
async run(): Promise<string | void> {
|
||||
debug("Generator.run...", {options: this.options})
|
||||
if (!this.options.dryRun) {
|
||||
await fs.ensureDir(this.options.destinationRoot!)
|
||||
process.chdir(this.options.destinationRoot!)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "test", "../../types"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"declaration": true,
|
||||
"downlevelIteration": true,
|
||||
"esModuleInterop": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: "test/tsconfig.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
0
packages/installer/jest.setup.js
Normal file
0
packages/installer/jest.setup.js
Normal file
@@ -5,23 +5,17 @@
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"predev": "yarn wait:server && yarn wait:generator",
|
||||
"wait:generator": "wait-on ../generator/dist/packages/generator/src/index.d.ts",
|
||||
"wait:server": "wait-on ../server/dist/packages/server/src/index.d.ts",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test --no-color",
|
||||
"test:watch": "tsdx test --watch"
|
||||
"test": "jest --no-color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"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/installer/src/index.d.ts",
|
||||
"main": "dist/blitzjs-installer.cjs.js",
|
||||
"module": "dist/blitzjs-installer.esm.js",
|
||||
"types": "dist/blitzjs-installer.cjs.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
||||
@@ -12,7 +12,7 @@ type ExecutorConfig =
|
||||
| FileTransformExecutor.Config
|
||||
| NewFileExecutor.Config
|
||||
|
||||
export {ExecutorConfig as ExecutorConfigUnion}
|
||||
export type {ExecutorConfig as ExecutorConfigUnion}
|
||||
|
||||
export class RecipeExecutor<Options extends RecipeMeta> {
|
||||
private readonly steps: ExecutorConfig[]
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"types": ["jest"],
|
||||
"target": "es6"
|
||||
},
|
||||
"references": [{"path": ".."}]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "types", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "../../jest.config.js",
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: "test/tsconfig.json",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
0
packages/repl/jest.setup.js
Normal file
0
packages/repl/jest.setup.js
Normal file
@@ -5,22 +5,17 @@
|
||||
"homepage": "https://github.com/blitz-js/blitz/packages/repl/#readme",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"wait:config": "wait-on ../config/dist/packages/config/src/index.d.ts",
|
||||
"predev": "yarn wait:config",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test",
|
||||
"test:watch": "tsdx test --watch"
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/repl.esm.js",
|
||||
"types": "dist/packages/repl/src/index.d.ts",
|
||||
"main": "dist/blitzjs-repl.cjs.js",
|
||||
"module": "dist/blitzjs-repl.esm.js",
|
||||
"types": "dist/blitzjs-repl.cjs.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
@@ -33,14 +28,13 @@
|
||||
"url": "git+https://github.com/blitz-js/blitz.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/config": "0.30.6",
|
||||
"chokidar": "3.5.1",
|
||||
"globby": "11.0.2",
|
||||
"pkg-dir": "^5.0.0",
|
||||
"progress": "^2.0.3"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922",
|
||||
"devDependencies": {
|
||||
"@types/progress": "^2.0.3"
|
||||
}
|
||||
"peerDependencies": {
|
||||
"@blitzjs/config": "0.30.6"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922"
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"types": ["jest"],
|
||||
"target": "es6"
|
||||
},
|
||||
"references": [{"path": ".."}]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"declaration": true,
|
||||
"downlevelIteration": true,
|
||||
"esModuleInterop": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = {}
|
||||
@@ -7,34 +7,21 @@
|
||||
"next-patched": "./bin/next-patched"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"wait:file-pipeline": "wait-on ../file-pipeline/dist/packages/file-pipeline/src/index.d.ts",
|
||||
"wait:core": "wait-on ../core/dist/packages/core/src/index.d.ts",
|
||||
"wait:config": "wait-on ../config/dist/packages/config/src/index.d.ts",
|
||||
"predev": "yarn wait:config && yarn wait:file-pipeline && yarn wait:core",
|
||||
"dev": "tsdx watch --verbose",
|
||||
"build": "tsdx build",
|
||||
"test": "tsdx test"
|
||||
"test": "jest --color",
|
||||
"test:watch": "jest --watch"
|
||||
},
|
||||
"author": {
|
||||
"name": "Brandon Bayer",
|
||||
"email": "b@bayer.ws",
|
||||
"url": "https://twitter.com/flybayer"
|
||||
},
|
||||
"browser": "index-browser.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/server.esm.js",
|
||||
"types": "dist/packages/server/src/index.d.ts",
|
||||
"main": "dist/blitzjs-server.cjs.js",
|
||||
"module": "dist/blitzjs-server.esm.js",
|
||||
"types": "dist/blitzjs-server.cjs.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"register",
|
||||
"index-browser.js"
|
||||
"register"
|
||||
],
|
||||
"jest": {
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest.setup.js"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/file-pipeline": "0.30.6",
|
||||
"b64-lite": "^1.4.0",
|
||||
@@ -47,9 +34,11 @@
|
||||
"flush-write-stream": "2.0.0",
|
||||
"from2": "2.3.0",
|
||||
"gulp-if": "3.0.0",
|
||||
"chalk": "^4.1.0",
|
||||
"fs-extra": "9.1.0",
|
||||
"module-alias": "2.2.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"lodash": "^4.17.20",
|
||||
"lodash-es": "^4.17.20",
|
||||
"lodash": "^4.0.0",
|
||||
"nanoid": "^3.1.20",
|
||||
"next": "10.0.7",
|
||||
"null-loader": "4.0.1",
|
||||
@@ -67,8 +56,12 @@
|
||||
"vinyl": "2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/core": "0.30.6",
|
||||
"next-transpile-modules": "6.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blitzjs/core": "0.30.6",
|
||||
"@blitzjs/config": "0.30.6",
|
||||
"@blitzjs/display": "0.30.6"
|
||||
},
|
||||
"gitHead": "d3b9fce0bdd251c2b1890793b0aa1cd77c1c0922"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ export {build} from "./build"
|
||||
export {dev} from "./dev"
|
||||
export {prod} from "./prod"
|
||||
export {routes} from "./routes"
|
||||
export {normalize, ServerConfig} from "./config"
|
||||
export {normalize} from "./config"
|
||||
export type {ServerConfig} from "./config"
|
||||
export {resolveBinAsync} from "./resolve-bin-async"
|
||||
export {ManifestLoader} from "./stages/manifest"
|
||||
export * from "./rpc"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {FileCache, RouteCache} from "@blitzjs/file-pipeline"
|
||||
import {StageArgs, StageConfig} from "@blitzjs/file-pipeline/dist/packages/file-pipeline/src/types"
|
||||
import {StageArgs, StageConfig} from "@blitzjs/file-pipeline"
|
||||
import {pipeline, through} from "../streams"
|
||||
|
||||
export function mockStageArgs(a: {entries?: string[]; cwd?: string}): StageArgs {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import {getProjectRoot, resolveAliases} from "@blitzjs/config"
|
||||
import {getProjectRoot} from "@blitzjs/config"
|
||||
import fs from "fs"
|
||||
import moduleAlias from "module-alias"
|
||||
import path from "path"
|
||||
|
||||
moduleAlias.addAliases(resolveAliases.node)
|
||||
|
||||
export function withBlitz(nextConfig: any) {
|
||||
return (phase: string, nextOpts: any = {}) => {
|
||||
// Need to grab the normalized config based on the phase
|
||||
@@ -21,11 +18,11 @@ export function withBlitz(nextConfig: any) {
|
||||
// ----------------------
|
||||
// Set up resolve aliases
|
||||
// ----------------------
|
||||
config.resolve ??= {}
|
||||
config.resolve.alias ??= {}
|
||||
for (const [from, to] of Object.entries(resolveAliases.webpack)) {
|
||||
config.resolve.alias[from] = to
|
||||
}
|
||||
// config.resolve ??= {}
|
||||
// config.resolve.alias ??= {}
|
||||
// for (const [from, to] of Object.entries(resolveAliases.webpack)) {
|
||||
// config.resolve.alias[from] = to
|
||||
// }
|
||||
|
||||
if (options.isServer) {
|
||||
const originalEntry = config.entry
|
||||
@@ -44,6 +41,10 @@ export function withBlitz(nextConfig: any) {
|
||||
/node_modules[\\/]cross-spawn/,
|
||||
/node_modules[\\/]node-libs-browser/,
|
||||
/node_modules[\\/]crypto-browserify/,
|
||||
/@blitzjs[\\/]display/,
|
||||
/@blitzjs[\\/]config/,
|
||||
/blitz[\\/]packages[\\/]config/,
|
||||
/blitz[\\/]packages[\\/]display/,
|
||||
]
|
||||
excluded.forEach((excluded) => {
|
||||
config.module.rules.push({test: excluded, use: {loader: "null-loader"}})
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
jest.mock("@blitzjs/config", () => {
|
||||
return {
|
||||
getConfig: jest.fn().mockReturnValue({}),
|
||||
resolveAliases: {
|
||||
node: {},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src", "test"],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"declarationDir": "./dist",
|
||||
"downlevelIteration": true,
|
||||
"paths": {
|
||||
"*": ["src/*", "node_modules/*"]
|
||||
},
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
module.exports = {
|
||||
rollup(config, options) {
|
||||
config.onwarn = (warning, warn) => {
|
||||
if (warning.code === "EVAL" && /[/\\](supertokens.ts)$/.test(warning.loc.file)) {
|
||||
return
|
||||
}
|
||||
warn(warning)
|
||||
}
|
||||
return config
|
||||
},
|
||||
}
|
||||
4
tsconfig.eslint.json
Normal file
4
tsconfig.eslint.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["**/*"]
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "ES2017",
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"importHelpers": true,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"rootDir": "./",
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"skipLibCheck": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
@@ -21,6 +21,23 @@
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true,
|
||||
"noEmit": true
|
||||
}
|
||||
"noEmit": true,
|
||||
"isolatedModules": true,
|
||||
"incremental": true
|
||||
},
|
||||
"include": [
|
||||
"types/**/*",
|
||||
"packages/babel-preset/src/**/*",
|
||||
"packages/blitz/src/**/*",
|
||||
"packages/config/src/**/*",
|
||||
"packages/core/src/**/*",
|
||||
"packages/display/src/**/*",
|
||||
"packages/file-pipeline/src/**/*",
|
||||
"packages/generator/src/**/*",
|
||||
"packages/installer/src/**/*",
|
||||
"packages/repl/src/**/*",
|
||||
"packages/server/src/**/*",
|
||||
"recipes/*"
|
||||
],
|
||||
"exclude": ["*.test.ts", "*.test.tsx"]
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"extends": "../tsconfig",
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"types": ["jest"],
|
||||
"target": "es6"
|
||||
"types": ["jest"]
|
||||
},
|
||||
"references": [{"path": ".."}]
|
||||
}
|
||||
4
types/lodash.frompairs.d.ts
vendored
Normal file
4
types/lodash.frompairs.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare module "lodash.frompairs" {
|
||||
// eslint-disable-next-line
|
||||
export default function fromPairs<T>(pairs: List<[string, T]> | null | undefined): Dictionary<T>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import File from "vinyl"
|
||||
|
||||
declare module "vinyl-file" {
|
||||
import File from "vinyl"
|
||||
|
||||
type Options = {
|
||||
cwd?: string
|
||||
base?: string
|
||||
Reference in New Issue
Block a user