Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[do not merge] experimental alpha -> master #473

Closed
wants to merge 120 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
2fab543
fix: update the README to trigger alpha release (#335)
adamstankiewicz Apr 13, 2023
12dfae5
Merge pull request #336 from openedx/master
edx-requirements-bot Apr 14, 2023
8e64e9e
feat: Re-enable typescript for production builds
marlonkeating Apr 14, 2023
cd1e726
fix(deps): update dependency cssnano to v6 (#344)
renovate[bot] Apr 25, 2023
4b5d84a
fix(deps): update dependency html-webpack-plugin to v5.5.1
renovate[bot] Apr 25, 2023
200a8ac
fix(deps): update dependency postcss to v8.4.23
renovate[bot] Apr 25, 2023
177d154
fix(deps): update dependency webpack-cli to v5.0.2
renovate[bot] Apr 25, 2023
2af8b42
fix(deps): update dependency webpack-dev-server to v4.13.3
renovate[bot] Apr 25, 2023
0edf13f
fix(deps): update dependency sass to v1.62.1
renovate[bot] Apr 26, 2023
9908041
fix: disable dot rule in historyApiFallback in webpack.dev.config.js …
adamstankiewicz May 2, 2023
602b7a0
fix(deps): update eslint (#351)
renovate[bot] May 4, 2023
357334c
fix(deps): update dependency clean-webpack-plugin to v4 (#341)
renovate[bot] May 4, 2023
1c81573
fix(deps): update dependency @svgr/webpack to v7 (#340)
renovate[bot] May 4, 2023
e298637
fix(deps): update babel monorepo
renovate[bot] May 4, 2023
68457f1
fix(deps): update dependency cssnano to v6.0.1
renovate[bot] May 4, 2023
0519c40
fix(deps): update dependency webpack to v5.82.0 (#355)
renovate[bot] May 5, 2023
5500920
fix(deps): update dependency dotenv-webpack to v8 (#357)
renovate[bot] May 5, 2023
632a667
fix(deps): update dependency postcss-loader to v7 (#358)
renovate[bot] May 5, 2023
4a5d559
chore(deps): update dependency typescript to v5 (#338)
renovate[bot] May 5, 2023
5e4f2c2
chore(deps): update peter-evans/enable-pull-request-automerge action …
renovate[bot] May 5, 2023
1dcd666
fix(deps): update dependency @edx/new-relic-source-map-webpack-plugin…
renovate[bot] May 5, 2023
30887b1
fix(deps): update dependency postcss-rtlcss to v4 (#359)
renovate[bot] May 5, 2023
70b01a5
fix(deps): update dependency @svgr/webpack to v8 (#364)
renovate[bot] May 26, 2023
fa974a3
fix(deps): update dependency webpack-cli to v5.1.1 (#363)
renovate[bot] May 26, 2023
0e20e2b
fix(deps): update dependency postcss-loader to v7.3.1 (#367)
renovate[bot] May 26, 2023
d7d790c
fix(deps): update dependency webpack-dev-server to v4.15.0 (#362)
renovate[bot] May 26, 2023
e05d46b
fix(deps): update dependency eslint to v8.41.0 (#361)
renovate[bot] May 26, 2023
23954c4
fix(deps): update dependency style-loader to v3.3.3 (#368)
renovate[bot] May 26, 2023
a105af8
fix(deps): update dependency sass-loader to v13 (#360)
renovate[bot] May 26, 2023
1980b75
fix(deps): update dependency webpack-merge to v5.9.0 (#371)
renovate[bot] May 26, 2023
8df0d32
fix(deps): update dependency webpack to v5.84.1 (#370)
renovate[bot] May 26, 2023
6931415
fix(deps): update dependency @edx/new-relic-source-map-webpack-plugin…
renovate[bot] May 26, 2023
37313b2
fix(deps): update dependency postcss-loader to v7.3.2
renovate[bot] May 28, 2023
d3a4c0f
fix(deps): update dependency postcss to v8.4.24
renovate[bot] May 28, 2023
93a04eb
fix(deps): update dependency sass-loader to v13.3.1
renovate[bot] May 28, 2023
3a6db3f
fix(deps): update dependency webpack-cli to v5.1.2
renovate[bot] Jun 4, 2023
b6169a8
fix(deps): update dependency webpack-cli to v5.1.3
renovate[bot] Jun 4, 2023
b759a41
fix(deps): update dependency webpack-cli to v5.1.4
renovate[bot] Jun 7, 2023
10c56c1
fix(deps): update dependency webpack to v5.86.0 (#376)
renovate[bot] Jun 8, 2023
d52a18a
fix(deps): update dependency sass to v1.63.2 (#382)
renovate[bot] Jun 8, 2023
54c1f51
fix(deps): update dependency webpack-bundle-analyzer to v4.9.0 (#377)
renovate[bot] Jun 9, 2023
5e4658d
fix(deps): update babel monorepo to v7.22.5 (#372)
renovate[bot] Jun 9, 2023
466e4a0
fix(deps): update eslint (#378)
renovate[bot] Jun 9, 2023
8e0f7e4
fix(deps): update dependency html-webpack-plugin to v5.5.2
renovate[bot] Jun 9, 2023
97d45e7
fix(deps): update dependency sass to v1.63.3
renovate[bot] Jun 9, 2023
f37b842
fix(deps): update dependency webpack-dev-server to v4.15.1
renovate[bot] Jun 9, 2023
d10c1c6
fix(deps): update dependency sass-loader to v13.3.2
renovate[bot] Jun 10, 2023
8a88f62
fix(deps): update dependency postcss-loader to v7.3.3
renovate[bot] Jun 10, 2023
733ea4f
fix(deps): update dependency html-webpack-plugin to v5.5.3
renovate[bot] Jun 10, 2023
4241f47
fix(deps): update dependency postcss-custom-media to v9.1.4
renovate[bot] Jun 13, 2023
0cb6885
chore(deps): update react monorepo
renovate[bot] Jun 13, 2023
6ca555f
fix(deps): update dependency sharp to v0.32.1
renovate[bot] Jun 13, 2023
488686d
fix(deps): update dependency sass to v1.63.4
renovate[bot] Jun 14, 2023
8674978
chore(deps): update actions/setup-node action to v3 (#396)
renovate[bot] Jun 22, 2023
05edd10
chore(deps): update actions/checkout action to v3 (#395)
renovate[bot] Jun 22, 2023
c07fa91
fix(deps): update dependency image-minimizer-webpack-plugin to v3.8.3
renovate[bot] Jun 22, 2023
5b86133
fix(deps): update dependency postcss-custom-media to v9.1.5
renovate[bot] Jun 22, 2023
69899aa
fix(deps): update dependency sass to v1.63.6
renovate[bot] Jun 22, 2023
06eee29
fix(deps): update eslint (#402)
renovate[bot] Jul 6, 2023
ee71d3e
fix(deps): update dependency postcss to v8.4.25
renovate[bot] Jul 6, 2023
71ee361
fix(deps): update dependency babel-loader to v9.1.3
renovate[bot] Jul 7, 2023
cc50692
fix: updated jest to resolve word-wrap ReDoS vulnerability (#411)
BilalQamar95 Jul 11, 2023
3299605
fix(deps): update dependency sharp to v0.32.2
renovate[bot] Jul 11, 2023
64fe89f
fix: bump semver from 5.7.1 to 5.7.2 (#414)
dependabot[bot] Jul 12, 2023
85b3c54
fix(deps): update dependency @babel/eslint-parser to v7.22.9
renovate[bot] Jul 12, 2023
909fd27
fix(deps): update dependency postcss to v8.4.26
renovate[bot] Jul 13, 2023
b28e6bc
fix(deps): update dependency sharp to v0.32.3
renovate[bot] Jul 14, 2023
a5c307b
fix(deps): update dependency webpack to v5.88.1 (#403)
renovate[bot] Jul 17, 2023
cd408cd
fix(deps): update dependency webpack to v5.88.2
renovate[bot] Jul 18, 2023
088793c
feat: add fedx-scripts serve (#404)
adamstankiewicz Jul 18, 2023
a49ad49
fix(deps): update dependency postcss-custom-media to v9.1.5
renovate[bot] Jul 18, 2023
012c4ee
fix(deps): update dependency sharp to v0.32.3
renovate[bot] Jul 18, 2023
bbf58fe
fix: ensure .env.development PORT works (#423)
adamstankiewicz Jul 18, 2023
2529a1e
fix: silence sass compiler warnings (#425)
adamstankiewicz Jul 19, 2023
589b78e
fix: reverted jest upgrade (#427)
BilalQamar95 Jul 25, 2023
ca26dca
fix: update webpack common config to fix errors (#428)
solababs Aug 2, 2023
6245a84
feat: Re-enable typescript for production builds
marlonkeating Apr 14, 2023
536bff7
Merge pull request #431 from openedx/bw/alpha_to_master
muselesscreator Aug 7, 2023
deacfed
fix: remove tsconfig for commitlint job
muselesscreator Aug 7, 2023
3b8f66a
fix: fis jest config for ts-jest access
muselesscreator Aug 7, 2023
a0f24df
fix: remove extraneous dependency
muselesscreator Aug 7, 2023
efed83d
Merge pull request #430 from openedx/bw/alpha_bump
muselesscreator Aug 7, 2023
b682f25
fix: install ts-jest as dev dependency to ensure winds up in consumin…
muselesscreator Aug 7, 2023
73ec49a
Merge pull request #432 from openedx/bw/alpha_ts_jest
muselesscreator Aug 7, 2023
4f794d2
fix: revert ts jest transform back to imported one
muselesscreator Aug 7, 2023
d67776d
Merge pull request #434 from openedx/bw/alpha_jest_config
muselesscreator Aug 8, 2023
c756d4d
fix: make ts-jest a dependency to try and ensure it makes it to consu…
muselesscreator Aug 8, 2023
709e3d1
chore: use static versions
muselesscreator Aug 8, 2023
8e7e068
Merge pull request #435 from openedx/bw/alpha_jest_config
muselesscreator Aug 8, 2023
7fbbe26
fix(deps): update eslint (#351)
renovate[bot] May 4, 2023
66d1f43
fix(deps): update dependency @svgr/webpack to v7 (#340)
renovate[bot] May 4, 2023
7cbdcaa
chore(deps): update dependency typescript to v5 (#338)
renovate[bot] May 5, 2023
2040f67
fix: updated jest to resolve word-wrap ReDoS vulnerability (#411)
BilalQamar95 Jul 11, 2023
e56ef6e
feat: add fedx-scripts serve (#404)
adamstankiewicz Jul 18, 2023
4e456e3
fix(deps): update dependency sharp to v0.32.3
renovate[bot] Jul 18, 2023
dd0a21f
fix: reverted jest upgrade (#427)
BilalQamar95 Jul 25, 2023
5e9de99
fix(deps): update dependency sass to v1.65.1 (#426)
renovate[bot] Aug 15, 2023
e8136dc
fix(deps): update dependency postcss-custom-media to v10 (#407)
renovate[bot] Aug 15, 2023
26c67bb
chore(deps): update dependency @types/react to v17.0.64
renovate[bot] Aug 15, 2023
b3f6406
fix(deps): update dependency @pmmmwh/react-refresh-webpack-plugin to …
renovate[bot] Aug 15, 2023
8dec2ba
fix(deps): update dependency autoprefixer to v10.4.15
renovate[bot] Aug 15, 2023
5e1f332
fix(deps): update dependency postcss to v8.4.27
renovate[bot] Aug 15, 2023
b351065
fix(deps): update dependency postcss-rtlcss to v4.0.7
renovate[bot] Aug 15, 2023
6986459
fix(deps): update dependency sharp to v0.32.4
renovate[bot] Aug 15, 2023
04068a7
fix(deps): update dependency postcss to v8.4.28
renovate[bot] Aug 15, 2023
edb8de8
fix(deps): update dependency sharp to v0.32.5
renovate[bot] Aug 16, 2023
4b0b1fb
feat: Re-enable typescript for production builds
marlonkeating Apr 14, 2023
0020ea0
fix: updated jest to resolve word-wrap ReDoS vulnerability (#411)
BilalQamar95 Jul 11, 2023
3926fa2
fix(deps): update dependency sharp to v0.32.2
renovate[bot] Jul 11, 2023
5a61aa6
feat: add fedx-scripts serve (#404)
adamstankiewicz Jul 18, 2023
5bf2fa2
fix: reverted jest upgrade (#427)
BilalQamar95 Jul 25, 2023
c2aaff8
feat: Re-enable typescript for production builds
marlonkeating Apr 14, 2023
9ea50a6
fix: install ts-jest as dev dependency to ensure winds up in consumin…
muselesscreator Aug 7, 2023
4c98ab5
fix: make ts-jest a dependency to try and ensure it makes it to consu…
muselesscreator Aug 8, 2023
3d6ee96
Merge pull request #449 from openedx/bw/alpha_master
muselesscreator Aug 31, 2023
06e1b86
fix: package rebase
muselesscreator Aug 31, 2023
ccb91a3
Merge branch 'master' into alpha
muselesscreator Aug 31, 2023
861a040
Merge remote-tracking branch 'origin/master' into alpha
muselesscreator Aug 31, 2023
4c76eb5
Merge pull request #450 from openedx/master
edx-requirements-bot Sep 6, 2023
b6fa780
Merge branch 'master' into alpha
marlonkeating Oct 23, 2023
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
12 changes: 11 additions & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ on:

jobs:
commitlint:
uses: openedx/.github/.github/workflows/commitlint.yml@master
runs-on: ubuntu-20.04
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: remove tsconfig.json # see issue https://github.com/conventional-changelog/commitlint/issues/3256
run: |
rm tsconfig.json
- name: Check commits
uses: wagoid/commitlint-github-action@v5
34 changes: 32 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ documentation to learn what options are available. Example package.json::
{
"scripts": {
"build": "fedx-scripts webpack",
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
"i18n_extract": "fedx-scripts formatjs extract",
"lint": "fedx-scripts eslint --ext .jsx,.js .",
"precommit": "npm run lint",
"snapshot": "fedx-scripts jest --updateSnapshot",
Expand Down Expand Up @@ -146,7 +146,7 @@ Notes

.. _this devstack ADR on local packages: https://github.com/openedx/devstack/tree/master/docs/decisions/0005-frontend-package-mounts.rst

Override default .env.development environment variables with .env.private
Override default ``.env.development`` environment variables with .env.private
-------------------------------------------------------------------------

In some situations, you may want to override development environment variables defined in .env.development
Expand All @@ -168,6 +168,36 @@ In some scenarios, you may want to run a production Webpack build locally. To se
#. Add an NPM script ``serve`` to your application's ``package.json`` (i.e., ``"serve": "fedx-scripts serve"``).
#. Run ``npm run serve`` to serve your production build assets. It will attempt to run the build on the same port specified in the ``env.config.js`` file.

Serving a production Webpack build locally
------------------------------------------

In some scenarios, you may want to run a production Webpack build locally. To serve a production build locally:

#. Create an ``env.config.js`` file containing the configuration for local development, with the exception of ``NODE_ENV='production'``.
#. Run ``npm run build`` to build the production assets. The output assets will rely on the local development configuration specified in the prior step.
#. Add an NPM script ``serve`` to your application's ``package.json`` (i.e., ``"serve": "fedx-scripts serve"``).
#. Run ``npm run serve`` to serve your production build assets. It will attempt to run the build on the same port specified in the ``env.config.js`` file.

Local module configuration for TypeScript
-----------------------------------------

#. Create file in repository `tsconfig.json`, with a clause `"extends": "@edx/frontend-build"`
#. Set "rootDir" to the root of the source code folders
#. Set "include" to wildcard patterns specifying the subdirectories/files under rootDir where source code can be found
#. Include any wildcards under rootDir that should be excluded using "exclude"

```Sample json
{
"extends": "@edx/frontend-build",
"compilerOptions": {
"rootDir": ".",
"outDir": "dist"
},
"include": ["src/**/*"],
"exclude": ["dist", "node_modules"]
}
```

Development
-----------

Expand Down
12 changes: 12 additions & 0 deletions bin/fedx-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ switch (commandName) {
ensureConfigOption(presets.webpackDevServer);
require('webpack-dev-server/bin/webpack-dev-server');
break;
case 'formatjs': {
const commonArgs = [
'--format', 'node_modules/@edx/frontend-build/lib/formatter.js',
'--ignore', 'src/**/*.json',
'--out-file', './temp/babel-plugin-formatjs/Default.messages.json',
'--', 'src/**/*.js*',
];
process.argv = process.argv.concat(commonArgs);
ensureConfigOption(presets.formatjs);
require('@formatjs/cli/bin/formatjs');
break;
}
case 'serve':
require('../lib/scripts/serve');
break;
Expand Down
3 changes: 2 additions & 1 deletion config/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const { babel } = require('../lib/presets');

module.exports = {
extends: '@edx/eslint-config',
parser: '@babel/eslint-parser',
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
requireConfigFile: true,
babelOptions: {
Expand Down
6 changes: 1 addition & 5 deletions config/babel-preserve-modules.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ module.exports = {
i18n: {
plugins: [
[
'react-intl',
{
messagesDir: './temp/babel-plugin-react-intl',
moduleSourceName: '@edx/frontend-platform/i18n',
},
'formatjs',
],
],
},
Expand Down
6 changes: 1 addition & 5 deletions config/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ module.exports = {
i18n: {
plugins: [
[
'react-intl',
{
messagesDir: './temp/babel-plugin-react-intl',
moduleSourceName: '@edx/frontend-platform/i18n',
},
'formatjs',
],
],
},
Expand Down
4 changes: 3 additions & 1 deletion config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const fs = require('fs');
const { jsWithTs: tsjPreset } = require('ts-jest/presets');

const presets = require('../lib/presets');

Expand Down Expand Up @@ -33,11 +34,12 @@ module.exports = {
'/node_modules/(?!@edx)',
],
transform: {
'^.+\\.[t|j]sx?$': [
'^.+\\.jsx?$': [
'babel-jest',
{
configFile: presets.babel.resolvedFilepath,
},
],
...tsjPreset.transform,
},
};
2 changes: 1 addition & 1 deletion config/webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
// the application being built.
'env.config': false,
},
extensions: ['.js', '.jsx'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
ignoreWarnings: [
// Ignore warnings raised by source-map-loader.
Expand Down
4 changes: 2 additions & 2 deletions config/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ module.exports = merge(commonConfig, {
// The babel-loader transforms newer ES2015+ syntax to older ES5 for older browsers.
// Babel is configured with the .babelrc file at the root of the project.
{
test: /\.(js|jsx)$/,
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules\/(?!@edx)/,
use: {
loader: 'babel-loader',
options: {
configFile: presets.babel.resolvedFilepath,
configFile: presets['babel-typescript'].resolvedFilepath,
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions example/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import config from 'env.config';
import Image from './Image';
import appleUrl, { ReactComponent as Apple } from './apple.svg';
import appleImg from './apple.jpg';

Expand All @@ -19,6 +20,8 @@ export default function App() {
</ul>
<h2>JSX parsing tests</h2>
<Apple style={{ width: '10rem' }} />
<h2>TSX parsing tests</h2>
<Image src={appleUrl} alt="appleFromTsx" style={{ width: '10rem' }} />
<h2>Asset import tests</h2>
<img src={appleUrl} alt="apple" style={{ width: '10rem' }} />
<img src={appleUrl} alt="apple" style={{ width: '10rem' }} />
Expand Down
16 changes: 16 additions & 0 deletions example/src/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { CSSProperties } from 'react';

type ImageProps = {
src: string;
alt?: string;
style?: CSSProperties;
};

const Image = ({ alt, ...rest }:ImageProps) => <img alt={alt} {...rest} />;

const defaultProps = {
alt: undefined,
style: undefined,
};
Image.defaultProps = defaultProps;
export default Image;
12 changes: 12 additions & 0 deletions example/src/__snapshots__/App.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ exports[`Basic test should render 1`] = `
}
}
/>
<h2>
TSX parsing tests
</h2>
<img
alt="appleFromTsx"
src="icon/mock/path"
style={
Object {
"width": "10rem",
}
}
/>
<h2>
Asset import tests
</h2>
Expand Down
16 changes: 16 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "dist"
},
"include": [
".eslintrc.js",
"env.config.js",
"src"
],
"exclude": [
"node_modules",
"dist",
]
}
10 changes: 10 additions & 0 deletions lib/formatter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
exports.format = (messages) => {
const results = Object.entries(messages).map(([id, message]) => (
{
id,
defaultMessage: message.defaultMessage,
description: message.description,
}
));
return results;
};
7 changes: 7 additions & 0 deletions lib/presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const babel = new ConfigPreset({
searchFilepaths,
});

const formatjs = new ConfigPreset({
defaultFilename: 'babel.config.js',
searchFilenames: ['.babelrc', '.babelrc.js', 'babel.config.js'],
searchFilepaths,
});

const babelPreserveModules = new ConfigPreset({
defaultFilename: 'babel-preserve-modules.config.js',
searchFilenames: ['.babelrc', '.babelrc.js', 'babel.config.js'],
Expand Down Expand Up @@ -52,6 +58,7 @@ const webpack = new ConfigPreset({

module.exports = {
babel,
formatjs,
babelPreserveModules,
'babel-preserve-modules': babelPreserveModules,
'babel-typescript': babelTypescript,
Expand Down
Loading