Remove CJS build from RCE

test plan
 - build passes

flag=none

refs FOO-3705

Change-Id: I6d14ad05133ec09206f88a86d0cd350a030d5f72
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324612
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Build-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Aaron Shafovaloff 2023-08-07 16:44:10 -06:00
parent e157cbffe9
commit 2b67658622
13 changed files with 21 additions and 52 deletions

View File

@ -25,7 +25,6 @@ services:
- canvas-media_node_modules:/usr/src/app/packages/canvas-media/node_modules
- canvas-planner_node_modules:/usr/src/app/packages/canvas-planner/node_modules
- canvas-rce_canvas:/usr/src/app/packages/canvas-rce/canvas
- canvas-rce_lib:/usr/src/app/packages/canvas-rce/lib
- canvas-rce_node_modules:/usr/src/app/packages/canvas-rce/node_modules
- jest-moxios-utils_node_modules:/usr/src/app/packages/jest-moxios-utils/node_modules
- js-utils_es:/usr/src/app/packages/js-utils/es

View File

@ -27,11 +27,6 @@ module.exports = {
'^Backbone$': '<rootDir>/public/javascripts/Backbone.js',
// jest can't import the icons
'@instructure/ui-icons/es/svg': '<rootDir>/packages/canvas-rce/src/rce/__tests__/_mockIcons.js',
// redirect imports from es/rce to lib
'@instructure/canvas-rce/es/rce/tinyRCE': '<rootDir>/packages/canvas-rce/lib/rce/tinyRCE.js',
'@instructure/canvas-rce/es/rce/RCE': '<rootDir>/packages/canvas-rce/lib/rce/RCE.js',
'@instructure/canvas-rce/es/rce/plugins/shared/Upload/CategoryProcessor':
'<rootDir>/packages/canvas-rce/lib/rce/plugins/shared/Upload/CategoryProcessor',
// mock the tinymce-react Editor react component
'@tinymce/tinymce-react': '<rootDir>/packages/canvas-rce/src/rce/__mocks__/tinymceReact.js',
'decimal.js/decimal.mjs': 'decimal.js/decimal.js',

View File

@ -20,7 +20,7 @@ import CoreTranslations from '../public/javascripts/translations/en.json'
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import {filterUselessConsoleMessages} from '@instructure/js-utils'
import rceFormatMessage from '@instructure/canvas-rce/lib/format-message'
import rceFormatMessage from '@instructure/canvas-rce/es/format-message'
import {up as configureDateTime} from '../ui/boot/initializers/configureDateTime'
import {up as configureDateTimeMomentParser} from '../ui/boot/initializers/configureDateTimeMomentParser'
import {useTranslations} from '@canvas/i18n'

View File

@ -37,9 +37,9 @@ module.exports = {
'<rootDir>/jest/jest-setup-framework.js',
'<rootDir>/../../jest/stubInstUi.js',
],
testPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/lib', '<rootDir>/canvas'],
testPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/canvas'],
testMatch: ['**/__tests__/**/?(*.)(spec|test).[jt]s?(x)'],
modulePathIgnorePatterns: ['<rootDir>/es', '<rootDir>/lib', '<rootDir>/canvas'],
modulePathIgnorePatterns: ['<rootDir>/es', '<rootDir>/canvas'],
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
testEnvironment: '<rootDir>../../jest/strictTimeLimitEnvironment.js',
moduleNameMapper: {

View File

@ -2,8 +2,7 @@
"name": "@instructure/canvas-rce",
"version": "5.7.0",
"description": "A component wrapping Canvas's usage of Tinymce",
"main": "lib/index.js",
"module": "es/index.js",
"main": "es/index.js",
"scripts": {
"i18n:extract": "format-message extract \"src/**/*.[jt]s*\" -g underscored_crc32 -o locales/en.json",
"integration-test": "nightwatch --env integration",
@ -37,17 +36,15 @@
"build:all": "scripts/build.js",
"build:es": "babel --out-dir es src --ignore '**/__tests__,**/__mocks__' --extensions '.ts,.tsx,.js,.jsx'",
"build:types": "tsc",
"build:cjs": "babel --out-dir lib src --ignore '**/__tests__,**/__mocks__' --config-file=./babel.config.cjs.js --extensions '.ts,.tsx,.js,.jsx'",
"build:canvas": "scripts/build-canvas",
"build:watch": "yarn clean:es && yarn build:es --watch",
"build:cjs:watch": "yarn build:cjs --watch",
"build:cafe": "wp --config webpack.testcafe.config.js",
"prepublishOnly": "yarn build:all && yarn test",
"fmt:check": "prettier -l '**/*.js*' '**/*.ts*'",
"fmt:fix": "prettier --write '**/*.js*' '**/*.ts*'",
"clean": "rm -rf lib && yarn clean:es && rm -rf coverage && yarn demo:clean",
"clean:es": "rm -rf es",
"generate-svgs": "yarn build:cjs && scripts/generateSvgs.js && prettier --write src/rce/plugins/instructure_equation/MathIcon/svgs.js",
"generate-svgs": "yarn build:es && node --experimental-modules scripts/generateSvgs.js && prettier --write src/rce/plugins/instructure_equation/MathIcon/svgs.js",
"publishToNpm": "scripts/publishToNpm.sh"
},
"keywords": [

View File

@ -14,5 +14,4 @@ rm -rf es/*
yarn build:types
yarn installTranslations
yarn build:cjs
yarn build:es

View File

@ -22,8 +22,6 @@
const shell = require('shelljs')
const promisify = require('util').promisify
const exec = promisify(require('child_process').exec)
const getTranslationList = require('@instructure/translations/bin/get-translation-list')
shell.set('-e')
@ -46,22 +44,3 @@ shell.exec(
shell.echo('Building ES Modules version')
shell.exec("npx babel --out-dir es src --ignore '**/__tests__' --extensions '.ts,.tsx,.js,.jsx'")
shell.echo(`building pretranslated output in lib/translated in mulitple processes`)
getTranslationList('canvas-rce')
.then(translationFiles => {
const locales = translationFiles.map(tf => tf.split('.')[0])
const processPromises = locales.map(locale => {
return exec(
`BUILD_LOCALE=${locale} npx babel --out-dir lib/translated/${locale}/modules --ignore locales* src --extensions '.ts,.tsx,.js,.jsx'`
)
})
Promise.all(processPromises)
.then(() => {
console.log('Translations complete')
})
.catch(e => {
throw e
})
})
.catch(e => console.error(e))

View File

@ -34,7 +34,7 @@ const fs = require('fs')
const mathjax = require('mathjax')
const buttons =
require('../lib/rce/plugins/instructure_equation/EquationEditorToolbar/buttons').default
require('../es/rce/plugins/instructure_equation/EquationEditorToolbar/buttons')
const OUTPUT_PATH = 'src/rce/plugins/instructure_equation/MathIcon/svgs.js'
const SVGS_TEMPLATE = `/*

View File

@ -16,7 +16,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import formatMessage from 'format-message'
const formatMessage = require('format-message')
const ns = formatMessage.namespace()
@ -24,4 +24,4 @@ ns.addLocale = translations => {
ns.setup({translations: {...ns.setup().translations, ...translations}})
}
export default ns
module.exports = ns

View File

@ -16,9 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import formatMessage from '../../../../format-message'
const formatMessage = require('../../../../format-message')
export default [
module.exports = [
{
name: formatMessage('Basic'),
commands: [

View File

@ -16,8 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** *** This is an auto-generated file. Please do not modify manually **** */
/** ********** If you need to update, run 'yarn generate-svgs' *********** */
/***** This is an auto-generated file. Please do not modify manually *****/
/************ If you need to update, run 'yarn generate-svgs' ************/
export default {
'_{\\placeholder{}}':

View File

@ -28,17 +28,20 @@ module.exports = {
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader',
include: [path.resolve(__dirname, 'src'), path.resolve(__dirname, 'demo')]
include: [path.resolve(__dirname, 'src'), path.resolve(__dirname, 'demo')],
},
{test: /(\.css$)/, include: /node_modules/, loaders: ['style-loader', 'css-loader']},
{test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000'}
]
{test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000'},
],
noParse: [
/i18nliner\/dist\/lib\/i18nliner/, // i18nLiner has a `require('fs')` that it doesn't actually need, ignore it.
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.DEBUG': JSON.stringify(process.env.DEBUG),
ENV: JSON.stringify(process.env.NODE_ENV)
})
]
ENV: JSON.stringify(process.env.NODE_ENV),
}),
],
}

View File

@ -38,9 +38,6 @@ module.exports = {
{test: /(\.css$)/, include: /node_modules/, loaders: ['style-loader', 'css-loader']},
{test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000'},
],
noParse: [
/i18nliner\/dist\/lib\/i18nliner/, // i18nLiner has a `require('fs')` that it doesn't actually need, ignore it.
],
},
resolve: {
extensions: ['.ts', '.js', '.tsx', '.jsx'],