1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Merge branch 'refactor_clipper_build'

This commit is contained in:
Laurent Cozic 2020-02-23 21:31:30 +00:00
commit ddb631d800
44 changed files with 62 additions and 7273 deletions

View File

@ -15,13 +15,13 @@ CliClient/tests/logs
CliClient/tests/support
CliClient/tests/sync
CliClient/tests/tmp
Clipper/joplin-webclipper/content_scripts/JSDOMParser.js
Clipper/joplin-webclipper/content_scripts/Readability-readerable.js
Clipper/joplin-webclipper/content_scripts/Readability.js
Clipper/joplin-webclipper/dist
Clipper/joplin-webclipper/icons
Clipper/joplin-webclipper/popup/build
Clipper/joplin-webclipper/popup/node_modules
Clipper/content_scripts/JSDOMParser.js
Clipper/content_scripts/Readability-readerable.js
Clipper/content_scripts/Readability.js
Clipper/dist
Clipper/icons
Clipper/popup/build
Clipper/popup/node_modules
docs/
ElectronClient/dist
ElectronClient/lib

View File

@ -39,6 +39,14 @@ Then:
To run the iOS application, it might be easier to open the file `ios/Joplin.xcworkspace` on XCode and run the app from there.
## Building the clipper
cd Clipper/popup
npm install
npm run watch # To watch for changes
To test the extension please refer to the relevant pages for each browser: [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#Trying_it_out) / [Chrome](https://developer.chrome.com/extensions/faq#faq-dev-01). Please note that the extension in dev mode will only connect to a dev instance of the desktop app (and vice-versa).
## Watching files
To make changes to the application, you'll need to rebuild any TypeScript file you've changed, and rebuild the lib. The simplest way to do all this is to watch for changes from the root of the project. Simply run this command, and it should take care of the rest:

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -1,5 +0,0 @@
/* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */
// Add here all the external scripts that the content script might need
// and run browserify on it to create vendor.bundle.js
const Readability = require('readability-node').Readability;

View File

@ -1,14 +0,0 @@
{
"name": "joplin-webclipper",
"version": "1.0.0",
"description": "",
"main": "main.js",
"author": "",
"license": "MIT",
"dependencies": {
"readability-node": "^0.1.0"
},
"devDependencies": {
"fs-extra": "^6.0.1"
}
}

View File

@ -1,24 +0,0 @@
<!DOCTYPE html>
<!-- NOTE: I think this is not used at all -->
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<div id="popup-content">
<div class="button" data-action="getCompletePageHtml">Complete HTMLxx</div>
<div class="button beast">Turtle</div>
<div class="button beast">Snake</div>
<div class="button reset">Reset</div>
</div>
<div id="error-content" class="hidden">
<p>Can't beastify this web page.</p><p>Try a different page.</p>
</div>
<script src="index.js"></script>
</body>
</html>

View File

@ -1,3 +0,0 @@
const fs = require('fs-extra');
fs.copySync(`${__dirname}/../../../../ReactNativeClient/lib/randomClipperPort.js`, `${__dirname}/../src/randomClipperPort.js`);

View File

@ -1,5 +0,0 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}

View File

@ -1,31 +0,0 @@
html, body {
width: 100px;
}
.hidden {
display: none;
}
.button {
margin: 3% auto;
padding: 4px;
text-align: center;
font-size: 1.5em;
cursor: pointer;
}
.beast:hover {
background-color: #CFF2F2;
}
.beast {
background-color: #E5F2F2;
}
.reset {
background-color: #FBFBC9;
}
.reset:hover {
background-color: #EAEA9D;
}

File diff suppressed because it is too large Load Diff

8
Clipper/package.json Normal file
View File

@ -0,0 +1,8 @@
{
"name": "joplin-webclipper",
"version": "1.0.0",
"description": "Joplin Web Clipper",
"main": "main.js",
"author": "Laurent Cozic",
"license": "MIT"
}

View File

@ -12,11 +12,11 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "SKIP_PREFLIGHT_CHECK=true react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"watch": "cra-build-watch",
"postinstall": "node scripts/postinstall.js"
"postinstall": "node scripts/postinstall.js && npm run build"
},
"devDependencies": {
"cra-build-watch": "^3.2.0",

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,11 @@
const fs = require('fs-extra');
const sourcePath = `${__dirname}../../../ReactNativeClient/lib/randomClipperPort.js`;
// Mozilla insists on building the clipper from a tarball, not from the repository
// so we add this check and only copy the file if it's present. Normally it rarely
// changes anyway and it is committed to the repo.
if (fs.pathExistsSync(sourcePath)) {
fs.copySync(sourcePath, `${__dirname}/../src/randomClipperPort.js`);
}

View File

@ -1,3 +1,9 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
.App {
width: 400px;

View File

@ -1,6 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
const { Provider } = require('react-redux');

View File

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

View File

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 355 B

View File

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

View File

@ -1,8 +1,8 @@
const fs = require('fs-extra');
const { execCommand } = require('./tool-utils.js');
const clipperDir = `${__dirname}/../Clipper/joplin-webclipper`;
const tmpSourceDir = `${__dirname}/../Clipper/joplin-webclipper-source`;
const clipperDir = `${__dirname}/../Clipper`;
const tmpSourceDir = `${__dirname}/../Clipper-source`;
async function copyDir(baseSourceDir, sourcePath, baseDestDir) {
await fs.mkdirp(`${baseDestDir}/${sourcePath}`);
@ -33,6 +33,8 @@ async function updateManifestVersionNumber(manifestPath) {
}
async function main() {
console.info(await execCommand('git pull'));
const newVersion = await updateManifestVersionNumber(`${clipperDir}/manifest.json`);
console.info('Building extension...');
@ -40,7 +42,7 @@ async function main() {
// SKIP_PREFLIGHT_CHECK avoids the error "There might be a problem with the project dependency tree." due to eslint 5.12.0 being
// installed by CRA and 6.1.0 by us. It doesn't affect anything though, and the behaviour of the preflight
// check is buggy so we can ignore it.
console.info(await execCommand('SKIP_PREFLIGHT_CHECK=true npm run build'));
console.info(await execCommand('npm run build'));
const dists = [
{
@ -86,7 +88,6 @@ async function main() {
console.info(await execCommand('7z a -tzip joplin-webclipper-source.zip joplin-webclipper-source'));
console.info(await execCommand(`mv joplin-webclipper-source.zip ${clipperDir}/dist/ && rm -rf joplin-webclipper-source`));
console.info(await execCommand('git pull'));
console.info(await execCommand('git add -A'));
console.info(await execCommand(`git commit -m "Clipper release v${newVersion}"`));
console.info(await execCommand(`git tag clipper-${newVersion}`));

View File

@ -57,8 +57,8 @@
"CliClient/tests/sync/": true,
"CliClient/tests/tmp/": true,
"CliClient/tests/logs/": true,
"Clipper/joplin-webclipper/dist/": true,
"Clipper/joplin-webclipper/popup/build/": true,
"Clipper/dist/": true,
"Clipper/popup/build/": true,
"ElectronClient/dist/": true,
"ElectronClient/fonts/": true,
"ElectronClient/gui/note-viewer/highlight/styles/": true,

View File

@ -27,7 +27,14 @@
"*.bundle.js",
"yarn.lock",
"*.icns",
"*.base64"
"*.base64",
"Podfile.lock",
"ReactNativeClient/PluginAssetsLoader.js",
"ElectronClient/gui/NoteText2.js",
"ElectronClient/gui/ResourceScreen.js",
"ElectronClient/gui/ShareNoteDialog.js",
"ElectronClient/gui/TinyMCE.js",
"ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/sanitize_html.js"
],
"folder_exclude_patterns":
[
@ -56,16 +63,18 @@
"ReactNativeClient/android/build",
"ReactNativeClient/android/local.properties",
"ReactNativeClient/node_modules",
"ReactNativeClient/pluginAssets",
"ElectronClient/gui/note-viewer/highlight/styles",
"tests/logs",
"ReactNativeClient/ios/build",
"ElectronClient/dist",
"_releases",
"ReactNativeClient/lib/csstojs",
"Clipper/joplin-webclipper/popup/build",
"Clipper/joplin-webclipper/dist",
"Clipper/popup/build",
"Clipper/dist",
"ReactNativeClient/lib/rnInjectedJs",
"ReactNativeClient/ios/Pods"
"ReactNativeClient/ios/Pods",
"CliClient/locales-build"
],
"path": "."
}