1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-29 23:48:19 +02:00

Compare commits

..

30 Commits

Author SHA1 Message Date
Laurent Cozic
10f934cc69 Merge branch 'dev' into lerna_migration 2020-11-05 16:00:51 +00:00
Laurent Cozic
e5f1436f7e updated build doc 2020-11-05 14:52:20 +00:00
Laurent Cozic
03258b9553 Fixed patch 2020-11-05 13:19:25 +00:00
Laurent Cozic
c00e60debf moved tests to root 2020-11-05 13:01:46 +00:00
Laurent Cozic
c2929b9368 restore linter 2020-11-05 12:57:37 +00:00
Laurent Cozic
b366b46958 fix mobile build 2020-11-05 12:11:54 +00:00
Laurent Cozic
3f19365b8c clean up ignore script 2020-11-05 09:58:19 +00:00
Laurent Cozic
06010d860d mobile release 2020-11-05 09:52:21 +00:00
Laurent Cozic
c2b3a231cb package lock? 2020-11-04 20:49:16 +00:00
Laurent Cozic
e06e624da0 Fix mobile build 2020-11-04 17:54:20 +00:00
Laurent Cozic
13d326f535 verbose 2020-11-04 17:09:33 +00:00
Laurent Cozic
0fb535377b Releasing sub-packages 2020-11-04 17:07:37 +00:00
Laurent Cozic
6a10d35d7e verbose 2020-11-04 17:07:22 +00:00
Laurent Cozic
895eee5fde Releasing sub-packages 2020-11-04 17:06:31 +00:00
Laurent Cozic
30669b3064 verbose exec 2020-11-04 17:06:13 +00:00
Laurent Cozic
13eb91410c Releasing sub-packages 2020-11-04 17:03:09 +00:00
Laurent Cozic
b270d1010b automate publish 2020-11-04 17:02:50 +00:00
Laurent Cozic
ceb7afbbdc buildAssets on prePublish 2020-11-04 16:56:26 +00:00
Laurent Cozic
43cb5ba69b should not build assets on postinstall 2020-11-04 16:47:59 +00:00
Laurent Cozic
9a5184357e Added script to publish everything 2020-11-04 16:36:43 +00:00
Laurent Cozic
13b086353c trying publish 2020-11-04 16:22:50 +00:00
Laurent Cozic
61e172aad2 Disable useless electron-builder block map 2020-11-04 15:59:40 +00:00
Laurent Cozic
132323de9c disable spellfix 2020-11-04 15:35:54 +00:00
Laurent Cozic
0686228351 Ignore files 2020-11-04 15:31:31 +00:00
Laurent Cozic
b41b0f0a53 Set package name 2020-11-04 15:31:20 +00:00
Laurent Cozic
3cb266ef1a import lerna config 2020-11-03 21:54:42 +00:00
Laurent Cozic
3d8fc36afe Moving packages to their final place 2020-11-03 21:49:31 +00:00
Laurent
f50b54fd14 API: Adds ability to paginate data (#3983) 2020-11-01 00:02:59 +00:00
Laurent
f3376c779e Desktop: Resolves #275: Adds spell checker support for Rich Text editor (#3974) 2020-10-31 23:52:46 +00:00
Laurent
76739eeff0 All: Resolves #3839: Change Markdown link rendering and soft-break default to align with CommonMark spec (#3975) 2020-10-31 23:47:55 +00:00
30 changed files with 68 additions and 206 deletions

4
.gitignore vendored
View File

@@ -45,8 +45,8 @@ QtClient/data/
sparse_test.php
sync_staging.sh
TODO.md
packages/tools/commit_hook.txt
packages/tools/github_oauth_token.txt
Tools/commit_hook.txt
Tools/github_oauth_token.txt
lerna-debug.log
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD

View File

@@ -44,9 +44,9 @@ Building the apps is relatively easy - please [see the build instructions](https
Coding style is enforced by a pre-commit hook that runs eslint. This hook is installed whenever running `npm install` on any of the application directory. If for some reason the pre-commit hook didn't get installed, you can manually install it by running `npm install` at the root of the repository.
For new React components, please use [React Hooks](https://reactjs.org/docs/hooks-intro.html). For new code in general, please use TypeScript. Even if you are modifying a file that was originally in JavaScript you should ideally convert it first to TypeScript before modifying it. Doing so is relatively easy and it helps maintain code quality.
For new React components, please use [React Hooks](https://reactjs.org/docs/hooks-intro.html). For new code in general, please use TypeScript (unless you are modifying a file that was originally in JavaScript).
For changes made to the Desktop client that affect the user interface, refer to `packages/app-desktop/theme.ts` for all styling information. The goal is to create a consistent user interface to allow for easy navigation of Joplin's various features and improve the overall user experience.
For changes made to the Desktop client that affect the user interface, refer to `packages/app-desktop/app/theme.js` for all styling information. The goal is to create a consistent user interface to allow for easy navigation of Joplin's various features and improve the overall user experience.
## Automated tests

View File

@@ -404,7 +404,7 @@ Please see the [donation page](https://github.com/laurent22/joplin/blob/dev/read
# Contributing
Please see the guide for information on how to contribute to the development of Joplin: https://github.com/laurent22/joplin/blob/dev/CONTRIBUTING.md
Please see the guide for information on how to contribute to the development of Joplin: https://github.com/laurent22/joplin/blob/master/CONTRIBUTING.md
# Localisation

View File

@@ -10,6 +10,7 @@ platform:
install:
- ps: Install-Product node 10 x64
- yarn
build_script:
- npm install

View File

@@ -7,10 +7,11 @@
},
"license": "MIT",
"scripts": {
"test": "lerna run test --stream",
"linter": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --fix --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter-precommit": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --fix --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter-ci": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"postinstall": "lerna bootstrap --no-ci && npm run tsc",
"postinstall": "lerna bootstrap && npm run tsc",
"tsc": "lerna run tsc --stream --parallel",
"watch": "lerna run watch --stream --parallel",
"updateIgnored": "gulp updateIgnoredTypeScriptBuild",
@@ -21,9 +22,6 @@
"setupNewRelease": "node ./packages/tools/setupNewRelease",
"clean": "lerna clean -y && lerna run clean",
"linkChecker": "linkchecker https://joplinapp.org",
"releaseDesktop": "node packages/tools/release-electron.js",
"releaseAndroid": "node packages/tools/release-android.js",
"releaseCli": "node packages/tools/release-cli.js",
"publishAll": "git pull && lerna version --no-git-tag-version && gulp completePublishAll"
},
"husky": {

View File

@@ -10,23 +10,15 @@ const tasks = {
// updateIgnoredTypeScriptBuild: require('../Tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
};
async function makePackagePublic(filePath) {
const text = await fs.readFile(filePath, 'utf8');
const obj = JSON.parse(text);
delete obj.private;
await fs.writeFile(filePath, JSON.stringify(obj), 'utf8');
}
tasks.prepareBuild = {
fn: async () => {
const buildDir = `${__dirname}/build`;
await utils.copyDir(`${__dirname}/app`, buildDir, {
excluded: ['node_modules'],
});
// await utils.copyDir(`${__dirname}/locales-build`, `${buildDir}/locales`);
// await tasks.copyLib.fn();
await utils.copyFile(`${__dirname}/package.json`, `${buildDir}/package.json`);
await makePackagePublic(`${buildDir}/package.json`);
await utils.copyFile(`${__dirname}/package-lock.json`, `${buildDir}/package-lock.json`);
await utils.copyFile(`${__dirname}/gulpfile.js`, `${buildDir}/gulpfile.js`);

View File

@@ -1,6 +1,6 @@
{
"name": "@joplinapp/app-cli",
"version": "1.4.3",
"version": "1.3.13",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"name": "joplin",
"name": "@joplinapp/app-cli",
"description": "Joplin CLI Client",
"license": "MIT",
"author": "Laurent Cozic",
@@ -7,6 +7,7 @@
"scripts": {
"test": "node node_modules/jasmine/bin/jasmine.js --fail-fast=true --config=tests/support/jasmine.json",
"test-ci": "node node_modules/jasmine/bin/jasmine.js --config=tests/support/jasmine.json",
"postinstall": "npm run build",
"build": "gulp build",
"start": "gulp build -L && node \"build/main.js\" --stack-trace-enabled --log-level debug --env dev",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
@@ -30,7 +31,7 @@
],
"owner": "Laurent Cozic"
},
"version": "1.4.3",
"version": "1.3.13",
"bin": {
"joplin": "./main.js"
},

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Joplin Web Clipper [DEV]",
"version": "1.4.0",
"version": "1.3.1",
"description": "Capture and save web pages and screenshots from your browser to Joplin.",
"homepage_url": "https://joplinapp.org",
"content_security_policy": "script-src 'self'; object-src 'self'",

View File

@@ -30,14 +30,9 @@ const getLabel = (commandName: string):string => {
return _('Command palette');
case 'config':
return shim.isMac() ? _('Preferences') : _('Options');
default:
throw new Error(`Command: ${commandName} is unknown`);
}
// We don't throw an error if a command is not found because if for
// example a command is removed from one version to the next, or a
// command is renamed, we still want the keymap editor to work. So in
// that case, we simply display the command name and it is up to the
// user to fix the shortcut if needed.
return `${commandName} (${_('Invalid')})`;
};
export default getLabel;

View File

@@ -1,6 +1,6 @@
{
"name": "@joplinapp/app-desktop",
"version": "1.4.6",
"version": "1.3.20",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,12 +1,13 @@
{
"name": "@joplinapp/app-desktop",
"version": "1.4.6",
"version": "1.3.20",
"description": "Joplin for Desktop",
"main": "main.js",
"private": true,
"scripts": {
"dist": "node_modules/.bin/electron-builder",
"build": "gulp build",
"preinstall": "node tools/unlinkReact",
"postinstall": "npm run build && gulp electronRebuild",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",
@@ -33,7 +34,7 @@
"asar": true,
"asarUnpack": "./node_modules/node-notifier/vendor/**",
"win": {
"rfc3161TimeStampServer": "http://timestamp.comodoca.com/rfc3161",
"rfc3161TimeStampServer": "http://sha256timestamp.ws.symantec.com/sha256/timestamp",
"icon": "../../Assets/ImageSources/Joplin.ico",
"target": [
{
@@ -73,7 +74,7 @@
"icon": "../../Assets/macOs.icns"
},
"linux": {
"icon": "../../Assets/LinuxIcons",
"icon": "../Assets/LinuxIcons",
"category": "Office",
"desktop": {
"Icon": "joplin"
@@ -90,7 +91,6 @@
"@types/node": "^14.14.6",
"@types/react": "16.9.55",
"@types/react-redux": "^7.1.9",
"@joplinapp/tools": "^1.0.9",
"ajv": "^6.5.0",
"app-builder-bin": "^1.9.11",
"babel-cli": "^6.26.0",
@@ -112,6 +112,7 @@
"@fortawesome/fontawesome-free": "^5.13.0",
"@joplinapp/lib": "^1.0.9",
"@joplinapp/renderer": "^1.0.17",
"@joplinapp/tools": "^1.0.9",
"async-mutex": "^0.1.3",
"codemirror": "^5.56.0",
"color": "^3.1.2",

View File

@@ -14,12 +14,9 @@ module.exports = async function() {
}
const appId = packageInfo.build.appId;
const productName = packageInfo.build.productName;
delete packageInfo.build;
packageInfo.build = { appId: appId };
packageInfo.name = productName;
let branch;
let hash;

View File

@@ -61,4 +61,3 @@ buck-out/
# Custom
lib/csstojs/
lib/rnInjectedJs/
dist/

View File

@@ -138,8 +138,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2097608
versionName "1.4.6"
versionCode 2097602
versionName "1.3.13"
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}

View File

@@ -11,7 +11,6 @@
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit

View File

@@ -12,9 +12,6 @@ const tasks = {
podInstall: {
fn: require('./tools/podInstall'),
},
prepareRelease: {
fn: require('./tools/prepareRelease'),
},
// clean: {
// fn: require('./tools/clean'),
// },

View File

@@ -344,7 +344,7 @@
INFOPLIST_FILE = Joplin/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 10.4.0;
MARKETING_VERSION = 10.3.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -370,7 +370,7 @@
INFOPLIST_FILE = Joplin/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 10.4.0;
MARKETING_VERSION = 10.3.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",

View File

@@ -9,12 +9,14 @@
"build": "gulp build",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",
"preinstall": "node tools/unlinkReact.js",
"clean": "node tools/clean.js",
"postinstall": "jetify && npm run build"
},
"dependencies": {
"@joplinapp/lib": "^1.0.9",
"@joplinapp/renderer": "^1.0.17",
"@joplinapp/tools": "^1.0.9",
"@react-native-community/clipboard": "^1.5.0",
"@react-native-community/datetimepicker": "^3.0.3",
"@react-native-community/geolocation": "^2.0.2",
@@ -58,7 +60,6 @@
"valid-url": "^1.0.9"
},
"devDependencies": {
"@joplinapp/tools": "^1.0.9",
"@babel/core": "^7.11.6",
"@babel/runtime": "^7.11.2",
"@types/node": "^14.14.6",

View File

@@ -1,32 +0,0 @@
// This is to replace the symlinks inside node_modules with the actual packages
// as I assumed it was needed to build the final release. However it seems
// Android `assembleRelease` handles symlinks properly so maybe this is not
// needed after all ¯\_(ツ)_/¯
const { copyDir } = require('@joplinapp/tools/gulp/utils');
const { rootDir, deleteLink, toSystemSlashes } = require('@joplinapp/tools/tool-utils');
const mobileDir = `${rootDir}/packages/app-mobile`;
module.exports = async function() {
const dirsToCopy = [
'fork-htmlparser2',
'fork-sax',
'lib',
'renderer',
];
const destDir = `${mobileDir}/node_modules/@joplinapp`;
for (const dir of dirsToCopy) {
const destPath = toSystemSlashes(`${destDir}/${dir}`);
const sourcePath = toSystemSlashes(`${rootDir}/packages/${dir}`);
console.info(`Copying ${sourcePath} => ${destPath}`);
// TODO: copy symlink so that it can be restored
await deleteLink(destPath);
await copyDir(sourcePath, destPath, {
excluded: ['node_modules'],
});
}
};

View File

@@ -51,13 +51,6 @@ shared.renderFolders = function(props, renderItem) {
shared.renderTags = function(props, renderItem) {
const tags = props.tags.slice();
tags.sort((a, b) => {
// It seems title can sometimes be undefined (perhaps when syncing
// and before tag has been decrypted?). It would be best to find
// the root cause but for now that will do.
//
// Fixes https://github.com/laurent22/joplin/issues/4051
if (!a || !a.title || !b || !b.title) return 0;
// Note: while newly created tags are normalized and lowercase
// imported tags might be any case, so we need to do case-insensitive
// sort.

Binary file not shown.

View File

@@ -261,7 +261,7 @@ function flagImageUrl(locale) {
}
function poFileUrl(locale) {
return `https://github.com/laurent22/joplin/blob/dev/packages/lib/locales/${locale}.po`;
return `https://github.com/laurent22/joplin/blob/dev/packages/app-cli/locales/${locale}.po`;
}
function translationStatusToMdTable(status) {

View File

@@ -228,33 +228,33 @@ const operations = [
{
source: 5,
dest: 'packages/tools/PortableAppsLauncher/App/AppInfo/appicon.ico',
dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon.ico',
},
{
source: 2,
dest: 'packages/tools/PortableAppsLauncher/App/AppInfo/appicon_16.png',
dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_16.png',
},
{
source: 3,
dest: 'packages/tools/PortableAppsLauncher/App/AppInfo/appicon_32.png',
dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_32.png',
width: 32,
height: 32,
},
{
source: 4,
dest: 'packages/tools/PortableAppsLauncher/App/AppInfo/appicon_75.png',
dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_75.png',
width: 75,
height: 75,
},
{
source: 4,
dest: 'packages/tools/PortableAppsLauncher/App/AppInfo/appicon_128.png',
dest: 'Tools/PortableAppsLauncher/App/AppInfo/appicon_128.png',
width: 128,
height: 128,
},
{
source: 4,
dest: 'packages/tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg',
dest: 'Tools/PortableAppsLauncher/App/AppInfo/Launcher/splash.jpg',
width: 144,
height: 144,
},

View File

@@ -1,13 +1,13 @@
const fs = require('fs-extra');
const { execCommandVerbose, execCommandWithPipes, githubRelease, githubOauthToken, fileExists } = require('./tool-utils.js');
const { execCommand, execCommandWithPipes, githubRelease, githubOauthToken, fileExists } = require('./tool-utils.js');
const path = require('path');
const fetch = require('node-fetch');
const uriTemplate = require('uri-template');
const projectName = 'joplin-android';
const rnDir = `${__dirname}/../../packages/app-mobile`;
const rnDir = `${__dirname}/../packages/app-mobile`;
const rootDir = path.dirname(__dirname);
const releaseDir = `${rnDir}/dist`;
const releaseDir = `${rootDir}/_releases`;
// function wslToWinPath(wslPath) {
// const s = wslPath.split('/');
@@ -84,8 +84,7 @@ async function createRelease(name, tagName, version) {
console.info(`Building APK file v${suffix}...`);
let restoreDir = null;
let apkBuildCmd = '';
const apkBuildCmdArgs = ['assembleRelease', '-PbuildDir=build'];
let apkBuildCmd = 'assembleRelease -PbuildDir=build';
if (await fileExists('/mnt/c/Windows/System32/cmd.exe')) {
// In recent versions (of Gradle? React Native?), running gradlew.bat from WSL throws the following error:
@@ -115,12 +114,14 @@ async function createRelease(name, tagName, version) {
apkBuildCmd = '';
} else {
process.chdir(`${rnDir}/android`);
apkBuildCmd = './gradlew';
apkBuildCmd = `./gradlew ${apkBuildCmd}`;
restoreDir = rootDir;
}
if (apkBuildCmd) {
await execCommandVerbose(apkBuildCmd, apkBuildCmdArgs);
console.info(apkBuildCmd);
const output = await execCommand(apkBuildCmd);
console.info(output);
}
if (restoreDir) process.chdir(restoreDir);
@@ -128,11 +129,11 @@ async function createRelease(name, tagName, version) {
await fs.mkdirp(releaseDir);
console.info(`Copying APK to ${apkFilePath}`);
await fs.copy('app-mobile/android/app/build/outputs/apk/release/app-release.apk', apkFilePath);
await fs.copy('packages/app-mobile/android/app/build/outputs/apk/release/app-release.apk', apkFilePath);
if (name === 'main') {
console.info(`Copying APK to ${releaseDir}/joplin-latest.apk`);
await fs.copy('app-mobile/android/app/build/outputs/apk/release/app-release.apk', `${releaseDir}/joplin-latest.apk`);
await fs.copy('packages/app-mobile/android/app/build/outputs/apk/release/app-release.apk', `${releaseDir}/joplin-latest.apk`);
}
for (const filename in originalContents) {
@@ -176,12 +177,12 @@ async function main() {
await fs.writeFile('README.md', readmeContent);
}
await execCommandVerbose('git', ['pull']);
await execCommandVerbose('git', ['add', '-A']);
await execCommandVerbose('git', ['commit', '-m', `Android release v${version}`]);
await execCommandVerbose('git', ['tag', tagName]);
await execCommandVerbose('git', ['push']);
await execCommandVerbose('git', ['push', '--tags']);
console.info(await execCommand('git pull'));
console.info(await execCommand('git add -A'));
console.info(await execCommand(`git commit -m "Android release v${version}"`));
console.info(await execCommand(`git tag ${tagName}`));
console.info(await execCommand('git push'));
console.info(await execCommand('git push --tags'));
console.info(`Creating GitHub release ${tagName}...`);

View File

@@ -1,7 +1,9 @@
const { execCommand, rootDir } = require('./tool-utils.js');
const { execCommand } = require('./tool-utils.js');
const path = require('path');
const fs = require('fs-extra');
const moment = require('moment');
const rootDir = path.dirname(__dirname);
const appDir = `${rootDir}/packages/app-cli`;
const changelogPath = `${rootDir}/readme/changelog_cli.md`;
@@ -57,7 +59,8 @@ async function main() {
await execCommand('git pull');
await execCommand('touch app/main.js');
await execCommand('npm run build');
await execCommand('cp ../../README.md build/');
// await execCommand('cp package.json build/');
await execCommand('cp ../README.md build/');
process.chdir(`${appDir}/build`);

View File

@@ -1,5 +1,7 @@
const { execCommand, githubRelease, rootDir } = require('./tool-utils.js');
const { execCommand, githubRelease } = require('./tool-utils.js');
const path = require('path');
const rootDir = path.dirname(__dirname);
const appDir = `${rootDir}/packages/app-desktop`;
async function main() {
@@ -27,7 +29,7 @@ async function main() {
console.info(`Created GitHub release: ${release.html_url}`);
console.info('GitHub release page: https://github.com/laurent22/joplin/releases');
console.info(`To create changelog: node packages/tools/git-changelog.js ${version}`);
console.info(`To create changelog: node Tools/git-changelog.js ${version}`);
}
main().catch((error) => {

View File

@@ -1,7 +1,7 @@
const fs = require('fs-extra');
const path = require('path');
const rootDir = path.dirname(path.dirname(__dirname));
const rootDir = path.dirname(__dirname);
async function updatePackageVersion(packageFilePath, majorMinorVersion) {
const contentText = await fs.readFile(packageFilePath, 'utf8');

View File

@@ -1,7 +1,5 @@
const fetch = require('node-fetch');
const fs = require('fs-extra');
const execa = require('execa');
const { execSync } = require('child_process');
const toolUtils = {};
@@ -23,30 +21,6 @@ toolUtils.execCommand = function(command) {
});
};
function quotePath(path) {
if (!path) return '';
if (path.indexOf('"') < 0 && path.indexOf(' ') < 0) return path;
path = path.replace(/"/, '\\"');
return `"${path}"`;
}
function commandToString(commandName, args = []) {
const output = [quotePath(commandName)];
for (const arg of args) {
output.push(quotePath(arg));
}
return output.join(' ');
}
toolUtils.execCommandVerbose = function(commandName, args = []) {
console.info(`> ${commandToString(commandName, args)}`);
const promise = execa(commandName, args);
promise.stdout.pipe(process.stdout);
return promise;
};
toolUtils.execCommandWithPipes = function(executable, args) {
const spawn = require('child_process').spawn;
@@ -67,61 +41,6 @@ toolUtils.execCommandWithPipes = function(executable, args) {
});
};
toolUtils.toSystemSlashes = function(path) {
const os = process.platform;
if (os === 'win32') return path.replace(/\//g, '\\');
return path.replace(/\\/g, '/');
};
toolUtils.deleteLink = async function(path) {
if (toolUtils.isWindows()) {
try {
execSync(`rmdir "${toolUtils.toSystemSlashes(path)}"`, { stdio: 'pipe' });
} catch (error) {
// console.info('Error: ' + error.message);
}
} else {
try {
fs.unlinkSync(toolUtils.toSystemSlashes(path));
} catch (error) {
// ignore
}
}
};
toolUtils.credentialDir = async function() {
const username = require('os').userInfo().username;
const toTry = [
`c:/Users/${username}/joplin-credentials`,
`/mnt/c/Users/${username}/joplin-credentials`,
`/home/${username}/joplin-credentials`,
`/Users/${username}/joplin-credentials`,
];
for (const dirPath of toTry) {
if (await fs.exists(dirPath)) return dirPath;
}
throw new Error(`Could not find credential directory in any of these paths: ${JSON.stringify(toTry)}`);
};
// Returns the project root dir
toolUtils.rootDir = require('path').dirname(require('path').dirname(__dirname));
toolUtils.credentialFile = async function(filename) {
const rootDir = await toolUtils.credentialDir();
const output = `${rootDir}/${filename}`;
if (!(await fs.exists(output))) throw new Error(`No such file: ${output}`);
return output;
};
toolUtils.readCredentialFile = async function(filename) {
const filePath = await toolUtils.credentialFile(filename);
const r = await fs.readFile(filePath);
return r.toString();
};
toolUtils.downloadFile = function(url, targetPath) {
const https = require('https');
const fs = require('fs');
@@ -244,11 +163,15 @@ toolUtils.githubUsername = async function(email, name) {
};
toolUtils.patreonOauthToken = async function() {
return toolUtils.readCredentialFile('patreon_oauth_token.txt');
const fs = require('fs-extra');
const r = await fs.readFile(`${__dirname}/patreon_oauth_token.txt`);
return r.toString();
};
toolUtils.githubOauthToken = async function() {
return toolUtils.readCredentialFile('github_oauth_token.txt');
const fs = require('fs-extra');
const r = await fs.readFile(`${__dirname}/github_oauth_token.txt`);
return r.toString();
};
toolUtils.githubRelease = async function(project, tagName, options = null) {

View File

@@ -1,14 +1,5 @@
# Joplin terminal app changelog
## [cli-v1.4.3](https://github.com/laurent22/joplin/releases/tag/cli-v1.4.3) - 2020-11-06T21:19:29Z
IMPORTANT: If you use the web API, please note that there are a few breaking changes in this release. See here for more information: https://github.com/laurent22/joplin/pull/3983#issue-509624899
- New: API: Adds ability to paginate data (#3983)
- Fixed: Display proper error message when decryption worker cannot be started (#4000)
- Fixed: Fixed OneDrive authentication
- Fixed: Fixed sync issue when importing ENEX files that contain new line characters in the source URL attribute (#3955)
## [cli-v1.3.3](https://github.com/laurent22/joplin/releases/tag/cli-v1.3.3) - 2020-10-23T16:00:38Z
- Improved: Added support for a custom S3 URL (#3921) (#3691 by [@aaron](https://github.com/aaron))