Skip to content

Commit

Permalink
[core] Inline x-grid-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 22, 2020
1 parent 3d65cf6 commit 38e5d71
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ __diff_output__
/docs/.next
/docs/export
dist
build
node_modules
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"react-dom": "^16.13.1",
"rollup": "^2.6.1",
"rollup-plugin-cleaner": "^1.0.0",
"rollup-plugin-command": "^1.1.3",
"rollup-plugin-dts": "^1.4.7",
"rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-terser": "^5.3.0",
Expand Down Expand Up @@ -122,5 +121,8 @@
"nohoist": [
"**/@material-ui/monorepo"
]
},
"dependencies": {
"replace-in-files": "^2.0.3"
}
}
3 changes: 2 additions & 1 deletion packages/grid/data-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
],
"scripts": {
"precommit": "npm run lint",
"build": "rollup -c ",
"prebuild": "rimraf build",
"build": "cp -r ./src ./build && mkdir ./build/x-grid-modules && cp -r ../x-grid-modules/src ./build/x-grid-modules/src && cp -r ../x-grid-modules/lib/ ./build/x-grid-modules/lib && node replaces.js && rollup -c",
"start": "rollup -cw",
"lint": "eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/grid/data-grid/replaces.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const replaceInFiles = require('replace-in-files');

replaceInFiles({
files: 'build/*',
from: '@material-ui/x-grid-modules',
to: './x-grid-modules/src',
});
10 changes: 1 addition & 9 deletions packages/grid/data-grid/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import cleaner from 'rollup-plugin-cleaner';
import sourceMaps from 'rollup-plugin-sourcemaps';
import { terser } from 'rollup-plugin-terser';
import dts from 'rollup-plugin-dts';
import command from 'rollup-plugin-command';
import pkg from './package.json';

// dev build if watching, prod build if not
const production = !process.env.ROLLUP_WATCH;
export default [
{
input: 'src/index.ts',
input: 'build/index.ts',
output: [
{
file: 'dist/index-esm.js',
Expand Down Expand Up @@ -43,13 +42,6 @@ export default [
output: [{ file: 'dist/data-grid.d.ts', format: 'es' }],
plugins: [
dts(),
command(
`cat ../x-grid-modules/dist/x-grid-modules.d.ts ./dist/data-grid.d.ts > ./dist/data-grid.all.d.ts`,
{
exitOnFail: true,
wait: true,
},
),
!production && sourceMaps(),
],
},
Expand Down
9 changes: 2 additions & 7 deletions packages/grid/data-grid/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"sourceMap": true,
"build": true
},
"include": ["src"],
"exclude": ["__tests__", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.tsx", "node_modules", "lib"],
"references": [
{
"path": "../x-grid-modules"
}
]
"include": ["build"],
"exclude": ["__tests__", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.tsx", "node_modules", "lib"]
}
3 changes: 2 additions & 1 deletion packages/grid/x-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
},
"scripts": {
"precommit": "npm run lint",
"build": "rollup -c ",
"prebuild": "rimraf build",
"build": "cp -r ./src ./build && mkdir ./build/x-grid-modules && cp -r ../x-grid-modules/src ./build/x-grid-modules/src && cp -r ../x-grid-modules/lib/ ./build/x-grid-modules/lib && node replaces.js && rollup -c",
"prepublishOnly": "npm run build",
"start": "rollup -cw",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
Expand Down
7 changes: 7 additions & 0 deletions packages/grid/x-grid/replaces.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const replaceInFiles = require('replace-in-files');

replaceInFiles({
files: 'build/*',
from: '@material-ui/x-grid-modules',
to: './x-grid-modules/src',
});
11 changes: 3 additions & 8 deletions packages/grid/x-grid/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import dts from 'rollup-plugin-dts';
import command from 'rollup-plugin-command';
import pkg from './package.json';

// dev build if watching, prod build if not
const production = !process.env.ROLLUP_WATCH;
export default [
{
input: 'src/index.ts',
input: 'build/index.ts',
output: [
{
file: 'dist/index-esm.js',
Expand All @@ -38,7 +37,7 @@ export default [
cleaner({
targets: ['./dist/'],
}),
typescript(),
typescript({ tsconfig: 'tsconfig.build.json' }),
!production && sourceMaps(),
production && terser(),
],
Expand All @@ -48,11 +47,7 @@ export default [
output: [{ file: 'dist/x-grid.d.ts', format: 'es' }],
plugins: [
dts(),
command(
`cat ../../x-license/dist/x-license.d.ts ../x-grid-modules/dist/x-grid-modules.d.ts ./dist/x-grid.d.ts > ./dist/x-grid.all.d.ts`,
{ exitOnFail: true, wait: true },
!production && sourceMaps(),
),
!production && sourceMaps(),
],
},
];
17 changes: 17 additions & 0 deletions packages/grid/x-grid/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"declaration": true,
"declarationDir": "./dist",
"module": "es6",
"noImplicitAny": false,
"strict": true,
"outDir": "./dist",
"target": "es6",
"sourceMap": true,
"build": true
},
"include": ["build"],
"exclude": ["__tests__", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.tsx", "node_modules", "lib"]
}
7 changes: 1 addition & 6 deletions packages/grid/x-grid/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,5 @@
"build": true
},
"include": ["src"],
"exclude": ["__tests__", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.tsx", "node_modules", "lib"],
"references": [
{
"path": "../x-grid-modules"
}
]
"exclude": ["__tests__", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.tsx", "node_modules", "lib"]
}
66 changes: 64 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6793,6 +6793,11 @@ binary-extensions@^2.0.0:
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9"
integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==

binaryextensions@^2.1.2:
version "2.3.0"
resolved "https://registry.yarnpkg.com/binaryextensions/-/binaryextensions-2.3.0.tgz#1d269cbf7e6243ea886aa41453c3651ccbe13c22"
integrity sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==

bindings@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
Expand Down Expand Up @@ -9398,6 +9403,14 @@ ecc-jsbn@~0.1.1:
jsbn "~0.1.0"
safer-buffer "^2.1.0"

editions@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/editions/-/editions-2.3.1.tgz#3bc9962f1978e801312fbd0aebfed63b49bfe698"
integrity sha512-ptGvkwTvGdGfC0hfhKg0MT+TRLRKGtUiWGBInxOm5pz7ssADezahjCUaYuZ8Dr+C05FW0AECIIPt4WBxVINEhA==
dependencies:
errlop "^2.0.0"
semver "^6.3.0"

ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
Expand Down Expand Up @@ -9678,6 +9691,11 @@ err-code@^1.0.0:
resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960"
integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=

errlop@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/errlop/-/errlop-2.2.0.tgz#1ff383f8f917ae328bebb802d6ca69666a42d21b"
integrity sha512-e64Qj9+4aZzjzzFpZC7p5kmm/ccCrbLhAJplhsDXQFs87XTsXwOpH4s1Io2s90Tau/8r2j9f4l/thhDevRjzxw==

errno@^0.1.1, errno@^0.1.3, errno@~0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618"
Expand Down Expand Up @@ -9776,6 +9794,11 @@ es6-promisify@^5.0.0:
dependencies:
es6-promise "^4.0.3"

es6-promisify@^6.0.2:
version "6.1.1"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-6.1.1.tgz#46837651b7b06bf6fff893d03f29393668d01621"
integrity sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==

es6-shim@^0.35.5:
version "0.35.5"
resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.5.tgz#46f59dc0a84a1c5029e8ff1166ca0a902077a9ab"
Expand Down Expand Up @@ -10403,7 +10426,7 @@ fast-glob@^2.0.2, fast-glob@^2.2.6:
merge2 "^1.2.3"
micromatch "^3.1.10"

fast-glob@^3.1.1, fast-glob@^3.2.4:
fast-glob@^3.0.3, fast-glob@^3.1.1, fast-glob@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3"
integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==
Expand Down Expand Up @@ -11309,6 +11332,20 @@ globby@8.0.2:
pify "^3.0.0"
slash "^1.0.0"

globby@^10.0.1:
version "10.0.2"
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.2.tgz#277593e745acaa4646c3ab411289ec47a0392543"
integrity sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==
dependencies:
"@types/glob" "^7.1.1"
array-union "^2.1.0"
dir-glob "^3.0.1"
fast-glob "^3.0.3"
glob "^7.1.3"
ignore "^5.1.1"
merge2 "^1.2.3"
slash "^3.0.0"

globby@^11.0.1:
version "11.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357"
Expand Down Expand Up @@ -12009,7 +12046,7 @@ ignore@^4.0.3, ignore@^4.0.6:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==

ignore@^5.0.5, ignore@^5.1.4, ignore@^5.1.8:
ignore@^5.0.5, ignore@^5.1.1, ignore@^5.1.4, ignore@^5.1.8:
version "5.1.8"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
Expand Down Expand Up @@ -12882,6 +12919,15 @@ istanbul-reports@^3.0.2:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"

istextorbinary@^2.5.1:
version "2.6.0"
resolved "https://registry.yarnpkg.com/istextorbinary/-/istextorbinary-2.6.0.tgz#60776315fb0fa3999add276c02c69557b9ca28ab"
integrity sha512-+XRlFseT8B3L9KyjxxLjfXSLMuErKDsd8DBNrsaxoViABMEZlOSCstwmw0qpoFX3+U6yWU1yhLudAe6/lETGGA==
dependencies:
binaryextensions "^2.1.2"
editions "^2.2.0"
textextensions "^2.5.0"

iterate-iterator@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/iterate-iterator/-/iterate-iterator-1.0.1.tgz#1693a768c1ddd79c969051459453f082fe82e9f6"
Expand Down Expand Up @@ -18510,6 +18556,17 @@ replace-ext@1.0.0:
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=

replace-in-files@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/replace-in-files/-/replace-in-files-2.0.3.tgz#2e20f3a06fb50abb9e77e689da6a0cf2bbd70f17"
integrity sha512-wm9kg+WhKQ10CFaCS9jvUtgw9JnaPilm4TqSRq57H06v5EgX7hTrr/qwgyvq3G+IeNhmr6VTW84LvfnpZfq5/g==
dependencies:
co "^4.6.0"
es6-promisify "^6.0.2"
globby "^10.0.1"
istextorbinary "^2.5.1"
lodash "^4.17.15"

request-promise-core@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9"
Expand Down Expand Up @@ -20481,6 +20538,11 @@ text-table@0.2.0, text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=

textextensions@^2.5.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.6.0.tgz#d7e4ab13fe54e32e08873be40d51b74229b00fc4"
integrity sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ==

thenify-all@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726"
Expand Down

0 comments on commit 38e5d71

Please sign in to comment.