Skip to content

Commit

Permalink
Publish
Browse files Browse the repository at this point in the history
 - duoyun-ui@1.1.8
 - @mantou/gem@1.7.8
 - gem-analyzer@1.7.6
 - gem-book@1.5.24
 - gem-devtools@1.7.5
 - gem-examples@1.7.5
 - gem-port@0.0.6
  • Loading branch information
mantou132 committed Dec 30, 2023
1 parent adcdf6f commit b345cc5
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 31 deletions.
2 changes: 1 addition & 1 deletion packages/duoyun-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "duoyun-ui",
"version": "1.1.7",
"version": "1.1.8",
"description": "A lightweight desktop UI component library, implemented using Gem",
"keywords": [
"frontend",
Expand Down
4 changes: 2 additions & 2 deletions packages/gem-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gem-analyzer",
"version": "1.7.5",
"version": "1.7.6",
"description": "gem analyzer",
"main": "index.js",
"files": [
Expand All @@ -13,7 +13,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@mantou/gem": "^1.7.6"
"@mantou/gem": "^1.7.8"
},
"devDependencies": {
"@gemjs/config": "^1.6.11",
Expand Down
4 changes: 2 additions & 2 deletions packages/gem-book/docs/zh/002-guide/003-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ npx gem-book -h

#### `-d, --source-dir <dir>`

指定文档目录在 GitHub 中的位置,最终生成前往 GitHub 的链接。
指定文档目录在 GitHub 中的位置,最终生成前往 GitHub 的链接,默认使用当前命令指定目录

#### `-b, --source-branch <branch>`

指定文档的分支,最终生成前往 GitHub 的链接。

#### `--base <dir>`

指定项目的基础目录
指定项目的基础目录,默认会读取 `package.json``repository.directory` 字段。

#### `--github <url>`

Expand Down
6 changes: 3 additions & 3 deletions packages/gem-book/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gem-book",
"version": "1.5.23",
"version": "1.5.26",
"description": "Create your document website easily and quickly",
"keywords": [
"doc",
Expand Down Expand Up @@ -37,7 +37,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@mantou/gem": "^1.7.6",
"@mantou/gem": "^1.7.8",
"commander": "^7.2.0",
"copy-webpack-plugin": "^11.0.0",
"front-matter": "^4.0.2",
Expand Down Expand Up @@ -71,7 +71,7 @@
"@web/dev-server-esbuild": "^0.2.16",
"@web/test-runner": "^0.13.22",
"esbuild": "^0.14.14",
"gem-analyzer": "^1.7.5",
"gem-analyzer": "^1.7.6",
"nodemon": "^2.0.7",
"ts-morph": "^13.0.0",
"webpack-cli": "^5.1.4",
Expand Down
1 change: 1 addition & 0 deletions packages/gem-book/src/bin/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export function startBuilder(dir: string, options: Required<CliUniqueConfig>, bo

if (stats.hasErrors()) {
console.error(info.errors);

Check warning on line 152 in packages/gem-book/src/bin/builder.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
process.exit(1);
}

if (stats.hasWarnings()) {
Expand Down
13 changes: 12 additions & 1 deletion packages/gem-book/src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ function readConfig(configPath: string) {
}
}
});
obj.nav = obj.nav?.filter((e) => {
if (e.title?.toLowerCase() === 'github') {
bookConfig.github = e.link;
} else {
return true;
}
});
Object.assign(bookConfig, obj);
}

Expand Down Expand Up @@ -276,7 +283,11 @@ program
bookConfig.nav ||= [];
const [title, link] = item.split(',');
if (!link) throw new Error('nav options error');
bookConfig.nav.push({ title, link });
if (title.toLowerCase() === 'github') {
bookConfig.github = link;
} else {
bookConfig.nav.push({ title, link });
}
})
.option('--plugin <name or path>', 'load plugin', (name: string) => {
cliConfig.plugin.push(name);
Expand Down
25 changes: 15 additions & 10 deletions packages/gem-book/src/element/elements/edit-link.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { html, GemElement, customElement, history, connectStore } from '@mantou/gem';
import { html, GemElement, customElement, connectStore } from '@mantou/gem';
import { mediaQuery } from '@mantou/gem/helper/mediaquery';

import { getGithubPath } from '../lib/utils';
import { selfI18n } from '../helper/i18n';
import { bookStore } from '../store';
import { bookStore, locationStore } from '../store';

import { icons } from './icons';

Expand All @@ -26,6 +26,7 @@ const fetchData = async (api: string) => {

@customElement('gem-book-edit-link')
@connectStore(selfI18n.store)
@connectStore(locationStore)
export class EditLink extends GemElement<State> {
state = {
lastUpdated: '',
Expand All @@ -50,7 +51,7 @@ export class EditLink extends GemElement<State> {

#getMdFullPath = () => {
const link = bookStore.getCurrentLink?.();
if (!link) return;
if (!link) return '';
return getGithubPath(link.originLink);
};

Expand All @@ -59,8 +60,7 @@ export class EditLink extends GemElement<State> {
const { message, commitUrl } = this.state;
const { config } = bookStore;
const { github, sourceBranch = '' } = config || {};
const fullPath = this.#getMdFullPath();
if (!github || !sourceBranch || !fullPath) return;
if (!github || !sourceBranch || !this.#fullPath) return;
return html`
<style>
:host {
Expand Down Expand Up @@ -96,7 +96,7 @@ export class EditLink extends GemElement<State> {
}
}
</style>
<gem-link class="edit" href=${`${github}/edit/${sourceBranch}${fullPath}`}>
<gem-link class="edit" href=${`${github}/edit/${sourceBranch}${this.#fullPath}`}>
<gem-use .element=${icons.compose}></gem-use>
<span>${selfI18n.get('editOnGithub')}</span>
</gem-link>
Expand All @@ -110,17 +110,22 @@ export class EditLink extends GemElement<State> {
`;
}

#fullPath = '';

mounted() {
this.memo(() => {
this.#fullPath = this.#getMdFullPath();
});

this.effect(
async () => {
const { config } = bookStore;
const { github, sourceBranch = '' } = config || {};
if (!github) return;
const repo = new URL(github).pathname;
const path = this.#getMdFullPath();
if (!path) return;
if (!this.#fullPath) return;
const query = new URLSearchParams({
path,
path: this.#fullPath,
page: '1',
per_page: '1',
sha: sourceBranch,
Expand All @@ -138,7 +143,7 @@ export class EditLink extends GemElement<State> {
this.setState({ lastUpdated: '' });
}
},
() => [history.getParams().path],
() => [this.#fullPath],
);
}
}
10 changes: 6 additions & 4 deletions packages/gem-book/src/plugins/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type State = { elements?: ElementDetail[]; exports?: ExportDetail[]; error?: any

customElements.whenDefined('gem-book').then(() => {
const { GemBookPluginElement } = customElements.get('gem-book') as typeof GemBookElement;
const { Gem, config, theme } = GemBookPluginElement;
const { Gem, theme } = GemBookPluginElement;
const { html, customElement, attribute, numattribute, createCSSSheet, css, adoptedStyle } = Gem;
const MainElement = customElements.get('gem-book-main') as typeof Main;

Expand Down Expand Up @@ -53,9 +53,11 @@ customElements.whenDefined('gem-book').then(() => {
#parseFile = async (text: string) => {
const { Project } = (await import(/* webpackIgnore: true */ tsMorph)) as typeof import('ts-morph');
const { getElements, getExports } =
config.github === 'https://github.com/mantou132/gem'
? await import('gem-analyzer')
: ((await import(/* webpackIgnore: true */ gemAnalyzer)) as typeof import('gem-analyzer'));
// 如何在当前项目使用本地依赖?
// webpackIgnore.config.github === 'https://github.com/mantou132/gem'
// ? require('gem-analyzer')
// :
(await import(/* webpackIgnore: true */ gemAnalyzer)) as typeof import('gem-analyzer');
const project = new Project({ useInMemoryFileSystem: true });
const file = project.createSourceFile(this.src, text);
return { elements: getElements(file), exports: getExports(file) };
Expand Down
4 changes: 2 additions & 2 deletions packages/gem-devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gem-devtools",
"version": "1.7.4",
"version": "1.7.5",
"description": "Gem devtools",
"scripts": {
"update:version": "node ./scripts/update.js",
Expand All @@ -11,7 +11,7 @@
"start": "yarn build && concurrently -k npm:watch npm:browser"
},
"dependencies": {
"@mantou/gem": "^1.7.6",
"@mantou/gem": "^1.7.8",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/gem-examples/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"private": true,
"name": "gem-examples",
"version": "1.7.4",
"version": "1.7.5",
"description": "gem examples",
"scripts": {
"build": "vite build",
"start": "vite serve"
},
"dependencies": {
"@mantou/gem": "^1.7.6",
"duoyun-ui": "^1.1.7"
"@mantou/gem": "^1.7.8",
"duoyun-ui": "^1.1.8"
},
"devDependencies": {
"@gemjs/config": "^1.6.11",
Expand Down
4 changes: 2 additions & 2 deletions packages/gem-port/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gem-port",
"version": "0.0.5",
"version": "0.0.6",
"description": "Export React component",
"keywords": [
"gem",
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"@gemjs/config": "^1.6.11",
"commander": "^7.2.0",
"gem-analyzer": "^1.7.5",
"gem-analyzer": "^1.7.6",
"ts-morph": "^13.0.0",
"typescript": "^4.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/gem/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mantou/gem",
"version": "1.7.7",
"version": "1.7.8",
"description": "💎 使用自定义元素的轻量级 WebApp 开发框架",
"keywords": [
"frontend",
Expand Down

0 comments on commit b345cc5

Please sign in to comment.