Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo authored Jan 27, 2023
0 parents commit faa9e44
Show file tree
Hide file tree
Showing 48 changed files with 3,129 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.scss]
indent_size = 2

[*.js]
indent_size = 2

[*.jsx]
indent_size = 2

[*.ts]
indent_size = 2

[*.tsx]
indent_size = 2

[*.vue]
indent_size = 2

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: linonetwo # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['dun.mianbaoduo.com/@linonetwo'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release Plugins

on:
push:
tags:
- 'v*.*.*'
paths-ignore:
- 'README.md'
- 'docs/**'
- '.vscode'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
- '.vscode'

concurrency:
group: release-ci-group
cancel-in-progress: true

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

jobs:
Plugins:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- id: setPluginInfoJSON
run: |
content=`cat ./src/plugin.info`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# here we replace "title": "$:/plugins/linonetwo/tw-example-plugin", to "title": "linonetwo/tw-example-plugin",
# so it can be used in tiddly-gittly/tw5-plugin-packer to find output path
content="${content//$\:\/plugins\//}"
content="${content//$\:\/themes\//}"
# replace plugin-type with pluginType
content="${content//$'plugin-type'/'pluginType'}"
# end of optional handling for multi line json
echo "::set-output name=pluginInfoJSON::$content"
- name: Get npm cache directory
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-node-
- name: Install dependencies
run: npm i

- name: Make Plugins
run: npm run make
env:
CI: true
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# this should be the same as `scripts/run-action.mjs`
- uses: tiddly-gittly/[email protected]
with:
minify: 'true'
# here we read plugin author and name from pluginInfoJSON, and pluginInfoJSON is read in the step above with id `setPluginInfoJSON`
source: 'dist/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).pluginType}}s/${{fromJson(steps.setPluginInfoJSON.outputs.pluginInfoJSON).title}}'
output: 'dist/out'
uglifyjs-options: '{ "warnings": false, "ie8": false, "safari10": false }'
cleancss-options: '{ "compatibility": "*", "level": 2 }'

- name: Make Demo Site
run: npx zx ./scripts/build-demo-html.mjs

- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/out/*.json
dist/out/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: ./dist/output
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
108 changes: 108 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
public-dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
.DS_Store
tiddlers/$__StoryList.tid
tiddlers/$__language.tid
tiddlers/$__Import.tid
13 changes: 13 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
printWidth: 160,
arrowParens: 'always',
jsxBracketSameLine: true,
jsxSingleQuote: false,
quoteProps: 'as-needed',
bracketSpacing: true,
useTabs: false,
};
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 lin onetwo

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.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Wikitext plugin template for TiddlyWiki5

This template will help you automatically package zipped multiple-file plugin for nodejs wiki, and single file JSON plugin for HTML wiki.

## What need to change after apply the template

### Basic

1. update `title`, `author` and `description` in the [src/plugin.info](src/plugin.info).
2. write your plugin tiddlers in the [src/](src/) directory.
3. tid files just put in the src directory, they will be copy to the plugin automatically.
1. You can use folder to organize the files, like `src/filters/` to place the filter tiddlers, and that structure will be preserved in the nodejs multiple-file plugin
2. In the JSON plugin, the structure will strictly follow the tiddler title.
4. update demo site tiddlers in the [demo/](demo/) directory.
5. update this readme.md

### Examples

## Development

See [tiddly-gittly/Tiddlywiki-WikiText-Plugin-Template](https://github.com/tiddly-gittly/Tiddlywiki-WikiText-Plugin-Template) for detail.

There are some scripts you can run to boost your development.

After `npm i`:

- `npm run dev` to auto pack the plugin and run a demo site. Your change in the src directory will automatically refresh the site.
- `npm run dev-html` to see demo site with packed plugin after you finish your development, this can be your final check, this runs slower than `npm run dev`

### After the plugin is complete

#### Publish

Enable github action in your repo (in your github repo - setting - action - general) if it is not allowed, and when you tagging a new version `vx.x.x` in a git commit and push, it will automatically publish to the github release.

#### Demo

You will get a Github Pages demo site automatically after publish. If it is 404, you may need to manually enable Github Pages in your github repo:

Settings - Pages (on left side) - Build and deployment- Source - choose `"Github Actions"`

Next time you trigger a publish, the site will be updated. You can see the site link in Settings - Pages
8 changes: 8 additions & 0 deletions demo/tiddlers/$__DefaultTiddlers.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
created: 20220312163059497
creator: 林一二
modified: 20220312163109352
modifier: 林一二
title: $:/DefaultTiddlers
type: text/vnd.tiddlywiki

Index
4 changes: 4 additions & 0 deletions demo/tiddlers/$__SiteSubtitle.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/SiteSubtitle
type: text/vnd.tiddlywiki

A Plugin Demo
4 changes: 4 additions & 0 deletions demo/tiddlers/$__SiteTitle.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: $:/SiteTitle
type: text/vnd.tiddlywiki

Demo
1 change: 1 addition & 0 deletions demo/tiddlers/$__plugins_bimlas_kin-filter.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions demo/tiddlers/$__plugins_bimlas_kin-filter.json.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
author: bimlas
core-version: >=5.1.18
created: 20211017092822775
dependents:
description: Kin filter: Recursively looking for kinship between tiddler titles
list: README/syntax README/examples
modified: 20211017092822775
plugin-type: plugin
source: https://gitlab.com/bimlas/tw5-kin-filter
title: $:/plugins/bimlas/kin-filter
type: application/json
version: 1.0.0
Loading

0 comments on commit faa9e44

Please sign in to comment.