From ece6111a47bca0b511099a004b06b2938fcce005 Mon Sep 17 00:00:00 2001 From: Taylor Fang Date: Fri, 6 Nov 2020 17:55:54 +0800 Subject: [PATCH 1/3] chore(orangutan): remove orangutan repo This patch removes orangutan repo which used to be an all-in-one npm package. BREAKING CHANGE: remove orangutan repo --- packages/orangutan/CHANGELOG.md | 234 ---------------- packages/orangutan/Makefile | 24 -- packages/orangutan/README.md | 4 - .../dev/embedded-code-test-server.js | 99 ------- packages/orangutan/package.json | 22 -- packages/orangutan/src/index.js | 61 ----- packages/orangutan/webpack-entry.js | 9 - packages/orangutan/webpack.config.js | 251 ------------------ 8 files changed, 704 deletions(-) delete mode 100644 packages/orangutan/CHANGELOG.md delete mode 100644 packages/orangutan/Makefile delete mode 100644 packages/orangutan/README.md delete mode 100644 packages/orangutan/dev/embedded-code-test-server.js delete mode 100644 packages/orangutan/package.json delete mode 100644 packages/orangutan/src/index.js delete mode 100644 packages/orangutan/webpack-entry.js delete mode 100644 packages/orangutan/webpack.config.js diff --git a/packages/orangutan/CHANGELOG.md b/packages/orangutan/CHANGELOG.md deleted file mode 100644 index 329d783e5..000000000 --- a/packages/orangutan/CHANGELOG.md +++ /dev/null @@ -1,234 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.2.0-rc.0](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.2-rc.1...@twreporter/orangutan@1.2.0-rc.0) (2020-11-03) - - -### Features - -* **orangutan:** add `zoom-in` ([d363b6d](https://github.com/twreporter/orangutan/commit/d363b6d5d7c1a2532da2fb771dba5fb69cb0e628)) - - - - - -## [1.1.2-rc.1](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.2-rc.0...@twreporter/orangutan@1.1.2-rc.1) (2020-10-18) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -## [1.1.2-rc.0](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.1-rc.2...@twreporter/orangutan@1.1.2-rc.0) (2020-07-16) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -## [1.1.1](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.1-rc.2...@twreporter/orangutan@1.1.1) (2020-07-13) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -## [1.1.1-rc.2](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.1-rc.1...@twreporter/orangutan@1.1.1-rc.2) (2020-07-02) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -## [1.1.1-rc.1](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.1-rc.0...@twreporter/orangutan@1.1.1-rc.1) (2020-06-16) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -## [1.1.1-rc.0](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0...@twreporter/orangutan@1.1.1-rc.0) (2020-06-16) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.18...@twreporter/orangutan@1.1.0) (2020-06-04) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.18](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.17...@twreporter/orangutan@1.1.0-rc.18) (2020-06-04) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.17](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.16...@twreporter/orangutan@1.1.0-rc.17) (2020-06-03) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.16](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.15...@twreporter/orangutan@1.1.0-rc.16) (2020-06-03) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.15](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.14...@twreporter/orangutan@1.1.0-rc.15) (2020-05-28) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.14](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.13...@twreporter/orangutan@1.1.0-rc.14) (2020-05-25) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.13](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.12...@twreporter/orangutan@1.1.0-rc.13) (2020-05-22) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.12](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.11...@twreporter/orangutan@1.1.0-rc.12) (2020-05-08) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.11](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.10...@twreporter/orangutan@1.1.0-rc.11) (2020-04-15) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.10](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.9...@twreporter/orangutan@1.1.0-rc.10) (2020-04-15) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.9](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.8...@twreporter/orangutan@1.1.0-rc.9) (2020-04-13) - - -### Bug Fixes - -* **orangutan:** `BundleListPlugin` with plural targetPackages ([d09995b](https://github.com/twreporter/orangutan/commit/d09995bada11c04d8a2060e120f210f723e33321)) - - -### Features - -* **orangutan:** add scrollable-image in webpack-entry ([f076eca](https://github.com/twreporter/orangutan/commit/f076eca8c4cebe1104e2866bbb9a4ced4f1f5d9b)) -* **orangutan:** add scrollable-image to embedded-code-test-server.js ([a985eb3](https://github.com/twreporter/orangutan/commit/a985eb33756a7bf801ab3f54be123ac3fa8a94d2)) - - - - - -# [1.1.0-rc.8](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.7...@twreporter/orangutan@1.1.0-rc.8) (2020-04-10) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.7](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.6...@twreporter/orangutan@1.1.0-rc.7) (2020-04-10) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.6](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.5...@twreporter/orangutan@1.1.0-rc.6) (2020-04-08) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.5](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.4...@twreporter/orangutan@1.1.0-rc.5) (2020-04-07) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.4](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.3...@twreporter/orangutan@1.1.0-rc.4) (2020-04-06) - - -### Features - -* **orangutan:** add scrollable-image package to orangutan ([1151bcc](https://github.com/twreporter/orangutan/commit/1151bccdb7151db809feba39e1c703cb2d19770c)) - - - - - -# [1.1.0-rc.3](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.2...@twreporter/orangutan@1.1.0-rc.3) (2020-04-01) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.2](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.1...@twreporter/orangutan@1.1.0-rc.2) (2020-04-01) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# [1.1.0-rc.1](https://github.com/twreporter/orangutan/compare/@twreporter/orangutan@1.1.0-rc.0...@twreporter/orangutan@1.1.0-rc.1) (2020-03-31) - -**Note:** Version bump only for package @twreporter/orangutan - - - - - -# 1.1.0-rc.0 (2020-03-30) - - -### Features - -* update timeline in @twreporter/orangutan ([b620a74](https://github.com/twreporter/orangutan/commit/b620a74792c17b3fe4b0f28fb6b9f02a1ec0739a)) diff --git a/packages/orangutan/Makefile b/packages/orangutan/Makefile deleted file mode 100644 index ce7b9840d..000000000 --- a/packages/orangutan/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -ROOT_DIR ?= $(abspath ../..) -include $(ROOT_DIR)/dev/base.makefile - -P := "\\033[32m[+]\\033[0m" - -help: - @echo "$(P) make build - Transpile es6 and above to es5 files, and build webpack bundles" - @echo "$(P) make test-embedded-code - Local build mock embedded codes to test" - -build: clean build-default - @echo "$(P) Build webpack chunks, bundles and webpack-assets.json" - NODE_ENV=production $(ROOT_BIN_DIR)/webpack --config webpack.config.js - -test-embedded-code: clean - @echo "$(P) Build development mode webpack chunks, bundles and webpack-assets.json" - NODE_ENV=development $(ROOT_BIN_DIR)/webpack --config webpack.config.js - @echo "$(P) Build testing embedded code and start express server to test it." - $(ROOT_BIN_DIR)/babel-node dev/embedded-code-test-server --root-mode upward - -clean: - @echo "$(P) Clean lib/ dist/" - $(ROOT_BIN_DIR)/rimraf lib/ dist/ - -.PHONY: build clean diff --git a/packages/orangutan/README.md b/packages/orangutan/README.md deleted file mode 100644 index 51b93ecf5..000000000 --- a/packages/orangutan/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# orangutan - -![npm (latest)](https://img.shields.io/npm/v/@twreporter/orangutan/latest) -![npm (rc)](https://img.shields.io/npm/v/@twreporter/orangutan/rc) diff --git a/packages/orangutan/dev/embedded-code-test-server.js b/packages/orangutan/dev/embedded-code-test-server.js deleted file mode 100644 index 5f939b492..000000000 --- a/packages/orangutan/dev/embedded-code-test-server.js +++ /dev/null @@ -1,99 +0,0 @@ -/* eslint no-console: 0 */ -import Express from 'express' -import dualChannel from '@twreporter/dual-channel' -import path from 'path' -import scrollableImage from '@twreporter/scrollable-image' -import timeline from '@twreporter/timeline' -import webpackAssets from '../dist/webpack-assets.json' - -const orangutan = { - dualChannel, - scrollableImage, - timeline, -} - -const distFolder = path.resolve(__dirname, '../dist') -const app = new Express() - -// serve webpack bundles and chunks -app.use('/dist', Express.static(distFolder)) - -app.get('/', (req, res) => { - res.send(` - - -
- dual-channel test link -
-
- scrollable-image test link -
-
- timeline test link -
- - - `) -}) - -app.get('/dual-channel', (req, res) => { - try { - const testData = orangutan.dualChannel.getTestData() - const dualChannelWebpackAssets = webpackAssets['dual-channel'] - const code = orangutan.dualChannel.buildEmbeddedCode( - testData, - dualChannelWebpackAssets - ) - res.send(` - - - ${code} - - - `) - } catch (err) { - res.send(err.toString()) - } -}) - -app.get('/scrollable-image', (req, res) => { - try { - const testData = orangutan.scrollableImage.getTestData() - const scrollableImageWebpackAssets = webpackAssets['scrollable-image'] - const code = orangutan.scrollableImage.buildEmbeddedCode( - testData, - scrollableImageWebpackAssets - ) - res.send(` - - - ${code} - - - `) - } catch (err) { - res.send(err.toString()) - } -}) - -app.get('/timeline', (req, res) => { - try { - const testData = orangutan.timeline.getTestData() - const code = orangutan.timeline.buildEmbeddedCode(testData) - res.send(` - - - ${code} - - - `) - } catch (err) { - res.send(err.toString()) - } -}) - -app.listen(8080, () => { - console.log('You can test generated embedded code on localhost:8080') -}) diff --git a/packages/orangutan/package.json b/packages/orangutan/package.json deleted file mode 100644 index 28f4162f3..000000000 --- a/packages/orangutan/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@twreporter/orangutan", - "version": "1.2.0-rc.0", - "description": "Provide all-in-one services, including Scrollable Image, Timeline, Dual Channel, ... etc, with webpack bunldes optimization", - "main": "lib/index.js", - "repository": "https://github.com/twreporter/orangutan.git", - "author": "twreporter ", - "license": "MIT", - "scripts": { - "build": "make build", - "dev": "make dev" - }, - "dependencies": { - "@twreporter/dual-channel": "^2.1.2-rc.1", - "@twreporter/scrollable-image": "^1.1.1-rc.0", - "@twreporter/zoom-in": "0.1.0-rc.0" - }, - "files": [ - "dist", - "lib" - ] -} diff --git a/packages/orangutan/src/index.js b/packages/orangutan/src/index.js deleted file mode 100644 index 12f36a312..000000000 --- a/packages/orangutan/src/index.js +++ /dev/null @@ -1,61 +0,0 @@ -import dualChannel from '@twreporter/dual-channel' -import scrollableImage from '@twreporter/scrollable-image' -import zoomIn from '@twreporter/zoom-in' -// `webpack-assets.json` is created by `make build` -import webpackAssets from '../dist/webpack-assets.json' - -/** - * @typedef {Object} DualChannel - * @property {Object} ReactComponent - React Component to render Dual Channel style web page - * @property {Object} Sheets - Dual Channel specific data handler integration with spreadsheet API - * @property {Function} buildEmbeddedCode - Build Dual Channel embedded code - */ - -/** - * @typedef {Object} ScrollableImage - * @property {Object} Component - React Component to render Scrollable Image style web page - * @property {Function} buildEmbeddedCode - Build Scrollable Image embedded code - */ - -/** - * @typedef {Object} ZoomIn - * @property {Object} Component - React Component to render Zoom In style web page - * @property {Function} buildEmbeddedCode - Build Zoom In embedded code - */ - -/** - * @function buildCode - * @param {Object} data - * @return {string} embedded code script - */ - -/** - * @typedef {Object} Orangutan - * @property {DualChannel} dualChannel - * @property {buildCode} buildDualChannelEmbeddedCode - * @property {ScrollableImage} scrollableImage - * @property {buildCode} buildScrollableImageEmbeddedCode - * @property {ZoomIn} zoomIn - * @property {buildCode} buildZoomInEmbeddedCode - */ - -/** - * @type {Orangutan} - */ -export default { - dualChannel, - buildDualChannelEmbeddedCode: data => { - return dualChannel.buildEmbeddedCode(data, webpackAssets['dual-channel']) - }, - scrollableImage, - buildScrollableImageEmbeddedCode: data => { - return scrollableImage.buildEmbeddedCode( - data, - webpackAssets['scrollable-image'] - ) - }, - zoomIn, - buildZoomInEmbeddedCode: data => { - return zoomIn.buildEmbeddedCode(data, webpackAssets['zoom-in']) - }, -} diff --git a/packages/orangutan/webpack-entry.js b/packages/orangutan/webpack-entry.js deleted file mode 100644 index 4c90dbf48..000000000 --- a/packages/orangutan/webpack-entry.js +++ /dev/null @@ -1,9 +0,0 @@ -const dualChannel = require('@twreporter/dual-channel').default -const scrollableImage = require('@twreporter/scrollable-image').default -const zoomIn = require('@twreporter/zoom-in').default - -module.exports = { - 'dual-channel': dualChannel.getWebpackEntry(), - 'scrollable-image': scrollableImage.getWebpackEntry(), - 'zoom-in': zoomIn.getWebpackEntry(), -} diff --git a/packages/orangutan/webpack.config.js b/packages/orangutan/webpack.config.js deleted file mode 100644 index 9ea3ea11f..000000000 --- a/packages/orangutan/webpack.config.js +++ /dev/null @@ -1,251 +0,0 @@ -// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin -const fs = require('fs') -const path = require('path') -const webpackEntry = require('./webpack-entry') -const pkgJson = require('./package.json') - -const isProduction = process.env.NODE_ENV === 'production' -const packagesList = Object.keys(webpackEntry) - -/* - * There will be a `webpack-assets.json` file to store paths to all the assets (chunks, bundles) by different packages - * After it is initialized, here is an example of content: - * { - * 'package1': { - * chunks: [], - * bundles: [] - * }, - * 'package2': { - * chunks: [], - * bundles: [] - * } - * } - */ -const webpackAssets = packagesList.reduce(function(acc, cur) { - return { - ...acc, - [cur]: { - chunks: [], - bundles: [], - }, - } -}, {}) - -function BundleListPlugin() {} - -/* - * BundleListPlugin is used to write the filename of bundles and chunks into webpack-assets.json. - * - * examples of two packages `package1`, `package2` to show the content of `webpack-assets.json`: - * - * Example1: with common chunks (e.g. `polyfill`, `react-base`) - * - * If the output of webpack contains these files: - * [ `common-chunk-1.js`, `package1-bundle.js`, `package2-bundle.js` ] - * - * ```webpack-assets.json - * { - * 'package1': { - * chunks: [ `common-chunk-1.js` ], - * bundles: [ `package1-bundle.js` ] - * }, - * 'package2': { - * chunks: [ `common-chunk-1.js` ], - * bundles: [ `package2-bundle.js` ] - * } - * } - * ``` - * Example2: with packages' own splitted chunk - * - * Now, package1 has its own splitted chunk, which is not a common chunk and should not load by others - * - * If the output of webpack contains these files: - * [ `common-chunk-1.js`, `package1-chunk-js`, `package1-bundle.js`, `package2-bundle.js` ] - * - * ```webpack-assets.json - * { - * 'package1': { - * chunks: [ - * `common-chunk-1.js`, - * `package1-chunk-js`` - * ], - * bundles: [ `package1-bundle.js` ] - * }, - * 'package2': { - * chunks: [ `common-chunk-1.js` ], - * bundles: [ `package2-bundle.js` ] - * } - * } - * ``` - */ -BundleListPlugin.prototype.apply = function(compiler) { - const cdnLinkPrefix = `https://unpkg.com/${pkgJson.name}@${pkgJson.version}/dist` - const distDir = './dist' - - compiler.hooks.emit.tap('BundleListPlugin', function(compilation) { - for (const filename in compilation.assets) { - const isBundle = filename.endsWith('bundle.js') - const targetPackages = packagesList.filter(function(element) { - return filename.indexOf(`${element}`) !== -1 - }) - - const scriptSrc = isProduction - ? `${cdnLinkPrefix}/${filename}` - : `/dist/${filename}` - - if (Array.isArray(targetPackages) && targetPackages.length > 0) { - targetPackages.forEach(function(pkg) { - webpackAssets[pkg][`${isBundle ? 'bundles' : 'chunks'}`].push( - scriptSrc - ) - }) - } else { - packagesList.forEach(function(pkg) { - webpackAssets[pkg][`${isBundle ? 'bundles' : 'chunks'}`].push( - scriptSrc - ) - }) - } - } - - if (!fs.existsSync(distDir)) { - fs.mkdirSync(distDir) - } - fs.writeFileSync( - path.resolve(__dirname, `${distDir}/webpack-assets.json`), - JSON.stringify(webpackAssets) - ) - }) -} - -const config = { - mode: isProduction ? 'production' : 'development', - entry: webpackEntry, - output: { - path: path.resolve(__dirname, 'dist/'), - filename: '[name].[chunkhash].bundle.js', - chunkFilename: '[name].[chunkhash].chunk.js', - library: pkgJson.name, - libraryTarget: 'umd', - }, - optimization: { - minimize: true, - splitChunks: { - chunks: 'initial', - minChunks: 1, - cacheGroups: { - /* - * common chunks - */ - polyfill: { - test: module => { - return ( - module.context && - /node_modules\/(babel-polyfill|core-js|regenerator-runtime)/.test( - module.context - ) - ) - }, - name: 'polyfill', - priority: 9, - reuseExistingChunk: true, - enforce: true, - }, - react: { - test: module => { - return ( - module.context && - /node_modules\/(react|history|redux|styled-components)/.test( - module.context - ) - ) - }, - name: 'react-base', - priority: 11, - reuseExistingChunk: true, - enforce: true, - }, - twreporter: { - test: module => { - return ( - module.context && - module.context.includes('node_modules/@twreporter') - ) - }, - name: 'twreporter-base', - priority: 10, - reuseExistingChunk: true, - enforce: true, - }, - lodash: { - test: module => { - return ( - module.context && module.context.includes('node_modules/lodash') - ) - }, - name: `lodash`, - priority: 11, - reuseExistingChunk: true, - enforce: true, - }, - /* - * package's own chunk - * - * Example: twreporterCore will be a chunk of package1 - * - * twreporterCore: { - * test: module => { - * return ( - * module.context && module.context.includes('node_modules/@twreporter/core') - * ) - * }, - * name: `${packages.package1}/twreporter-core`, - * priority: 11, - * reuseExistingChunk: true, - * } - */ - }, - }, - }, - module: { - rules: [ - { - test: /\.jsx?$/, - exclude: /node_modules/, - use: { - loader: 'babel-loader', - options: { - rootMode: 'upward', - presets: [ - [ - '@babel/env', - // Config the bundle for browsers - { - useBuiltIns: 'usage', - modules: 'auto', - targets: 'last 2 versions, not dead', // Ref: https://github.com/browserslist/browserslist#best-practices - }, - ], - ], - }, - }, - }, - { - test: /\.(jpe?g|png|gif|mp4)$/i, - use: { - loader: 'url-loader', - }, - }, - { - test: /\.svg$/, - use: ['@svgr/webpack'], - }, - ], - }, - plugins: [ - new BundleListPlugin(), - // new BundleAnalyzerPlugin() - ], -} - -module.exports = config From bcfd2577fdf619dffa990afa7f843d87026698bb Mon Sep 17 00:00:00 2001 From: Taylor Fang Date: Fri, 6 Nov 2020 19:06:29 +0800 Subject: [PATCH 2/3] refactor: remove `getWebpackEntry` and `getTestData` from export object This patch removes `getWebpackEntry` and `getTestData` from export object since the `orangutan` repo is removed. --- packages/dual-channel/src/index.js | 7 ------- packages/scrollable-image/src/index.js | 11 ----------- packages/scrollable-video/src/index.js | 1 - packages/timeline/src/index.js | 2 -- packages/zoom-in/src/index.js | 6 ------ 5 files changed, 27 deletions(-) diff --git a/packages/dual-channel/src/index.js b/packages/dual-channel/src/index.js index a5baa9a0a..89e30863e 100644 --- a/packages/dual-channel/src/index.js +++ b/packages/dual-channel/src/index.js @@ -1,14 +1,7 @@ import ReactComponent from './app' -import path from 'path' import { buildEmbeddedCode } from './build-code' export default { ReactComponent, buildEmbeddedCode, - getWebpackEntry: () => { - return path.resolve(__dirname, './build-code/client.js') - }, - getTestData: () => { - return require('./test-data/data.json') - }, } diff --git a/packages/scrollable-image/src/index.js b/packages/scrollable-image/src/index.js index e8f3cbe56..93012fbd9 100644 --- a/packages/scrollable-image/src/index.js +++ b/packages/scrollable-image/src/index.js @@ -1,18 +1,7 @@ import Component from './components/scroll-horizontal' -import path from 'path' import { buildEmbeddedCode } from './build-code' -import { mockImgSrcs } from './test-data/data' export default { Component, buildEmbeddedCode, - getWebpackEntry: () => { - return path.resolve(__dirname, './build-code/client.js') - }, - getTestData: () => { - return { - data: mockImgSrcs, - lazyload: true, - } - }, } diff --git a/packages/scrollable-video/src/index.js b/packages/scrollable-video/src/index.js index 4c580afe2..fb8c2e403 100644 --- a/packages/scrollable-video/src/index.js +++ b/packages/scrollable-video/src/index.js @@ -5,6 +5,5 @@ import Sheets from './sheets' export default { buildEmbeddedCode, Component, - getTestData: () => require('../dev/data.json'), Sheets, } diff --git a/packages/timeline/src/index.js b/packages/timeline/src/index.js index b68841066..b9a437f1c 100644 --- a/packages/timeline/src/index.js +++ b/packages/timeline/src/index.js @@ -1,13 +1,11 @@ import { buildEmbeddedCode } from './build-code' import Component from './components/timeline' import Sheets from './sheets' -import testData from '../dev/data.json' import buildContent from './tree/elements-to-tree' export default { buildContent, buildEmbeddedCode, Component, - getTestData: () => testData, Sheets, } diff --git a/packages/zoom-in/src/index.js b/packages/zoom-in/src/index.js index 1953e5860..3a5791738 100644 --- a/packages/zoom-in/src/index.js +++ b/packages/zoom-in/src/index.js @@ -1,13 +1,7 @@ import Component from './components/zoomable-image' -import path from 'path' import { buildEmbeddedCode } from './build-code' -import { mockData } from './test-data/data' export default { Component, buildEmbeddedCode, - getWebpackEntry: () => { - return path.resolve(__dirname, './build-code/client.js') - }, - getTestData: () => mockData, } From 9454b8d73c8486ad59974e0af8aaf6b76f8fc19f Mon Sep 17 00:00:00 2001 From: Taylor Fang Date: Tue, 10 Nov 2020 16:01:09 +0800 Subject: [PATCH 3/3] docs: update README.md --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 90acaadf8..c010a615f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# orangutan +# orangutan-monorepo This repository is a monorepo containing several npm packages used by the website of online news media [The Reporter](https://www.twreporter.org). -- [orangutan](#orangutan) +- [orangutan-monorepo](#orangutan-monorepo) - [Packages](#packages) - [Developing Environment](#developing-environment) - [Yarn Workspaces](#yarn-workspaces) @@ -16,6 +16,11 @@ This repository is a monorepo containing several npm packages used by the websit See [`packages`](https://github.com/twreporter/orangutan-monorepo/tree/master/packages) +Note that `orangutan` used to be an all-in-one package which can be utilized to generate embedded code of other packages. +The goal was to prevent dependencies from reloading when multiple components of other packages exist on the same page. +However, it brings other issues. For example, when multiple embedded code built by `orangutan` in different version on the same page, the dependency reloading issue would be even severer since they might change between each version. +Therefore, `orangutan` is removed in this [PR](https://github.com/twreporter/orangutan-monorepo/pull/80). + ## Developing Environment ### Yarn Workspaces