Skip to content

Commit dfafb27

Browse files
authored
chore: packages do not explicitly run tsc (#28450)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Rollup has a plugin to handle TypeScript compilation that we are not using. As a result, we are maintaining unnecessary infrastructure such as compiling to `dist-transpiled`(TS to JS) and then compiling the results to `dist` (JS files to bundled code). ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Vue, Vue Router, React, and React Router now make use of the Rollup Typescript plugin to handle TypeScript compilation for us. This lets us remove the `dist-transpiled` directory altogether and the manual `tsc` invocation. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Developers should not see any changes in how they consume Ionic. This just hands the TypeScript compilation step off to the Rollup plugin. Dev build: `7.5.3-dev.11698859252.15ac163e`
1 parent 63a8b76 commit dfafb27

15 files changed

+393
-31
lines changed

packages/react-router/package-lock.json

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-router/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
},
2222
"scripts": {
2323
"build": "npm run clean && npm run compile",
24-
"clean": "rimraf dist dist-transpiled",
25-
"compile": "npm run tsc && rollup -c",
24+
"clean": "rimraf dist",
25+
"compile": "rollup -c",
2626
"eslint": "eslint src",
2727
"prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx}\"",
2828
"lint": "npm run eslint && npm run prettier -- --write --cache",
2929
"lint.fix": "npm run eslint -- --fix && npm run prettier -- --write --cache",
30-
"tsc": "tsc -p .",
3130
"sync": "sh ./scripts/sync.sh"
3231
},
3332
"main": "dist/index.js",
@@ -49,6 +48,7 @@
4948
"@ionic/eslint-config": "^0.3.0",
5049
"@ionic/prettier-config": "^2.0.0",
5150
"@rollup/plugin-node-resolve": "^8.1.0",
51+
"@rollup/plugin-typescript": "^11.1.5",
5252
"@types/node": "^14.0.14",
5353
"@types/react": "16.14.0",
5454
"@types/react-dom": "^16.9.0",
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import sourcemaps from 'rollup-plugin-sourcemaps';
22
import resolve from '@rollup/plugin-node-resolve';
3+
import typescript from '@rollup/plugin-typescript';
34

45
export default {
5-
input: 'dist-transpiled/index.js',
6+
input: 'src/index.ts',
67
output: [
78
{
89
file: 'dist/index.js',
@@ -11,5 +12,9 @@ export default {
1112
}
1213
],
1314
external: (id) => !/^(\.|\/)/.test(id),
14-
plugins: [resolve(), sourcemaps()],
15+
plugins: [
16+
typescript(),
17+
resolve(),
18+
sourcemaps()
19+
],
1520
};

packages/react-router/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"noImplicitReturns": true,
1616
"noUnusedLocals": true,
1717
"noUnusedParameters": true,
18-
"outDir": "dist-transpiled",
18+
"outDir": "dist",
1919
"declarationDir": "dist/types",
2020
"removeComments": false,
2121
"inlineSources": true,

packages/react/package-lock.json

Lines changed: 102 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
},
2222
"scripts": {
2323
"build": "npm run clean && npm run copy && npm run compile",
24-
"clean": "rimraf dist && rimraf dist-transpiled && rimraf routing",
25-
"compile": "npm run tsc && rollup -c",
24+
"clean": "rimraf dist && rimraf routing",
25+
"compile": "rollup -c",
2626
"eslint": "eslint src",
2727
"prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx}\"",
2828
"lint": "npm run eslint && npm run prettier -- --write --cache",
2929
"lint.fix": "npm run eslint -- --fix && npm run prettier -- --write --cache",
30-
"tsc": "tsc -p .",
3130
"copy": "node scripts/copy.js",
3231
"test.spec": "jest --ci",
3332
"test.treeshake": "node scripts/treeshaking.js dist/index.esm.js",
@@ -52,6 +51,7 @@
5251
"@ionic/eslint-config": "^0.3.0",
5352
"@ionic/prettier-config": "^2.0.0",
5453
"@rollup/plugin-node-resolve": "^8.1.0",
54+
"@rollup/plugin-typescript": "^11.1.5",
5555
"@rollup/plugin-virtual": "^2.0.3",
5656
"@testing-library/jest-dom": "^5.11.6",
5757
"@testing-library/react": "^11.2.2",
@@ -83,7 +83,6 @@
8383
"testPathIgnorePatterns": [
8484
"cypress",
8585
"node_modules",
86-
"dist-transpiled",
8786
"dist",
8887
"test/base/*",
8988
"test/apps/*",

packages/react/rollup.config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import resolve from '@rollup/plugin-node-resolve';
22
import sourcemaps from 'rollup-plugin-sourcemaps';
3-
// import json from '@rollup/plugin-json';
3+
import typescript from '@rollup/plugin-typescript';
44

55
export default {
6-
input: {
7-
index: 'dist-transpiled/index',
8-
// 'routing/index': 'dist-transpiled/routing/index'
9-
},
6+
input: 'src/index.ts',
107
output: [
118
{
129
dir: 'dist/',
@@ -18,8 +15,8 @@ export default {
1815
],
1916
external: (id) => !/^(\.|\/)/.test(id),
2017
plugins: [
18+
typescript(),
2119
resolve(),
2220
sourcemaps(),
23-
// json()
2421
],
2522
};

packages/react/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"noImplicitReturns": true,
1616
"noUnusedLocals": true,
1717
"noUnusedParameters": true,
18-
"outDir": "dist-transpiled",
18+
"outDir": "dist",
1919
"declarationDir": "dist/types",
2020
"removeComments": false,
2121
"inlineSources": true,

0 commit comments

Comments
 (0)