diff --git a/.eslintignore b/.eslintignore index c8e7abbe0..e3163d941 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1646,4 +1646,7 @@ packages/server/src/utils/urlUtils.js.map packages/server/src/utils/uuidgen.d.ts packages/server/src/utils/uuidgen.js packages/server/src/utils/uuidgen.js.map +packages/tools/release-server.d.ts +packages/tools/release-server.js +packages/tools/release-server.js.map # AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD diff --git a/.gitignore b/.gitignore index 5faf9ef06..5311aba26 100644 --- a/.gitignore +++ b/.gitignore @@ -1635,4 +1635,7 @@ packages/server/src/utils/urlUtils.js.map packages/server/src/utils/uuidgen.d.ts packages/server/src/utils/uuidgen.js packages/server/src/utils/uuidgen.js.map +packages/tools/release-server.d.ts +packages/tools/release-server.js +packages/tools/release-server.js.map # AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD diff --git a/package.json b/package.json index 12ead56bd..88421cc2d 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,6 @@ }, "license": "MIT", "scripts": { - "addPackageCli": "lerna add --scope joplin", - "addPackageCliD": "lerna add --scope joplin -D", - "addPackageDesktop": "lerna add --scope @joplin/app-desktop", - "addPackageDesktopD": "lerna add --scope @joplin/app-desktop -D", - "addPackageMobile": "lerna add --scope @joplin/app-mobile", - "addPackageMobileD": "lerna add --scope @joplin/app-mobile -D", "buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md", "buildDoc": "./packages/tools/build-all.sh", "buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out docs/api/references/plugin_api packages/lib/services/plugins/api/", @@ -43,8 +37,7 @@ "updateIgnored": "gulp updateIgnoredTypeScriptBuild", "updatePluginTypes": "./packages/generator-joplin/updateTypes.sh", "watch": "lerna run watch --stream --parallel", - "i": "lerna add --no-bootstrap --scope", - "server-start-dev": "docker-compose --file docker-compose.server-dev.yml up" + "i": "lerna add --no-bootstrap --scope" }, "husky": { "hooks": { diff --git a/packages/server/README.md b/packages/server/README.md index b1a7c1e17..7d1883300 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -10,9 +10,9 @@ First copy `.env-sample` to `.env` and edit the values in there: ## Install application ```shell -git clone https://github.com/laurent22/joplin -cd joplin -npm install +mkdir joplin && cd joplin +wget https://github.com/laurent22/joplin/archive/server-v1.6.3.tar.gz +tar xzvf server-v1.6.3.tar.gz docker-compose --file docker-compose.server.yml up --detach ``` diff --git a/packages/server/package-lock.json b/packages/server/package-lock.json index 9a7028578..348279a6e 100644 --- a/packages/server/package-lock.json +++ b/packages/server/package-lock.json @@ -1,6 +1,6 @@ { "name": "@joplin/server", - "version": "0.0.0", + "version": "1.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/server/package.json b/packages/server/package.json index 16a7da04f..fe709c44f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@joplin/server", - "version": "0.0.0", + "version": "1.6.3", "private": true, "scripts": { "start-dev": "nodemon --config nodemon.json dist/app.js --env dev", diff --git a/packages/tools/package-lock.json b/packages/tools/package-lock.json index 1c5a5d1cc..0593f9423 100644 --- a/packages/tools/package-lock.json +++ b/packages/tools/package-lock.json @@ -145,6 +145,15 @@ "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, + "@types/fs-extra": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.6.tgz", + "integrity": "sha512-ecNRHw4clCkowNOBJH1e77nvbPxHYnWIXMv1IAoG/9+MYGkgoyr3Ppxr7XYFNL41V422EDhyV4/4SSK8L2mlig==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/node": { "version": "14.14.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz", @@ -4412,6 +4421,12 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typescript": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", + "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", + "dev": true + }, "uc.micro": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.5.tgz", diff --git a/packages/tools/package.json b/packages/tools/package.json index df196b766..7079f8d59 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -5,7 +5,9 @@ "main": "index.js", "author": "Laurent Cozic", "scripts": { - "updateIgnored": "gulp updateIgnoredTypeScriptBuild" + "updateIgnored": "gulp updateIgnoredTypeScriptBuild", + "tsc": "tsc --project tsconfig.json", + "watch": "tsc --watch --project tsconfig.json" }, "publishConfig": { "access": "public" @@ -34,9 +36,11 @@ }, "devDependencies": { "@rmp135/sql-ts": "^1.6.0", + "@types/fs-extra": "^9.0.6", "@types/node": "^14.14.6", "gulp": "^4.0.2", - "sqlite3": "^5.0.0" + "sqlite3": "^5.0.0", + "typescript": "^4.1.3" }, "gitHead": "80c0089d2c52aff608b2bea74389de5a7f12f2e2" } diff --git a/packages/tools/release-server.ts b/packages/tools/release-server.ts new file mode 100644 index 000000000..c239f7bdb --- /dev/null +++ b/packages/tools/release-server.ts @@ -0,0 +1,39 @@ +import * as fs from 'fs-extra'; +const { execCommand, execCommandVerbose, rootDir, gitPullTry } = require('./tool-utils.js'); + +const serverDir = `${rootDir}/packages/server`; +const readmePath = `${serverDir}/README.md`; + +async function updateReadmeLinkVersion(version: string) { + const content = await fs.readFile(readmePath, 'utf8'); + const newContent = content.replace(/server-v(.*?).tar.gz/g, `server-${version}.tar.gz`); + if (content === newContent) throw new Error(`Could not change version number in ${readmePath}`); + await fs.writeFile(readmePath, newContent, 'utf8'); +} + +async function main() { + process.chdir(serverDir); + + console.info(`Running from: ${process.cwd()}`); + + await gitPullTry(); + + const version = (await execCommand('npm version patch')).trim(); + const tagName = `server-${version}`; + + console.info(`New version number: ${version}`); + + await updateReadmeLinkVersion(version); + + await execCommandVerbose('git', ['add', '-A']); + await execCommandVerbose('git', ['commit', '-m', `Server release ${version}`]); + await execCommandVerbose('git', ['tag', tagName]); + await execCommandVerbose('git', ['push']); + await execCommandVerbose('git', ['push', '--tags']); +} + +main().catch((error) => { + console.error('Fatal error'); + console.error(error); + process.exit(1); +}); diff --git a/packages/tools/setupNewRelease.js b/packages/tools/setupNewRelease.js index e4155282a..25847e285 100644 --- a/packages/tools/setupNewRelease.js +++ b/packages/tools/setupNewRelease.js @@ -79,6 +79,7 @@ async function main() { await updatePackageVersion(`${rootDir}/packages/app-desktop/package.json`, majorMinorVersion); await updatePackageVersion(`${rootDir}/packages/app-cli/package.json`, majorMinorVersion); await updatePackageVersion(`${rootDir}/packages/generator-joplin/package.json`, majorMinorVersion); + await updatePackageVersion(`${rootDir}/packages/server/package.json`, majorMinorVersion); await updateGradleVersion(`${rootDir}/packages/app-mobile/android/app/build.gradle`, majorMinorVersion); await updateCodeProjVersion(`${rootDir}/packages/app-mobile/ios/Joplin.xcodeproj/project.pbxproj`, iosVersionHack(majorMinorVersion)); await updateClipperManifestVersion(`${rootDir}/packages/app-clipper/manifest.json`, majorMinorVersion); diff --git a/packages/tools/tsconfig.json b/packages/tools/tsconfig.json new file mode 100644 index 000000000..2ad98ea48 --- /dev/null +++ b/packages/tools/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "include": [ + "**/*.ts", + "**/*.tsx", + ], + "exclude": [ + "**/node_modules" + ], +} \ No newline at end of file