1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-19 20:31:46 +02:00

Tools: Use Yarn 3 to manage monorepo (#5833)

This commit is contained in:
Laurent 2021-12-20 16:08:43 +01:00 committed by GitHub
parent dea79fa3b7
commit 7f64fbfd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
127 changed files with 32340 additions and 261687 deletions

View File

@ -5,6 +5,7 @@ _releases/
*.min.js
**/commands/index.ts
**/node_modules/
.yarn/
Assets/
docs/
highlight.pack.js
@ -12,6 +13,8 @@ Modules/TinyMCE/IconPack/postinstall.js
Modules/TinyMCE/JoplinLists/
Modules/TinyMCE/langs/
node_modules/
packages/app-desktop/build/
packages/app-cli/tests/test data/
packages/app-cli/build
packages/app-cli/build/
packages/app-cli/locales
@ -1509,9 +1512,6 @@ packages/lib/services/plugins/api/types.js.map
packages/lib/services/plugins/reducer.d.ts
packages/lib/services/plugins/reducer.js
packages/lib/services/plugins/reducer.js.map
packages/lib/services/plugins/sandboxProxy.d.ts
packages/lib/services/plugins/sandboxProxy.js
packages/lib/services/plugins/sandboxProxy.js.map
packages/lib/services/plugins/utils/createViewHandle.d.ts
packages/lib/services/plugins/utils/createViewHandle.js
packages/lib/services/plugins/utils/createViewHandle.js.map
@ -1941,9 +1941,6 @@ packages/tools/generate-images.js.map
packages/tools/git-changelog.d.ts
packages/tools/git-changelog.js
packages/tools/git-changelog.js.map
packages/tools/lerna-add.d.ts
packages/tools/lerna-add.js
packages/tools/lerna-add.js.map
packages/tools/release-android.d.ts
packages/tools/release-android.js
packages/tools/release-android.js.map

View File

@ -46,13 +46,14 @@ echo "IS_MACOS=$IS_MACOS"
echo "Node $( node -v )"
echo "Npm $( npm -v )"
echo "Yarn $( yarn -v )"
# =============================================================================
# Install packages
# =============================================================================
cd "$ROOT_DIR"
npm install
yarn install
# =============================================================================
# Run test units. Only do it for pull requests and dev branch because we don't
@ -78,7 +79,7 @@ if [ "$IS_PULL_REQUEST" == "1" ] || [ "$IS_DEV_BRANCH" = "1" ]; then
#
# https://stackoverflow.com/questions/38558989
export NODE_OPTIONS="--max-old-space-size=4096"
npm run test-ci
yarn run test-ci
testResult=$?
if [ $testResult -ne 0 ]; then
exit $testResult
@ -93,7 +94,7 @@ fi
if [ "$IS_PULL_REQUEST" == "1" ] || [ "$IS_DEV_BRANCH" = "1" ]; then
echo "Step: Running linter..."
npm run linter-ci ./
yarn run linter-ci ./
testResult=$?
if [ $testResult -ne 0 ]; then
exit $testResult
@ -166,12 +167,12 @@ cd "$ROOT_DIR/packages/app-desktop"
if [[ $GIT_TAG_NAME = v* ]]; then
echo "Step: Building and publishing desktop application..."
USE_HARD_LINKS=false npm run dist
USE_HARD_LINKS=false yarn run dist
elif [[ $GIT_TAG_NAME = server-v* ]] && [[ $IS_LINUX = 1 ]]; then
echo "Step: Building Docker Image..."
cd "$ROOT_DIR"
npm run buildServerDocker -- --tag-name $GIT_TAG_NAME --push-images
yarn run buildServerDocker -- --tag-name $GIT_TAG_NAME --push-images
else
echo "Step: Building but *not* publishing desktop application..."
USE_HARD_LINKS=false npm run dist -- --publish=never
USE_HARD_LINKS=false yarn run dist -- --publish=never
fi

View File

@ -49,6 +49,11 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Yarn
run: |
# https://yarnpkg.com/getting-started/install
corepack enable
# Login to Docker only if we're on a server release tag. If we run this on
# a pull request it will fail because the PR doesn't have access to
@ -80,6 +85,44 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
IS_CONTINUOUS_INTEGRATION: 1
run: |
npm install
yarn install
cd packages/app-desktop
npm run dist
yarn run dist
ServerDockerImage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Install Docker Engine
run: |
sudo apt-get install -y apt-transport-https
sudo apt-get install -y ca-certificates
sudo apt-get install -y curl
sudo apt-get install -y gnupg
sudo apt-get install -y lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update || true
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Yarn
run: |
# https://yarnpkg.com/getting-started/install
corepack enable
- name: Build Docker Image
run: |
yarn install
yarn run buildServerDocker --tag-name server-v0.0.0

17
.gitignore vendored
View File

@ -51,6 +51,17 @@ lerna-debug.log
.env
docs/**/*.mustache
# Yarn stuff
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
packages/app-cli/app/LinkSelector.d.ts
packages/app-cli/app/LinkSelector.js
@ -1492,9 +1503,6 @@ packages/lib/services/plugins/api/types.js.map
packages/lib/services/plugins/reducer.d.ts
packages/lib/services/plugins/reducer.js
packages/lib/services/plugins/reducer.js.map
packages/lib/services/plugins/sandboxProxy.d.ts
packages/lib/services/plugins/sandboxProxy.js
packages/lib/services/plugins/sandboxProxy.js.map
packages/lib/services/plugins/utils/createViewHandle.d.ts
packages/lib/services/plugins/utils/createViewHandle.js
packages/lib/services/plugins/utils/createViewHandle.js.map
@ -1924,9 +1932,6 @@ packages/tools/generate-images.js.map
packages/tools/git-changelog.d.ts
packages/tools/git-changelog.js
packages/tools/git-changelog.js.map
packages/tools/lerna-add.d.ts
packages/tools/lerna-add.js
packages/tools/lerna-add.js.map
packages/tools/release-android.d.ts
packages/tools/release-android.js
packages/tools/release-android.js.map

File diff suppressed because one or more lines are too long

768
.yarn/releases/yarn-3.1.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

9
.yarnrc.yml Normal file
View File

@ -0,0 +1,9 @@
nmHoistingLimits: workspaces
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: .yarn/releases/yarn-3.1.1.cjs

View File

@ -1,6 +1,6 @@
# Building the applications
The Joplin source code is hosted on a [monorepo](https://en.wikipedia.org/wiki/Monorepo) managed by Lerna. The usage of Lerna is mostly transparent as the needed commands have been moved to the root package.json and thus are invoked for example when running `npm install` or `npm run watch`. The main thing to know about Lerna is that it links the packages in the monorepo using `npm link`, so if you check the node_modules directory you will see links instead of actual directories for certain packages. This is something to keep in mind as these links can cause issues in some cases.
The Joplin source code is hosted on a [monorepo](https://en.wikipedia.org/wiki/Monorepo) and is managed using Yarn workspaces (as well as Lerna for publishing the packages).
The list of the main sub-packages is below:
@ -18,30 +18,30 @@ There are also a few forks of existing packages under the "fork-*" name.
## Required dependencies
- Install node 14+ - https://nodejs.org/en/
- Install node 16+ - https://nodejs.org/en/
- macOS: Install Cocoapods - `brew install cocoapods`
- Windows: Install Windows Build Tools - `npm install -g windows-build-tools --vs2015`
- Windows: Install Windows Build Tools - `yarn install -g windows-build-tools --vs2015`
- Linux: Install dependencies - `sudo apt install build-essential libnss3 libsecret-1-dev python rsync`
## Building
Before doing anything else, from the root of the project, run:
npm install
yarn install
Then you can test the various applications:
## Testing the desktop application
cd packages/app-desktop
npm start
yarn start
You can also run it under WSL 2. To do so, [follow these instructions](https://www.beekeeperstudio.io/blog/building-electron-windows-ubuntu-wsl2) to setup your environment.
## Testing the Terminal application
cd packages/app-cli
npm start
yarn start
## Testing the Mobile application
@ -54,12 +54,12 @@ Then, for **Android**:
On **iOS**, open the file `ios/Joplin.xcworkspace` on XCode and run the app from there.
Normally the **bundler** should start automatically with the application. If it doesn't, run `npm start` from `packages/app-mobile`.
Normally the **bundler** should start automatically with the application. If it doesn't, run `yarn start` from `packages/app-mobile`.
## Building the clipper
cd packages/app-clipper/popup
npm run watch # To watch for changes
yarn 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/docs/extensions/mv3/getstarted/). Please note that the extension in dev mode will only connect to a dev instance of the desktop app (and vice-versa).
@ -67,23 +67,15 @@ To test the extension please refer to the relevant pages for each browser: [Fire
To make changes to the application, you'll need to rebuild any TypeScript file you've changed. The simplest way to do this is to watch for changes from the root of the project. Simply run this command, and it should take care of the rest:
npm run watch
yarn run watch
Running `npm run tsc` would have the same effect, but without watching.
Running `yarn run tsc` would have the same effect, but without watching.
## Running an application with additional parameters
You can specify additional parameters when running the desktop or CLI application. To do so, add `--` to the `npm start` command, followed by your flags. For example:
You can specify additional parameters when running the desktop or CLI application. To do so, add `--` to the `yarn start` command, followed by your flags. For example:
npm start -- --debug
## Adding a new dependency
Since Joplin uses Lerna, adding a new dependency should not be done using `npm i -s ...`. Instead you should use the `lerna add` command, which will take care of adding the package while handling the linked packages correctly. For example, to add the package "leftpad" to the "app-desktop" sub-package, you would run:
npx lerna add leftpad --scope=@joplin/app-desktop
Note that you should most likely always specify a scope because otherwise it will add the package to all the sub-packages.
yarn start -- --debug
## TypeScript
@ -95,14 +87,14 @@ If you'd like to auto-reload the desktop app on changes rather than having to qu
```sh
cd packages/app-desktop
watchman-make -p '**/*.js' '**/*.jsx' --run "npm start"
watchman-make -p '**/*.js' '**/*.jsx' --run "yarn start"
```
It still requires you to quit the application each time you want it to rebuild, but at least you don't have to re-run `"npm start"` each time. Here's what the workflow loop looks like in practice:
It still requires you to quit the application each time you want it to rebuild, but at least you don't have to re-run `"yarn start"` each time. Here's what the workflow loop looks like in practice:
1. Edit and save files in your text editor.
2. Switch to the Electron app and <kbd>cmd</kbd>+<kbd>Q</kbd> to quit it.
3. `watchman` immediately restarts the app for you (whereas usually you'd have to switch back to the terminal, type `"npm start"`, and hit enter).
3. `watchman` immediately restarts the app for you (whereas usually you'd have to switch back to the terminal, type `"yarn start"`, and hit enter).
# Troubleshooting

View File

@ -44,7 +44,7 @@ Building the apps is relatively easy - please [see the build instructions](https
## Coding style
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.
Coding style is enforced by a pre-commit hook that runs eslint. This hook is installed whenever running `yarn 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 `yarn 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.
@ -61,26 +61,26 @@ When submitting a pull request for a new feature or a bug fix, please add automa
The tests are under packages/app-cli/tests. To get them running, you first need to build the CLI app:
```sh
npm install
yarn install
cd packages/app-cli
```
To run all the test units:
```sh
npm test
yarn test
```
To run just one particular file:
```sh
npm test -- --filter=markdownUtils # Don't add the .js extension
yarn test -- --filter=markdownUtils # Don't add the .js extension
```
To filter tests. For example, to run all the test units that contain "should handle conflict" in their description:
```sh
npm test -- --filter="should handle conflict"
yarn test -- --filter="should handle conflict"
```
## About abandoned pull requests

View File

@ -6,7 +6,7 @@ Various scripts are provided to deploy the Joplin applications, scripts and tool
Before new releases are created, all version numbers must be updated. This is done using the `setupNewRelease` script and passing it the new major.minor version number. For example:
npm run setupNewRelease -- 1.8
yarn run setupNewRelease -- 1.8
Patch numbers are going to be incremented automatically when releasing each individual package.
@ -14,13 +14,13 @@ Patch numbers are going to be incremented automatically when releasing each indi
The desktop application is built for Windows, macOS and Linux via continuous integration, by pushing a version tag to GitHub. The process is automated using:
npm run releaseDesktop
yarn run releaseDesktop
## Android application
The app is built and upload to GitHub using:
npm run releaseAndroid -- --type=prerelease
yarn run releaseAndroid -- --type=prerelease
The "type" parameter can be either "release" or "prerelease"
@ -32,7 +32,7 @@ It must be built and released manually using XCode.
Unlike the mobile or desktop application, the CLI app doesn't bundle its dependencies and is always installed from source. For that reason, all its `@joplin` dependencies must be deployed publicly first. This is done using:
npm run publishAll
yarn run publishAll
This is going to publish all the Joplin libraries, such as `@joplin/lib`, `@joplin/tools`, etc.
@ -52,26 +52,26 @@ Then in `app-cli/package.json`, all `@joplin` dependencies and devdependencies m
Finally, to release the actual app, run:
npm run releaseCli
yarn run releaseCli
## Joplin Server
Run:
npm run releaseServer
yarn run releaseServer
## Web clipper
Run:
npm run releaseClipper
yarn run releaseClipper
## Plugin generator
First the types should generally be updated, using `./updateTypes.sh`. Then run:
npm run releasePluginGenerator
yarn run releasePluginGenerator
## Plugin Repo Cli
Since it has dependencies to the `@joplin` packages, it is released when running `npm run publishAll`
Since it has dependencies to the `@joplin` packages, it is released when running `yarn run publishAll`

View File

@ -1,5 +1,3 @@
# https://versatile.nl/blog/deploying-lerna-web-apps-with-docker
FROM node:16-bullseye
RUN apt-get update \
@ -7,8 +5,12 @@ RUN apt-get update \
python \
&& rm -rf /var/lib/apt/lists/*
# Enables Yarn
RUN corepack enable
RUN echo "Node: $(node --version)"
RUN echo "Npm: $(npm --version)"
RUN echo "Yarn: $(yarn --version)"
ARG user=joplin
@ -26,7 +28,11 @@ RUN mkdir /home/$user/logs
# this point)
COPY --chown=$user:$user package*.json ./
RUN npm install --ignore-scripts
COPY --chown=$user:$user .yarn ./.yarn
COPY --chown=$user:$user .yarnrc.yml .
COPY --chown=$user:$user yarn.lock .
RUN yarn install --inline-builds --mode=skip-build
# To take advantage of the Docker cache, we first copy all the package.json
# and package-lock.json files, as they rarely change, and then bootstrap
@ -40,11 +46,11 @@ RUN npm install --ignore-scripts
# prevent certain sub-packages, such as sqlite3, from being built
COPY --chown=$user:$user packages/fork-sax/package*.json ./packages/fork-sax/
COPY --chown=$user:$user packages/fork-uslug/package*.json ./packages/fork-uslug/
COPY --chown=$user:$user packages/htmlpack/package*.json ./packages/htmlpack/
COPY --chown=$user:$user packages/renderer/package*.json ./packages/renderer/
COPY --chown=$user:$user packages/tools/package*.json ./packages/tools/
COPY --chown=$user:$user packages/lib/package*.json ./packages/lib/
COPY --chown=$user:$user lerna.json .
COPY --chown=$user:$user tsconfig.json .
# The following have postinstall scripts so we need to copy all the files.
@ -53,20 +59,16 @@ COPY --chown=$user:$user tsconfig.json .
COPY --chown=$user:$user packages/turndown ./packages/turndown
COPY --chown=$user:$user packages/turndown-plugin-gfm ./packages/turndown-plugin-gfm
COPY --chown=$user:$user packages/fork-htmlparser2 ./packages/fork-htmlparser2
COPY --chown=$user:$user packages/server/package*.json ./packages/server/
# Then bootstrap only, without compiling the TypeScript files
RUN npm run bootstrap
# We have a separate step for the server files because they are more likely to
# change.
COPY --chown=$user:$user packages/server/package*.json ./packages/server/
RUN npm run bootstrapServerOnly
RUN yarn install --inline-builds --mode=skip-build
# Now copy the source files. Put lib and server last as they are more likely to change.
COPY --chown=$user:$user packages/fork-sax ./packages/fork-sax
COPY --chown=$user:$user packages/fork-uslug ./packages/fork-uslug
COPY --chown=$user:$user packages/htmlpack ./packages/htmlpack
COPY --chown=$user:$user packages/renderer ./packages/renderer
COPY --chown=$user:$user packages/tools ./packages/tools
@ -75,12 +77,12 @@ COPY --chown=$user:$user packages/server ./packages/server
# Finally build everything, in particular the TypeScript files.
RUN npm run build
RUN yarn run build
ENV RUNNING_IN_DOCKER=1
EXPOSE ${APP_PORT}
CMD [ "npm", "--prefix", "packages/server", "start" ]
CMD [ "yarn", "--prefix", "packages/server", "start" ]
# Build-time metadata
# https://github.com/opencontainers/image-spec/blob/master/annotations.md

View File

@ -1,5 +1,5 @@
# For development this compose file starts the database only. The app can then
# be started using `npm run start-dev`, which is useful for development, because
# be started using `yarn run start-dev`, which is useful for development, because
# it means the app Docker file doesn't have to be rebuilt on each change.
version: '3'

View File

@ -6,6 +6,7 @@
],
"settings": {
"files.exclude": {
".yarn": true,
"lerna-debug.log": true,
"_mydocs/mdtest/": true,
"./packages/lib/plugin_types": true,

View File

@ -11,7 +11,7 @@ module.exports = {
//
// '**/*.ts?(x)': () => 'npm run tsc',
'*.{js,jsx,ts,tsx}': [
'npm run linter-precommit',
'yarn run linter-precommit',
'git add',
],
};

33138
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,37 @@
{
"name": "root",
"private": true,
"workspaces": [
"packages/*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/laurent22/joplin.git"
},
"engines": {
"node": ">=16"
},
"scripts": {
"audit": "lerna-audit",
"bootstrap": "lerna bootstrap --force-local --no-ci",
"bootstrapServerOnly": "lerna bootstrap --force-local --no-ci --include-dependents --include-dependencies --scope @joplin/server",
"build": "lerna run build && npm run tsc",
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
"build": "yarn workspaces foreach --verbose --interlaced --parallel run build && yarn run tsc",
"buildApiDoc": "yarn workspace joplin start apidoc ../../readme/api/references/rest_api.md",
"buildCommandIndex": "gulp buildCommandIndex",
"updateMarkdownDoc": "node ./packages/tools/updateMarkdownDoc",
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out ../joplin-website/docs/api/references/plugin_api packages/lib/services/plugins/api/",
"buildSettingJsonSchema": "npm start --prefix=packages/app-cli -- settingschema ../../../joplin-website/docs/schema/settings.json",
"buildTranslations": "npm run tsc && node packages/tools/build-translation.js",
"updateMarkdownDoc": "node ./packages/tools/updateMarkdownDoc",
"buildSettingJsonSchema": "yarn workspace joplin start -- settingschema ../../../joplin-website/docs/schema/settings.json",
"buildTranslations": "yarn run tsc && node packages/tools/build-translation.js",
"buildTranslationsNoTsc": "node packages/tools/build-translation.js",
"buildWebsite": "node ./packages/tools/website/build.js && npm run buildPluginDoc && npm run buildSettingJsonSchema",
"buildWebsite": "node ./packages/tools/website/build.js && yarn run buildPluginDoc && yarn run buildSettingJsonSchema",
"circularDependencyCheck": "madge --warning --circular --extensions js ./",
"clean": "lerna clean -y && lerna run clean",
"clean": "npm run clean --workspaces --if-present && node packages/tools/clean && yarn cache clean",
"dependencyTree": "madge",
"generateDatabaseTypes": "node packages/tools/generate-database-types",
"linkChecker": "linkchecker https://joplinapp.org",
"linter-ci": "eslint --resolve-plugins-relative-to . --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter-precommit": "eslint --resolve-plugins-relative-to . --fix --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter": "eslint --resolve-plugins-relative-to . --fix --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"postinstall": "npm run bootstrap --no-ci && npm run build",
"publishAll": "git pull && npm run build && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll",
"releaseAndroid": "npm run build && export PATH=\"/usr/local/opt/openjdk@11/bin:$PATH\" && node packages/tools/release-android.js",
"postinstall": "yarn run build",
"publishAll": "git pull && yarn run build && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll",
"releaseAndroid": "yarn run build && export PATH=\"/usr/local/opt/openjdk@11/bin:$PATH\" && node packages/tools/release-android.js",
"releaseAndroidClean": "node packages/tools/release-android.js",
"releaseCli": "node packages/tools/release-cli.js",
"releaseClipper": "node packages/tools/release-clipper.js",
@ -39,14 +42,13 @@
"tagServerLatest": "node packages/tools/tagServerLatest.js",
"buildServerDocker": "node packages/tools/buildServerDocker.js",
"setupNewRelease": "node ./packages/tools/setupNewRelease",
"test-ci": "lerna run test-ci --stream",
"test": "lerna run test --stream",
"tsc": "lerna run tsc --stream --parallel",
"test-ci": "yarn workspaces foreach --parallel --verbose --interlaced run test-ci",
"test": "yarn workspaces foreach --parallel --verbose --interlaced run test",
"tsc": "yarn workspaces foreach --parallel --verbose --interlaced run tsc",
"updateIgnored": "gulp updateIgnoredTypeScriptBuild",
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
"watch": "lerna run watch --stream --parallel",
"watchWebsite": "nodemon --verbose --watch Assets/WebsiteAssets --watch packages/tools/website/build.js --ext md,ts,js,mustache,css,tsx,gif,png,svg --exec \"node packages/tools/website/build.js && http-server --port 8077 ../joplin-website/docs -a localhost\"",
"i": "node packages/tools/lernaInstall"
"watch": "yarn workspaces foreach --parallel --verbose --interlaced run watch",
"watchWebsite": "nodemon --verbose --watch Assets/WebsiteAssets --watch packages/tools/website/build.js --ext md,ts,js,mustache,css,tsx,gif,png,svg --exec \"node packages/tools/website/build.js && http-server --port 8077 ../joplin-website/docs -a localhost\""
},
"husky": {
"hooks": {
@ -65,14 +67,15 @@
"gulp": "^4.0.2",
"husky": "^3.0.2",
"lerna": "^3.22.1",
"lerna-audit": "^1.3.2",
"lint-staged": "^9.2.1",
"madge": "^4.0.2",
"typedoc": "^0.17.8",
"typescript": "^4.0.5"
"typescript": "4.0.5"
},
"dependencies": {
"http-server": "^0.12.3",
"node-gyp": "^8.4.1",
"nodemon": "^2.0.9"
}
},
"packageManager": "yarn@3.1.1"
}

View File

@ -1,11 +1,11 @@
import * as vm from 'vm';
import Plugin from '@joplin/lib/services/plugins/Plugin';
import sandboxProxy from '@joplin/lib/services/plugins/sandboxProxy';
import BasePluginRunner from '@joplin/lib/services/plugins/BasePluginRunner';
import executeSandboxCall from '@joplin/lib/services/plugins/utils/executeSandboxCall';
import Global from '@joplin/lib/services/plugins/api/Global';
import mapEventHandlersToIds, { EventHandlers } from '@joplin/lib/services/plugins/utils/mapEventHandlersToIds';
import uuid from '@joplin/lib/uuid';
const sandboxProxy = require('@joplin/lib/services/plugins/sandboxProxy');
function createConsoleWrapper(pluginId: string) {
const wrapper: any = {};

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -e
npm run build && NODE_PATH=build node build/build-doc.js
yarn run build && NODE_PATH=build node build/build-doc.js

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -e
npm run build && NODE_PATH="build/" node build/cli-integration-tests.js
yarn run build && NODE_PATH="build/" node build/cli-integration-tests.js

View File

@ -2,7 +2,7 @@
# Start the server with:
#
# JOPLIN_IS_TESTING=1 npm run start-dev
# JOPLIN_IS_TESTING=1 yarn run start-dev
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
@ -48,5 +48,5 @@ while [ "$NUM" -lt 400 ]; do
echo "config sync.10.password hunter1hunter2hunter3" >> "$CMD_FILE"
echo "sync" >> "$CMD_FILE"
npm start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
yarn start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
done

View File

@ -1,4 +1,4 @@
#!/bin/bash
#
set -e
npm run build && NODE_PATH="build/" node build/fuzzing.js
yarn run build && NODE_PATH="build/" node build/fuzzing.js

View File

@ -14,7 +14,7 @@ tasks.prepareBuild = {
await utils.copyFile(`${__dirname}/package.json`, `${buildDir}/package.json`);
await utils.setPackagePrivateField(`${buildDir}/package.json`, false);
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`);
fs.chmodSync(`${buildDir}/main.js`, 0o755);

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,8 @@
"build": "gulp build",
"start": "gulp build -L && node \"build/main.js\" --stack-trace-enabled --log-level debug --env dev",
"start-no-build": "node \"build/main.js\" --stack-trace-enabled --log-level debug --env dev",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json"
"tsc": "tsc --project tsconfig.json",
"watch": "tsc --watch --project tsconfig.json"
},
"bugs": {
"url": "https://github.com/laurent22/joplin/issues"
@ -34,9 +34,7 @@
"owner": "Laurent Cozic"
},
"version": "2.6.2",
"bin": {
"joplin": "./main.js"
},
"bin": "./main.js",
"engines": {
"node": ">=10.0.0"
},
@ -61,9 +59,9 @@
"sqlite3": "^5.0.2",
"string-padding": "^1.0.2",
"strip-ansi": "^4.0.0",
"tcp-port-used": "^0.1.2",
"tcp-port-used": "^1.0.2",
"terminal-kit": "^1.30.0",
"tkwidgets": "^0.5.26",
"tkwidgets": "0.5.27",
"url-parse": "^1.4.7",
"word-wrap": "^1.2.3",
"yargs-parser": "^7.0.0"

View File

@ -1,4 +1,4 @@
import sandboxProxy, { Target } from '@joplin/lib/services/plugins/sandboxProxy';
const sandboxProxy = require('@joplin/lib/services/plugins/sandboxProxy');
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
describe('services_plugins_sandboxProxy', function() {
@ -17,7 +17,7 @@ describe('services_plugins_sandboxProxy', function() {
const results: Result[] = [];
const target: Target = (path: string, args: any[]) => {
const target: any = (path: string, args: any[]) => {
results.push({ path, args });
};
@ -40,7 +40,7 @@ describe('services_plugins_sandboxProxy', function() {
const results: Result[] = [];
const target: Target = (path: string, args: any[]) => {
const target: any = (path: string, args: any[]) => {
results.push({ path, args });
};

View File

@ -4,4 +4,4 @@
# - Run the below command
# - Then the file /manifests.json also needs to be updated with the new manifest file
npm run dist && cp publish/org.joplinapp.plugins.RegisterCommandDemo.jpl ~/src/joplin-plugins-test/plugins/org.joplinapp.plugins.RegisterCommandDemo/plugin.jpl && cp publish/org.joplinapp.plugins.RegisterCommandDemo.json ~/src/joplin-plugins-test/plugins/org.joplinapp.plugins.RegisterCommandDemo/plugin.json
yarn run dist && cp publish/org.joplinapp.plugins.RegisterCommandDemo.jpl ~/src/joplin-plugins-test/plugins/org.joplinapp.plugins.RegisterCommandDemo/plugin.jpl && cp publish/org.joplinapp.plugins.RegisterCommandDemo.json ~/src/joplin-plugins-test/plugins/org.joplinapp.plugins.RegisterCommandDemo/plugin.json

View File

@ -1,7 +1,7 @@
import joplin from 'api';
import { ToolbarButtonLocation } from 'api/types';
const uslug = require('uslug');
const uslug = require('@joplin/fork-uslug');
// From https://stackoverflow.com/a/6234804/561309
function escapeHtml(unsafe:string) {

View File

@ -52,7 +52,7 @@ do
done
cd "$ROOT_DIR/packages/app-cli"
npm start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
npm start -- --profile "$PROFILE_DIR" import ~/Desktop/Joplin_17_06_2021.jex
# npm start -- --profile "$PROFILE_DIR" import ~/Desktop/Tout_18_06_2021.jex
npm start -- --profile "$PROFILE_DIR" sync --use-lock 1
yarn start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
yarn start -- --profile "$PROFILE_DIR" import ~/Desktop/Joplin_17_06_2021.jex
# yarn start -- --profile "$PROFILE_DIR" import ~/Desktop/Tout_18_06_2021.jex
yarn start -- --profile "$PROFILE_DIR" sync --use-lock 1

View File

@ -6,7 +6,7 @@
// - Run the Postgres database -- `sudo docker-compose --file docker-compose.db-dev.yml up`
// - Update the DB parameters in ~/joplin-credentials/server.env to use the dev
// database
// - Run the server - `JOPLIN_IS_TESTING=1 npm run start-dev`
// - Run the server - `JOPLIN_IS_TESTING=1 yarn run start-dev`
// - Then run this script - `node populateDatabase.js`
//
// Currently it doesn't actually create the users, so that should be done using:
@ -64,7 +64,7 @@ const processUser = async (userNum: number) => {
await chdir(cliDir);
await execCommand2(['npm', 'run', 'start-no-build', '--', '--profile', profileDir, 'batch', commandFile]);
await execCommand2(['yarn', 'run', 'start-no-build', '--', '--profile', profileDir, 'batch', commandFile]);
} catch (error) {
console.error(`Could not process user ${userNum}:`, error);
} finally {
@ -88,7 +88,7 @@ const main = async () => {
// Build the app once before starting, because we'll use start-no-build to
// run the scripts (faster)
await execCommand2(['npm', 'run', 'build']);
await execCommand2(['yarn', 'run', 'build']);
const focusUserNum = 0;

View File

@ -1,5 +0,0 @@
{
"name": "joplin-webclipper",
"version": "1.0.8",
"lockfileVersion": 1
}

View File

@ -11,3 +11,4 @@ gui/NoteEditor/NoteBody/TinyMCE/supportedLocales.js
runForSharingCommands-*
runForTestingCommands-*
style.min.css
build/lib/

View File

@ -0,0 +1 @@
nodeLinker: node-modules

View File

@ -97,7 +97,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
}
screenFromName(screenName: string) {
if (screenName === 'encryption') return <EncryptionConfigScreen themeId={this.props.themeId}/>;
if (screenName === 'encryption') return <EncryptionConfigScreen/>;
if (screenName === 'server') return <ClipperConfigScreen themeId={this.props.themeId}/>;
if (screenName === 'keymap') return <KeymapConfigScreen themeId={this.props.themeId}/>;

View File

@ -55,7 +55,7 @@ export interface PluginItem {
hasBeenUpdated: boolean;
}
const CellRoot = styled.div`
const CellRoot = styled.div<{isCompatible: boolean}>`
display: flex;
box-sizing: border-box;
background-color: ${props => props.theme.backgroundColor};
@ -104,7 +104,7 @@ const DevModeLabel = styled.div`
color: ${props => props.theme.color};
`;
const StyledNameAndVersion = styled.div`
const StyledNameAndVersion = styled.div<{mb: any}>`
font-family: ${props => props.theme.fontFamily};
color: ${props => props.theme.color};
font-size: ${props => props.theme.fontSize}px;

View File

@ -27,7 +27,7 @@ const Root = styled.div`
flex-direction: column;
`;
const UserPluginsRoot = styled.div`
const UserPluginsRoot = styled.div<any>`
${space}
display: flex;
flex-wrap: wrap;
@ -37,7 +37,7 @@ const ToolsButton = styled(Button)`
margin-right: 6px;
`;
const RepoApiErrorMessage = styled(StyledMessage)`
const RepoApiErrorMessage = styled(StyledMessage)<any>`
max-width: ${props => props.maxWidth}px;
margin-bottom: 10px;
`;

View File

@ -1,6 +1,6 @@
import styled from 'styled-components';
const Root = styled.div`
const Root = styled.div<any>`
display: flex;
justify-content: ${props => props.justifyContent ? props.justifyContent : 'center'};
font-family: ${props => props.theme.fontFamily};

View File

@ -29,7 +29,7 @@ export const IconSelector = (props: Props) => {
await loadScript({
id: 'emoji-button-lib',
src: 'node_modules/@joeattardi/emoji-button/dist/index.js',
src: 'build/lib/@joeattardi/emoji-button/dist/index.js',
attrs: {
type: 'module',
},

View File

@ -1,2 +1,2 @@
import { EmojiButton } from '../../node_modules/@joeattardi/emoji-button/dist/index.js';
import { EmojiButton } from '../../build/lib/@joeattardi/emoji-button/dist/index.js';
window.EmojiButton = EmojiButton;

View File

@ -832,7 +832,9 @@ class MainScreenComponent extends React.Component<Props, State> {
{this.renderPluginDialogs()}
{noteContentPropertiesDialogOptions.visible && <NoteContentPropertiesDialog markupLanguage={noteContentPropertiesDialogOptions.markupLanguage} themeId={this.props.themeId} onClose={this.noteContentPropertiesDialog_close} text={noteContentPropertiesDialogOptions.text}/>}
{notePropertiesDialogOptions.visible && <NotePropertiesDialog themeId={this.props.themeId} noteId={notePropertiesDialogOptions.noteId} onClose={this.notePropertiesDialog_close} onRevisionLinkClick={notePropertiesDialogOptions.onRevisionLinkClick} />}
{/* @ts-ignore */}
{shareNoteDialogOptions.visible && <ShareNoteDialog themeId={this.props.themeId} noteIds={shareNoteDialogOptions.noteIds} onClose={this.shareNoteDialog_close} />}
{/* @ts-ignore */}
{shareFolderDialogOptions.visible && <ShareFolderDialog themeId={this.props.themeId} folderId={shareFolderDialogOptions.folderId} onClose={this.shareFolderDialog_close} />}
<PromptDialog autocomplete={promptOptions && 'autocomplete' in promptOptions ? promptOptions.autocomplete : null} defaultValue={promptOptions && promptOptions.value ? promptOptions.value : ''} themeId={this.props.themeId} style={styles.prompt} onClose={this.promptOnClose_} label={promptOptions ? promptOptions.label : ''} description={promptOptions ? promptOptions.description : null} visible={!!this.state.promptOptions} buttons={promptOptions && 'buttons' in promptOptions ? promptOptions.buttons : null} inputType={promptOptions && 'inputType' in promptOptions ? promptOptions.inputType : null} />

View File

@ -336,7 +336,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
async function loadScripts() {
const scriptsToLoad: {src: string; id: string; loaded: boolean}[] = [
{
src: 'node_modules/codemirror/addon/dialog/dialog.css',
src: 'build/lib/codemirror/addon/dialog/dialog.css',
id: 'codemirrorDialogStyle',
loaded: false,
},
@ -351,7 +351,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
if (theme.indexOf('solarized') >= 0) theme = 'solarized';
scriptsToLoad.push({
src: `node_modules/codemirror/theme/${theme}.css`,
src: `build/lib/codemirror/theme/${theme}.css`,
id: `codemirrorTheme${theme}`,
loaded: false,
});

View File

@ -320,7 +320,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
async function loadScripts() {
const scriptsToLoad: any[] = [
{
src: 'node_modules/tinymce/tinymce.min.js',
src: 'build/lib/tinymce/tinymce.min.js',
id: 'tinyMceScript',
loaded: false,
},
@ -571,7 +571,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
statusbar: false,
target_list: false,
table_resize_bars: false,
language: ['en_US', 'en_GB'].includes(language) ? undefined : language,
language_url: ['en_US', 'en_GB'].includes(language) ? undefined : `build/lib/tinymce/langs/${language}`,
toolbar: toolbar.join(' '),
localization_function: _,
contextmenu: false,
@ -708,7 +708,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
}
const cssFiles = [
'node_modules/@fortawesome/fontawesome-free/css/all.min.css',
'build/lib/@fortawesome/fontawesome-free/css/all.min.css',
`gui/note-viewer/pluginAssets/highlight.js/${theme.codeThemeCss}`,
].concat(
pluginAssets

View File

@ -4,7 +4,7 @@ import styled from 'styled-components';
// Need to use `attrs` otherwise styled-components creates many instances of the
// style when the component is resized.
// https://github.com/styled-components/styled-components/issues/1212
export const StyledWrapperRoot = styled.div.attrs((props: any) => ({
export const StyledWrapperRoot: any = styled.div.attrs((props: any) => ({
style: {
width: props.size.width,
height: props.size.height,

View File

@ -82,11 +82,11 @@ const GlobalStyle = createGlobalStyle`
box-sizing: border-box;
}
/*
div, span, a {
/*color: ${(props: any) => props.theme.color};*/
/*font-size: ${(props: any) => props.theme.fontSize}px;*/
font-family: ${(props: any) => props.theme.fontFamily};
}
*/
`;
let wcsTimeoutId_: any = null;

View File

@ -46,7 +46,7 @@ const StyledAddRecipient = styled.div`
margin-bottom: 1em;
`;
const StyledRecipient = styled(StyledMessage)`
const StyledRecipient = styled(StyledMessage)<any>`
display: flex;
flex-direction: row;
padding: .6em 1em;
@ -80,7 +80,7 @@ const StyledError = styled(StyledMessage)`
margin-bottom: 1em;
`;
const StyledShareState = styled(StyledMessage)`
const StyledShareState = styled(StyledMessage)<any>`
word-break: break-all;
margin-bottom: 1em;
`;

View File

@ -24,7 +24,7 @@ const StyledRoot = styled.div`
max-width: 1200px;
`;
const SyncTargetDescription = styled.div`
const SyncTargetDescription = styled.div<{height: number}>`
${props => props.height ? `height: ${props.height}px` : ''};
margin-bottom: 1.3em;
line-height: ${props => props.theme.lineHeight};
@ -69,7 +69,7 @@ const SyncTargetLogo = styled.img`
margin-right: 0.4em;
`;
const SyncTargetBox = styled.div`
const SyncTargetBox = styled.div<{faded: boolean}>`
display: flex;
flex: 1;
flex-direction: column;
@ -96,7 +96,7 @@ const FeatureIcon = styled.i`
position: absolute;
`;
const FeatureLine = styled.div`
const FeatureLine = styled.div<{enabled: boolean}>`
margin-bottom: .5em;
opacity: ${props => props.enabled ? 1 : 0.5};
position: relative;

View File

@ -430,7 +430,7 @@
setMarkers(markLoader_.whenDone.keywords, markLoader_.whenDone.options);
};
script.src = '../../node_modules/mark.js/dist/mark.min.js';
script.src = '../../build/lib/mark.js/dist/mark.min.js';
document.getElementById('joplin-container-markScriptContainer').appendChild(script);
} else if (markLoader_.state === 'ready') {
setMarkers(keywords, options);

View File

@ -1,6 +1,6 @@
import styled from 'styled-components';
const StyledMessage = styled.div`
const StyledMessage = styled.div<{type: string}>`
border-radius: 3px;
background-color: ${props => props.type === 'error' ? props.theme.warningBackgroundColor : 'transparent'};
font-size: ${props => props.theme.fontSize}px;

View File

@ -15,8 +15,8 @@ const tasks = {
copyPluginAssets: {
fn: require('./tools/copyPluginAssets.js'),
},
copyTinyMceLangs: {
fn: require('./tools/copyTinyMceLangs.js'),
copyApplicationAssets: {
fn: require('./tools/copyApplicationAssets.js'),
},
electronRebuild: {
fn: require('./tools/electronRebuild.js'),
@ -40,7 +40,7 @@ const buildParallel = [
'compileScripts',
'compilePackageInfo',
'copyPluginAssets',
'copyTinyMceLangs',
'copyApplicationAssets',
'updateIgnoredTypeScriptBuild',
'buildCommandIndex',
'compileSass',

View File

@ -10,11 +10,11 @@
<title>Joplin</title>
<link rel="stylesheet" href="style.min.css">
<link rel="stylesheet" href="style/icons/style.css">
<link rel="stylesheet" href="node_modules/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="node_modules/react-datetime/css/react-datetime.css">
<link rel="stylesheet" href="node_modules/smalltalk/css/smalltalk.css">
<link rel="stylesheet" href="node_modules/roboto-fontface/css/roboto/roboto-fontface.css">
<link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="build/lib/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="build/lib/react-datetime/css/react-datetime.css">
<link rel="stylesheet" href="build/lib/smalltalk/css/smalltalk.css">
<link rel="stylesheet" href="build/lib/roboto-fontface/css/roboto/roboto-fontface.css">
<link rel="stylesheet" href="build/lib/codemirror/lib/codemirror.css">
<style>
.smalltalk {

View File

@ -23,11 +23,6 @@ module.exports = {
// The directory where Jest should output its coverage files
// coverageDirectory: undefined,
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
@ -63,11 +58,6 @@ module.exports = {
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
@ -148,11 +138,6 @@ module.exports = {
'**/*.test.js',
],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
@ -171,12 +156,6 @@ module.exports = {
// A map from regular expressions to paths to transformers
// transform: undefined,
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

View File

@ -154,6 +154,10 @@ body, button {
font-size: 16px;
}
div, span, a {
font-family: Roboto;
}
h2 {
font-size: 24px;

File diff suppressed because it is too large Load Diff

View File

@ -5,15 +5,15 @@
"main": "main.js",
"private": true,
"scripts": {
"dist": "npm run electronRebuild && npx electron-builder",
"dist": "yarn run electronRebuild && npx electron-builder",
"build": "gulp build",
"postinstall": "npm run build",
"postinstall": "yarn run build",
"electronRebuild": "gulp electronRebuild",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",
"tsc": "tsc --project tsconfig.json",
"watch": "tsc --watch --project tsconfig.json",
"start": "gulp build && electron . --env dev --log-level debug --no-welcome --open-dev-tools",
"test": "jest",
"test-ci": "npm run test"
"test-ci": "yarn test"
},
"repository": {
"type": "git",
@ -31,7 +31,8 @@
"afterSign": "./tools/notarizeMacApp.js",
"extraResources": [
"build/icons/*",
"build/images/*"
"build/images/*",
"build/lib/*"
],
"afterAllArtifactBuild": "./generateSha512.js",
"asar": true,
@ -110,13 +111,13 @@
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"@types/react": "16.9.55",
"@types/react-redux": "^7.1.9",
"@types/styled-components": "^5.1.4",
"@types/react-redux": "7.1.9",
"@types/styled-components": "5.1.4",
"ajv": "^6.5.0",
"app-builder-bin": "^1.9.11",
"babel-cli": "^6.26.0",
"babel-preset-react": "^6.24.1",
"electron": "^14.1.0",
"electron": "14.1.0",
"electron-builder": "^22.11.7",
"electron-notarize": "^1.0.0",
"electron-rebuild": "^3.2.3",
@ -126,7 +127,7 @@
"js-sha512": "^0.8.0",
"nan": "2.14.2",
"react-test-renderer": "^16.14.0",
"typescript": "^4.0.5"
"typescript": "4.0.5"
},
"optionalDependencies": {
"7zip-bin-linux": "^1.0.1",
@ -162,17 +163,17 @@
"react": "16.13.1",
"react-datetime": "^2.14.0",
"react-dom": "16.9.0",
"react-redux": "^5.0.7",
"react-redux": "5.0.7",
"react-select": "^2.4.3",
"react-toggle-button": "^2.2.0",
"react-tooltip": "^3.10.0",
"redux": "^3.7.2",
"redux": "3.7.2",
"reselect": "^4.0.0",
"roboto-fontface": "^0.10.0",
"smalltalk": "^2.5.1",
"sqlite3": "^5.0.2",
"styled-components": "^5.1.1",
"styled-system": "^5.1.5",
"styled-components": "5.1.1",
"styled-system": "5.1.5",
"taboverride": "^4.0.3",
"tinymce": "^5.2.0"
}

View File

@ -101,11 +101,11 @@ do
done
cd "$ROOT_DIR/packages/app-cli"
npm start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
yarn start -- --profile "$PROFILE_DIR" batch "$CMD_FILE"
if [[ $COMMANDS != "" ]]; then
exit 0
fi
cd "$ROOT_DIR/packages/app-desktop"
npm start -- --profile "$PROFILE_DIR"
yarn start -- --profile "$PROFILE_DIR"

View File

@ -28,13 +28,13 @@ export interface Props {
onReady?: Function;
}
const StyledFrame = styled.iframe`
const StyledFrame = styled.iframe<{fitToContent: boolean; borderBottom: boolean}>`
padding: 0;
margin: 0;
width: ${(props: any) => props.fitToContent ? `${props.width}px` : '100%'};
height: ${(props: any) => props.fitToContent ? `${props.height}px` : '100%'};
border: none;
border-bottom: ${(props: Props) => props.borderBottom ? `1px solid ${props.theme.dividerColor}` : 'none'};
border-bottom: ${(props: any) => props.borderBottom ? `1px solid ${props.theme.dividerColor}` : 'none'};
`;
function serializeForm(form: any) {

View File

@ -4,8 +4,8 @@
<meta charset="UTF-8">
<script src="UserWebviewIndex.js"></script>
<link rel="stylesheet" href="../../style/icons/style.css">
<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="../../node_modules/roboto-fontface/css/roboto/roboto-fontface.css">
<link rel="stylesheet" href="../../build/lib/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="../../build/lib/roboto-fontface/css/roboto/roboto-fontface.css">
<style>
html {
overflow: hidden;

View File

@ -1,6 +1,6 @@
(function(globalObject) {
// TODO: Not sure if that will work once packaged in Electron
const sandboxProxy = require('../../node_modules/@joplin/lib/services/plugins/sandboxProxy.js').default;
const sandboxProxy = require('../../build/lib/@joplin/lib/services/plugins/sandboxProxy.js');
const ipcRenderer = require('electron').ipcRenderer;
const ipcRendererSend = (message, args) => {

View File

@ -4,5 +4,5 @@
# It could be used to develop plugins too.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PLUGIN_PATH="$SCRIPT_DIR/../app-cli/tests/support/plugins/load_css"
npm i --prefix="$PLUGIN_PATH" && npm start -- --dev-plugins "$PLUGIN_PATH"
PLUGIN_PATH="$SCRIPT_DIR/../app-cli/tests/support/plugins/toc"
yarn i --prefix="$PLUGIN_PATH" && yarn start -- --dev-plugins "$PLUGIN_PATH"

View File

@ -1,7 +1,7 @@
const fs = require('fs-extra');
const spawnSync = require('child_process').spawnSync;
const { chdir } = require('process');
const babelPath = `${__dirname}/../node_modules/.bin/babel${process.platform === 'win32' ? '.cmd' : ''}`;
const basePath = `${__dirname}/../../..`;
function fileIsNewerThan(path1, path2) {
@ -14,6 +14,8 @@ function fileIsNewerThan(path1, path2) {
}
function convertJsx(path) {
chdir(`${__dirname}/..`);
fs.readdirSync(path).forEach((filename) => {
const jsxPath = `${path}/${filename}`;
const p = jsxPath.split('.');
@ -28,7 +30,7 @@ function convertJsx(path) {
if (fileIsNewerThan(jsxPath, jsPath)) {
console.info(`Compiling ${jsxPath}...`);
const result = spawnSync(babelPath, ['--presets', 'react', '--out-file', jsPath, jsxPath]);
const result = spawnSync('yarn', ['run', 'babel', '--presets', 'react', '--out-file', jsPath, jsxPath]);
if (result.status !== 0) {
const msg = [];
if (result.stdout) msg.push(result.stdout.toString());

View File

@ -0,0 +1,83 @@
const fs = require('fs-extra');
const glob = require('glob');
const { resolve } = require('path');
const { copyDir, dirname, copyFile, mkdir } = require('@joplin/tools/gulp/utils');
const nodeModulesDir = resolve(__dirname, '../node_modules');
async function main() {
const langSourceDir = resolve(__dirname, '../../../Assets/TinyMCE/langs');
const buildLibDir = resolve(__dirname, '../build/lib');
const dirs = [
'tinymce',
'@fortawesome/fontawesome-free/webfonts',
'roboto-fontface/fonts',
'codemirror/theme',
{
src: langSourceDir,
dest: `${buildLibDir}/tinymce/langs`,
},
];
const files = [
'@fortawesome/fontawesome-free/css/all.min.css',
'react-datetime/css/react-datetime.css',
'smalltalk/css/smalltalk.css',
'roboto-fontface/css/roboto/roboto-fontface.css',
'codemirror/lib/codemirror.css',
'codemirror/addon/dialog/dialog.css',
'@joeattardi/emoji-button/dist/index.js',
'mark.js/dist/mark.min.js',
{
src: resolve(__dirname, '../../lib/services/plugins/sandboxProxy.js'),
dest: `${buildLibDir}/@joplin/lib/services/plugins/sandboxProxy.js`,
},
];
for (const dir of dirs) {
let sourceDir, destDir;
if (typeof dir !== 'string') {
sourceDir = dir.src;
destDir = dir.dest;
} else {
sourceDir = `${nodeModulesDir}/${dir}`;
destDir = `${buildLibDir}/${dir}`;
}
console.info(`Copying ${sourceDir} => ${destDir}`);
await mkdir(destDir);
await copyDir(sourceDir, destDir);
}
for (const file of files) {
let sourceFile, destFile;
if (typeof file !== 'string') {
sourceFile = file.src;
destFile = file.dest;
} else {
sourceFile = `${nodeModulesDir}/${file}`;
destFile = `${buildLibDir}/${file}`;
}
await mkdir(dirname(destFile));
console.info(`Copying ${sourceFile} => ${destFile}`);
await copyFile(sourceFile, destFile);
}
const supportedLocales = glob.sync(`${langSourceDir}/*.js`).map(s => {
s = s.split('/');
s = s[s.length - 1];
s = s.split('.');
return s[0];
});
const content = `module.exports = ${JSON.stringify(supportedLocales, null, 2)}`;
await fs.writeFile(`${__dirname}/../gui/NoteEditor/NoteBody/TinyMCE/supportedLocales.js`, content, 'utf8');
}
module.exports = main;

View File

@ -2,7 +2,7 @@ const utils = require('@joplin/tools/gulp/utils');
async function main() {
const rootDir = `${__dirname}/..`;
// TODO: should take from node_modules/@joplin/renderer
const sourceDir = `${rootDir}/../../packages/renderer/assets`;
const destDirs = [
`${rootDir}/gui/note-viewer/pluginAssets`,

View File

@ -1,23 +0,0 @@
const fs = require('fs-extra');
const glob = require('glob');
const utils = require('@joplin/tools/gulp/utils');
async function main() {
const sourceDir = `${__dirname}/../../../Assets/TinyMCE/langs`;
const destDir = `${__dirname}/../node_modules/tinymce/langs`;
console.info(`Copying ${sourceDir} => ${destDir}`);
await utils.copyDir(sourceDir, destDir);
const supportedLocales = glob.sync(`${sourceDir}/*.js`).map(s => {
s = s.split('/');
s = s[s.length - 1];
s = s.split('.');
return s[0];
});
const content = `module.exports = ${JSON.stringify(supportedLocales, null, 2)}`;
await fs.writeFile(`${__dirname}/../gui/NoteEditor/NoteBody/TinyMCE/supportedLocales.js`, content, 'utf8');
}
module.exports = main;

View File

@ -30,8 +30,8 @@ async function main() {
// console.warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
// return;
let exePath = `${__dirname}/../node_modules/.bin/electron-rebuild`;
if (isWindows()) exePath += '.cmd';
// let exePath = `${__dirname}/../node_modules/.bin/electron-rebuild`;
// if (isWindows()) exePath += '.cmd';
process.chdir(`${__dirname}/..`);
@ -44,10 +44,10 @@ async function main() {
if (isWindows()) {
// Cannot run this in parallel, or the 64-bit version might end up
// with 32-bit files and vice-versa
console.info(await execCommand([`"${exePath}"`, forceAbiArgs, '--arch ia32'].join(' ')));
console.info(await execCommand([`"${exePath}"`, forceAbiArgs, '--arch x64'].join(' ')));
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs, '--arch ia32'].join(' ')));
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs, '--arch x64'].join(' ')));
} else {
console.info(await execCommand([`"${exePath}"`, forceAbiArgs].join(' ')));
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs].join(' ')));
}
}

View File

@ -1,13 +0,0 @@
// const fs = require('fs');
// try {
// fs.unlinkSync(`${__dirname}/../node_modules/react`);
// } catch (error) {
// // ignore
// }
// try {
// fs.unlinkSync(`${__dirname}/../node_modules/react-dom`);
// } catch (error) {
// // ignore
// }

View File

@ -3,5 +3,5 @@ rmdir /s/q android\app\build
rmdir /s/q android\build
rmdir /s/q android\.gradle
rmdir /s/q node_modules
npm install
npm run start
yarn install
yarn run start

View File

@ -215,15 +215,15 @@ PODS:
- glog
- react-native-alarm-notification (1.0.5):
- React
- react-native-camera (3.40.0):
- react-native-camera (3.44.3):
- React-Core
- react-native-camera/RCT (= 3.40.0)
- react-native-camera/RN (= 3.40.0)
- react-native-camera/RCT (3.40.0):
- react-native-camera/RCT (= 3.44.3)
- react-native-camera/RN (= 3.44.3)
- react-native-camera/RCT (3.44.3):
- React-Core
- react-native-camera/RN (3.40.0):
- react-native-camera/RN (3.44.3):
- React-Core
- react-native-document-picker (4.0.0):
- react-native-document-picker (4.3.0):
- React-Core
- react-native-geolocation (2.0.2):
- React
@ -231,9 +231,9 @@ PODS:
- React-Core
- react-native-image-picker (2.3.4):
- React-Core
- react-native-image-resizer (1.3.0):
- react-native-image-resizer (1.4.5):
- React-Core
- react-native-netinfo (6.0.0):
- react-native-netinfo (6.2.1):
- React-Core
- react-native-rsa-native (2.0.4):
- React
@ -241,9 +241,9 @@ PODS:
- React
- react-native-sqlite-storage (5.0.0):
- React
- react-native-version-info (1.1.0):
- react-native-version-info (1.1.1):
- React-Core
- react-native-webview (10.9.2):
- react-native-webview (10.10.2):
- React-Core
- React-perflogger (0.66.1)
- React-RCTActionSheet (0.66.1):
@ -312,21 +312,21 @@ PODS:
- React-perflogger (= 0.66.1)
- rn-fetch-blob (0.12.0):
- React-Core
- RNCClipboard (1.5.0):
- RNCClipboard (1.5.1):
- React-Core
- RNCPushNotificationIOS (1.6.0):
- RNCPushNotificationIOS (1.10.1):
- React-Core
- RNDateTimePicker (3.0.3):
- RNDateTimePicker (3.5.2):
- React-Core
- RNFileViewer (2.1.4):
- React-Core
- RNFS (2.16.6):
- RNFS (2.18.0):
- React
- RNQuickAction (0.3.13):
- React
- RNSecureRandom (1.0.0-rc.0):
- RNSecureRandom (1.0.0):
- React
- RNShare (7.2.1):
- RNShare (7.3.2):
- React-Core
- RNVectorIcons (7.1.0):
- React
@ -529,18 +529,18 @@ SPEC CHECKSUMS:
React-jsinspector: 8c0517dee5e8c70cd6c3066f20213ff7ce54f176
React-logger: bfddd3418dc1d45b77b822958f3e31422e2c179b
react-native-alarm-notification: 4817a2a0d7cc2ed2acc97337ebcdf9ae2a69c9d5
react-native-camera: 35854c4f764a4a6cf61c1c3525888b92f0fe4b31
react-native-document-picker: 0bba80cc56caab1f67dbaa81ff557e3a9b7f2b9f
react-native-camera: b8cc03e2feec0c04403d0998e37cf519d8fd4c6f
react-native-document-picker: 20f652c2402d3ddc81f396d8167c3bd978add4a2
react-native-geolocation: c956aeb136625c23e0dce0467664af2c437888c9
react-native-get-random-values: 2c4ff6b44cb71291dabe9a8ae87d3877dcf387da
react-native-image-picker: c6d75c4ab2cf46f9289f341242b219cb3c1180d3
react-native-image-resizer: a79bcffdef1b52160ff91db0d6fa24816a4ff332
react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d
react-native-image-resizer: d9fb629a867335bdc13230ac2a58702bb8c8828f
react-native-netinfo: 3d3769f0d65de15c83a9bf1346f8be71de5a24bf
react-native-rsa-native: 1f6bba06dd02f0e652a66a384c75c270f7a0062f
react-native-slider: e99fc201cefe81270fc9d81714a7a0f5e566b168
react-native-sqlite-storage: 418ef4afc5e6df6ce3574c4617e5f0b65cffde55
react-native-version-info: 36490da17d2c6b5cc21321c70e433784dee7ed0b
react-native-webview: 4e96d493f9f90ba4f03b28933f30b2964df07e39
react-native-version-info: a106f23009ac0db4ee00de39574eb546682579b9
react-native-webview: 0aa2cde4ee7e3e1c5fffdf64dbce9c709aa18155
React-perflogger: fcac6090a80e3d967791b4c7f1b1a017f9d4a398
React-RCTActionSheet: caf5913d9f9e605f5467206cf9d1caa6d47d7ad6
React-RCTAnimation: 6539e3bf594f6a529cd861985ba6548286ae1ead
@ -554,14 +554,14 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 33a949a51bec5f8a3c9e8d8092deb259600d761e
ReactCommon: 620442811dc6f707b4bf5e3b27d4f19c12d5a821
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
RNCClipboard: c7abea1baea58adca5c1f29e56dd5261837b4892
RNCPushNotificationIOS: ec7ffe65c7b5097f8d287fd627e1c1674ea69cef
RNDateTimePicker: 6f62fd42ac8b58bcc30c43ac3620e5097e8a227f
RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495
RNCPushNotificationIOS: 87b8d16d3ede4532745e05b03c42cff33a36cc45
RNDateTimePicker: 7658208086d86d09e1627b5c34ba0cf237c60140
RNFileViewer: 83cc066ad795b1f986791d03b56fe0ee14b6a69f
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
RNFS: 3ab21fa6c56d65566d1fb26c2228e2b6132e5e32
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
RNSecureRandom: 1f19ad1492f7ed416b8fc79e92216a1f73f13a4c
RNShare: edd621a71124961e29a7ba43a84bd1c6f9980d88
RNSecureRandom: 0dcee021fdb3d50cd5cee5db0ebf583c42f5af0e
RNShare: d76b8c9c6e6ffb38fc18f40b4338c9d867592ed3
RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59
Yoga: 2b4a01651f42a32f82e6cef3830a3ba48088237f

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,8 @@
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",
"clean": "node tools/clean.js",
"buildInjectedJs": "gulp buildInjectedJs",
"watchInjectedJs": "nodemon --verbose --watch components/NoteEditor/CodeMirror.ts --exec \"npm run buildInjectedJs\"",
"postinstall": "jetify && npm run build"
"watchInjectedJs": "nodemon --verbose --watch components/NoteEditor/CodeMirror.ts --exec \"yarn run buildInjectedJs\"",
"postinstall": "jetify && yarn run build"
},
"dependencies": {
"@joplin/lib": "~2.6",

View File

@ -26,7 +26,8 @@ async function buildCodeMirrorBundle() {
const sourceFile = `${mobileDir}/components/NoteEditor/CodeMirror.ts`;
const fullBundleFile = `${mobileDir}/components/NoteEditor/CodeMirror.bundle.js`;
await execa('./node_modules/rollup/dist/bin/rollup', [
await execa('yarn', [
'run', 'rollup',
sourceFile,
'--name', 'codeMirrorBundle',
'-f', 'iife',
@ -35,7 +36,9 @@ async function buildCodeMirrorBundle() {
'-p', '@rollup/plugin-typescript',
]);
await execa('./node_modules/uglify-js/bin/uglifyjs', [
// await execa('./node_modules/uglify-js/bin/uglifyjs', [
await execa('yarn', [
'run', 'uglifyjs',
'--compress',
'-o', codeMirrorBundleFile,
fullBundleFile,
@ -45,7 +48,7 @@ async function buildCodeMirrorBundle() {
async function main() {
await fs.mkdirp(outputDir);
await buildCodeMirrorBundle();
await copyJs('webviewLib', `${mobileDir}/node_modules/@joplin/lib/renderers/webviewLib.js`);
await copyJs('webviewLib', `${mobileDir}/../lib/renderers/webviewLib.js`);
await copyJs('CodeMirror.bundle', `${mobileDir}/components/NoteEditor/CodeMirror.bundle.min.js`);
}

View File

@ -1,17 +1,19 @@
// We don't make that a gulp task because we might want to run it before
// gulp has been installed.
const fs = require('fs-extra');
const fs = require('fs');
async function main() {
function main() {
const mobileDir = `${__dirname}/..`;
await fs.remove(`${mobileDir}/android/.gradle`);
await fs.remove(`${mobileDir}/android/app/build`);
await fs.remove(`${mobileDir}/ios/Pods`);
fs.rmSync(`${mobileDir}/android/.gradle`, { recursive: true, force: true });
fs.rmSync(`${mobileDir}/android/app/build`, { recursive: true, force: true });
fs.rmSync(`${mobileDir}/ios/Pods`, { recursive: true, force: true });
console.info('To clean the Android build, in some rare cases you might also need to clear the cache in ~/.android and ~/.gradle');
}
main().catch((error) => {
try {
main();
} catch (error) {
console.error('Could not clean mobile app build', error);
process.exit(1);
});
}

View File

@ -47,7 +47,7 @@ async function main() {
await fs.mkdirp(outputDir);
const encodedFiles = [];
const sourceAssetDir = `${rootDir}/node_modules/@joplin/renderer/assets`;
const sourceAssetDir = `${rootDir}/../renderer/assets`;
const files = walk(sourceAssetDir);
for (const file of files) {

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
},
"dependencies": {
"domelementtype": "^2.0.1",
"domhandler": "^3.0.0",
"domhandler": "3.0.0",
"domutils": "^2.0.0",
"entities": "^2.0.0"
},
@ -55,7 +55,7 @@
"jest": "^26.6.3",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"typescript": "^3.5.3"
"typescript": "3.8.2"
},
"jest": {
"preset": "ts-jest",

View File

@ -1,4 +1,4 @@
import DomHandler, { DomHandlerOptions, Node, Element } from "domhandler";
import DomHandler, { DomHandlerOptions, Element } from "domhandler";
import * as DomUtils from "domutils";
import { Parser, ParserOptions } from "./Parser";
@ -147,16 +147,16 @@ export class FeedHandler extends DomHandler {
}
}
function getElements(what: string, where: Node | Node[]) {
function getElements(what: string, where: any) {
return DomUtils.getElementsByTagName(what, where, true);
}
function getOneElement(
what: string | ((name: string) => boolean),
where: Node | Node[]
where: any
) {
return DomUtils.getElementsByTagName(what, where, true, 1)[0];
}
function fetch(what: string, where: Node | Node[], recurse = false): string {
function fetch(what: string, where: any, recurse = false): string {
return DomUtils.getText(
DomUtils.getElementsByTagName(what, where, recurse, 1)
).trim();
@ -175,7 +175,7 @@ function addConditionally<T>(
obj: T,
prop: keyof T,
what: string,
where: Node | Node[],
where: any,
recurse = false
) {
const tmp = fetch(what, where, recurse);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
Copyright (c) 2012 Jeremy Selier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,51 @@
# Uslug.js
* * *
Modified for Joplin:
- Added support for emojis - "🐶🐶🐶🐱" => "dogdogdogcat"
* * *
Permissive slug generator that works with unicode.
We keep only characters from the categories Letter, Number and Separator (see [Unicode Categories](http://www.unicode.org/versions/Unicode6.0.0/ch04.pdf))
and the common [CJK Unified Ideographs](http://www.unicode.org/versions/Unicode6.0.0/ch12.pdf) as defined in the version 6.0.0 of the Unicode specification.
Inspired by [unicode-slugify](https://github.com/mozilla/unicode-slugify).
Note that this slug generator is different from [node-slug](https://github.com/dodo/node-slug) which focus on translating unicode characters to english or latin equivalent.
## Quick Examples
uslug('Быстрее и лучше!') // 'быстрее-и-лучше'
uslug('汉语/漢語') // '汉语漢語'
uslug('Y U NO', { lower: false })) // 'Y-U-NO'
uslug('Y U NO', { spaces: true })) // 'y u no'
uslug('Y-U|NO', { allowedChars: '|' })) // 'yu|no'
## Installation
npm install uslug
## Options
### uslug(string, options)
Generate a slug for the string passed.
__Arguments__
* string - The string you want to slugify.
* options - An optional object that can contain:
* allowedChars: a String of chars that you want to be whitelisted. Default: '-_~'.
* lower: a Boolean to force to lower case the slug. Default: true.
* spaces: a Boolean to allow spaces. Default: false.
## License
This project is distributed under the MIT License. See LICENSE file for more information.

View File

@ -0,0 +1 @@
module.exports = require('./lib/uslug');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
/*
* List of Unicode code that are flagged as separator.
*
* Contains Unicode code of:
* - Zs = Separator, space
* - Zl = Separator, line
* - Zp = Separator, paragraph
*
* This list has been computed from http://unicode.org/Public/UNIDATA/UnicodeData.txt
* curl -s http://unicode.org/Public/UNIDATA/UnicodeData.txt | grep -E ';Zs;|;Zl;|;Zp;' | cut -d \; -f 1 | xargs -I{} printf '%d, ' 0x{}
*
*/
exports.Z = [32, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];

View File

@ -0,0 +1,61 @@
(function() {
var L = require('./L').L,
N = require('./N').N,
Z = require('./Z').Z,
M = require('./M').M,
unorm = require('unorm');
var nodeEmoji = require('node-emoji')
var _unicodeCategory = function(code) {
if (~L.indexOf(code)) return 'L';
if (~N.indexOf(code)) return 'N';
if (~Z.indexOf(code)) return 'Z';
if (~M.indexOf(code)) return 'M';
return undefined;
};
module.exports = function(string, options) {
string = string || '';
options = options || {};
var allowedChars = options.allowedChars || '-_~';
var lower = typeof options.lower === 'boolean' ? options.lower : true;
var spaces = typeof options.spaces === 'boolean' ? options.spaces : false;
var rv = [];
var noEmojiString = nodeEmoji.unemojify(string);
var chars = unorm.nfkc(noEmojiString);
for(var i = 0; i < chars.length; i++) {
var c = chars[i];
var code = c.charCodeAt(0);
// Allow Common CJK Unified Ideographs
// See: http://www.unicode.org/versions/Unicode6.0.0/ch12.pdf - Table 12-2
if (0x4E00 <= code && code <= 0x9FFF) {
rv.push(c);
continue;
}
// Allow Hangul
if (0xAC00 <= code && code <= 0xD7A3) {
rv.push(c);
continue;
}
// Japanese ideographic punctuation
if ((0x3000 <= code && code <= 0x3002) || (0xFF01 <= code && code <= 0xFF02)) {
rv.push(' ');
}
if (allowedChars.indexOf(c) != -1) {
rv.push(c);
continue;
}
var val = _unicodeCategory(code);
if (val && ~'LNM'.indexOf(val)) rv.push(c);
if (val && ~'Z'.indexOf(val)) rv.push(' ');
}
var slug = rv.join('').replace(/^\s+|\s+$/g, '').replace(/\s+/g,' ');
if (!spaces) slug = slug.replace(/[\s\-]+/g,'-');
if (lower) slug = slug.toLowerCase();
return slug;
};
}());

View File

@ -0,0 +1,33 @@
{
"name": "@joplin/fork-uslug",
"version": "1.0.4",
"description": "A permissive slug generator that works with unicode.",
"author": "Jeremy Selier <jerem.selier@gmail.com>",
"publishConfig": {
"access": "public"
},
"dependencies": {
"node-emoji": "1.11.0",
"unorm": ">= 1.0.0"
},
"devDependencies": {
"should": ">= 0.2.1"
},
"repository": {
"type": "git",
"url": "http://github.com/jeremys/uslug.git"
},
"main": "./index",
"engines": {
"node": ">= 0.4.0"
},
"bugs": {
"url": "http://github.com/jeremys/uslug/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/jeremys/uslug/raw/master/LICENSE"
}
]
}

View File

@ -0,0 +1,44 @@
var should = require('should'),
uslug = require('../lib/uslug');
var word0 = 'Ελληνικά';
var word1 = [word0, word0].join('-');
var word2 = [word0, word0].join(' - ');
var tests = [
['', ''],
['The \u212B symbol invented by A. J. \u00C5ngstr\u00F6m (1814, L\u00F6gd\u00F6, \u2013 1874) denotes the length 10\u207B\u00B9\u2070 m.', 'the-å-symbol-invented-by-a-j-ångström-1814-lögdö-1874-denotes-the-length-1010-m'],
['Быстрее и лучше!', 'быстрее-и-лучше'],
['xx x - "#$@ x', 'xx-x-x'],
['Bän...g (bang)', 'bäng-bang'],
[word0, word0.toLowerCase()],
[word1, word1.toLowerCase()],
[word2, word1.toLowerCase()],
[' a ', 'a'],
['tags/', 'tags'],
['y_u_no', 'y_u_no'],
['el-ni\xf1o', 'el-ni\xf1o'],
['x荿', 'x荿'],
['ϧ΃蒬蓣', '\u03e7蒬蓣'],
['¿x', 'x'],
['汉语/漢語', '汉语漢語'],
['فار,سي', 'فارسي'],
['เแโ|ใไ', 'เแโใไ'],
['日本語ドキュメンテ(ーション)', '日本語ドキュメンテーション'],
['一二三四五六七八九十!。。。', '一二三四五六七八九十'],
['संसद में काम नहीं तो वेतन क्यों?', 'संसद-में-काम-नहीं-तो-वेतन-क्यों'],
['เร่งรัด \'ปรับเงินเดือนท้องถิ่น 1 ขั้น\' ตามมติ ครม.', 'เร่งรัด-ปรับเงินเดือนท้องถิ่น-1-ขั้น-ตามมติ-ครม'],
['オバマ大統領が病院爆撃の調査へ同意するように、協力してください!', 'オバマ大統領が病院爆撃の調査へ同意するように-協力してください'],
['일본정부 법무대신(法務大臣): 우리는 일본 입관법의 재검토를 요구한다!', '일본정부-법무대신法務大臣-우리는-일본-입관법의-재검토를-요구한다'],
['😁', 'grin'],
['😁a', 'grina'],
['🐶🐶🐶🐱', 'dogdogdogcat'],
];
for (var t in tests) {
var test = tests[t];
uslug(test[0]).should.equal(test[1]);
}
uslug('qbc,fe', { allowedChars: 'q' }).should.equal('qbcfe');

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
},
"scripts": {
"test": "jest",
"test-ci": "npm run test"
"test-ci": "yarn test"
},
"files": [
"generators"

View File

@ -12,7 +12,7 @@ CLI_DIR="$SCRIPT_DIR/../app-cli"
LIB_DIR="$SCRIPT_DIR/../lib"
cd "$LIB_DIR"
npm run generatePluginTypes
yarn run generatePluginTypes
cd "$SCRIPT_DIR"
rsync -a --delete "$LIB_DIR/plugin_types/services/plugins/api/" "$SCRIPT_DIR/generators/app/templates/api/"
@ -20,7 +20,7 @@ cp "$LIB_DIR/services/plugins/api/types.ts" "$SCRIPT_DIR/generators/app/template
cp "$SCRIPT_DIR/generators/app/templates/api_index.ts" "$SCRIPT_DIR/generators/app/templates/api/index.ts"
rm -f "$SCRIPT_DIR/generators/app/templates/api/types.d.ts"
npm link
yarn link
"$CLI_DIR/tests/support/plugins/updatePlugins.sh"

View File

@ -1,321 +0,0 @@
{
"name": "@joplin/htmlpack",
"version": "2.6.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@joplin/htmlpack",
"version": "2.6",
"license": "MIT",
"dependencies": {
"css": "^3.0.0",
"datauri": "^4.1.0",
"fs-extra": "^10.0.0",
"html-entities": "^1.2.1"
},
"devDependencies": {
"@types/fs-extra": "^9.0.6"
}
},
"../fork-htmlparser2": {
"name": "@joplin/fork-htmlparser2",
"version": "4.1.34",
"extraneous": true,
"license": "MIT",
"dependencies": {
"domelementtype": "^2.0.1",
"domhandler": "^3.0.0",
"domutils": "^2.0.0",
"entities": "^2.0.0",
"fs-extra": "^10.0.0"
},
"devDependencies": {
"@types/jest": "^25.1.3",
"@types/node": "^13.1.1",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"coveralls": "^3.0.1",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"jest": "^26.6.3",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"typescript": "^3.5.3"
}
},
"node_modules/@types/fs-extra": {
"version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
"integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "16.10.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.1.tgz",
"integrity": "sha512-4/Z9DMPKFexZj/Gn3LylFgamNKHm4K3QDi0gz9B26Uk0c8izYf97B5fxfpspMNkWlFupblKM/nV8+NA9Ffvr+w==",
"dev": true
},
"node_modules/atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"bin": {
"atob": "bin/atob.js"
},
"engines": {
"node": ">= 4.5.0"
}
},
"node_modules/css": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/css/-/css-3.0.0.tgz",
"integrity": "sha512-DG9pFfwOrzc+hawpmqX/dHYHJG+Bsdb0klhyi1sDneOgGOXy9wQIC8hzyVp1e4NRYDBdxcylvywPkkXCHAzTyQ==",
"dependencies": {
"inherits": "^2.0.4",
"source-map": "^0.6.1",
"source-map-resolve": "^0.6.0"
}
},
"node_modules/datauri": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/datauri/-/datauri-4.1.0.tgz",
"integrity": "sha512-y17kh32+I82G+ED9MNWFkZiP/Cq/vO1hN9+tSZsT9C9qn3NrvcBnh7crSepg0AQPge1hXx2Ca44s1FRdv0gFWA==",
"dependencies": {
"image-size": "1.0.0",
"mimer": "^2.0.2"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
"engines": {
"node": ">=0.10"
}
},
"node_modules/fs-extra": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/graceful-fs": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
},
"node_modules/html-entities": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.4.0.tgz",
"integrity": "sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA=="
},
"node_modules/image-size": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.0.tgz",
"integrity": "sha512-JLJ6OwBfO1KcA+TvJT+v8gbE6iWbj24LyDNFgFEN0lzegn6cC6a/p3NIDaepMsJjQjlUWqIC7wJv8lBFxPNjcw==",
"dependencies": {
"queue": "6.0.2"
},
"bin": {
"image-size": "bin/image-size.js"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/mimer": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/mimer/-/mimer-2.0.2.tgz",
"integrity": "sha512-izxvjsB7Ur5HrTbPu6VKTrzxSMBFBqyZQc6dWlZNQ4/wAvf886fD4lrjtFd8IQ8/WmZKdxKjUtqFFNaj3hQ52g==",
"bin": {
"mimer": "bin/mimer"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/queue": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
"dependencies": {
"inherits": "~2.0.3"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-resolve": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz",
"integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==",
"dependencies": {
"atob": "^2.1.2",
"decode-uri-component": "^0.2.0"
}
},
"node_modules/universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"engines": {
"node": ">= 10.0.0"
}
}
},
"dependencies": {
"@types/fs-extra": {
"version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
"integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/node": {
"version": "16.10.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.1.tgz",
"integrity": "sha512-4/Z9DMPKFexZj/Gn3LylFgamNKHm4K3QDi0gz9B26Uk0c8izYf97B5fxfpspMNkWlFupblKM/nV8+NA9Ffvr+w==",
"dev": true
},
"atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
},
"css": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/css/-/css-3.0.0.tgz",
"integrity": "sha512-DG9pFfwOrzc+hawpmqX/dHYHJG+Bsdb0klhyi1sDneOgGOXy9wQIC8hzyVp1e4NRYDBdxcylvywPkkXCHAzTyQ==",
"requires": {
"inherits": "^2.0.4",
"source-map": "^0.6.1",
"source-map-resolve": "^0.6.0"
}
},
"datauri": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/datauri/-/datauri-4.1.0.tgz",
"integrity": "sha512-y17kh32+I82G+ED9MNWFkZiP/Cq/vO1hN9+tSZsT9C9qn3NrvcBnh7crSepg0AQPge1hXx2Ca44s1FRdv0gFWA==",
"requires": {
"image-size": "1.0.0",
"mimer": "^2.0.2"
}
},
"decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
},
"fs-extra": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
}
},
"graceful-fs": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
},
"html-entities": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.4.0.tgz",
"integrity": "sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA=="
},
"image-size": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.0.tgz",
"integrity": "sha512-JLJ6OwBfO1KcA+TvJT+v8gbE6iWbj24LyDNFgFEN0lzegn6cC6a/p3NIDaepMsJjQjlUWqIC7wJv8lBFxPNjcw==",
"requires": {
"queue": "6.0.2"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
}
},
"mimer": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/mimer/-/mimer-2.0.2.tgz",
"integrity": "sha512-izxvjsB7Ur5HrTbPu6VKTrzxSMBFBqyZQc6dWlZNQ4/wAvf886fD4lrjtFd8IQ8/WmZKdxKjUtqFFNaj3hQ52g=="
},
"queue": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
"requires": {
"inherits": "~2.0.3"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
},
"source-map-resolve": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz",
"integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==",
"requires": {
"atob": "^2.1.2",
"decode-uri-component": "^0.2.0"
}
},
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,11 @@
"access": "public"
},
"scripts": {
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",
"generatePluginTypes": "rm -rf ./plugin_types && node node_modules/typescript/bin/tsc --declaration --declarationDir ./plugin_types --project tsconfig.json",
"tsc": "tsc --project tsconfig.json",
"watch": "tsc --watch --project tsconfig.json",
"generatePluginTypes": "rm -rf ./plugin_types && yarn run tsc --declaration --declarationDir ./plugin_types --project tsconfig.json",
"test": "jest --verbose=false",
"test-ci": "npm run test"
"test-ci": "yarn test"
},
"devDependencies": {
"@types/fs-extra": "^9.0.6",
@ -32,8 +32,9 @@
"@aws-sdk/s3-request-presigner": "^3.34.0",
"@joplin/fork-htmlparser2": "^4.1.39",
"@joplin/fork-sax": "^1.2.43",
"@joplin/htmlpack": "^2.6.1",
"@joplin/renderer": "^2.6.3",
"@joplin/fork-uslug": "^1.0.4",
"@joplin/htmlpack": "~2.6",
"@joplin/renderer": "~2.6",
"@joplin/turndown": "^4.0.61",
"@joplin/turndown-plugin-gfm": "^1.0.43",
"async-mutex": "^0.1.3",
@ -47,6 +48,7 @@
"diff-match-patch": "^1.0.4",
"es6-promise-pool": "^2.5.0",
"fast-deep-equal": "^3.1.3",
"fast-xml-parser": "3.21.1",
"follow-redirects": "^1.2.4",
"form-data": "^2.1.4",
"fs-extra": "^5.0.0",
@ -85,7 +87,6 @@
"tcp-port-used": "^0.1.2",
"uglifycss": "0.0.29",
"url-parse": "^1.4.7",
"uslug": "git+https://github.com/laurent22/uslug.git#emoji-support",
"uuid": "^3.0.1",
"valid-url": "^1.0.9",
"word-wrap": "^1.2.3",

View File

@ -10,7 +10,7 @@ import Logger from '../../Logger';
import RepositoryApi from './RepositoryApi';
import produce from 'immer';
const compareVersions = require('compare-versions');
const uslug = require('uslug');
const uslug = require('@joplin/fork-uslug');
const logger = Logger.create('PluginService');

View File

@ -1,9 +1,7 @@
export type Target = (name: string, args: any[])=> any;
const handler = {};
const handler: any = {};
handler.get = function(target: Target, prop: string) {
let t = target as any;
handler.get = function(target, prop) {
let t = target;
// There's probably a cleaner way to do this but not sure how. The idea is to keep
// track of the calling chain current state. So if the user call `joplin.something.test("bla")`
@ -19,7 +17,7 @@ handler.get = function(target: Target, prop: string) {
// and attach a custom "__joplinNamespace" property to it.
if (!t.__joplinNamespace) {
const originalTarget = t;
const newTarget: any = (name: string, args: any[]) => {
const newTarget = (name, args) => {
return originalTarget(name, args);
};
newTarget.__joplinNamespace = [prop];
@ -31,12 +29,12 @@ handler.get = function(target: Target, prop: string) {
return new Proxy(t, handler);
};
handler.apply = function(target: Target, _thisArg: any, argumentsList: any[]) {
const path = (target as any).__joplinNamespace.join('.');
(target as any).__joplinNamespace.pop();
handler.apply = function(target, _thisArg, argumentsList) {
const path = target.__joplinNamespace.join('.');
target.__joplinNamespace.pop();
return target(path, argumentsList);
};
export default function sandboxProxy(target: Target): any {
module.exports = function sandboxProxy(target) {
return new Proxy(target, handler);
}
};

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,7 @@
"version": "2.6.3",
"description": "",
"main": "index.js",
"bin": {
"plugin-repo-cli": "./index.js"
},
"bin": "./index.js",
"publishConfig": {
"access": "public"
},
@ -13,7 +11,7 @@
"tsc": "tsc --project tsconfig.json",
"watch": "tsc --watch --project tsconfig.json",
"test": "jest",
"test-ci": "npm run test",
"test-ci": "yarn test",
"start": "node index.js"
},
"author": "",
@ -31,7 +29,7 @@
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"jest": "^26.6.3",
"typescript": "^4.1.3"
"typescript": "4.1.3"
},
"gitHead": "eb4b0e64eab40a51b0895d3a40a9d8c3cb7b1b14"
}

View File

@ -6,6 +6,7 @@ import validateLinks from './MdToHtml/validateLinks';
import { ItemIdToUrlHandler } from './utils';
import { RenderResult, RenderResultPluginAsset } from './MarkupToHtml';
import { Options as NoteStyleOptions } from './noteStyle';
const hljs = require('highlight.js');
const MarkdownIt = require('markdown-it');
const md5 = require('md5');
@ -66,8 +67,7 @@ const rules: RendererRules = {
source_map: require('./MdToHtml/rules/source_map').default,
};
const hljs = require('highlight.js');
const uslug = require('uslug');
const uslug = require('@joplin/fork-uslug');
const markdownItAnchor = require('markdown-it-anchor');
// The keys must match the corresponding entry in Setting.js

File diff suppressed because it is too large Load Diff

View File

@ -10,10 +10,10 @@
},
"scripts": {
"buildAssets": "node Tools/buildAssets.js",
"tsc": "node node_modules/typescript/bin/tsc --project tsconfig.json",
"watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.json",
"tsc": "tsc --project tsconfig.json",
"watch": "tsc --watch --project tsconfig.json",
"test": "jest",
"test-ci": "npm run test"
"test-ci": "yarn test"
},
"author": "",
"license": "MIT",
@ -25,9 +25,10 @@
},
"dependencies": {
"@joplin/fork-htmlparser2": "^4.1.39",
"@joplin/fork-uslug": "^1.0.4",
"font-awesome-filetypes": "^2.1.0",
"fs-extra": "^8.1.0",
"highlight.js": "^11.2.0",
"highlight.js": "11.1.0",
"html-entities": "^1.2.1",
"json-stringify-safe": "^5.0.1",
"katex": "^0.13.3",
@ -45,8 +46,7 @@
"markdown-it-sup": "^1.0.0",
"markdown-it-toc-done-right": "^4.1.0",
"md5": "^2.2.1",
"mermaid": "^8.13.5",
"uslug": "git+https://github.com/laurent22/uslug.git#emoji-support"
"mermaid": "^8.13.5"
},
"gitHead": "eb4b0e64eab40a51b0895d3a40a9d8c3cb7b1b14"
}

View File

@ -3,9 +3,9 @@ set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
npm run buildAssets
npm version patch
npm publish
yarn run buildAssets
yarn version patch
yarn publish
NEW_VERSION=$(cat package.json | jq -r .version)
git add -A

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More