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

Compare commits

...

10 Commits

Author SHA1 Message Date
Laurent Cozic
54f4b41de8 CLI v1.4.3 2020-11-06 21:21:17 +00:00
Laurent Cozic
b33aeeecc5 remove postinstall 2020-11-06 21:19:07 +00:00
Laurent Cozic
7eefac0b54 CLI v1.4.2 2020-11-06 21:10:07 +00:00
Laurent Cozic
3fbec21c2e fix script 2020-11-06 20:59:25 +00:00
Laurent Cozic
d3b2f23983 fix script 2020-11-06 20:54:19 +00:00
Laurent Cozic
9956b6612d Added release script 2020-11-06 20:53:40 +00:00
Laurent Cozic
bc3f6dd51a fix cli release script 2020-11-06 20:50:32 +00:00
Laurent Cozic
7b0122a8db Merge branch 'dev' of github.com:laurent22/joplin into dev 2020-11-06 20:41:37 +00:00
Laurent Cozic
7ea4f570cb Tools: Refactor Android release script 2020-11-06 18:45:45 +00:00
Laurent Cozic
1e1f2582c5 Tools: minor tweak 2020-11-06 12:31:30 +00:00
15 changed files with 129 additions and 32 deletions

View File

@@ -22,6 +22,8 @@
"clean": "lerna clean -y && lerna run clean", "clean": "lerna clean -y && lerna run clean",
"linkChecker": "linkchecker https://joplinapp.org", "linkChecker": "linkchecker https://joplinapp.org",
"releaseDesktop": "node packages/tools/release-electron.js", "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" "publishAll": "git pull && lerna version --no-git-tag-version && gulp completePublishAll"
}, },
"husky": { "husky": {

View File

@@ -10,15 +10,23 @@ const tasks = {
// updateIgnoredTypeScriptBuild: require('../Tools/gulp/tasks/updateIgnoredTypeScriptBuild'), // 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 = { tasks.prepareBuild = {
fn: async () => { fn: async () => {
const buildDir = `${__dirname}/build`; const buildDir = `${__dirname}/build`;
await utils.copyDir(`${__dirname}/app`, buildDir, { await utils.copyDir(`${__dirname}/app`, buildDir, {
excluded: ['node_modules'], 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 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}/package-lock.json`, `${buildDir}/package-lock.json`);
await utils.copyFile(`${__dirname}/gulpfile.js`, `${buildDir}/gulpfile.js`); await utils.copyFile(`${__dirname}/gulpfile.js`, `${buildDir}/gulpfile.js`);

View File

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

View File

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

View File

@@ -7,7 +7,6 @@
"scripts": { "scripts": {
"dist": "node_modules/.bin/electron-builder", "dist": "node_modules/.bin/electron-builder",
"build": "gulp build", "build": "gulp build",
"preinstall": "node tools/unlinkReact",
"postinstall": "npm run build && gulp electronRebuild", "postinstall": "npm run build && gulp electronRebuild",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json", "tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json", "watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
// 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

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

View File

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

View File

@@ -1,5 +1,7 @@
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const fs = require('fs-extra'); const fs = require('fs-extra');
const execa = require('execa');
const { execSync } = require('child_process');
const toolUtils = {}; const toolUtils = {};
@@ -21,6 +23,30 @@ 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) { toolUtils.execCommandWithPipes = function(executable, args) {
const spawn = require('child_process').spawn; const spawn = require('child_process').spawn;
@@ -41,6 +67,28 @@ 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() { toolUtils.credentialDir = async function() {
const username = require('os').userInfo().username; const username = require('os').userInfo().username;

View File

@@ -1,5 +1,14 @@
# Joplin terminal app changelog # 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 ## [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)) - Improved: Added support for a custom S3 URL (#3921) (#3691 by [@aaron](https://github.com/aaron))