diff --git a/README.md b/README.md index 1c787a6409d..b8ba3466143 100644 --- a/README.md +++ b/README.md @@ -308,5 +308,5 @@ resource development efforts. Donations of any size are appreciated. Thank you! ## Codio Added `codio-client.js` link to `index.ejs` WARNING: The build takes too much resources!!! -Build minified client with `export NODE_OPTIONS=--max-old-space-size=4000 export NODE_ENV=production npm run build` +Build minified client with `NODE_ENV=production npm run build` Upload to S3 `./s3-upload.sh "s3_assets_access_key" "s3_assets_access_secret"` diff --git a/package-lock.json b/package-lock.json index 73bf6deb304..6de582b5f0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -112,7 +112,7 @@ "redux-mock-store": "1.5.5", "rimraf": "2.7.1", "scratch-semantic-release-config": "1.0.16", - "scratch-webpack-configuration": "1.5.1", + "scratch-webpack-configuration": "1.6.0", "selenium-webdriver": "3.6.0", "semantic-release": "19.0.5", "stream-browserify": "3.0.0", @@ -25360,9 +25360,9 @@ "integrity": "sha512-sf7oGoLuaYAScB4VGr0tzetsYlS8EJH6qnTCfQ/WVEa89hALQ4RQfCKt5xCyPQKPDUbVUAIP1QsxAwfAjlDp7Q==" }, "node_modules/scratch-sb1-converter": { - "version": "1.0.299", - "resolved": "https://registry.npmjs.org/scratch-sb1-converter/-/scratch-sb1-converter-1.0.299.tgz", - "integrity": "sha512-2lFnEIFbpVzMRQ0c1HyZf6xyDaEkWC87b6ZoCyMLX3okuJcfl1P2hpWJra0EvK9wYdIj7NUknrvffkpuMGmsyA==", + "version": "1.0.319", + "resolved": "https://registry.npmjs.org/scratch-sb1-converter/-/scratch-sb1-converter-1.0.319.tgz", + "integrity": "sha512-llckYbxbpubOGSF+KNqMfVSsttxzyERuxqRCiKo7XZNrgWuIczM/Jo1PxgkER2oEKapqRNBBQ2+r1RBlm2TCfw==", "license": "BSD-3-Clause", "dependencies": { "js-md5": "^0.7.3", @@ -25391,7 +25391,7 @@ "node_modules/scratch-storage": { "name": "@codioedu/scratch-storage", "version": "3.0.9", - "resolved": "git+ssh://git@github.com/codio/scratch-storage.git#0cb49e4e0fae41b560767b09d0f436db56bb7a17", + "resolved": "git+ssh://git@github.com/codio/scratch-storage.git#2c937ada569018924c7efce38d9cf90bc891e20e", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime": "^7.21.0", @@ -25430,7 +25430,7 @@ "node_modules/scratch-vm": { "name": "@codioedu/scratch-vm", "version": "4.8.59", - "resolved": "git+ssh://git@github.com/codio/scratch-vm.git#a58b775f23f08b09b22aac3a6579ea7a1461c42d", + "resolved": "git+ssh://git@github.com/codio/scratch-vm.git#16156db108433778362615407bd5a028df27f120", "license": "BSD-3-Clause", "dependencies": { "@vernier/godirect": "^1.5.0", @@ -25449,7 +25449,7 @@ "scratch-parser": "^5.1.1", "scratch-render": "^1.0.232", "scratch-sb1-converter": "^1.0.0", - "scratch-storage": "codio/scratch-storage#merge_upstream_31102024", + "scratch-storage": "codio/scratch-storage#16210_fixes", "scratch-svg-renderer": "2.5.26", "scratch-translate-extension-languages": "^1.0.0", "text-encoding": "^0.7.0", @@ -25488,9 +25488,9 @@ } }, "node_modules/scratch-webpack-configuration": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/scratch-webpack-configuration/-/scratch-webpack-configuration-1.5.1.tgz", - "integrity": "sha512-O8RbcgjbNnkMrb7Q34NDqs8Wc9vhuRDWjgOVuMg25h8IgAC7ED04wnHL4qFH3l1+Zf8sx5pzbJMHZFdWVq4ktA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/scratch-webpack-configuration/-/scratch-webpack-configuration-1.6.0.tgz", + "integrity": "sha512-RHxQg99UwmFSdHFYQ8xPzqmUo5YIoIiUOttewSrc1GcXZu67DFtP7Fyod8e5PqoN0AsYVrkGEXX8yNmTZ2cMdw==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -25507,6 +25507,7 @@ "postcss-loader": "4.3.0", "postcss-simple-vars": "^5.0.1", "style-loader": "4.0.0", + "ts-loader": "^9.5.1", "url-loader": "4.1.1", "webpack": "^5.90.3" } @@ -28249,6 +28250,79 @@ "node": ">=0.10.0" } }, + "node_modules/ts-loader": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", + "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/ts-loader/node_modules/enhanced-resolve": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ts-loader/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "peer": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-loader/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ts-loader/node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", diff --git a/package.json b/package.json index 9018a6d45a2..0eccb08c8ca 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "redux-mock-store": "1.5.5", "rimraf": "2.7.1", "scratch-semantic-release-config": "1.0.16", - "scratch-webpack-configuration": "1.5.1", + "scratch-webpack-configuration": "1.6.0", "selenium-webdriver": "3.6.0", "semantic-release": "19.0.5", "stream-browserify": "3.0.0", diff --git a/src/components/crash-message/crash-message.jsx b/src/components/crash-message/crash-message.jsx index c3732ddc0cb..7ddc3810754 100644 --- a/src/components/crash-message/crash-message.jsx +++ b/src/components/crash-message/crash-message.jsx @@ -41,23 +41,25 @@ const CrashMessage = props => ( />

)} - + {props.onReload && ( + + )} ); CrashMessage.propTypes = { eventId: PropTypes.string, - onReload: PropTypes.func.isRequired + onReload: PropTypes.func }; export default CrashMessage; diff --git a/src/containers/error-boundary.jsx b/src/containers/error-boundary.jsx index 0df13ea1aec..0232aaef3d9 100644 --- a/src/containers/error-boundary.jsx +++ b/src/containers/error-boundary.jsx @@ -50,16 +50,16 @@ class ErrorBoundary extends React.Component { } handleReload () { - window.location.replace(window.location.origin + window.location.pathname); + // do nothing. maybe in the future create new default project. + // window.location.replace(window.location.origin + window.location.pathname); + return; } render () { if (this.state.error) { if (recommendedBrowser()) { return ( - + ); } return ( { - codio.subscribe('callSave', () => this.storeProjectToCodio()); + codio.subscribe('callSave', () => this.storeProjectToCodio() + .catch(msg => { + /* eslint-disable-next-line no-console */ + console.log(`error on save codio project: ${msg}`); + }) + ); }) .fail(msg => { /* eslint-disable-next-line no-console */ @@ -249,31 +254,6 @@ const ProjectSaverHOC = function (WrappedComponent) { this.props.onSetProjectUnchanged(); }); } - saveCodioFile (data) { - return new Promise((resolve, reject) => { - const {codio} = window; - if (codio) { - codio.loaded() - .then(() => { - const saveFile = codio.getFileName(); - window.codio.saveFile(saveFile, data) - .then(resolve) - .fail(msg => { - const err = `saveCodioFile - error saving scratch file: ${msg}`; - /* eslint-disable-next-line no-console */ - console.log(err); - reject(new Error(err)); - }); - }) - .fail(msg => { - const err = `codio loaded - error: ${msg}`; - /* eslint-disable-next-line no-console */ - console.log(err); - reject(new Error(err)); - }); - } - }); - } /** * storeProject: * @param {number|string|undefined} projectId - defined value will PUT/update; undefined/null will POST/create diff --git a/test/unit/util/project-saver-hoc.test.jsx b/test/unit/util/project-saver-hoc.test.jsx index f5ac7b680e6..1ec4aa91e8b 100644 --- a/test/unit/util/project-saver-hoc.test.jsx +++ b/test/unit/util/project-saver-hoc.test.jsx @@ -299,7 +299,8 @@ describe('projectSaverHOC', () => { expect(mockedShowCreatingAlert).not.toHaveBeenCalled(); }); - test('if user saves, inline saving alert should show', () => { + // skipped due to not allowing empty projects (without targets) to save + test.skip('if user saves, inline saving alert should show', () => { const mockedShowSavingAlert = jest.fn(); const Component = () =>
; const WrappedComponent = projectSaverHOC(Component); diff --git a/webpack.config.js b/webpack.config.js index 314e302993e..d9bfc16808e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,7 +14,8 @@ const baseConfig = new ScratchWebpackConfigBuilder( { rootPath: path.resolve(__dirname), enableReact: true, - shouldSplitChunks: false + shouldSplitChunks: false, + publicPath: '' }) .setTarget('browserslist') .merge({ @@ -60,6 +61,11 @@ const baseConfig = new ScratchWebpackConfigBuilder( to: 'static/blocks-media/high-contrast', force: true }, + { + context: 'node_modules/scratch-storage/dist/web/chunks', + from: '*.{js,js.map}', + to: 'chunks' + }, { context: 'node_modules/scratch-vm/dist/web', from: 'extension-worker.{js,js.map}',