Skip to content

Commit

Permalink
Remove typescript dependencies from most packages
Browse files Browse the repository at this point in the history
* Using a 4.7+ version of TypeScript lets us use the "exports" field.
* Since "tsdx test" depends on an older version of TypeScript,
  replace it with a new root "test" comamnd.

Change-Id: I2fc943932e0a7d319e59f0a597cd72a32a18e002
  • Loading branch information
jaslong committed Apr 26, 2023
1 parent 9ec2031 commit 1fd84da
Show file tree
Hide file tree
Showing 80 changed files with 376 additions and 1,415 deletions.
8 changes: 4 additions & 4 deletions jest-transform-esbuild.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const esbuild = require('esbuild');
const esbuild = require("esbuild");

// This transforms TypeScript to JavaScript for Jest.
// We use esbuild here for speed and consistency with our actual builds.
// https://jestjs.io/docs/code-transformation
module.exports = {
process: (sourceText, sourcePath, _options) => {
const { code, map } = esbuild.transformSync(sourceText, {
format: 'cjs',
loader: 'ts',
format: "cjs",
loader: sourcePath.endsWith(".tsx") ? "tsx" : "ts",
sourcefile: sourcePath,
sourcemap: 'both',
sourcemap: "both",
target: `node${process.versions.node}`,
});
return { code, map };
Expand Down
5 changes: 3 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('jest').Config} */
module.exports = {
testRegex: '.(spec|test).(js|jsx|ts|tsx)$',
testRegex: "\\.(spec|test)\\.(js|jsx|ts|tsx)$",
transform: {
'\\.tsx?$': '<rootDir>/jest-transform-esbuild.js',
"\\.tsx?$": "<rootDir>/jest-transform-esbuild.js",
},
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"local-canary": "yarn local-unpublish && lerna publish --canary --yes --include-merged-tags --no-git-tag-version --no-push --registry=http://localhost:4873 --force-publish",
"local-publish": "./scripts/local-publish.sh",
"local-unpublish": "lerna exec -- npm unpublish -f --registry=\"http://localhost:4873/\" \"\\${LERNA_PACKAGE_NAME}\"",
"deps": "lerna list --include-dependencies --scope"
"deps": "lerna list --include-dependencies --scope",
"test": "jest $INIT_CWD"
},
"workspaces": [
"packages/auth-api",
Expand Down
5 changes: 2 additions & 3 deletions packages/auth-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start": "tsdx watch",
"build": "tsdx build",
"yalcp": "yalc publish --push",
"test": "tsdx test",
"test": "yarn --cwd=../.. test --passWithNoTests",
"lint": "tsdx lint",
"prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
"size": "size-limit",
Expand Down Expand Up @@ -48,8 +48,7 @@
"husky": "^6.0.0",
"size-limit": "^4.11.0",
"tsdx": "^0.14.1",
"tslib": "^2.2.0",
"typescript": "^4.3.2"
"tslib": "^2.2.0"
},
"dependencies": {
"@plasmicapp/isomorphic-unfetch": "^1.0.1"
Expand Down
5 changes: 2 additions & 3 deletions packages/auth-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"start": "tsdx watch",
"build": "tsdx build",
"yalcp": "yalc publish --push",
"test": "tsdx test",
"test": "yarn --cwd=../.. test",
"lint": "tsdx lint",
"prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
"size": "size-limit",
Expand Down Expand Up @@ -54,8 +54,7 @@
"husky": "^6.0.0",
"size-limit": "^4.11.0",
"tsdx": "^0.14.1",
"tslib": "^2.2.0",
"typescript": "^4.3.2"
"tslib": "^2.2.0"
},
"dependencies": {
"@plasmicapp/auth-api": "0.0.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/create-plasmic-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"ts-jest": "^26.5.3",
"ts-node": "^10.9.1",
"typescript": "^4.2.3"
"ts-node": "^10.9.1"
},
"dependencies": {
"@plasmicapp/cli": "0.1.187",
Expand Down
5 changes: 2 additions & 3 deletions packages/data-sources-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test --passWithNoTests",
"test": "yarn --cwd=../.. test --passWithNoTests",
"lint": "tsdx lint",
"prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
"size": "size-limit",
Expand Down Expand Up @@ -55,8 +55,7 @@
"rollup-plugin-banner2": "^1.2.2",
"size-limit": "^7.0.4",
"tsdx": "^0.14.1",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
"tslib": "^2.3.1"
},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 2 additions & 3 deletions packages/data-sources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test --passWithNoTests",
"test": "yarn --cwd=../.. test --passWithNoTests",
"lint": "tsdx lint",
"prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
"size": "size-limit",
Expand Down Expand Up @@ -54,8 +54,7 @@
"react-dom": "^18.2.0",
"size-limit": "^7.0.4",
"tsdx": "^0.14.1",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
"tslib": "^2.3.1"
},
"dependencies": {
"@plasmicapp/data-sources-context": "0.1.10",
Expand Down
5 changes: 2 additions & 3 deletions packages/host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"postbuild:registerToken": "node ../../print-module-api.js ./packages/host/registerToken/dist/index.cjs.js > registerToken-api.txt",
"postbuild:registerTrait": "node ../../print-module-api.js ./packages/host/registerTrait/dist/index.cjs.js > registerTrait-api.txt",
"start": "tsdx watch",
"test": "tsdx test --passWithNoTests",
"test": "yarn --cwd=../.. test --passWithNoTests",
"lint": "tsdx lint",
"prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
"size": "size-limit",
Expand Down Expand Up @@ -74,8 +74,7 @@
"rollup-plugin-typescript2": "^0.30.0",
"size-limit": "^4.11.0",
"tsdx": "^0.14.1",
"tslib": "^2.2.0",
"typescript": "^3.9.7"
"tslib": "^2.2.0"
},
"peerDependencies": {
"react": ">=16.8.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/loader-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ng-packagr": "^12.1.1",
"typescript": "~4.3.5"
"ng-packagr": "^12.1.1"
}
}
Loading

0 comments on commit 1fd84da

Please sign in to comment.