Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use babel to transpile TS projects #47502

Merged
merged 13 commits into from
Nov 19, 2020
76 changes: 0 additions & 76 deletions bin/watch-packages-and-rebuild.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"build-client-if-prod": "node -e \"process.env.CALYPSO_ENV === 'production' && process.exit(1)\" || yarn run build-client-both && yarn run build-languages-if-enabled",
"build-client-if-desktop": "node -e \"(process.env.CALYPSO_ENV === 'desktop' || process.env.CALYPSO_ENV === 'desktop-development') && process.exit(1)\" || yarn run build-client-fallback",
"build-client-stats": "NODE_ENV=production CALYPSO_ENV=production EMIT_STATS=true PROGRESS=true yarn run build-client-evergreen",
"build-packages": "npx lerna run prepare --stream",
"build-packages:watch": "node bin/watch-packages-and-rebuild.js",
"build-packages": "tsc --build packages/tsconfig.json",
"build-packages:watch": "tsc --build packages/tsconfig.json --watch",
"build-languages": "yarn run translate && node bin/build-languages.js",
"build-languages-if-enabled": "node -e \"(process.env.BUILD_TRANSLATION_CHUNKS === 'true' || process.env.ENABLE_FEATURES === 'use-translation-chunks') && process.exit(1)\" || yarn run build-languages",
"calypso-doctor": "./node_modules/.bin/calypso-doctor",
Expand Down
13 changes: 7 additions & 6 deletions packages/browser-data-collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"homepage": "https://github.com/Automattic/wp-calypso",
"license": "GPL-2.0-or-later",
"author": "Automattic Inc.",
"main": "dist/cjs/index",
"module": "dist/esm/index",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/Automattic/wp-calypso.git",
Expand All @@ -17,10 +18,10 @@
"url": "https://github.com/Automattic/wp-calypso/issues"
},
"scripts": {
"clean": "tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"prepublish": "yarn run clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json",
"watch": "tsc --build ./tsconfig.json --watch"
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
Copy link
Contributor Author

@scinos scinos Nov 17, 2020

Choose a reason for hiding this comment

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

tsc --build ... --clean deletes the files but lefts lots of empty dirs, that's why I added npx rimraf dist

"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
sirreal marked this conversation as resolved.
Show resolved Hide resolved
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --watch"
},
"dependencies": {
"wpcom-proxy-request": "^6.0.0"
Expand Down
11 changes: 6 additions & 5 deletions packages/calypso-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"license": "GPL-2.0-or-later",
"author": "Automattic Inc.",
"sideEffects": true,
"main": "dist/cjs/index",
"module": "dist/esm/index",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/Automattic/wp-calypso.git",
Expand All @@ -25,9 +26,9 @@
"url": "https://github.com/Automattic/wp-calypso/issues"
},
"scripts": {
"clean": "tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"prepublish": "yarn run clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch"
},
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/calypso-stripe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"calypso:src": "index.ts",
"sideEffects": false,
"scripts": {
"clean": "npx rimraf dist && tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"build:esm": "tsc --build ./tsconfig.json",
"build:cjs": "tsc --build ./tsconfig-cjs.json",
"prepare": "yarn run build:esm",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch"
},
"files": [
Expand Down
8 changes: 5 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "Automattic Inc.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.js",
"sideEffects": [
"*.css",
"*.scss"
Expand Down Expand Up @@ -46,8 +47,9 @@
"ts-loader": "^8.0.8"
},
"scripts": {
"clean": "npx rimraf dist && tsc --build --clean",
"prepublish": "yarn run clean",
"prepare": "transpile && tsc --build && copy-assets"
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets",
"prepare": "yarn run build",
"prepack": "yarn run clean && yarn run build"
}
}
12 changes: 12 additions & 0 deletions packages/components/tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "commonjs",
"declaration": false,
"declarationMap": false,
"declarationDir": null,
"outDir": "dist/cjs",
"composite": false,
"incremental": true
}
}
7 changes: 4 additions & 3 deletions packages/composite-checkout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"main": "dist/cjs/public-api.js",
"module": "dist/esm/public-api.js",
"types": "dist/types/public-api.d.ts",
"calypso:src": "src/public-api.ts",
"sideEffects": false,
"scripts": {
"clean": "npx rimraf dist \"../../.tsc-cache/packages__composite-checkout*\"",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json",
"prepublish": "yarn run clean",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch"
},
"files": [
Expand Down
7 changes: 4 additions & 3 deletions packages/data-stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "Automattic Inc.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"sideEffects": false,
"repository": {
"type": "git",
Expand All @@ -26,9 +27,9 @@
],
"types": "dist/types",
"scripts": {
"clean": "tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json",
"prepublish": "yarn run clean",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-stores/src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { DispatchFromMap, SelectFromMap } from '../mapped-types';
import { controls as wpcomRequestControls } from '../wpcom-request-controls';

export * from './types';
export { State };
export type { State };

let isRegistered = false;
export function register( config: ActionsConfig ): typeof STORE_KEY {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-stores/src/domain-suggestions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { DispatchFromMap, SelectFromMap } from '../mapped-types';
import { controls } from '../wpcom-request-controls';

export * from './types';
export { State };
export type { State };

let isRegistered = false;
interface StoreConfiguration {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-stores/src/site/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { WpcomClientCredentials } from '../shared-types';
import { controls } from '../wpcom-request-controls';

export * from './types';
export { State };
export type { State };

let isRegistered = false;
export function register( clientCreds: WpcomClientCredentials ): typeof STORE_KEY {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-stores/src/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { DispatchFromMap, SelectFromMap } from '../mapped-types';
import type { WpcomClientCredentials } from '../shared-types';

export * from './types';
export { State };
export type { State };

let isRegistered = false;
export function register( clientCreds: WpcomClientCredentials ): typeof STORE_KEY {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-stores/src/verticals-templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as selectors from './selectors';
import type { DispatchFromMap, SelectFromMap } from '../mapped-types';

export * from './types';
export { State };
export type { State };

let isRegistered = false;
export function register(): typeof STORE_KEY {
Expand Down
7 changes: 4 additions & 3 deletions packages/domain-picker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "Automattic Inc.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.tsx",
"sideEffects": [
"*.css",
"*.scss"
Expand All @@ -24,9 +25,9 @@
},
"types": "dist/types",
"scripts": {
"clean": "tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json && copy-assets",
"prepublish": "yarn run clean",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/domain-picker/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Internal dependencies
*/
export { default, Props } from './domain-picker';
export { default } from './domain-picker';
export type { Props } from './domain-picker';

export { ITEM_TYPE_RADIO, ITEM_TYPE_BUTTON } from './domain-picker/suggestion-item';
export type { SUGGESTION_ITEM_TYPE } from './domain-picker/suggestion-item';
7 changes: 4 additions & 3 deletions packages/i18n-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "WordPress.com i18n utils",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"types": "dist/types/index.d.ts",
"sideEffects": false,
"license": "GPL-2.0-or-later",
Expand All @@ -14,9 +15,9 @@
},
"author": "Automattic Inc.",
"scripts": {
"clean": "npx rimraf dist",
"prepublish": "yarn run clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch",
"download": "node bin/download.js",
"test": "yarn jest"
Expand Down
9 changes: 4 additions & 5 deletions packages/language-picker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "Automattic Inc.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"sideEffects": [
"*.css",
"*.scss"
Expand Down Expand Up @@ -40,10 +41,8 @@
"react-dom": "^16.8"
},
"scripts": {
"clean": "npx rimraf dist && tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"build:esm": "tsc --build ./tsconfig.json && copy-assets --esm",
"build:cjs": "tsc --build ./tsconfig-cjs.json && copy-assets --cjs",
"prepare": "yarn run build:esm",
"prepack": "yarn run clean && yarn run build:esm && yarn run build:cjs"
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"prepack": "yarn run clean && yarn run build"
}
}
8 changes: 4 additions & 4 deletions packages/languages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "WordPress.com Language Data",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"types": "dist/types/index.d.ts",
"sideEffects": false,
"license": "GPL-2.0-or-later",
Expand All @@ -14,10 +15,9 @@
},
"author": "Automattic Inc.",
"scripts": {
"clean": "npx rimraf dist",
"prepublish": "yarn run clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json",
"watch": "tsc --build ./tsconfig.json --watch",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"prepack": "yarn run clean && yarn run build",
"download": "node bin/download.js",
"test": "yarn jest"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/launch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "Automattic Inc.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"sideEffects": [
"*.css",
"*.scss"
Expand All @@ -24,9 +25,9 @@
},
"types": "dist/types",
"scripts": {
"clean": "tsc --build ./tsconfig.json --clean && tsc --build ./tsconfig-cjs.json --clean",
"prepare": "tsc --build ./tsconfig.json && tsc --build ./tsconfig-cjs.json && copy-assets && npx copyfiles ./styles/** dist",
"prepublish": "yarn run clean",
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && npx rimraf dist",
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets && npx copyfiles ./styles/** dist",
"prepack": "yarn run clean && yarn run build",
"watch": "tsc --build ./tsconfig.json --watch"
},
"dependencies": {
Expand Down
Loading