diff --git a/.circleci/config.yml b/.circleci/config.yml index 977a2f70e32..77398a4fd95 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,6 @@ references: - packages/react-codemods/node_modules/ - packages/react-icons/node_modules/ build_cache_paths: &build_cache_paths - - .cache/ - packages/react-charts/dist/ - packages/react-core/dist/ - packages/react-inline-edit-extension/dist/ @@ -128,7 +127,7 @@ jobs: - *build_cache_key - run: name: Build Dist - command: yarn build + command: yarn build && yarn build:umd - save_cache: paths: *build_cache_paths key: *build_cache_key diff --git a/babel.config.js b/babel.config.js index 469ae67aacd..71cac5b07b3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,11 @@ module.exports = { - extends: './packages/.babelrc', - presets: [['@babel/env', {'modules': 'commonjs'}], '@babel/react'], -}; + presets: [ + '@babel/preset-env', + '@babel/preset-typescript', + '@babel/preset-react' + ], + plugins: [ + '@babel/plugin-proposal-class-properties', + '@babel/plugin-proposal-object-rest-spread' + ] +} diff --git a/package.json b/package.json index 474182a90d2..dfd9f140c0c 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,14 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/preset-react": "^7.0.0", + "@babel/preset-typescript": "^7.0.0", "@octokit/rest": "^16.39.0", + "@types/jest": "^24.0.11", "@types/enzyme": "3.9.0", "@typescript-eslint/eslint-plugin": "^2.18.0", "@typescript-eslint/parser": "^2.18.0", @@ -65,12 +72,15 @@ }, "scripts": { "bootstrap": "lerna bootstrap", - "build": "node scripts/incrementalBuild.js", - "build:docs": "lerna run build:docs --stream", - "build:integration:report": "lerna run build:integration:report --stream", + "build": "yarn build:generate && yarn build:esm && yarn build:cjs", + "build:cjs": "tsc --build packages/tsconfig.cjs.json -v", + "build:esm": "tsc --build packages/tsconfig.json -v", "build:integration": "lerna run build:demo-app --stream", + "build:docs": "yarn workspace @patternfly/react-docs build:docs", + "build:umd": "yarn workspace @patternfly/react-core build:umd", + "build:generate": "lerna run generate --parallel --stream", "clean": "yarn clean:build && yarn clean:pf3 && lerna run clean --parallel", - "clean:build": "rimraf .cache", + "clean:build": "rimraf .cache .eslintcache coverage", "clean:pf3": "rimraf packages/patternfly-3 packages/patternfly-4", "commit": "git-cz", "generate": "yarn plop", @@ -81,7 +91,7 @@ "prettier": "node node_modules/.bin/prettier --write \"packages/**/*.{js,jsx,ts,tsx}\" \"scripts/**/*.{js,jsx,ts,tsx}\"", "serve:docs": "lerna run serve", "serve:integration": "lerna run serve:demo-app", - "start": "yarn build && lerna run develop --parallel --stream", + "start": "concurrently --kill-others \"yarn build && yarn build:esm --watch\" \"yarn workspace @patternfly/react-docs develop\"", "start:cypress": "lerna run cypress:open", "start:demo-app": "lerna run start:demo-app --stream", "start:pf4": "yarn start", diff --git a/packages/.babelrc b/packages/.babelrc deleted file mode 100644 index ddb4a62f248..00000000000 --- a/packages/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": ["@babel/react"], - "ignore": ["**/__snapshots__", "**/*.d.ts", "**/*.test.*"], - "plugins": [ - "@babel/plugin-transform-typescript", - "babel-plugin-typescript-to-proptypes", - "@babel/plugin-proposal-export-default-from", - "@babel/proposal-class-properties", - "@babel/proposal-object-rest-spread" - ] -} diff --git a/packages/react-catalog-view-extension/.babelrc b/packages/react-catalog-view-extension/.babelrc deleted file mode 100644 index 3eeb33a71bc..00000000000 --- a/packages/react-catalog-view-extension/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} diff --git a/packages/react-catalog-view-extension/.npmignore b/packages/react-catalog-view-extension/.npmignore deleted file mode 100644 index 378eac25d31..00000000000 --- a/packages/react-catalog-view-extension/.npmignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/packages/react-catalog-view-extension/package.json b/packages/react-catalog-view-extension/package.json index 8184301bf33..e38c98a95c1 100644 --- a/packages/react-catalog-view-extension/package.json +++ b/packages/react-catalog-view-extension/package.json @@ -29,15 +29,10 @@ }, "homepage": "https://github.com/patternfly/patternfly-react/blob/master/packages/react-catalog-view-extension/README.md", "scripts": { - "build": "yarn build:babel && yarn build:types && yarn build:sass", - "build:babel": "concurrently 'yarn build:babel:esm && yarn build:babel:umd' 'yarn build:babel:cjs'", - "build:babel:cjs": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions '.js' dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", - "build:sass": "shx mkdir -p dist/sass && shx cp -r sass/react-catalog-view-extension/* dist/sass && node-sass --output-style compressed --importer=./node-sass-patternfly-importer.js -o dist/css sass/react-catalog-view-extension.scss", - "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose --source-maps" + "generate": "concurrently \"yarn build:sass\" \"yarn copy:sass\"", + "build:sass": "node-sass --output-style compressed --importer=./node-sass-patternfly-importer.js -o dist/css sass/react-catalog-view-extension.scss", + "copy:sass": "shx mkdir -p dist/sass && shx cp -r sass/react-catalog-view-extension/* dist/sass", + "clean": "rimraf dist" }, "dependencies": { "@patternfly/patternfly": "4.6.0", @@ -47,25 +42,14 @@ "patternfly": "^3.59.4" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "@types/react": "^16.4.0", - "@types/react-dom": "^16.4.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", + "concurrently": "^3.5.1", "node-sass": "^4.12.0", "rimraf": "^2.6.2", "shx": "^0.3.2", + "tslib": "^1.11.1", "typescript": "^3.8.3" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" } diff --git a/packages/react-catalog-view-extension/src/components/CatalogTile/__snapshots__/CatalogTile.test.tsx.snap b/packages/react-catalog-view-extension/src/components/CatalogTile/__snapshots__/CatalogTile.test.tsx.snap index d5bfd77ddba..e457c18b420 100644 --- a/packages/react-catalog-view-extension/src/components/CatalogTile/__snapshots__/CatalogTile.test.tsx.snap +++ b/packages/react-catalog-view-extension/src/components/CatalogTile/__snapshots__/CatalogTile.test.tsx.snap @@ -17,7 +17,7 @@ exports[`CatalogTile href renders properly 1`] = ` title="Patternfly" vendor="Provided by Red Hat" > - -
-
- +
-
+ -
+ `; @@ -120,7 +120,7 @@ exports[`CatalogTile renders properly 1`] = ` } > - - +
- +
@@ -195,11 +195,11 @@ exports[`CatalogTile renders properly 1`] = ` id="certified" role="tooltip" > - Certified - +
} delay={ @@ -298,7 +298,7 @@ exports[`CatalogTile renders properly 1`] = ` id="certified" role="tooltip" > -
Certified
-
+
@@ -353,10 +353,10 @@ exports[`CatalogTile renders properly 1`] = ` - +
-
- +
-
- +
-
+ -
+ - - +
- +
@@ -515,11 +515,11 @@ exports[`CatalogTile renders properly 1`] = ` id="certified" role="tooltip" > - Certified - +
} delay={ @@ -618,7 +618,7 @@ exports[`CatalogTile renders properly 1`] = ` id="certified" role="tooltip" > -
Certified
-
+
@@ -683,11 +683,11 @@ exports[`CatalogTile renders properly 1`] = ` id="approved" role="tooltip" > - USDA Approved - + } delay={ @@ -786,7 +786,7 @@ exports[`CatalogTile renders properly 1`] = ` id="approved" role="tooltip" > -
USDA Approved
-
+
@@ -803,10 +803,10 @@ exports[`CatalogTile renders properly 1`] = ` - + -
- +
-
- +
-
+ -
+
- - +
- +
@@ -951,11 +951,11 @@ exports[`CatalogTile renders properly 1`] = ` id="approved" role="tooltip" > - USDA Approved - +
} delay={ @@ -1054,7 +1054,7 @@ exports[`CatalogTile renders properly 1`] = ` id="approved" role="tooltip" > -
USDA Approved
-
+
@@ -1071,10 +1071,10 @@ exports[`CatalogTile renders properly 1`] = ` - +
-
- +
-
- +
-
+ -
+
- - +
- +
@@ -1225,11 +1225,11 @@ exports[`CatalogTile renders properly 1`] = ` id="certified" role="tooltip" > - Certified - +
} delay={ @@ -1328,7 +1328,7 @@ exports[`CatalogTile renders properly 1`] = ` id="certified" role="tooltip" > -
Certified
-
+
@@ -1345,10 +1345,10 @@ exports[`CatalogTile renders properly 1`] = ` - +
-
- +
-
- +
-
- +
-
+ -
+
- - +
@@ -1488,8 +1488,8 @@ exports[`CatalogTile renders properly 1`] = `
-
- +
-
+ -
+
`; diff --git a/packages/react-catalog-view-extension/tsconfig.cjs.json b/packages/react-catalog-view-extension/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-catalog-view-extension/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-catalog-view-extension/tsconfig.gen-dts.json b/packages/react-catalog-view-extension/tsconfig.gen-dts.json deleted file mode 100644 index e2a3d669154..00000000000 --- a/packages/react-catalog-view-extension/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} diff --git a/packages/react-catalog-view-extension/tsconfig.json b/packages/react-catalog-view-extension/tsconfig.json new file mode 100644 index 00000000000..5abe07a0542 --- /dev/null +++ b/packages/react-catalog-view-extension/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ], + "references": [ + { + "path": "../react-core" + }, + { + "path": "../react-styles" + }, + { + "path": "../react-table" + } + ] +} diff --git a/packages/react-charts/.babelrc b/packages/react-charts/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-charts/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-charts/.npmignore b/packages/react-charts/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-charts/.npmignore +++ b/packages/react-charts/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-charts/package.json b/packages/react-charts/package.json index e10b3bc16b6..eaf83dce6d5 100644 --- a/packages/react-charts/package.json +++ b/packages/react-charts/package.json @@ -34,36 +34,19 @@ "@patternfly/react-tokens": "^4.2.0", "hoist-non-react-statics": "^3.3.0", "lodash": "^4.17.15", + "tslib": "^1.11.1", "victory": "^34.1.3", "victory-core": "^34.1.3" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0" }, "scripts": { - "build": "yarn build:babel && yarn build:types", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", - "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose --source-maps" + "clean": "rimraf dist" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", "@types/lodash": "^4.14.138", "@types/victory": "^33.1.4", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", "css": "^2.2.3", "fs-extra": "^6.0.1", "glob": "^7.1.2", diff --git a/packages/react-charts/tsconfig.cjs.json b/packages/react-charts/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-charts/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-charts/tsconfig.gen-dts.json b/packages/react-charts/tsconfig.gen-dts.json deleted file mode 100644 index 05bf1c16e6f..00000000000 --- a/packages/react-charts/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} \ No newline at end of file diff --git a/packages/react-charts/tsconfig.json b/packages/react-charts/tsconfig.json new file mode 100644 index 00000000000..a7fc6b54403 --- /dev/null +++ b/packages/react-charts/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ] +} diff --git a/packages/react-core/.babelrc b/packages/react-core/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-core/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-core/.npmignore b/packages/react-core/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-core/.npmignore +++ b/packages/react-core/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-core/package.json b/packages/react-core/package.json index 416bc9eb98f..31d9613b3f2 100644 --- a/packages/react-core/package.json +++ b/packages/react-core/package.json @@ -29,15 +29,9 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "scripts": { - "build": "yarn build:babel && yarn build:umd && yarn build:types && node ./scripts/copyStyles.js", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", - "build:umd": "rollup -c && rollup -c --environment IS_PRODUCTION", "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose", + "build:umd": "rollup -c && rollup -c --environment IS_PRODUCTION", + "generate": "node scripts/copyStyles.js", "gen:tests": "yo tsx-docgen" }, "dependencies": { @@ -46,26 +40,14 @@ "@patternfly/react-tokens": "^4.2.0", "focus-trap": "4.0.2", "react-dropzone": "9.0.0", - "tippy.js": "5.1.2" + "tippy.js": "5.1.2", + "tslib": "^1.11.1" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", "@patternfly/patternfly": "4.6.0", "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-node-resolve": "^7.1.1", "@rollup/plugin-replace": "^2.3.1", - "@types/jest": "^24.0.11", - "@types/react": "^16.4.0", - "@types/react-dom": "^16.4.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", "css": "^2.2.3", "fs-extra": "^6.0.1", "generator-tsx-docgen": "^0.1.0", @@ -78,7 +60,6 @@ "yo": "^3.1.1" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" } diff --git a/packages/react-core/rollup.config.js b/packages/react-core/rollup.config.js index 27882cb0069..67204136aeb 100644 --- a/packages/react-core/rollup.config.js +++ b/packages/react-core/rollup.config.js @@ -14,11 +14,10 @@ module.exports = { name: 'PatternFlyReact', globals: { react: 'React', - 'react-dom': 'ReactDOM', - 'prop-types': 'PropTypes' + 'react-dom': 'ReactDOM' } }, - external: ['react', 'react-dom', 'prop-types'], + external: ['react', 'react-dom'], plugins: [ replace({ 'process.env.NODE_ENV': `'${isProduction ? 'production' : 'development'}'` diff --git a/packages/react-core/tsconfig.cjs.json b/packages/react-core/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-core/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-core/tsconfig.gen-dts.json b/packages/react-core/tsconfig.gen-dts.json deleted file mode 100644 index e2a3d669154..00000000000 --- a/packages/react-core/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} diff --git a/packages/react-core/tsconfig.json b/packages/react-core/tsconfig.json new file mode 100644 index 00000000000..151e7cb29f7 --- /dev/null +++ b/packages/react-core/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ], + "references": [ + { + "path": "../react-styles" + } + ] +} diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index bca363756eb..48310e80677 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -39,6 +39,8 @@ }, "devDependencies": { "@patternfly/patternfly-a11y": "^0.0.17", + "@types/react": "^16.8.0", + "@types/react-dom": "^16.8.0", "rimraf": "^2.6.3", "shx": "^0.3.2" }, diff --git a/packages/react-docs/static/umd.html b/packages/react-docs/static/umd.html index a9ef0dec625..d1e379b1b64 100644 --- a/packages/react-docs/static/umd.html +++ b/packages/react-docs/static/umd.html @@ -26,7 +26,7 @@

2. Include JS

<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script> <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script> <script src="https://unpkg.com/prop-types@15.6/prop-types.js" crossorigin></script> - <script src="https://unpkg.com/@patternfly/react-core@3/dist/umd/react-core.umd.js"></script> + <script src="https://unpkg.com/@patternfly/react-core@3/dist/umd/react-core.js" crossorigin></script> <script src="like-button.js"></script> @@ -92,7 +92,7 @@

4. Don't do this in production

- + diff --git a/packages/react-icons/.babelrc b/packages/react-icons/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-icons/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-icons/.npmignore b/packages/react-icons/.npmignore index dd2cdd7ae6b..99fb55a3b11 100644 --- a/packages/react-icons/.npmignore +++ b/packages/react-icons/.npmignore @@ -1,5 +1 @@ -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-icons/package.json b/packages/react-icons/package.json index 808707775e1..562d46f679d 100644 --- a/packages/react-icons/package.json +++ b/packages/react-icons/package.json @@ -25,40 +25,21 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "scripts": { - "build": "yarn generate && yarn build:babel && yarn build:types", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", "generate": "node scripts/writeIcons.js", "clean": "rimraf dist src/icons src/index.js src/index.d.ts" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", + "@fortawesome/free-brands-svg-icons": "^5.7.2", "@fortawesome/free-regular-svg-icons": "^5.7.2", "@fortawesome/free-solid-svg-icons": "^5.7.2", "@patternfly/patternfly": "4.6.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", "fs-extra": "^6.0.1", "glob": "^7.1.2", "rimraf": "^2.6.2", "typescript": "^3.8.3" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" - }, - "dependencies": { - "@fortawesome/free-brands-svg-icons": "^5.8.1" } } diff --git a/packages/react-icons/scripts/writeIcons.js b/packages/react-icons/scripts/writeIcons.js index b416a1b501b..f99c7fe4d75 100644 --- a/packages/react-icons/scripts/writeIcons.js +++ b/packages/react-icons/scripts/writeIcons.js @@ -55,7 +55,7 @@ export default ${jsName}; const writeDTSExport = (fname, jsName, icon) => { outputFileSync( - join(outDir, 'js/icons', `${fname}.ts`), + join(outDir, 'js/icons', `${fname}.d.ts`), `import React from 'react'; import { SVGIconProps } from '../createIcon'; export declare const ${jsName}Config: { diff --git a/packages/react-icons/src/createIcon.tsx b/packages/react-icons/src/createIcon.tsx index aa3c489f6c5..9d34d68c5d9 100644 --- a/packages/react-icons/src/createIcon.tsx +++ b/packages/react-icons/src/createIcon.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; export enum IconSize { sm = 'sm', diff --git a/packages/react-icons/tsconfig.cjs.json b/packages/react-icons/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-icons/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-icons/tsconfig.gen-dts.json b/packages/react-icons/tsconfig.json similarity index 50% rename from packages/react-icons/tsconfig.gen-dts.json rename to packages/react-icons/tsconfig.json index 12109397683..b0d167bb350 100644 --- a/packages/react-icons/tsconfig.gen-dts.json +++ b/packages/react-icons/tsconfig.json @@ -1,22 +1,18 @@ { "extends": "../tsconfig.base.json", "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js", + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", "rootDirs": [ "src", "src/icons", "dist/js/icons" - ] + ], + "importHelpers": false }, "include": [ "./src/*", "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" ] } diff --git a/packages/react-inline-edit-extension/.babelrc b/packages/react-inline-edit-extension/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-inline-edit-extension/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-inline-edit-extension/.npmignore b/packages/react-inline-edit-extension/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-inline-edit-extension/.npmignore +++ b/packages/react-inline-edit-extension/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-inline-edit-extension/package.json b/packages/react-inline-edit-extension/package.json index ccbf13eef75..1ce83038c91 100644 --- a/packages/react-inline-edit-extension/package.json +++ b/packages/react-inline-edit-extension/package.json @@ -36,32 +36,15 @@ "reactabular-table": "^8.14.0" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" }, "scripts": { - "build": "yarn build:babel && yarn build:types", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", - "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose" + "clean": "rimraf dist" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", "rimraf": "^2.6.2", + "tslib": "^1.11.1", "typescript": "^3.8.3" } } diff --git a/packages/react-inline-edit-extension/src/components/CancelButton/__snapshots__/CancelButton.test.js.snap b/packages/react-inline-edit-extension/src/components/CancelButton/__snapshots__/CancelButton.test.js.snap index ba2c363eb9e..b5fecb621f7 100644 --- a/packages/react-inline-edit-extension/src/components/CancelButton/__snapshots__/CancelButton.test.js.snap +++ b/packages/react-inline-edit-extension/src/components/CancelButton/__snapshots__/CancelButton.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`it renders properly 1`] = ` - + `; diff --git a/packages/react-inline-edit-extension/src/components/ConfirmButton/__snapshots__/ConfirmButton.test.js.snap b/packages/react-inline-edit-extension/src/components/ConfirmButton/__snapshots__/ConfirmButton.test.js.snap index c9b2014b893..d7b86b3d1a3 100644 --- a/packages/react-inline-edit-extension/src/components/ConfirmButton/__snapshots__/ConfirmButton.test.js.snap +++ b/packages/react-inline-edit-extension/src/components/ConfirmButton/__snapshots__/ConfirmButton.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`it renders properly 1`] = ` - + `; diff --git a/packages/react-inline-edit-extension/src/components/ConfirmButtons/__snapshots__/ConfirmButtons.test.js.snap b/packages/react-inline-edit-extension/src/components/ConfirmButtons/__snapshots__/ConfirmButtons.test.js.snap index f96696eac7a..b24bbc63ee5 100644 --- a/packages/react-inline-edit-extension/src/components/ConfirmButtons/__snapshots__/ConfirmButtons.test.js.snap +++ b/packages/react-inline-edit-extension/src/components/ConfirmButtons/__snapshots__/ConfirmButtons.test.js.snap @@ -42,7 +42,7 @@ exports[`ConfirmButtons renders correctly 1`] = ` key="confirm" onMouseUp={[MockFunction]} > - - + - - + diff --git a/packages/react-inline-edit-extension/tsconfig.cjs.json b/packages/react-inline-edit-extension/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-inline-edit-extension/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-inline-edit-extension/tsconfig.gen-dts.json b/packages/react-inline-edit-extension/tsconfig.gen-dts.json deleted file mode 100644 index e2a3d669154..00000000000 --- a/packages/react-inline-edit-extension/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} diff --git a/packages/react-inline-edit-extension/tsconfig.json b/packages/react-inline-edit-extension/tsconfig.json new file mode 100644 index 00000000000..417160ee7a1 --- /dev/null +++ b/packages/react-inline-edit-extension/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ], + "references": [ + { + "path": "../react-table" + } + ] +} diff --git a/packages/react-integration/.npmignore b/packages/react-integration/.npmignore deleted file mode 100644 index 24d7d24d3f5..00000000000 --- a/packages/react-integration/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -src -build \ No newline at end of file diff --git a/packages/react-styles/.babelrc b/packages/react-styles/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-styles/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-styles/.npmignore b/packages/react-styles/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-styles/.npmignore +++ b/packages/react-styles/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-styles/package.json b/packages/react-styles/package.json index b195ed5f37c..515a74d43c4 100644 --- a/packages/react-styles/package.json +++ b/packages/react-styles/package.json @@ -15,38 +15,17 @@ "tag": "prerelease-v4" }, "scripts": { - "build": "yarn build:babel && yarn build:types && yarn build:css && node scripts/copyStyles.js", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/preset-env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", - "build:css": "node scripts/writeClassMaps.js", - "clean": "rimraf dist css", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose" + "generate": "node scripts/writeClassMaps.js && node scripts/copyStyles.js", + "clean": "rimraf dist css" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0-beta.48", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-flow-strip-types": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", "@patternfly/patternfly": "4.6.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", "camel-case": "^3.0.0", "css": "^2.2.3", - "cssstyle": "^0.3.1", "fbjs-scripts": "^0.8.3", "fs-extra": "^6.0.1", "glob": "^7.1.2", "jsdom": "^15.1.0", - "relative": "^3.0.2", "rimraf": "^2.6.2", "typescript": "^3.8.3" }, diff --git a/packages/react-styles/tsconfig.cjs.json b/packages/react-styles/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-styles/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-styles/tsconfig.gen-dts.json b/packages/react-styles/tsconfig.gen-dts.json deleted file mode 100644 index 05bf1c16e6f..00000000000 --- a/packages/react-styles/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} \ No newline at end of file diff --git a/packages/react-styles/tsconfig.json b/packages/react-styles/tsconfig.json new file mode 100644 index 00000000000..a7fc6b54403 --- /dev/null +++ b/packages/react-styles/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ] +} diff --git a/packages/react-table/.babelrc b/packages/react-table/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-table/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-table/.npmignore b/packages/react-table/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-table/.npmignore +++ b/packages/react-table/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-table/build/copyStyles.js b/packages/react-table/build/copyStyles.js deleted file mode 100644 index 5b36824b2ac..00000000000 --- a/packages/react-table/build/copyStyles.js +++ /dev/null @@ -1,44 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const { copySync, readFileSync, writeFileSync } = require('fs-extra'); -const { resolve, dirname, join } = require('path'); -const { parse: parseCSS, stringify: stringifyCSS } = require('css'); -/* eslint-enable @typescript-eslint/no-var-requires */ - -const baseCSSFilename = 'patternfly-base.css'; -const stylesDir = resolve(__dirname, '../dist/styles'); -const pfDir = dirname(require.resolve(`@patternfly/patternfly/${baseCSSFilename}`)); - -const css = readFileSync(join(pfDir, baseCSSFilename), 'utf8'); -const ast = parseCSS(css); - -const unusedSelectorRegEx = /(\.fas?|\.sr-only)/; -const unusedKeyFramesRegEx = /fa-/; -const unusedFontFamilyRegEx = /Font Awesome 5 Free/; -const ununsedFontFilesRegExt = /(fa-|\.html$|\.css$)/; - -// Core provides font awesome fonts and utlities. React does not use these -ast.stylesheet.rules = ast.stylesheet.rules.filter(rule => { - switch (rule.type) { - case 'rule': - return !rule.selectors.some(sel => unusedSelectorRegEx.test(sel)); - case 'keyframes': - return !unusedKeyFramesRegEx.test(rule.name); - case 'charset': - case 'comment': - return false; - case 'font-face': - // eslint-disable-next-line no-case-declarations - const fontFamilyDecl = rule.declarations.find(decl => decl.property === 'font-family'); - return !unusedFontFamilyRegEx.test(fontFamilyDecl.value); - default: - return true; - } -}); - -copySync(join(pfDir, 'assets/images'), join(stylesDir, 'assets/images')); -copySync(join(pfDir, 'assets/fonts'), join(stylesDir, 'assets/fonts'), { - filter(src) { - return !ununsedFontFilesRegExt.test(src); - } -}); -writeFileSync(join(stylesDir, 'base.css'), stringifyCSS(ast)); diff --git a/packages/react-table/build/snapshot-serializer.js b/packages/react-table/build/snapshot-serializer.js deleted file mode 100644 index afc30cfc483..00000000000 --- a/packages/react-table/build/snapshot-serializer.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const fs = require('fs'); -const { createSerializer } = require('@patternfly/react-styles/snapshot-serializer'); -/* eslint-enable @typescript-eslint/no-var-requires */ - -const pf4CSS = fs.readFileSync(require.resolve('@patternfly/react-styles/css/patternfly-base.css'), 'utf8'); - -module.exports = createSerializer({ - globalCSS: pf4CSS.match(/:root\W?\{(.|\n)*?\}/)[0] -}); diff --git a/packages/react-table/package.json b/packages/react-table/package.json index ab5b98ef412..25a66855063 100644 --- a/packages/react-table/package.json +++ b/packages/react-table/package.json @@ -32,40 +32,19 @@ "@patternfly/react-icons": "^4.1.0", "@patternfly/react-styles": "^4.1.0", "@patternfly/react-tokens": "^4.2.0", + "@types/classnames": "^2.2.9", "classnames": "^2.2.5", - "lodash": "^4.17.15" + "lodash": "^4.17.15", + "tslib": "^1.11.1" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" }, "scripts": { - "build": "yarn build:babel && yarn build:types && node ./build/copyStyles.js", - "build:babel": "concurrently 'yarn build:babel:esm && yarn build:babel:umd' 'yarn build:babel:cjs'", - "build:babel:cjs": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions '.js' dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "watch:types": "tsc -w -p tsconfig.gen-dts.json", - "build:types": "tsc -p tsconfig.gen-dts.json", - "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose --source-maps" + "clean": "rimraf dist" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "@types/classnames": "^2.2.9", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", - "css": "^2.2.3", - "fs-extra": "^6.0.1", - "glob": "^7.1.2", "rimraf": "^2.6.2", "typescript": "^3.8.3" } diff --git a/packages/react-table/src/components/Table/__snapshots__/Table.test.tsx.snap b/packages/react-table/src/components/Table/__snapshots__/Table.test.tsx.snap index f6866d49e25..077460e6a50 100644 --- a/packages/react-table/src/components/Table/__snapshots__/Table.test.tsx.snap +++ b/packages/react-table/src/components/Table/__snapshots__/Table.test.tsx.snap @@ -4470,18 +4470,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -4518,14 +4518,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -4553,7 +4553,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -4565,7 +4565,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -5308,18 +5308,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -5356,14 +5356,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -5391,7 +5391,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -5403,7 +5403,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -6146,18 +6146,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -6194,14 +6194,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -6229,7 +6229,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -6241,7 +6241,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -6984,18 +6984,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -7032,14 +7032,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -7067,7 +7067,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -7079,7 +7079,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -7822,18 +7822,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -7870,14 +7870,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -7905,7 +7905,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -7917,7 +7917,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -8660,18 +8660,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -8708,14 +8708,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -8743,7 +8743,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -8755,7 +8755,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -9498,18 +9498,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -9546,14 +9546,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -9581,7 +9581,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -9593,7 +9593,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -10336,18 +10336,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -10384,14 +10384,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -10419,7 +10419,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -10431,7 +10431,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -11174,18 +11174,18 @@ exports[`Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -11222,14 +11222,14 @@ exports[`Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -11257,7 +11257,7 @@ exports[`Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -11269,7 +11269,7 @@ exports[`Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -23283,7 +23283,7 @@ exports[`Collapsible nested table 1`] = ` isOpen={false} onToggle={[Function]} > - - + @@ -23836,7 +23836,7 @@ exports[`Collapsible nested table 1`] = ` isOpen={true} onToggle={[Function]} > - - + @@ -24846,7 +24846,7 @@ exports[`Collapsible nested table 1`] = ` isOpen={false} onToggle={[Function]} > - - + @@ -31832,7 +31832,7 @@ exports[`Collapsible table 1`] = ` isOpen={true} onToggle={[Function]} > - - + @@ -33365,7 +33365,7 @@ exports[`Collapsible table 1`] = ` isOpen={false} onToggle={[Function]} > - - + @@ -37634,7 +37634,7 @@ exports[`Compound Expandable table 1`] = ` data-key={0} data-label="col1" > - - + - - + @@ -38121,7 +38121,7 @@ exports[`Compound Expandable table 1`] = ` data-key={0} data-label="col1" > - - + - - + @@ -41907,7 +41907,7 @@ exports[`Editable table 1`] = `
- - +
- - +
- - +
@@ -42875,7 +42875,7 @@ exports[`Editable table 1`] = `
- - +
- - +
- - +
@@ -71924,18 +71924,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -71971,14 +71971,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -72006,7 +72006,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -72017,7 +72017,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -72891,18 +72891,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -72938,14 +72938,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -72973,7 +72973,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -72984,7 +72984,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -73858,18 +73858,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -73905,14 +73905,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -73940,7 +73940,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -73951,7 +73951,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -74825,18 +74825,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -74872,14 +74872,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -74907,7 +74907,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -74918,7 +74918,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -75792,18 +75792,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -75839,14 +75839,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -75874,7 +75874,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -75885,7 +75885,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -76759,18 +76759,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -76806,14 +76806,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -76841,7 +76841,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -76852,7 +76852,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -77726,18 +77726,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -77773,14 +77773,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -77808,7 +77808,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -77819,7 +77819,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -78693,18 +78693,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -78740,14 +78740,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -78775,7 +78775,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -78786,7 +78786,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -79660,18 +79660,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - } @@ -79707,14 +79707,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -79742,7 +79742,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - } @@ -79753,7 +79753,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + @@ -80631,18 +80631,18 @@ exports[`Simple Actions table 1`] = ` } } > - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isOpen={false} isPlain={true} position="right" toggle={ - @@ -80679,14 +80679,14 @@ exports[`Simple Actions table 1`] = ` direction="down" dropdownItems={ Array [ - Some action - , - , + Another action - , - , + , - Third action - , + , ] } isGrouped={false} @@ -80714,7 +80714,7 @@ exports[`Simple Actions table 1`] = ` ouiaComponentType="Dropdown" position="right" toggle={ - @@ -80726,7 +80726,7 @@ exports[`Simple Actions table 1`] = ` data-ouia-component-type="PF4/Dropdown" data-ouia-safe={true} > - - + - + diff --git a/packages/react-table/tsconfig.cjs.json b/packages/react-table/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-table/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-table/tsconfig.gen-dts.json b/packages/react-table/tsconfig.gen-dts.json deleted file mode 100644 index 05bf1c16e6f..00000000000 --- a/packages/react-table/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} \ No newline at end of file diff --git a/packages/react-table/tsconfig.json b/packages/react-table/tsconfig.json new file mode 100644 index 00000000000..6e5f3e83710 --- /dev/null +++ b/packages/react-table/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ], + "references": [ + { + "path": "../react-core" + }, + { + "path": "../react-icons" + }, + { + "path": "../react-styles" + } + ] +} diff --git a/packages/react-tokens/.npmignore b/packages/react-tokens/.npmignore deleted file mode 100644 index 5344519a423..00000000000 --- a/packages/react-tokens/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map diff --git a/packages/react-tokens/package.json b/packages/react-tokens/package.json index 6b195001055..5182b02b3d1 100644 --- a/packages/react-tokens/package.json +++ b/packages/react-tokens/package.json @@ -25,7 +25,7 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "scripts": { - "build": "node scripts/writeTokens.js && yarn build:babel:umd", + "generate": "node scripts/writeTokens.js", "build:babel:umd": "babel dist/esm --out-dir dist/umd --plugins transform-es2015-modules-umd -q", "clean": "rimraf dist" }, diff --git a/packages/react-topology/.babelrc b/packages/react-topology/.babelrc deleted file mode 100644 index 3eeb33a71bc..00000000000 --- a/packages/react-topology/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} diff --git a/packages/react-topology/.npmignore b/packages/react-topology/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-topology/.npmignore +++ b/packages/react-topology/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-topology/build/copyStyles.js b/packages/react-topology/build/copyStyles.js deleted file mode 100644 index cefb1722ab1..00000000000 --- a/packages/react-topology/build/copyStyles.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable no-case-declarations, @typescript-eslint/no-var-requires */ -const { copySync, readFileSync, writeFileSync } = require('fs-extra'); -const { resolve, dirname, join } = require('path'); -const { parse: parseCSS, stringify: stringifyCSS } = require('css'); -/* eslint-enable @typescript-eslint/no-var-requiresShadowman06 */ - -const baseCSSFilename = 'patternfly-base.css'; -const stylesDir = resolve(__dirname, '../dist/styles'); -const pfDir = dirname(require.resolve(`@patternfly/patternfly/${baseCSSFilename}`)); - -const css = readFileSync(join(pfDir, baseCSSFilename), 'utf8'); -const ast = parseCSS(css); - -const unusedSelectorRegEx = /(\.fas?|\.sr-only)/; -const unusedKeyFramesRegEx = /fa-/; -const unusedFontFamilyRegEx = /Font Awesome 5 Free/; -const ununsedFontFilesRegExt = /(fa-|\.html$|\.css$)/; - -// Core provides font awesome fonts and utlities. React does not use these -ast.stylesheet.rules = ast.stylesheet.rules.filter(rule => { - switch (rule.type) { - case 'rule': - return !rule.selectors.some(sel => unusedSelectorRegEx.test(sel)); - case 'keyframes': - return !unusedKeyFramesRegEx.test(rule.name); - case 'charset': - case 'comment': - return false; - case 'font-face': - const fontFamilyDecl = rule.declarations.find(decl => decl.property === 'font-family'); - return !unusedFontFamilyRegEx.test(fontFamilyDecl.value); - default: - return true; - } -}); - -copySync(join(pfDir, 'assets/images'), join(stylesDir, 'assets/images')); -copySync(join(pfDir, 'assets/fonts'), join(stylesDir, 'assets/fonts'), { - filter(src) { - return !ununsedFontFilesRegExt.test(src); - } -}); -writeFileSync(join(stylesDir, 'base.css'), stringifyCSS(ast)); diff --git a/packages/react-topology/package.json b/packages/react-topology/package.json index f2fb2d5b999..bf308ba20ac 100644 --- a/packages/react-topology/package.json +++ b/packages/react-topology/package.json @@ -28,41 +28,17 @@ "@patternfly/patternfly": "4.6.0", "@patternfly/react-core": "^4.5.0", "@patternfly/react-icons": "^4.1.0", - "@patternfly/react-styles": "^4.1.0" + "@patternfly/react-styles": "^4.1.0", + "tslib": "^1.11.1" }, "peerDependencies": { - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" }, "scripts": { - "build": "yarn build:babel && yarn build:types && node ./build/copyStyles.js", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "build:types": "tsc -p tsconfig.gen-dts.json", - "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose" + "clean": "rimraf dist" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "@patternfly/react-tokens": "^4.2.0", - "@types/prop-types": "^15.7.0", - "@types/react": "^16.4.0", - "@types/react-dom": "^16.4.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", - "css": "^2.2.3", - "fs-extra": "^6.0.1", - "glob": "^7.1.2", "rimraf": "^2.6.2", "typescript": "^3.8.3" } diff --git a/packages/react-topology/src/components/TopologyControlBar/__snapshots__/TopologyControlBar.test.tsx.snap b/packages/react-topology/src/components/TopologyControlBar/__snapshots__/TopologyControlBar.test.tsx.snap index 35da400106b..a900ba4f4da 100644 --- a/packages/react-topology/src/components/TopologyControlBar/__snapshots__/TopologyControlBar.test.tsx.snap +++ b/packages/react-topology/src/components/TopologyControlBar/__snapshots__/TopologyControlBar.test.tsx.snap @@ -117,7 +117,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = `
-
- test zoom in tooltip - +
} delay={ @@ -212,7 +212,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = ` trigger="mouseenter focus" zIndex={9999} > - - + @@ -265,7 +265,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = ` id="" role="tooltip" > -
test zoom in tooltip
-
+
- - +
- Zoom Out - +
} delay={ @@ -375,7 +375,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = ` trigger="mouseenter focus" zIndex={9999} > - - +
@@ -450,7 +450,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = ` id="" role="tooltip" > -
Zoom Out
-
+
-
- +
- Reset View - +
} delay={ @@ -560,7 +560,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = ` trigger="mouseenter focus" zIndex={9999} > - - +
@@ -635,7 +635,7 @@ exports[`TopologyControlBar should accept button options correctly 1`] = ` id="" role="tooltip" > -
Reset View
-
+
-
+ @@ -868,7 +868,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] =
-
- Zoom In - +
} delay={ @@ -963,7 +963,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = trigger="mouseenter focus" zIndex={9999} > - - + @@ -1038,7 +1038,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = id="" role="tooltip" > -
Zoom In
-
+
- - +
- Zoom Out - +
} delay={ @@ -1148,7 +1148,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = trigger="mouseenter focus" zIndex={9999} > - - +
@@ -1223,7 +1223,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = id="" role="tooltip" > -
Zoom Out
-
+
-
- +
- Fit to Screen - +
} delay={ @@ -1333,7 +1333,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = trigger="mouseenter focus" zIndex={9999} > - - +
@@ -1408,7 +1408,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = id="" role="tooltip" > -
Fit to Screen
-
+
-
- +
- Reset View - +
} delay={ @@ -1518,7 +1518,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = trigger="mouseenter focus" zIndex={9999} > - - +
@@ -1593,7 +1593,7 @@ exports[`TopologyControlBar should display the default controls correctly 1`] = id="" role="tooltip" > -
Reset View
-
+
-
- +
- - +
-
+ diff --git a/packages/react-topology/src/components/TopologySideBar/__snapshots__/TopologySideBar.test.tsx.snap b/packages/react-topology/src/components/TopologySideBar/__snapshots__/TopologySideBar.test.tsx.snap index 3a68efb8a1d..c377e2da9ee 100644 --- a/packages/react-topology/src/components/TopologySideBar/__snapshots__/TopologySideBar.test.tsx.snap +++ b/packages/react-topology/src/components/TopologySideBar/__snapshots__/TopologySideBar.test.tsx.snap @@ -46,7 +46,7 @@ exports[`TopologySideBar should display topology sidebar w/ close correctly 1`] className="pf-topology-side-bar fade my-test-class shown" role="dialog" > - - +
diff --git a/packages/react-topology/src/components/TopologyView/__snapshots__/TopologyView.test.tsx.snap b/packages/react-topology/src/components/TopologyView/__snapshots__/TopologyView.test.tsx.snap index b3e7833d300..12b6b7331f9 100644 --- a/packages/react-topology/src/components/TopologyView/__snapshots__/TopologyView.test.tsx.snap +++ b/packages/react-topology/src/components/TopologyView/__snapshots__/TopologyView.test.tsx.snap @@ -5,7 +5,7 @@ exports[`TopologyView should display an empty topology correctly 1`] = ` className="my-test-class" id="simple-test-id" > - @@ -13,7 +13,7 @@ exports[`TopologyView should display an empty topology correctly 1`] = ` className="pf-l-stack my-test-class" id="simple-test-id" > -
- - +
-
- + @@ -96,9 +96,9 @@ exports[`TopologyView should display an empty topology correctly 1`] = ` className="pf-topology-content" />
- + - + `; @@ -122,7 +122,7 @@ exports[`TopologyView should display topology correctly 1`] = ` /> } > - @@ -130,7 +130,7 @@ exports[`TopologyView should display topology correctly 1`] = ` className="pf-l-stack my-test-class" id="simple-test-id" > -
- - + -
- + @@ -368,9 +368,9 @@ exports[`TopologyView should display topology correctly 1`] = ` - + -
+ `; @@ -400,7 +400,7 @@ exports[`TopologyView should display topology sidebar correctly 1`] = ` /> } > - @@ -408,7 +408,7 @@ exports[`TopologyView should display topology sidebar correctly 1`] = ` className="pf-l-stack my-test-class" id="simple-test-id" > -
- - + -
- + @@ -649,9 +649,9 @@ exports[`TopologyView should display topology sidebar correctly 1`] = ` Test SideBar - + -
+ `; @@ -681,7 +681,7 @@ exports[`TopologyView should display topology w/ open sidebar correctly 1`] = ` /> } > - @@ -689,7 +689,7 @@ exports[`TopologyView should display topology w/ open sidebar correctly 1`] = ` className="pf-l-stack my-test-class" id="simple-test-id" > -
- - + -
- + @@ -930,8 +930,8 @@ exports[`TopologyView should display topology w/ open sidebar correctly 1`] = ` Test SideBar - + -
+ `; diff --git a/packages/react-topology/tsconfig.cjs.json b/packages/react-topology/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-topology/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-topology/tsconfig.gen-dts.json b/packages/react-topology/tsconfig.gen-dts.json deleted file mode 100644 index e2a3d669154..00000000000 --- a/packages/react-topology/tsconfig.gen-dts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true, - "outDir": "dist/js" - }, - "include": [ - "./src/*", - "./src/**/*" - ], - "exclude": [ - "./src/**/**.test.tsx", - "./src/**/**.test.ts", - "./src/**/examples/**" - ] -} diff --git a/packages/react-topology/tsconfig.json b/packages/react-topology/tsconfig.json new file mode 100644 index 00000000000..7555a6bf3ba --- /dev/null +++ b/packages/react-topology/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ], + "references": [ + { + "path": "../react-core" + } + ] +} diff --git a/packages/react-virtualized-extension/.babelrc b/packages/react-virtualized-extension/.babelrc deleted file mode 100644 index 25c4221a16d..00000000000 --- a/packages/react-virtualized-extension/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.babelrc" -} \ No newline at end of file diff --git a/packages/react-virtualized-extension/.npmignore b/packages/react-virtualized-extension/.npmignore index 5344519a423..99fb55a3b11 100644 --- a/packages/react-virtualized-extension/.npmignore +++ b/packages/react-virtualized-extension/.npmignore @@ -1,6 +1 @@ -build -dist/**/demos -dist/**/examples -dist/**/__snapshots__ -dist/**/*.test.js -dist/**/*.map +dist/*.tsbuildinfo diff --git a/packages/react-virtualized-extension/build/copyStyles.js b/packages/react-virtualized-extension/build/copyStyles.js deleted file mode 100644 index 3c501ed0ad6..00000000000 --- a/packages/react-virtualized-extension/build/copyStyles.js +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-disable no-case-declarations */ -const { copySync, readFileSync, writeFileSync } = require('fs-extra'); -const { resolve, dirname, join } = require('path'); -const { parse: parseCSS, stringify: stringifyCSS } = require('css'); - -const baseCSSFilename = 'patternfly-base.css'; -const stylesDir = resolve(__dirname, '../dist/styles'); -const pfDir = dirname(require.resolve(`@patternfly/patternfly/${baseCSSFilename}`)); - -const css = readFileSync(join(pfDir, baseCSSFilename), 'utf8'); -const ast = parseCSS(css); - -const unusedSelectorRegEx = /(\.fas?|\.sr-only)/; -const unusedKeyFramesRegEx = /fa-/; -const unusedFontFamilyRegEx = /Font Awesome 5 Free/; -const ununsedFontFilesRegExt = /(fa-|\.html$|\.css$)/; - -// Core provides font awesome fonts and utlities. React does not use these -ast.stylesheet.rules = ast.stylesheet.rules.filter(rule => { - switch (rule.type) { - case 'rule': - return !rule.selectors.some(sel => unusedSelectorRegEx.test(sel)); - case 'keyframes': - return !unusedKeyFramesRegEx.test(rule.name); - case 'charset': - case 'comment': - return false; - case 'font-face': - const fontFamilyDecl = rule.declarations.find(decl => decl.property === 'font-family'); - return !unusedFontFamilyRegEx.test(fontFamilyDecl.value); - default: - return true; - } -}); - -copySync(join(pfDir, 'assets/images'), join(stylesDir, 'assets/images')); -copySync(join(pfDir, 'assets/fonts'), join(stylesDir, 'assets/fonts'), { - filter(src) { - return !ununsedFontFilesRegExt.test(src); - } -}); -writeFileSync(join(stylesDir, 'base.css'), stringifyCSS(ast)); diff --git a/packages/react-virtualized-extension/package.json b/packages/react-virtualized-extension/package.json index ebb546637b9..3fc3ad6e023 100644 --- a/packages/react-virtualized-extension/package.json +++ b/packages/react-virtualized-extension/package.json @@ -36,41 +36,23 @@ "dom-helpers": "^2.4.0 || ^3.0.0", "linear-layout-vector": "0.0.1", "react-lifecycles-compat": "^3.0.4", - "react-virtualized": "^9.21.1" + "react-virtualized": "^9.21.1", + "tslib": "^1.11.1" }, "peerDependencies": { "@patternfly/react-table": "^2.10.0", - "prop-types": "^15.6.1", "react": "^16.4.0", "react-dom": "^15.6.2 || ^16.4.0" }, "scripts": { - "build": "yarn build:babel && node ./build/copyStyles.js", - "build:babel": "concurrently \"yarn build:babel:esm && yarn build:babel:umd\" \"yarn build:babel:cjs\"", - "build:babel:cjs": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --source-maps --extensions \".js,.ts,.tsx\" src --out-dir dist/esm", - "build:babel:umd": "babel --source-maps --extensions \".js\" dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", - "clean": "rimraf dist", - "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose" + "clean": "rimraf dist" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", "@types/dom-helpers": "^3.4.1", "@types/react-lifecycles-compat": "^3.0.1", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", - "css": "^2.2.3", - "fs-extra": "^6.0.1", - "glob": "^7.1.2", "lodash": "^4.17.15", "rimraf": "^2.6.2", - "uuid": "^3.3.2" + "uuid": "^3.3.2", + "typescript": "^3.8.3" } } diff --git a/packages/react-virtualized-extension/src/components/Virtualized/__snapshots__/VirtualizedTable.test.tsx.snap b/packages/react-virtualized-extension/src/components/Virtualized/__snapshots__/VirtualizedTable.test.tsx.snap index ffeb223ab99..0cb5c0fc6cb 100644 --- a/packages/react-virtualized-extension/src/components/Virtualized/__snapshots__/VirtualizedTable.test.tsx.snap +++ b/packages/react-virtualized-extension/src/components/Virtualized/__snapshots__/VirtualizedTable.test.tsx.snap @@ -413,11 +413,11 @@ exports[`Actions virtualized table 1`] = ` data-ouia-safe={true} role="grid" > - + -
@@ -708,7 +708,7 @@ exports[`Actions virtualized table 1`] = ` - - - - + - - + Branches - - + Pull requests - - + Workspaces - - + Last Commit - - + - + - + -
+
-
+ @@ -1540,11 +1540,11 @@ exports[`Selectable virtualized table 1`] = ` data-ouia-safe={true} role="grid" > - + -
@@ -1835,7 +1835,7 @@ exports[`Selectable virtualized table 1`] = ` - - - - + - - + - - + - - + Branches - - + Pull requests - - + Workspaces - - + Last Commit - + - + -
+
-
+ @@ -2829,11 +2829,11 @@ exports[`Simple Actions table 1`] = ` data-ouia-safe={true} role="grid" > - + -
@@ -3238,7 +3238,7 @@ exports[`Simple Actions table 1`] = ` - - - - + - - + Branches - - + Pull requests - - + Workspaces - - + Last Commit - - + - + - + -
+
-
+ @@ -4134,11 +4134,11 @@ exports[`Simple virtualized table aria-label 1`] = ` data-ouia-safe={true} role="grid" > - + -
@@ -4383,7 +4383,7 @@ exports[`Simple virtualized table aria-label 1`] = ` - - Header cell - - + Branches - - + Pull requests - - + Workspaces - - + Last Commit - + - + -
+
-
+ @@ -5063,11 +5063,11 @@ exports[`Simple virtualized table className 1`] = ` data-ouia-safe={true} role="grid" > - + -
@@ -5312,7 +5312,7 @@ exports[`Simple virtualized table className 1`] = ` - - Header cell - - + Branches - - + Pull requests - - + Workspaces - - + Last Commit - + - + -
+
-
+ @@ -5998,11 +5998,11 @@ exports[`Sortable Virtualized Table 1`] = ` data-ouia-safe={true} role="grid" > - + -
@@ -6248,7 +6248,7 @@ exports[`Sortable Virtualized Table 1`] = ` - - - - + - - + Branches - - + Pull requests - - + Workspaces - - + Last Commit - + - + -
+
-
+ diff --git a/packages/react-virtualized-extension/src/components/Virtualized/utils/CellSizeAndPositionManager.ts b/packages/react-virtualized-extension/src/components/Virtualized/utils/CellSizeAndPositionManager.ts index bc5bacb54f1..51717ef52ad 100644 --- a/packages/react-virtualized-extension/src/components/Virtualized/utils/CellSizeAndPositionManager.ts +++ b/packages/react-virtualized-extension/src/components/Virtualized/utils/CellSizeAndPositionManager.ts @@ -27,7 +27,7 @@ interface GetVisibleCellRangeParams { offset: number; } -interface SizeAndPositionData { +export interface SizeAndPositionData { offset: number; size: number; } diff --git a/packages/react-virtualized-extension/src/components/Virtualized/utils/ScalingCellSizeAndPositionManager.ts b/packages/react-virtualized-extension/src/components/Virtualized/utils/ScalingCellSizeAndPositionManager.ts index a2a55de9260..b1d2cf9a050 100644 --- a/packages/react-virtualized-extension/src/components/Virtualized/utils/ScalingCellSizeAndPositionManager.ts +++ b/packages/react-virtualized-extension/src/components/Virtualized/utils/ScalingCellSizeAndPositionManager.ts @@ -2,7 +2,7 @@ import { Alignment, CellSizeGetter, VisibleCellRange } from '../types'; -import CellSizeAndPositionManager from './CellSizeAndPositionManager'; +import CellSizeAndPositionManager, { SizeAndPositionData } from './CellSizeAndPositionManager'; import { getMaxElementSize } from './maxElementSize'; interface ContainerSizeAndOffset { @@ -75,11 +75,11 @@ export default class ScalingCellSizeAndPositionManager { return Math.round(offsetPercentage * (safeTotalSize - totalSize)); } - getSizeAndPositionOfCell(index: number) { + getSizeAndPositionOfCell(index: number): SizeAndPositionData { return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index); } - getSizeAndPositionOfLastMeasuredCell() { + getSizeAndPositionOfLastMeasuredCell(): SizeAndPositionData { return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell(); } diff --git a/packages/react-virtualized-extension/tsconfig.cjs.json b/packages/react-virtualized-extension/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/packages/react-virtualized-extension/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/packages/react-virtualized-extension/tsconfig.json b/packages/react-virtualized-extension/tsconfig.json new file mode 100644 index 00000000000..a7fc6b54403 --- /dev/null +++ b/packages/react-virtualized-extension/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ] +} diff --git a/packages/tsconfig.base.json b/packages/tsconfig.base.json index a1f68a1569d..805310f10a9 100644 --- a/packages/tsconfig.base.json +++ b/packages/tsconfig.base.json @@ -2,15 +2,24 @@ "compilerOptions": { "jsx": "react", "lib": [ - "es2017", + "es2015", "dom" ], - "esModuleInterop": true, - "module": "commonjs", + "target": "es2015", + "module": "es2015", "moduleResolution": "node", + "esModuleInterop": true, "skipLibCheck": true, + "importHelpers": true, + "composite": true, + "sourceMap": true, + "declarationMap": true, "strict": true, - "strictNullChecks": false, - "target": "es5" - } -} + "strictNullChecks": false + }, + "exclude": [ + "**/**.test.tsx", + "**/**.test.ts", + "**/examples/**" + ] +} \ No newline at end of file diff --git a/packages/tsconfig.cjs.json b/packages/tsconfig.cjs.json new file mode 100644 index 00000000000..9ee578951e4 --- /dev/null +++ b/packages/tsconfig.cjs.json @@ -0,0 +1,32 @@ +{ + "files": [], + "references": [ + { + "path": "./react-catalog-view-extension/tsconfig.cjs.json" + }, + { + "path": "./react-charts/tsconfig.cjs.json" + }, + { + "path": "./react-core/tsconfig.cjs.json" + }, + { + "path": "./react-icons/tsconfig.cjs.json" + }, + { + "path": "./react-inline-edit-extension/tsconfig.cjs.json" + }, + { + "path": "./react-styles/tsconfig.cjs.json" + }, + { + "path": "./react-table/tsconfig.cjs.json" + }, + { + "path": "./react-topology/tsconfig.cjs.json" + }, + { + "path": "./react-virtualized-extension/tsconfig.cjs.json" + } + ] +} \ No newline at end of file diff --git a/packages/tsconfig.json b/packages/tsconfig.json new file mode 100644 index 00000000000..d794941a72c --- /dev/null +++ b/packages/tsconfig.json @@ -0,0 +1,32 @@ +{ + "files": [], + "references": [ + { + "path": "./react-catalog-view-extension" + }, + { + "path": "./react-charts" + }, + { + "path": "./react-core" + }, + { + "path": "./react-icons" + }, + { + "path": "./react-inline-edit-extension" + }, + { + "path": "./react-styles" + }, + { + "path": "./react-table" + }, + { + "path": "./react-topology" + }, + { + "path": "./react-virtualized-extension" + } + ] +} \ No newline at end of file diff --git a/scripts/bumpCore.js b/scripts/bumpCore.js deleted file mode 100644 index 4956797133a..00000000000 --- a/scripts/bumpCore.js +++ /dev/null @@ -1,32 +0,0 @@ -const fs = require('fs'); -const Project = require('@lerna/project'); - -// These are packages we need to rebuild -async function getCorePackages() { - const packages = (await new Project(__dirname).getPackages()).filter(p => { - if (p.dependencies && Object.keys(p.dependencies).includes('@patternfly/patternfly')) { - return true; - } - if (p.devDependencies && Object.keys(p.devDependencies).includes('@patternfly/patternfly')) { - return true; - } - return false; - }); - - return packages; -} - -// https://github.com/lerna/lerna/blob/master/core/package/index.js -getCorePackages().then(packages => - packages.forEach(package => { - const json = require(package.manifestLocation); - if (json.dependencies && json.dependencies['@patternfly/patternfly']) { - json.dependencies['@patternfly/patternfly'] = process.argv[2]; - } - if (json.devDependencies && json.devDependencies['@patternfly/patternfly']) { - json.devDependencies['@patternfly/patternfly'] = process.argv[2]; - } - - fs.writeFileSync(package.manifestLocation, JSON.stringify(json, null, 2) + '\n'); - }) -); diff --git a/scripts/generators/package/.babelrc.hbs b/scripts/generators/package/.babelrc.hbs deleted file mode 100644 index 8ade66d8e14..00000000000 --- a/scripts/generators/package/.babelrc.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["../.babelrc.js"] -} diff --git a/scripts/generators/package/.npmignore b/scripts/generators/package/.npmignore new file mode 100644 index 00000000000..b1655e5e919 --- /dev/null +++ b/scripts/generators/package/.npmignore @@ -0,0 +1 @@ +dist/*.tsbuildinfo \ No newline at end of file diff --git a/scripts/generators/package/.npmignore.hbs b/scripts/generators/package/.npmignore.hbs deleted file mode 100644 index 24d7d24d3f5..00000000000 --- a/scripts/generators/package/.npmignore.hbs +++ /dev/null @@ -1,2 +0,0 @@ -src -build \ No newline at end of file diff --git a/scripts/generators/package/index.js b/scripts/generators/package/index.js index 9b9e9fb569b..5125990718d 100644 --- a/scripts/generators/package/index.js +++ b/scripts/generators/package/index.js @@ -1,27 +1,8 @@ -const helpers = require('../../lernaHelpers'); const { join, resolve } = require('path'); const { REMOVE_NPM_SCOPE } = require('../helpers'); const packagesRoot = resolve(__dirname, '../../../packages'); -const packageTypes = { - general: 0, - pf4: 4 -}; - -const packageConfigs = { - [packageTypes.general]: { - name: 'General', - value: packageTypes.general, - location: packagesRoot - }, - [packageTypes.pf4]: { - name: 'PatternFly 4', - value: packageTypes.pf4, - location: packagesRoot - } -}; - function setPackageGenerators(plop) { plop.setGenerator('Package', { description: 'A new package for the monorepo', @@ -29,39 +10,21 @@ function setPackageGenerators(plop) { { type: 'input', name: 'name', - message: 'What should the package name be?', - async validate(input) { - const packages = await helpers.getPfPackages(false); - const pkgConfigs = packages.map(pkg => pkg.toJSON()); - const matchingPackage = pkgConfigs.find(p => p.name === input); - return matchingPackage ? `Packages already exits at ${matchingPackage.location}` : true; - } + message: 'What should the package name be?' }, { type: 'input', name: 'description', message: 'Describe this package' }, - { - type: 'list', - choices: Object.keys(packageConfigs).map(key => packageConfigs[key]), - name: 'packageType', - message: 'What type of package is it?' - }, - { - type: 'confirm', - name: 'buildsWithBabel', - message: 'Does this build with Babel?' - }, { type: 'confirm', - name: 'includeTypings', - message: 'Will TypeScript definitions be included?' + name: 'buildsWithTypescript', + message: 'Does this build with Typescript?' } ], actions: answers => { - const packageConfig = packageConfigs[answers.packageType]; - const packageBaseTemplate = join(packageConfig.location, `./{{${REMOVE_NPM_SCOPE} name}}/`); + const packageBaseTemplate = join(packagesRoot, `./{{${REMOVE_NPM_SCOPE} name}}/`); return [ { @@ -72,19 +35,27 @@ function setPackageGenerators(plop) { { type: 'add', template: '// placeholder\n', - path: answers.buildsWithBabel - ? join(packageBaseTemplate, 'src/index.js') + path: answers.buildsWithTypescript + ? join(packageBaseTemplate, 'src/index.ts') : join(packageBaseTemplate, 'lib/index.js') }, - answers.buildsWithBabel && { + answers.buildsWithTypescript && + { type: 'add', - path: join(packageBaseTemplate, `.babelrc`), - templateFile: resolve(__dirname, './.babelrc.hbs') + path: join(packageBaseTemplate, `.npmignore`), + templateFile: resolve(__dirname, './.npmignore') }, + answers.buildsWithTypescript && { type: 'add', - path: join(packageBaseTemplate, `.npmignore`), - templateFile: resolve(__dirname, './.npmignore.hbs') + path: join(packageBaseTemplate, `tsconfig.json`), + templateFile: resolve(__dirname, './tsconfig.json') + }, + answers.buildsWithTypescript && + { + type: 'add', + path: join(packageBaseTemplate, `tsconfig.cjs.json`), + templateFile: resolve(__dirname, './tsconfig.cjs.json') }, { type: 'add', diff --git a/scripts/generators/package/package.json.hbs b/scripts/generators/package/package.json.hbs index 34c4b24480e..ef1376c4434 100644 --- a/scripts/generators/package/package.json.hbs +++ b/scripts/generators/package/package.json.hbs @@ -2,17 +2,12 @@ "name": "{{name}}", "version": "1.0.0", "description": "{{description}}", - {{#if buildsWithBabel }} + {{#if buildsWithTypescript }} "main": "dist/js/index.js", "module": "dist/esm/index.js", - {{#if includeTypings}} "types": "dist/js/index.d.ts", - {{/if}} {{else}} "main": "lib/index.js", - {{#if includeTypings}} - "types": "lib/index.d.ts", - {{/if}} {{/if}} "sideEffects": false, "publishConfig": { @@ -33,25 +28,20 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "scripts": { - {{#if buildsWithBabel}} - "build": "yarn build:babel", - "build:babel": "concurrently 'yarn build:babel:esm && yarn build:babel:umd' 'yarn build:babel:cjs'", - "build:babel:cjs": "babel --extensions '.js,.ts,.tsx' src --out-dir dist/js --presets=@babel/env", - "build:babel:esm": "babel --extensions '.js,.ts,.tsx' src --out-dir dist/esm", - "build:babel:umd": "babel dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", + {{#if buildsWithTypescript}} + "clean": "rimraf dist" {{/if}} }, "dependencies": {}, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-typescript-to-proptypes": "^0.17.1", + {{#if buildsWithTypescript}} + "rimraf": "^2.6.2", + "tslib": "^1.11.1", + "typescript": "^3.8.3" + {{/if}} + }, + "peerDependencies": { + "react": "^16.4.0", + "react-dom": "^15.6.2 || ^16.4.0" } } diff --git a/scripts/generators/package/tsconfig.cjs.json b/scripts/generators/package/tsconfig.cjs.json new file mode 100644 index 00000000000..578d46af9d3 --- /dev/null +++ b/scripts/generators/package/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/js", + "module": "commonjs", + "tsBuildInfoFile": "dist/cjs.tsbuildinfo" + } +} diff --git a/scripts/generators/package/tsconfig.json b/scripts/generators/package/tsconfig.json new file mode 100644 index 00000000000..a7fc6b54403 --- /dev/null +++ b/scripts/generators/package/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist/esm", + "declarationDir": "./dist/js", + "tsBuildInfoFile": "dist/esm.tsbuildinfo" + }, + "include": [ + "./src/*", + "./src/**/*" + ] +} diff --git a/scripts/hashDir.js b/scripts/hashDir.js deleted file mode 100644 index e9baa9c55b5..00000000000 --- a/scripts/hashDir.js +++ /dev/null @@ -1,49 +0,0 @@ -const fs = require('fs-extra'); -const path = require('path'); -const crypto = require('crypto'); - -// http://stackoverflow.com/a/5827895/4241030 -function filewalker(dir) { - let results = []; - - fs.readdirSync(dir).forEach(file => { - filePath = path.resolve(dir, file); - - const stat = fs.statSync(filePath); - // If directory, execute a recursive call - if (stat && stat.isDirectory() && !stat.isSymbolicLink()) { - results.push({ path: filePath, type: 'dir' }); - results = results.concat(filewalker(filePath)); - } else if (stat && stat.isFile()) { - results.push({ path: filePath, type: 'file' }); - } - }); - - return results; -} - -function hashDir(dirPath) { - const md5 = crypto.createHash('md5'); - const stat = fs.statSync(dirPath); - - if (stat && stat.isFile()) { - const fileContents = fs.readFileSync(dirPath); - md5.update(fileContents); - } else { - filewalker(dirPath) - .sort((f1, f2) => f1.path.localeCompare(f2.path)) - .forEach(file => { - if (file.type === 'file') { - const fileContents = fs.readFileSync(file.path); - md5.update(fileContents); - } else if (file.type === 'dir') { - md5.update(file.path); - } - }); - } - return md5.digest('hex'); -} - -module.exports = { - hashDir -}; diff --git a/scripts/incrementalBuild.js b/scripts/incrementalBuild.js deleted file mode 100644 index f221e14567a..00000000000 --- a/scripts/incrementalBuild.js +++ /dev/null @@ -1,79 +0,0 @@ -// This script should be replaced by some standard incremental build system -// `tsc` is a pretty good example... -const fs = require('fs'); -const { hashDir } = require('./hashDir'); -const Project = require('@lerna/project'); -const RunCommand = require('@lerna/run'); - -// Load cache -const cacheFile = '.cache/incrementalCache'; -let cache = {}; -if (fs.existsSync(cacheFile)) { - cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8')); -} -const yarnLockHash = hashDir('yarn.lock'); - -// Assume src directory gets made into dist -const getSrcDirs = packageName => { - switch (packageName) { - case '@patternfly/react-icons': - return ['src', 'scripts']; - case '@patternfly/react-catalog-view-extension': - return ['src', 'sass']; - case '@patternfly/react-tokens': - return ['scripts']; - case '@patternfly/react-styles': - return ['src', 'scripts']; - default: - return ['src']; - } -}; - -const hashPackageSrc = (packageLoc, packageName) => { - let hash = 0; - for (let srcDir of getSrcDirs(packageName)) { - hash += hashDir(`${packageLoc}/${srcDir}`); - } - - return hash; -}; - -// These are packages we need to rebuild -async function getInvalidPackages() { - const packages = (await new Project(__dirname).getPackages()).filter(p => p.scripts.build); // Only packages that have a build target - - for (let p of packages) { - p.hash = hashPackageSrc(p.location, p.name); - p.valid = cache && cache[p.name] === p.hash; - if (p.valid) { - console.info('Skipping', p.name, '(already built).'); - } - } - - // Invalidate everything if any deps change. - if (cache['yarn.lock'] !== yarnLockHash) { - return packages; - } - - return packages.filter(p => !p.valid); -} - -getInvalidPackages().then(packages => { - if (packages.length > 0) { - // Run for all invalid packages - RunCommand({ - cwd: '.', - script: 'build', - npmClient: 'yarn', - scope: packages.map(p => p.name) - }).then(() => { - // Mark as valid - packages.forEach(p => (cache[p.name] = p.hash)); - if (!fs.existsSync('.cache')) { - fs.mkdirSync('.cache'); - } - cache['yarn.lock'] = yarnLockHash; - fs.writeFileSync(cacheFile, JSON.stringify(cache, null, 2)); - }); - } -}); diff --git a/scripts/verifyPatternflyVersions.js b/scripts/verifyPatternflyVersions.js index 2c741c8dea5..201e3be0d27 100644 --- a/scripts/verifyPatternflyVersions.js +++ b/scripts/verifyPatternflyVersions.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const Project = require('@lerna/project'); // '@patternfly/patternfly': {'4.0.4': ['@patternfly/react-styles', ...]}, diff --git a/yarn.lock b/yarn.lock index 1bd9d389065..e7c8ee8fc48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -471,7 +471,7 @@ dependencies: "@babel/types" "^7.8.3" -"@babel/helper-plugin-utils@7.0.0", "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.0.0-beta.48": +"@babel/helper-plugin-utils@7.0.0", "@babel/helper-plugin-utils@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" @@ -717,13 +717,6 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-dynamic-import" "^7.8.0" -"@babel/plugin-proposal-export-default-from@^7.0.0": - version "7.5.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.5.2.tgz#2c0ac2dcc36e3b2443fead2c3c5fc796fb1b5145" - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-export-default-from" "^7.2.0" - "@babel/plugin-proposal-json-strings@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" @@ -872,12 +865,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-export-default-from@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.2.0.tgz#edd83b7adc2e0d059e2467ca96c650ab6d2f3820" - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" @@ -964,6 +951,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-typescript@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.8.3.tgz#c1f659dda97711a569cef75275f7e15dcaa6cabc" + integrity sha512-GO1MQ/SGGGoiEXY0e0bSpHimJvxqB7lktLLIq2pv8xG7WZ8IMEle74jIe1FhprHBWjwjZtXHkycDLZXIWM5Wfg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-transform-arrow-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" @@ -1136,13 +1130,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-flow" "^7.2.0" -"@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.6.3.tgz#8110f153e7360cfd5996eee68706cfad92d85256" - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" - "@babel/plugin-transform-for-of@^7.2.0", "@babel/plugin-transform-for-of@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" @@ -1530,7 +1517,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-typescript@^7.0.0", "@babel/plugin-transform-typescript@^7.1.0": +"@babel/plugin-transform-typescript@^7.1.0": version "7.6.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.6.3.tgz#dddb50cf3b8b2ef70b22e5326e9a91f05a1db13b" dependencies: @@ -1538,6 +1525,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-typescript" "^7.2.0" +"@babel/plugin-transform-typescript@^7.9.0": + version "7.9.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.9.4.tgz#4bb4dde4f10bbf2d787fce9707fb09b483e33359" + integrity sha512-yeWeUkKx2auDbSxRe8MusAG+n4m9BFY/v+lPjmQDgOFX5qnySkUY5oXzkp6FwPdsYqnKay6lorXYdC0n3bZO7w== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-typescript" "^7.8.3" + "@babel/plugin-transform-unicode-regex@^7.2.0", "@babel/plugin-transform-unicode-regex@^7.6.2": version "7.6.2" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.6.2.tgz#b692aad888a7e8d8b1b214be6b9dc03d5031f698" @@ -1780,6 +1776,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-typescript" "^7.1.0" +"@babel/preset-typescript@^7.0.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.9.0.tgz#87705a72b1f0d59df21c179f7c3d2ef4b16ce192" + integrity sha512-S4cueFnGrIbvYJgwsVFKdvOmpiL0XGw9MFW9D0vgRys5g36PBhZRL8NX8Gr2akz8XRtzq6HuDXPD/1nniagNUg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-transform-typescript" "^7.9.0" + "@babel/runtime-corejs3@^7.8.3": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.9.0.tgz#0d4119c44ad05bfa0ca16f2f4f91cde430056c08" @@ -2063,11 +2067,17 @@ version "0.2.25" resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.25.tgz#6df015905081f2762e5cfddeb7a20d2e9b16c786" -"@fortawesome/free-brands-svg-icons@^5.8.1": - version "5.11.2" - resolved "https://registry.yarnpkg.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.11.2.tgz#39d4296d03bf5719c579dea4bdcdd356ed2de0b4" +"@fortawesome/fontawesome-common-types@^0.2.28": + version "0.2.28" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.28.tgz#1091bdfe63b3f139441e9cba27aa022bff97d8b2" + integrity sha512-gtis2/5yLdfI6n0ia0jH7NJs5i/Z/8M/ZbQL6jXQhCthEOe5Cr5NcQPhgTvFxNOtURE03/ZqUcEskdn2M+QaBg== + +"@fortawesome/free-brands-svg-icons@^5.7.2": + version "5.13.0" + resolved "https://registry.yarnpkg.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.13.0.tgz#e79de73ba6555055204828dca9c0691e7ce5242b" + integrity sha512-/6xXiJFCMEQxqxXbL0FPJpwq5Cv6MRrjsbJEmH/t5vOvB4dILDpnY0f7zZSlA8+TG7jwlt12miF/yZpZkykucA== dependencies: - "@fortawesome/fontawesome-common-types" "^0.2.25" + "@fortawesome/fontawesome-common-types" "^0.2.28" "@fortawesome/free-regular-svg-icons@^5.7.2": version "5.11.2" @@ -3591,7 +3601,7 @@ version "4.0.0" resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" -"@types/prop-types@*", "@types/prop-types@^15.7.0": +"@types/prop-types@*": version "15.7.3" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" @@ -3607,7 +3617,7 @@ "@types/history" "*" "@types/react" "*" -"@types/react-dom@^16.4.0", "@types/react-dom@^16.8.0": +"@types/react-dom@^16.8.0": version "16.9.2" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.2.tgz#90f9e6c161850be1feb31d2f448121be2a4f3b47" dependencies: @@ -3641,7 +3651,7 @@ "@types/prop-types" "*" "@types/react" "*" -"@types/react@*", "@types/react@^16.4.0", "@types/react@^16.8.0": +"@types/react@*", "@types/react@^16.8.0": version "16.9.9" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.9.tgz#a62c6f40f04bc7681be5e20975503a64fe783c3a" dependencies: @@ -7620,12 +7630,6 @@ cssom@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.1.tgz#b24111d236b6dbd00cdfacb5ab67a20473381fe3" -cssstyle@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.3.1.tgz#6da9b4cff1bc5d716e6e5fe8e04fcb1b50a49adf" - dependencies: - cssom "0.3.x" - cssstyle@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" @@ -19145,12 +19149,6 @@ relateurl@0.2.x: version "0.2.7" resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" -relative@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/relative/-/relative-3.0.2.tgz#0dcd8ec54a5d35a3c15e104503d65375b5a5367f" - dependencies: - isobject "^2.0.0" - remark-mdx@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/remark-mdx/-/remark-mdx-1.5.1.tgz#df176c69b0d22fca890812cb828a100d5c14ae60" @@ -21616,7 +21614,7 @@ ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.6.tgz#389a24396d425a0d3162e96d2b4638900fdc289a" integrity sha512-CrG5GqAAzMT7144Cl+UIFP7mz/iIhiy+xQ6GGcnjTezhALT02uPMRw7tgDSESgB5MsfKt55+GPWw4ir1kVtMIQ== -tslib@^1.10.0: +tslib@^1.10.0, tslib@^1.11.1: version "1.11.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==