zenn-cli-wysiwyg 0.0.4 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # zenn-cli-wysiwyg
2
2
 
3
- ローカルで Zenn の投稿コンテンツを管理/プレビューするための CLI です。
3
+ WYSIWYG エディタの機能が備わった zenn-cli です。
4
+ [zenn-editor](https://github.com/zenn-dev/zenn-editor) をフォークして開発しています。
4
5
 
5
6
  ## ユーザー向けドキュメント
6
7
 
@@ -226,7 +226,7 @@ PERFORMANCE OF THIS SOFTWARE.
226
226
  @media (max-width: 468px) {
227
227
  padding: 0 1rem;
228
228
  }
229
- `;function xf(e){M.useEffect(()=>{e&&(document.title=e)},[e])}const gW=()=>{const{data:e}=gi("/api/cli-version",{revalidateOnFocus:!1,revalidateOnReconnect:!1});return!e||e.updateAvailable===!1?null:O(EW,{className:"update-notification-bar",children:O(za,{children:ye("div",{className:"update-notification-bar__inner",children:[O("div",{className:"update-notification-bar__icon",children:"!"}),ye("div",{className:"update-notification-bar__text",children:["新しいバージョンがリリースされています。",O("code",{children:"npm install zenn-cli@latest"}),"で更新してください"]})]})})})},bW=_D`
229
+ `;function xf(e){M.useEffect(()=>{e&&(document.title=e)},[e])}const gW=()=>{const{data:e}=gi("/api/cli-version",{revalidateOnFocus:!1,revalidateOnReconnect:!1});return!e||e.updateAvailable===!1?null:O(EW,{className:"update-notification-bar",children:O(za,{children:ye("div",{className:"update-notification-bar__inner",children:[O("div",{className:"update-notification-bar__icon",children:"!"}),ye("div",{className:"update-notification-bar__text",children:["新しいバージョンがリリースされています。",O("code",{children:"npm install zenn-cli-wysiwyg@latest"}),"で更新してください"]})]})})})},bW=_D`
230
230
  from {
231
231
  opacity: 0;
232
232
  transform: translateY(-40px);
@@ -11,8 +11,8 @@
11
11
  <title>Zenn CLI</title>
12
12
 
13
13
  <!-- 埋め込み要素のイベントを処理するためのスクリプト -->
14
- <script src="https://embed.zenn.studio/js/listen-embed-event.js"></script>
15
- <script type="module" crossorigin src="/assets/index-f6a785bd.js"></script>
14
+ <script src="/js/listen-embed-event.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-1f4ab015.js"></script>
16
16
  <link rel="stylesheet" href="/assets/index-53781b61.css">
17
17
  </head>
18
18
 
@@ -13510,7 +13510,7 @@ var require_parse2 = __commonJS({
13510
13510
  try {
13511
13511
  parser.parse();
13512
13512
  } catch (e2) {
13513
- if (process.env.NODE_ENV !== "production") {
13513
+ if (false) {
13514
13514
  if (e2.name === "CssSyntaxError" && opts && opts.from) {
13515
13515
  if (/\.scss$/i.test(opts.from)) {
13516
13516
  e2.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
@@ -13806,7 +13806,7 @@ var require_lazy_result = __commonJS({
13806
13806
  error2.plugin = plugin.postcssPlugin;
13807
13807
  error2.setMessage();
13808
13808
  } else if (plugin.postcssVersion) {
13809
- if (process.env.NODE_ENV !== "production") {
13809
+ if (false) {
13810
13810
  let pluginName = plugin.postcssPlugin;
13811
13811
  let pluginVer = plugin.postcssVersion;
13812
13812
  let runtimeVer = this.result.processor.version;
@@ -13982,7 +13982,7 @@ var require_lazy_result = __commonJS({
13982
13982
  return this.result;
13983
13983
  }
13984
13984
  then(onFulfilled, onRejected) {
13985
- if (process.env.NODE_ENV !== "production") {
13985
+ if (false) {
13986
13986
  if (!("from" in this.opts)) {
13987
13987
  warnOnce(
13988
13988
  "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."
@@ -14190,7 +14190,7 @@ var require_no_work_result = __commonJS({
14190
14190
  return this.result;
14191
14191
  }
14192
14192
  then(onFulfilled, onRejected) {
14193
- if (process.env.NODE_ENV !== "production") {
14193
+ if (false) {
14194
14194
  if (!("from" in this._opts)) {
14195
14195
  warnOnce(
14196
14196
  "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."
@@ -14239,7 +14239,7 @@ var require_processor = __commonJS({
14239
14239
  } else if (typeof i2 === "function") {
14240
14240
  normalized.push(i2);
14241
14241
  } else if (typeof i2 === "object" && (i2.parse || i2.stringify)) {
14242
- if (process.env.NODE_ENV !== "production") {
14242
+ if (false) {
14243
14243
  throw new Error(
14244
14244
  "PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation."
14245
14245
  );
@@ -20245,130 +20245,23 @@ var import_crypto = __toESM(require("crypto"));
20245
20245
  var import_node_fetch = __toESM(require("node-fetch"));
20246
20246
  var cheerio = __toESM(require("cheerio"));
20247
20247
  var import_os = require("os");
20248
-
20249
- // package.json
20250
- var package_default = {
20251
- name: "zenn-cli-wysiwyg",
20252
- version: "0.0.3",
20253
- description: "Preview Zenn content locally with wysiwyg editor.",
20254
- repository: {
20255
- type: "git",
20256
- url: "https://github.com/karintou8710/zenn-editor-wysiwyg.git",
20257
- directory: "packages/zenn-cli-wysiwyg"
20258
- },
20259
- license: "MIT",
20260
- bin: {
20261
- zenn: "dist/server/zenn.js"
20262
- },
20263
- files: [
20264
- "dist"
20265
- ],
20266
- scripts: {
20267
- dev: "run-p dev:server dev:client",
20268
- "dev:client": "wait-on http://localhost:8000 && vite",
20269
- "dev:server": "nodemon -r dotenv/config ./src/server/zenn.ts",
20270
- clean: "rimraf dist/*",
20271
- build: "pnpm clean && run-p build:client build:server",
20272
- "build:client": "tsc --project tsconfig.client.json && vite build",
20273
- "build:server": "tsc --project tsconfig.server.json && tsup",
20274
- lint: "run-s lint:*",
20275
- "lint:eslint": "eslint 'src/**/*.{ts,tsx}'",
20276
- "lint:prettier": "prettier .",
20277
- "lint-strict": "run-s lint-strict:*",
20278
- "lint-strict:eslint": "eslint 'src/**/*.{ts,tsx}' --max-warnings 0",
20279
- "lint-strict:prettier": "prettier --check .",
20280
- fix: "run-s fix:*",
20281
- "fix:eslint": "eslint --fix 'src/**/*.{ts,tsx}'",
20282
- "fix:prettier": "prettier -w .",
20283
- test: "run-s test:client test:server",
20284
- "test:client": "vitest run --config vitest.client.config.ts",
20285
- "test:server": "vitest run --config vitest.server.config.ts",
20286
- "exec:zenn": "node ./dist/server/zenn.js"
20287
- },
20288
- dependencies: {
20289
- "@tiptap/pm": "^3.1.0",
20290
- "@tiptap/react": "^3.1.0",
20291
- arg: "^5.0.2",
20292
- boxen: "^6.2.1",
20293
- cheerio: "1.0.0-rc.12",
20294
- chokidar: "^4.0.3",
20295
- clsx: "^2.0.0",
20296
- colors: "1.4.0",
20297
- configstore: "^6.0.0",
20298
- "connect-history-api-fallback": "^2.0.0",
20299
- "emoji-regex": "^10.2.1",
20300
- express: "^4.18.2",
20301
- "fs-extra": "^11.1.0",
20302
- "gray-matter": "^4.0.3",
20303
- history: "^5.3.0",
20304
- "image-size": "^1.0.2",
20305
- "js-yaml": "^4.1.0",
20306
- "node-fetch": "^2.6.9",
20307
- open: "^8.4.1",
20308
- path: "^0.12.7",
20309
- react: "^18.2.0",
20310
- "react-dom": "^18.2.0",
20311
- "react-icons": "^4.7.1",
20312
- rocon: "^1.2.8",
20313
- "styled-components": "^5.3.6",
20314
- swr: "^1.3.0",
20315
- ws: "^8.12.1",
20316
- "zenn-wysiwyg-editor": "workspace:*"
20317
- },
20318
- devDependencies: {
20319
- "@types/configstore": "^6.0.0",
20320
- "@types/connect-history-api-fallback": "^1.3.5",
20321
- "@types/emoji-regex": "^9.2.0",
20322
- "@types/express": "^4.17.17",
20323
- "@types/fs-extra": "^11.0.1",
20324
- "@types/js-yaml": "^4.0.5",
20325
- "@types/node": "^22.13.0",
20326
- "@types/node-fetch": "^2.6.2",
20327
- "@types/react": "^18.0.28",
20328
- "@types/react-dom": "^18.0.11",
20329
- "@types/styled-components": "^5.1.26",
20330
- "@types/supertest": "^2.0.12",
20331
- "@types/ws": "^8.5.4",
20332
- "@typescript-eslint/eslint-plugin": "^5.52.0",
20333
- "@typescript-eslint/parser": "^5.52.0",
20334
- "@vitejs/plugin-react": "^3.1.0",
20335
- dotenv: "^16.0.3",
20336
- "esbuild-loader": "^3.0.1",
20337
- "esbuild-register": "^3.4.2",
20338
- eslint: "^8.34.0",
20339
- "eslint-config-prettier": "^8.6.0",
20340
- nodemon: "^2.0.20",
20341
- "npm-run-all": "^4.1.5",
20342
- rimraf: "^4.1.2",
20343
- supertest: "^6.3.3",
20344
- tsup: "^8.5.0",
20345
- typescript: "^5.9.2",
20346
- vite: "^4.2.1",
20347
- vitest: "^0.34.4",
20348
- "wait-on": "^7.0.1",
20349
- "zenn-content-css": "workspace:*",
20350
- "zenn-embed-elements": "workspace:*",
20351
- "zenn-markdown-html": "workspace:*",
20352
- "zenn-model": "workspace:*"
20353
- },
20354
- engines: {
20355
- node: ">=14.0.0"
20356
- },
20357
- publishConfig: {
20358
- access: "public"
20359
- },
20360
- gitHead: "4d1b8deae4a6f359c0e6b25bb74aebd69af93458"
20361
- };
20362
-
20363
- // src/server/lib/helper.ts
20364
20248
  function generateSlug() {
20365
20249
  return import_crypto.default.randomBytes(7).toString("hex");
20366
20250
  }
20251
+ function getPackageJson() {
20252
+ const packageJsonPath = true ? "../../package.json" : "../../../package.json";
20253
+ const packagePath = import_path.default.join(__dirname, packageJsonPath);
20254
+ const packageContent = import_fs_extra.default.readFileSync(packagePath, "utf8");
20255
+ return JSON.parse(packageContent);
20256
+ }
20367
20257
  function getCurrentCliVersion() {
20368
- return package_default.version;
20258
+ const pkg = getPackageJson();
20259
+ return pkg.version;
20369
20260
  }
20370
20261
  async function getPublishedCliVersion() {
20371
- const response = await (0, import_node_fetch.default)(`https://registry.npmjs.org/zenn-cli/latest`);
20262
+ const response = await (0, import_node_fetch.default)(
20263
+ `https://registry.npmjs.org/zenn-cli-wysiwyg/latest`
20264
+ );
20372
20265
  const data = await response.json();
20373
20266
  const latest = data["version"];
20374
20267
  return latest;
@@ -20571,7 +20464,9 @@ var detectPackageExecutor = () => {
20571
20464
  // src/server/lib/notify-update.ts
20572
20465
  var CLI_UPDATE_CHECK_INTERVAL = 1e3 * 60 * 60 * 12;
20573
20466
  async function notifyNeedUpdateCLI() {
20574
- const config = new import_configstore.default("zenn-cli", { lastUpdateCheck: Date.now() });
20467
+ const config = new import_configstore.default("zenn-cli-wysiwyg", {
20468
+ lastUpdateCheck: Date.now()
20469
+ });
20575
20470
  if (Date.now() - config.get("lastUpdateCheck") < CLI_UPDATE_CHECK_INTERVAL) {
20576
20471
  return;
20577
20472
  }
@@ -20583,7 +20478,7 @@ async function notifyNeedUpdateCLI() {
20583
20478
  [
20584
20479
  // prettier-ignore
20585
20480
  `\u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u30EA\u30EA\u30FC\u30B9\u3055\u308C\u3066\u3044\u307E\u3059: ${import_colors.default.grey(currentVersion)} \u2192 ${import_colors.default.green(publishedVersion)}`,
20586
- `${import_colors.default.cyan("npm install zenn-cli@latest")} \u3067\u66F4\u65B0\u3057\u3066\u304F\u3060\u3055\u3044`
20481
+ `${import_colors.default.cyan("npm install zenn-cli-wysiwyg@latest")} \u3067\u66F4\u65B0\u3057\u3066\u304F\u3060\u3055\u3044`
20587
20482
  ].join("\n"),
20588
20483
  {
20589
20484
  padding: 1,
@@ -20615,7 +20510,7 @@ function getLocalArticle(slug) {
20615
20510
  if (!data) return null;
20616
20511
  const { meta, bodyMarkdown } = data;
20617
20512
  const rawHtml = zennMarkdownHtml.default(bodyMarkdown, {
20618
- embedOrigin: "https://embed.zenn.studio"
20513
+ embedOrigin: ""
20619
20514
  });
20620
20515
  const bodyHtml = completeHtml(rawHtml);
20621
20516
  const toc = zennMarkdownHtml.parseToc(bodyHtml);
@@ -20791,7 +20686,7 @@ function getLocalChapter(book, chapterFilename) {
20791
20686
  if (!data) return null;
20792
20687
  const { meta, bodyMarkdown } = data;
20793
20688
  const rawHtml = zennMarkdownHtml2.default(bodyMarkdown, {
20794
- embedOrigin: "https://embed.zenn.studio"
20689
+ embedOrigin: ""
20795
20690
  });
20796
20691
  const bodyHtml = completeHtml(rawHtml);
20797
20692
  return {
@@ -21018,7 +20913,9 @@ async function getCliVersion(_req, res) {
21018
20913
  const updateAvailable = latest !== current;
21019
20914
  res.json({ current, latest, updateAvailable });
21020
20915
  } catch (err) {
21021
- res.status(500).json({ message: "\u6700\u65B0\u306Ezenn-cli\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F" });
20916
+ res.status(500).json({
20917
+ message: "\u6700\u65B0\u306Ezenn-cli-wysiwyg\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"
20918
+ });
21022
20919
  }
21023
20920
  }
21024
20921
 
@@ -21528,7 +21425,7 @@ var exec7 = () => {
21528
21425
  var exec8 = () => {
21529
21426
  const version = getCurrentCliVersion();
21530
21427
  if (!version) {
21531
- error("zenn-cli\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F");
21428
+ error("zenn-cli-wysiwyg\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F");
21532
21429
  return;
21533
21430
  }
21534
21431
  console.log(version);