Skip to content

Commit

Permalink
finish tutorial!
Browse files Browse the repository at this point in the history
  • Loading branch information
Gk0Wk committed Jan 8, 2023
1 parent cf6fa63 commit f89633c
Show file tree
Hide file tree
Showing 29 changed files with 1,149 additions and 84 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,26 @@
</center>

[View Tutorials](https://tiddly-gittly.github.io/Modern.TiddlyDev/)

Modern.TiddlyDev is a one-click development environment for various TiddlyWiki plug-in developers built on a modern front-end technology stack, with the following features and functions:

* Compile, test and publish plug-ins with one click:
* Open the page server in development mode, which can be tested in the browser, automatically detect changes to the plug-in files and synchronize the plug-in content updates to the browser page, realizing the WYSIWYG of plug-in development;
* One-click plugin building and support for generating plugin repositories for use by your subscribers.
* Has a built-in GitHub Page publishing script that automatically publishes written plugin documentation pages and plugin repositories to the Internet;
* Built-in GitHub Release script, which releases the plugin according to the version specified by the git tag;
* Tailored for TypeScript plugin development, so it is now easy to use TypeScript development in TiddlyWiki:
* Multi-entry file compilation is supported, and various plugins can be easily written in TiddlyWiki;
* Support for `.ts`, `.tsx`, `.jsx`, `.mjs`, `.cjs` files compiled with the [tw-react](https://github.com/tiddly-gittly/tw-react) plugin for React development in TiddlyWiki;
* Use [tw5-typed](https://github.com/tiddly-gittly/TW5-Typed) to type annotate TiddlyWiki API to bring a native TypeScript experience to development;
* Use the full amount of ESLint and Prettier rules provided by [Modern.JS](https://modernjs.dev/) to normalize the code;
* Incremental project builds using the extremely fast [esbuild](https://esbuild.github.io/), which makes writing code a blast;
* Support for setting browser compatibility ranges for plugins using [browserslist](https://browsersl.ist/);
* Automatically generate sourcemap for source code (start by default when developing, specify to turn on when building), no need to worry about debugging!
* The possibility of introducing CSS, JSON, etc. into the script;
* Automatic volume compression of the plug-in (can be turned off);
* Automatic generation of hash-check signatures for the generated plug-ins;

Don't worry, even if you are not good at programming, it doesn't matter, Modern.TiddlyDev can be your development tool as well. No code plugin development can be an enjoyable development experience as well!

There's a lot of work here, but it's just Out-of-the-Box for you. Use it and get started on your modern TiddlyWiki plugin development journey!
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"dependencies": {
"npm-check-updates": "^16.6.2",
"tiddlywiki": "^5.2.5",
"tiddlywiki-plugin-dev": "^0.0.22"
"tiddlywiki-plugin-dev": "^0.0.23"
}
}
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified src/doc/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/doc/plugin.info
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"description": "Document of Modern.TiddlyDev",
"core-version": ">=5.1.0",
"plugin-type": "plugin",
"version": "2023.1.8",
"version": "2023.1.9",
"list": "readme tutorials"
}
45 changes: 42 additions & 3 deletions src/doc/readme.tid
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,52 @@ type: text/vnd.tiddlywiki

Change the language: {{$:/snippets/minilanguageswitcher}}

! Welcome to Modern.~TiddlyDev! 🎉
@@display:flex;align-items:center;justify-content:center;
! Welcome to <$text text="Modern.TiddlyDev" />! 🎉
@@

@@display:flex;align-items:center;justify-content:center;
<a href="https://github.com/tiddly-gittly/Modern.TiddlyDev">[img[https://img.shields.io/github/stars/tiddly-gittly/Modern.TiddlyDev?style=for-the-badge&color=red]]</a>&nbsp;&nbsp;
<a href="https://github.com/tiddly-gittly/Modern.TiddlyDev">[img[https://img.shields.io/github/forks/tiddly-gittly/Modern.TiddlyDev?style=for-the-badge]]</a>&nbsp;&nbsp;
<a href="https://github.com/tiddly-gittly/Modern.TiddlyDev">[img[https://img.shields.io/github/issues/tiddly-gittly/Modern.TiddlyDev?style=for-the-badge]]</a>&nbsp;&nbsp;
<a href="https://github.com/tiddly-gittly/Modern.TiddlyDev">[img[https://img.shields.io/github/watchers/tiddly-gittly/Modern.TiddlyDev?style=for-the-badge&color=blueviolet]]</a>
@@

@@display:flex;align-items:center;justify-content:center;
<a href="https://github.com/tiddly-gittly/Modern.TiddlyDev">[img[https://img.shields.io/github/license/tiddly-gittly/Modern.TiddlyDev?style=for-the-badge&label=LICENSE]]</a>&nbsp;&nbsp;
<a href="https://github.com/Gk0Wk">[img[https://img.shields.io/github/followers/Gk0Wk?style=for-the-badge&label=Gk0Wk&color=critical]]</a>
@@

<$text text="Modern.TiddlyDev" /> is a one-click development environment for various <$text text="TiddlyWiki" /> plug-in developers built on a modern front-end technology stack, with the following features and functions:

* Compile, test and publish plug-ins with one click:
** Open the page server in development mode, which can be tested in the browser, automatically detect changes to the plug-in files and synchronize the plug-in content updates to the browser page, realizing the WYSIWYG of plug-in development;
** One-click plugin building and support for generating plugin repositories for use by your subscribers.
** Has a built-in <$text text="GitHub" /> Page publishing script that automatically publishes written plugin documentation pages and plugin repositories to the Internet;
** Built-in <$text text="GitHub" /> Release script, which releases the plugin according to the version specified by the git tag;
* Tailored for <$text text="TypeScript" /> plugin development, so it is now easy to use <$text text="TypeScript" /> development in <$text text="TiddlyWiki" />:
** Multi-entry file compilation is supported, and various plugins can be easily written in <$text text="TiddlyWiki" />;
** Support for `.ts`, `.tsx`, `.jsx`, `.mjs`, `.cjs` files compiled with the [[tw-react|https://github.com/tiddly-gittly/tw-react]] plugin for React development in <$text text="TiddlyWiki" />;
** Use [[tw5-typed|https://github.com/tiddly-gittly/TW5-Typed]] to type annotate <$text text="TiddlyWiki API" /> to bring a native <$text text="TypeScript" /> experience to development;
** Use the full amount of ESLint and Prettier rules provided by [[Modern.JS|https://modernjs.dev/]] to normalize the code;
** Incremental project builds using the extremely fast [[esbuild|https://esbuild.github.io/]], which makes writing code a blast;
** Support for setting browser compatibility ranges for plugins using [[browserslist|https://browsersl.ist/]];
** Automatically generate sourcemap for source code (start by default when developing, specify to turn on when building), no need to worry about debugging!
** The possibility of introducing CSS, JSON, etc. into the script;
** Automatic volume compression of the plug-in (can be turned off);
** Automatic generation of hash-check signatures for the generated plug-ins;

Don't worry, even if you are not good at programming, it doesn't matter, <$text text="Modern.TiddlyDev" /> can be your development tool as well. No code plugin development can be an enjoyable development experience as well!

There's a lot of work here, but it's just Out-of-the-Box for you. Use it and get started on your modern <$text text="TiddlyWiki" /> plugin development journey!

> Taking advantage of the plugin builder, the framework's documentation is also packaged as a plugin and published in [[CPL Plugin Library|https://github.com/tiddly-gittly/TiddlyWiki-CPL]] so that you can download and install it in any project and keep the documentation up to date.

[![](https://img.shields.io/badge/Join-TiddlyWiki_CN-blue)](https://github.com/tiddly-gittly) ![GitHub](https://img.shields.io/github/license/tiddly-gittly/Modern.TiddlyDev) ![GitHub issues](https://img.shields.io/github/issues/tiddly-gittly/Modern.TiddlyDev) [![Sttot](https://img.shields.io/github/followers/Gk0Wk)](https://github.com/Gk0Wk)
Next, please click the [tutorials] tab above to enter the tutorial page. If you are seeing the plugin in the plugin library, please install it first or browse the [[official documentation|https://tiddly-gittly.github.io/Modern.TiddlyDev/]].

</$list>
</$list>

@@display:flex;align-items:center;justify-content:center;background:#1c1c1c;border-radius:10px;overflow:hidden;box-shadow:#000a 0 0 8px;
[img[$:/plugins/Modern.TiddlyDev/doc/wyswtg-demo.gif]]
[img[$:/plugins/Modern.TiddlyDev/doc/wysiwtg-demo.gif]]
@@
110 changes: 110 additions & 0 deletions src/doc/tutorials/en/001-beginning.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
title: $:/plugins/Modern.TiddlyDev/doc/tutorials/en/001-beginning
caption: Install & Basic Usage
authors: Sttot(Gk0Wk)
type: text/vnd.tiddlywiki

Before you officially start.

* You should be able to execute simple commands using the command line;
* You should have a code editing software instead of using notepad the whole time to develop plugins, VSCode is recommended and install plugins like <$text text="TiddlyWiki5" /> Syntax, ESLint Prettier, etc.;
* You should first have a brief knowledge of git (e.g. clone, pull, push, add, commit, etc.) and install the git command line software;
* You should sign up for a <$text text="GitHub" /> account if you need automated build functionality and code management;
* You should understand what npm is and have a good grasp of common npm commands (such as install, run, etc.) and install <$text text="NodeJS" /> software;
* You'd better ideally have some experience using <$text text="TiddlyWiki" />;
* You can go into technologies related to HTML, CSS, <$text text="JavaScript" /> and <$text text="TypeScript" />;

! Start with an empty template

First make sure you have git and <$text text="NodeJS" /> installed, then choose the path where you wish to create the project, determine the name of the project folder, and enter the following command at the command line:

```bash
npx tiddlywiki-plugin-dev@latest init <project-name>
```

You If you need a web proxy to speed things up, init has two additional parameters.

* `--repo <repo-url>` Proxy address for the <$text text="GitHub" /> repo;
* `--npm <npm-repo>` Speed up npm, e.g. `http://registry.npmmirror.com`;

<details>
<summary>Proxy example</summary>
<pre>npx tiddlywiki-plugin-dev@latest init --repo https://ghproxy.com/https://github.com/tiddly-gittly/Modern.TiddlyDev.git --npm http://registry.npmmirror.com project</pre>
</details>

The download of the template project and the installation of various tools will follow, so please wait a little. If you need to download the template project manually, [[you can find it here|https://github.com/tiddly-gittly/Modern.TiddlyDev/tree/template]].

Use your code editor to open this project folder, and you can officially enter the plugin development stage.

Note: Here you need to choose your package manager, if you are not sure what to choose, please choose npm. If you choose something other than npm, please replace any npm command in the following tutorial with the package manager you are using to execute.

! Experience the WYSIWYG development process

You should notice that there are already a lot of folders and files in this project, so here are some introductions:

* .git is a hidden folder that holds all kinds of information about this git project, so you won't be able to use git commands after deleting it;
* .github is a hidden folder that holds the CI/CD automation scripts for <$text text="GitHub" />;
* node_modules is the installation path for npm packages, which can be removed and reinstalled using npm install afterwards;
* src is the main directory for plugin development, where each folder contains a plugin;
* wiki is the wiki project presented in development mode and release mode, used for development testing, and documentation generation;
* .eslintignore .eslintrc.js and other hidden files, as well as package.json and tsconfig.json are the relevant configuration files for the project, so please do not modify them if you don't known what you are doing;

In src, there is already a `plugin-name` sample project for demo, you can start development by modifying this project or just delete it. Let's keep it and go directly into development mode to see the effect by typing this in the console:

```bash
npm run dev
```

If no errors are reported, the console will show a local URL (usually `http://127.0.0.1:8080`), and if you browse this URL with your browser, you will see a Wiki page, which will also show this tutorial first. Further inspection shows that this Wiki has the plugin `$:/plugins/your-name/plugin-name` installed.

This sample plugin implements a widget called `test` that displays a fixed line of text. We create a tiddler called Test in which we use this widget.

```
<$test />
```

Save to see the words `This is a widget!`.

Do not close your browser or development server, try to change the text in line 19 of `src/plugin-name/index.ts`, save it and you will see that the plugin is recompiled and the text in Test on the web page is changed:

[img[$:/plugins/Modern.TiddlyDev/doc/wysiwtg-demo.gif]]

Afterwards, press <kbd>ctrl</kbd> + <kbd>C</kbd> in the console to stop the server.

! Compiling the plugin

If you don't want to use <$text text="GitHub" /> for automated builds and releases, or just want to compile the plugin first, you can use the following command.

```bash
npm run build
```

After a short compilation process, the console will output something like this.

```
Minimized plugins
1.97 KiB $:/plugins/your-name/plugin-name
```

This means that this build compiles and packages a total of one plugin with a compressed size of 1.97KB, which can be found in the `dist` folder.

! Publishing

First, bind your git project using git remote (please Google for details).

After git push, an automated build of the <$text text="GitHub" /> project starts, and you can see the build details in Actions on the project home page.

Typically, the automated build will generate an online version of the wiki and a plugin repository with all the plugins in src, which you can publish to your plugin subscribers and they will get the latest plugin updates after each automated build.

If you also add a tag to your commit, and the tag is in a version format like `v1.2.3`, then the project will also automatically release the built plugin in your project's Release, [[like this|https://github.com/tiddly-gittly/Modern.TiddlyDev/ releases]].

! Update

The `tiddlywiki-plugin-dev` and `tw5-typed` in your project are updated frequently to fix bugs or to further enhance functionality. It is therefore recommended to update them every once in a while or when you encounter a bug, as follows.

Execute in networked state:

```bash
npm run update
```

After checking, follow its instructions to execute further commands, such as `npm install`.
Loading

0 comments on commit f89633c

Please sign in to comment.