Skip to content

Commit

Permalink
Fix build script (#344)
Browse files Browse the repository at this point in the history
* Fix build

* Fix build script

* Delete ESM tsconfigs

* Fix compile

* Fix testing

* Upgrade mrlint
  • Loading branch information
zachkirsch authored Jul 6, 2022
1 parent 0c29a2b commit 0ba11a6
Show file tree
Hide file tree
Showing 182 changed files with 954 additions and 725 deletions.
191 changes: 159 additions & 32 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
],
"scripts": {
"clean": "yarn workspace @fern-api/compile-root run clean",
"compile": "yarn compile:cjs",
"compile": "yarn compile:esm",
"compile:all": "yarn compile:prepare && yarn workspace @fern-api/compile-root run compile:all",
"compile:cjs": "yarn compile:prepare && yarn workspace @fern-api/compile-root run compile:cjs",
"compile:esm": "yarn compile:prepare && yarn workspace @fern-api/compile-root run compile:esm",
"compile:prepare": "ts-node scripts/checkRootPackage.ts --fix",
"test": "yarn compile && jest --passWithNoTests",
"test": "yarn compile:all && jest --passWithNoTests",
"test:ete": "yarn workspace @fern-api/cli dist && yarn workspace fern-typescript dockerTagLocal && yarn workspace @fern-api/ete-tests test",
"lint:eslint": "eslint --max-warnings 0 .",
"lint:eslint:fix": "yarn lint:eslint --fix",
Expand Down Expand Up @@ -61,12 +61,13 @@
"jest": "^28.1.2",
"lint-staged": "^12.3.7",
"lodash": "^4.17.21",
"mrlint": "^0.0.46",
"mrlint": "^0.0.50",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"stylelint": "^14.9.1",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard-scss": "^4.0.0",
"ts-jest": "^28.0.5",
"ts-node": "^10.8.0",
"typescript": "^4.6.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/_root/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "ignores": ["@types/jest", "@types/node"], "ignore-patterns": ["lib"] }
{ "ignores": ["@types/jest", "@types/node", "ts-jest"], "ignore-patterns": ["lib"] }
17 changes: 9 additions & 8 deletions packages/_root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
],
"source": "src/index.ts",
"module": "src/index.ts",
"main": "./lib/cjs/index.js",
"types": "./lib/cjs/index.d.ts",
"main": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"exports": {
".": {
"require": "./lib/cjs/index.js",
Expand All @@ -22,12 +22,12 @@
},
"sideEffects": false,
"scripts": {
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.esm.json",
"compile": "yarn run compile:cjs",
"compile:all": "run-s compile:cjs compile:esm",
"compile:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"compile:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"test": "yarn run compile && jest --passWithNoTests",
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.cjs.json",
"compile": "yarn run compile:esm",
"compile:all": "run-s compile:esm compile:cjs",
"compile:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"compile:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"test": "yarn run compile:all && jest --passWithNoTests",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore",
"lint:eslint:fix": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../shared/.prettierignore \"**\"",
Expand Down Expand Up @@ -78,6 +78,7 @@
"jest": "^28.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"ts-jest": "^28.0.5",
"typescript": "^4.6.4"
}
}
38 changes: 38 additions & 0 deletions packages/_root/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"include": ["./src"],
"references": [
{ "path": "../add-generator/tsconfig.cjs.json" },
{ "path": "../cli/tsconfig.cjs.json" },
{ "path": "../commons/tsconfig.cjs.json" },
{ "path": "../compiler/commons/tsconfig.cjs.json" },
{ "path": "../compiler/compiler/tsconfig.cjs.json" },
{ "path": "../compiler/ir-generation/tsconfig.cjs.json" },
{ "path": "../compiler/syntax-analysis/tsconfig.cjs.json" },
{ "path": "../ete-tests/tsconfig.cjs.json" },
{ "path": "../fern-typescript/cli/tsconfig.cjs.json" },
{ "path": "../fern-typescript/client/tsconfig.cjs.json" },
{ "path": "../fern-typescript/commons/tsconfig.cjs.json" },
{ "path": "../fern-typescript/encoders/tsconfig.cjs.json" },
{ "path": "../fern-typescript/errors/tsconfig.cjs.json" },
{ "path": "../fern-typescript/helpers/built-in/json-encoding-helper/tsconfig.cjs.json" },
{ "path": "../fern-typescript/helpers/helper-manager/tsconfig.cjs.json" },
{ "path": "../fern-typescript/helpers/utils/tsconfig.cjs.json" },
{ "path": "../fern-typescript/model/tsconfig.cjs.json" },
{ "path": "../fern-typescript/model-context/tsconfig.cjs.json" },
{ "path": "../fern-typescript/server/tsconfig.cjs.json" },
{ "path": "../fern-typescript/service-types/tsconfig.cjs.json" },
{ "path": "../fern-typescript/service-utils/tsconfig.cjs.json" },
{ "path": "../fern-typescript/testing-utils/tsconfig.cjs.json" },
{ "path": "../fern-typescript/types/tsconfig.cjs.json" },
{ "path": "../init/tsconfig.cjs.json" },
{ "path": "../local-generation/docker-utils/tsconfig.cjs.json" },
{ "path": "../local-generation/local-workspace-runner/tsconfig.cjs.json" },
{ "path": "../login/tsconfig.cjs.json" },
{ "path": "../openapi-converter/tsconfig.cjs.json" },
{ "path": "../remote-generation/remote-workspace-runner/tsconfig.cjs.json" },
{ "path": "../ui/app/tsconfig.cjs.json" },
{ "path": "../ui/fe-bundle/tsconfig.cjs.json" }
]
}
38 changes: 0 additions & 38 deletions packages/_root/tsconfig.esm.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/_root/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"compilerOptions": { "composite": true, "outDir": "lib/esm", "rootDir": "src", "module": "esnext" },
"include": ["./src"],
"references": [
{ "path": "../add-generator/tsconfig.json" },
Expand Down
2 changes: 1 addition & 1 deletion packages/add-generator/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "ignores": ["@types/jest", "@types/node"], "ignore-patterns": ["lib"] }
{ "ignores": ["@types/jest", "@types/node", "ts-jest"], "ignore-patterns": ["lib"] }
17 changes: 9 additions & 8 deletions packages/add-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
],
"source": "src/index.ts",
"module": "src/index.ts",
"main": "./lib/cjs/index.js",
"types": "./lib/cjs/index.d.ts",
"main": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"exports": {
".": {
"require": "./lib/cjs/index.js",
Expand All @@ -21,12 +21,12 @@
},
"sideEffects": false,
"scripts": {
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.esm.json",
"compile": "yarn run compile:cjs",
"compile:all": "run-s compile:cjs compile:esm",
"compile:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"compile:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"test": "yarn run compile && jest --passWithNoTests",
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.cjs.json",
"compile": "yarn run compile:esm",
"compile:all": "run-s compile:esm compile:cjs",
"compile:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"compile:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"test": "yarn run compile:all && jest --passWithNoTests",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore",
"lint:eslint:fix": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../shared/.prettierignore \"**\"",
Expand All @@ -47,6 +47,7 @@
"jest": "^28.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"ts-jest": "^28.0.5",
"typescript": "^4.6.4"
}
}
6 changes: 6 additions & 0 deletions packages/add-generator/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"include": ["./src"],
"references": [{ "path": "../commons/tsconfig.cjs.json" }]
}
6 changes: 0 additions & 6 deletions packages/add-generator/tsconfig.esm.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/add-generator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"compilerOptions": { "composite": true, "outDir": "lib/esm", "rootDir": "src", "module": "esnext" },
"include": ["./src"],
"references": [{ "path": "../commons/tsconfig.json" }]
}
2 changes: 1 addition & 1 deletion packages/cli/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ignores": ["@types/jest", "@types/node", "webpack-cli", "ts-loader", "node-loader", "ts-node"],
"ignores": ["@types/jest", "@types/node", "ts-jest", "webpack-cli", "ts-loader", "node-loader", "ts-node"],
"ignore-patterns": ["lib", "webpack/dist/bundle.js"]
}
17 changes: 9 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
],
"source": "src/index.ts",
"module": "src/index.ts",
"main": "./lib/cjs/index.js",
"types": "./lib/cjs/index.d.ts",
"main": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"exports": {
".": {
"require": "./lib/cjs/index.js",
Expand All @@ -24,12 +24,12 @@
"fern": "./cli"
},
"scripts": {
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.esm.json",
"compile": "yarn run compile:cjs",
"compile:all": "run-s compile:cjs compile:esm",
"compile:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"compile:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"test": "yarn run compile && jest --passWithNoTests",
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.cjs.json",
"compile": "yarn run compile:esm",
"compile:all": "run-s compile:esm compile:cjs",
"compile:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"compile:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"test": "yarn run compile:all && jest --passWithNoTests",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore",
"lint:eslint:fix": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../shared/.prettierignore \"**\"",
Expand Down Expand Up @@ -73,6 +73,7 @@
"node-loader": "^2.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"ts-jest": "^28.0.5",
"ts-loader": "^9.3.1",
"ts-node": "^10.8.1",
"typescript": "^4.6.4",
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"include": ["./src"],
"references": [
{ "path": "../add-generator/tsconfig.cjs.json" },
{ "path": "../commons/tsconfig.cjs.json" },
{ "path": "../compiler/commons/tsconfig.cjs.json" },
{ "path": "../compiler/compiler/tsconfig.cjs.json" },
{ "path": "../compiler/syntax-analysis/tsconfig.cjs.json" },
{ "path": "../init/tsconfig.cjs.json" },
{ "path": "../local-generation/local-workspace-runner/tsconfig.cjs.json" },
{ "path": "../login/tsconfig.cjs.json" },
{ "path": "../openapi-converter/tsconfig.cjs.json" },
{ "path": "../remote-generation/remote-workspace-runner/tsconfig.cjs.json" }
]
}
17 changes: 0 additions & 17 deletions packages/cli/tsconfig.esm.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"compilerOptions": { "composite": true, "outDir": "lib/esm", "rootDir": "src", "module": "esnext" },
"include": ["./src"],
"references": [
{ "path": "../add-generator/tsconfig.json" },
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/webpack/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ cd $(cd -P -- "$(dirname -- "$0")" && pwd -P)
# remove existing dist
/bin/rm -rf "$dist_dir"

# compile ESM so we can tree-shake
# compile CJS so we have the most up-to-date .d.ts declarations
yarn run --top-level compile:all
yarn run --top-level compile

# webpack
package_version=$(yarn info @fern-api/cli --all --json | jq -r .children.Version)
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default (): webpack.Configuration => {
loader: "ts-loader",
options: {
projectReferences: true,
configFile: "tsconfig.esm.json",
// esm config
configFile: "tsconfig.json",
},
exclude: /node_modules/,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "ignores": ["@types/jest", "@types/node"], "ignore-patterns": ["lib"] }
{ "ignores": ["@types/jest", "@types/node", "ts-jest"], "ignore-patterns": ["lib"] }
19 changes: 10 additions & 9 deletions packages/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
],
"source": "src/index.ts",
"module": "src/index.ts",
"main": "./lib/cjs/index.js",
"types": "./lib/cjs/index.d.ts",
"main": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"exports": {
".": {
"require": "./lib/cjs/index.js",
Expand All @@ -21,12 +21,12 @@
},
"sideEffects": false,
"scripts": {
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.esm.json",
"compile": "yarn run compile:cjs",
"compile:all": "run-s compile:cjs compile:esm",
"compile:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"compile:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"test": "yarn run compile && jest --passWithNoTests",
"clean": "tsc --build --clean tsconfig.json && tsc --build --clean tsconfig.cjs.json",
"compile": "yarn run compile:esm",
"compile:all": "run-s compile:esm compile:cjs",
"compile:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
"compile:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
"test": "yarn run compile:all && jest --passWithNoTests",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore",
"lint:eslint:fix": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../shared/.prettierignore \"**\"",
Expand All @@ -50,6 +50,7 @@
"eslint": "^8.12.0",
"jest": "^28.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2"
"prettier": "^2.6.2",
"ts-jest": "^28.0.5"
}
}
5 changes: 5 additions & 0 deletions packages/commons/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"include": ["./src"]
}
5 changes: 0 additions & 5 deletions packages/commons/tsconfig.esm.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/commons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib/cjs", "rootDir": "src", "module": "CommonJS" },
"compilerOptions": { "composite": true, "outDir": "lib/esm", "rootDir": "src", "module": "esnext" },
"include": ["./src"]
}
2 changes: 1 addition & 1 deletion packages/compiler/commons/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "ignores": ["@types/jest", "@types/node"], "ignore-patterns": ["lib"] }
{ "ignores": ["@types/jest", "@types/node", "ts-jest"], "ignore-patterns": ["lib"] }
Loading

1 comment on commit 0ba11a6

@vercel
Copy link

@vercel vercel bot commented on 0ba11a6 Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fern – ./

fern-zachkirsch.vercel.app
fern-git-main-zachkirsch.vercel.app
fern-ten.vercel.app

Please sign in to comment.