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 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/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(` - -
- - - - - - `) -}) - -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