Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/enact.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ const semver = require('semver');
const pkg = require('../package.json');

// Verify the correct version of Node is in use.
if (!semver.satisfies(process.version, pkg.engines.node)) {
if (
!semver.satisfies(
// Coerce strings with metadata (i.e. `15.0.0-nightly`).
semver.coerce(process.version),
pkg.engines.node
)
) {
console.log(
chalk.red(`You are running Node ${process.version}, but @enact/cli requires Node ${pkg.engines.node}.\n`) +
chalk.bold.red('Please update your version of Node.')
Expand Down
18 changes: 11 additions & 7 deletions commands/pack.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,17 @@ function details(err, stats, output) {
process.env.CI.toLowerCase() !== 'false' &&
messages.warnings.length
) {
console.log(
chalk.yellow(
'Treating warnings as errors because process.env.CI = true. ' +
'Most CI servers set it automatically.\n'
)
);
return new Error(messages.warnings.join('\n\n'));
// Ignore sourcemap warnings in CI builds. See #8227 for more info.
const filteredWarnings = messages.warnings.filter(w => !/Failed to parse source map/.test(w));
if (filteredWarnings.length) {
console.log(
chalk.yellow(
'Treating warnings as errors because process.env.CI = true. ' +
'Most CI servers set it automatically.\n'
)
);
return new Error(messages.warnings.join('\n\n'));
}
} else {
copyPublicFolder(output);
if (messages.warnings.length) {
Expand Down
15 changes: 9 additions & 6 deletions commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ process.on('unhandledRejection', err => {
// As react-dev-utils assumes the webpack production packaging command is
// "npm run build" with no way to modify it yet, we provide a basic override
// to console.log to ensure the correct output is displayed to the user.
console.log = (log => (data, ...rest) =>
typeof data === 'undefined'
? log()
: typeof data === 'string'
? log(data.replace(/npm run build/, 'npm run pack-p'), ...rest)
: log.call(this, data, ...rest))(console.log);
console.log = (
log =>
(data, ...rest) =>
typeof data === 'undefined'
? log()
: typeof data === 'string'
? log(data.replace(/npm run build/, 'npm run pack-p'), ...rest)
: log.call(this, data, ...rest)
)(console.log);

function displayHelp() {
let e = 'node ' + path.relative(process.cwd(), __filename);
Expand Down
2 changes: 2 additions & 0 deletions config/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ module.exports = function (api) {
// Stage 3
require('@babel/plugin-syntax-dynamic-import').default,
[require('@babel/plugin-proposal-class-properties').default, {loose: true}],
[require('@babel/plugin-proposal-private-methods').default, {loose: true}],
[require('@babel/plugin-proposal-private-property-in-object').default, {loose: true}],
// '@babel/plugin-syntax-import-meta',
// '@babel/plugin-proposal-json-strings'

Expand Down
35 changes: 11 additions & 24 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ESLintPlugin = require('eslint-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
Expand Down Expand Up @@ -64,6 +64,9 @@ module.exports = function (env) {
// Check if TypeScript is setup
const useTypeScript = fs.existsSync('tsconfig.json');

// Check if Tailwind config exists
const useTailwind = fs.existsSync(path.join(app.context, 'tailwind.config.js'));

process.env.NODE_ENV = env || process.env.NODE_ENV;
const isEnvProduction = process.env.NODE_ENV === 'production';

Expand Down Expand Up @@ -118,6 +121,7 @@ module.exports = function (env) {
options: {
postcssOptions: {
plugins: [
useTailwind && require('tailwindcss'),
// Fix and adjust for known flexbox issues
// See https://github.com/philipwalton/flexbugs
require('postcss-flexbugs-fixes'),
Expand All @@ -136,7 +140,7 @@ module.exports = function (env) {
}),
// Adds PostCSS Normalize to standardize browser quirks based on
// the browserslist targets.
require('postcss-normalize')(),
!useTailwind && require('postcss-normalize')(),
// Resolution indepedence support
app.ri !== false && require('postcss-resolution-independence')(app.ri)
].filter(Boolean)
Expand Down Expand Up @@ -372,6 +376,9 @@ module.exports = function (env) {
mangle: {
safari10: true
},
// Added for profiling in devtools
keep_classnames: isEnvProduction,
keep_fnames: isEnvProduction,
output: {
ecma: 5,
comments: false,
Expand All @@ -382,29 +389,9 @@ module.exports = function (env) {
},
// Use multi-process parallel running to improve the build speed
// Default number of concurrent runs: os.cpus().length - 1
parallel: true,
// Enable file caching
cache: true,
sourceMap: shouldUseSourceMap
parallel: true
}),
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
// TODO: verify calc issue fixed. Related: https://github.com/postcss/postcss-calc/issues/50
// calc: false,
parser: require('postcss-safe-parser'),
map: shouldUseSourceMap && {
// `inline: false` forces the sourcemap to be output into a
// separate file
inline: false,
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true
}
},
cssProcessorPluginOptions: {
preset: ['default', {minifyFontValues: {removeQuotes: false}}]
}
})
new CssMinimizerPlugin()
]
},
plugins: [
Expand Down
133 changes: 65 additions & 68 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,18 @@
"upupdowndownleftrightleftrightbastart"
],
"dependencies": {
"@babel/core": "7.12.3",
"@babel/plugin-proposal-class-properties": "7.12.1",
"@babel/plugin-proposal-decorators": "7.10.4",
"@babel/plugin-proposal-export-default-from": "7.10.4",
"@babel/plugin-proposal-export-namespace-from": "7.10.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.10.4",
"@babel/plugin-proposal-numeric-separator": "7.10.4",
"@babel/plugin-proposal-optional-chaining": "7.10.4",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-modules-commonjs": "7.10.4",
"@babel/plugin-transform-react-inline-elements": "7.10.4",
"@babel/plugin-transform-runtime": "7.10.5",
"@babel/preset-env": "7.12.1",
"@babel/preset-react": "7.12.1",
"@babel/preset-typescript": "7.12.1",
"@babel/runtime": "7.12.1",
"@enact/dev-utils": "4.1.4",
"@enact/template-sandstone": "1.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-decorators": "^7.16.4",
"@babel/plugin-proposal-export-default-from": "^7.16.4",
"@babel/plugin-transform-react-inline-elements": "^7.16.7",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/preset-env": "^7.16.4",
"@babel/preset-react": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@babel/runtime": "^7.16.3",
"@enact/dev-utils": "^4.1.4",
"@enact/template-sandstone": "^1.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^7.0.1",
Expand All @@ -67,18 +60,19 @@
"@wojtekmaj/enzyme-adapter-react-17": "0.3.2",
"babel-eslint": "10.1.0",
"babel-jest": "26.6.3",
"babel-loader": "8.1.0",
"babel-plugin-dev-expression": "0.2.2",
"babel-plugin-dynamic-import-node": "2.3.3",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"babel-plugin-transform-rename-import": "2.3.0",
"case-sensitive-paths-webpack-plugin": "2.3.0",
"chalk": "4.1.0",
"core-js": "3.6.5",
"cross-spawn": "7.0.3",
"babel-loader": "^8.2.3",
"babel-plugin-dev-expression": "^0.2.2",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-rename-import": "^2.3.0",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"chalk": "^4.1.2",
"core-js": "^3.19.2",
"cross-spawn": "^7.0.3",
"css-loader": "4.3.0",
"dotenv": "8.2.0",
"dotenv-expand": "5.1.0",
"css-minimizer-webpack-plugin": "^3.2.0",
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"enzyme": "3.11.0",
"eslint": "7.11.0",
"eslint-config-enact": "3.1.3",
Expand All @@ -89,55 +83,58 @@
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-testing-library": "3.10.2",
"eslint-webpack-plugin": "2.4.3",
"expose-loader": "1.0.0",
"file-loader": "6.1.1",
"filesize": "6.1.0",
"fs-extra": "9.0.1",
"glob": "7.1.6",
"global-modules": "2.0.0",
"html-webpack-plugin": "4.5.0",
"identity-obj-proxy": "3.0.0",
"expose-loader": "^1.0.0",
"file-loader": "^6.2.0",
"filesize": "^8.0.6",
"fs-extra": "^10.0.0",
"glob": "^7.1.6",
"global-modules": "^2.0.0",
"html-webpack-plugin": "^5.5.0",
"identity-obj-proxy": "^3.0.0",
"jest": "26.6.3",
"jest-circus": "26.6.3",
"jest-watch-typeahead": "0.6.2",
"less": "3.11.3",
"less-loader": "6.2.0",
"less-plugin-npm-import": "2.1.0",
"license-checker": "25.0.1",
"less": "^3.11.3",
"less-loader": "^6.2.0",
"less-plugin-npm-import": "^2.1.0",
"license-checker": "^25.0.1",
"mini-css-extract-plugin": "0.11.3",
"minimist": "1.2.5",
"optimize-css-assets-webpack-plugin": "5.0.3",
"postcss": "8.3.5",
"postcss-flexbugs-fixes": "5.0.2",
"postcss-global-import": "1.0.6",
"minimist": "^1.2.5",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"postcss": "^8.4.4",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-global-import": "^1.0.6",
"postcss-loader": "4.2.0",
"postcss-normalize": "10.0.1",
"postcss-preset-env": "6.7.0",
"postcss-resolution-independence": "1.0.0",
"postcss-safe-parser": "5.0.2",
"prompts": "2.4.0",
"raw-loader": "4.0.1",
"react": "17.0.1",
"postcss-normalize": "^10.0.1",
"postcss-preset-env": "^7.0.1",
"postcss-resolution-independence": "^1.0.1",
"postcss-safe-parser": "^5.0.2",
"prompts": "^2.4.2",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react-dev-utils": "11.0.1",
"react-dom": "17.0.1",
"react-refresh": "0.9.0",
"react-test-renderer": "17.0.1",
"resolution-independence": "1.0.0",
"resolve": "1.17.0",
"semver": "7.3.2",
"strip-ansi": "6.0.0",
"react-dom": "^17.0.2",
"react-refresh": "^0.11.0",
"react-test-renderer": "^17.0.2",
"resolution-independence": "^1.0.0",
"resolve": "^1.20.0",
"semver": "^7.3.5",
"source-map-loader": "^3.0.0",
"strip-ansi": "^6.0.1",
"style-loader": "1.2.1",
"tar": "6.0.2",
"terser-webpack-plugin": "3.0.6",
"v8-compile-cache": "2.1.1",
"validate-npm-package-name": "3.0.0",
"tailwindcss": "^3.0.2",
"tar": "^6.1.11",
"terser-webpack-plugin": "^5.2.5",
"v8-compile-cache": "^2.3.0",
"validate-npm-package-name": "^3.0.0",
"webpack": "4.44.2",
"webpack-dev-server": "3.11.0"
},
"optionalDependencies": {
"fsevents": "^2.1.3"
"fsevents": "^2.3.2"
},
"peerDependencies": {
"react": ">= 16",
"typescript": "^3.2.1 || ^4"
},
"peerDependenciesMeta": {
Expand All @@ -147,8 +144,8 @@
},
"devDependencies": {
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5"
"prettier": "^2.5.0"
}
}