From ce00d94b42e311c1c833bd578f9971020ae1bf1e Mon Sep 17 00:00:00 2001 From: ienaga Date: Thu, 6 Jul 2023 06:17:55 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=81=AE=E6=9B=B8=E3=81=8D=E6=8F=9B=E3=81=88=E3=81=AEscript?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- scripts/version.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/index.ts | 2 +- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 scripts/version.js diff --git a/package.json b/package.json index 2e7f02c..b09da42 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@next2d/framework", "description": "It is a framework dedicated to Next2D that enables scene management by URL (SPA), which has been difficult with conventional Canvas/WebGL applications, and simplifies readability and shareability by fixing the development pattern (MVVM).", - "version": "1.6.0", + "version": "1.6.1", "homepage": "https://next2d.app", "bugs": "https://github.com/Next2D/Framework/issues/new", "author": "Toshiyuki Ienaga (https://github.com/ienaga/)", @@ -13,7 +13,7 @@ ], "scripts": { "lint": "eslint src/**/*.ts", - "publish": "tsc", + "publish": "node ./scripts/version.js && tsc", "test": "jest", "jsdoc": "tsc && jsdoc -c jsdoc.conf.js -r dist DOCS.md" }, diff --git a/scripts/version.js b/scripts/version.js new file mode 100644 index 0000000..287a9dd --- /dev/null +++ b/scripts/version.js @@ -0,0 +1,44 @@ +#!/usr/bin/env node + +"use strict"; + +const fs = require("fs"); + +/** + * @param {string} dir + * @return {void} + * @method + * @private + */ +const execute = () => +{ + const indexPath = `${process.cwd()}/src/index.ts`; + if (fs.existsSync(indexPath)) { + + const src = fs.readFileSync(indexPath, "utf8"); + const packageJson = require(`${process.cwd()}/package.json`); + + const texts = src.split("\n"); + for (let idx = 0; idx < texts.length; ++idx) { + + const text = texts[idx]; + if (text.indexOf("Next2D Framework") === -1) { + continue; + } + + const top = texts.slice(0, idx).join("\n"); + const lower = texts.slice(idx + 1).join("\n"); + + fs.writeFileSync( + indexPath, + `${top} +console.log("%c Next2D Framework %c ${packageJson.version} %c https://next2d.app", +${lower}` + ); + + break; + } + } +}; + +execute(); \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e1bc683..ebbf0d5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ import { response } from "./application/variable/Response"; import { loaderInfoMap } from "./application/variable/LoaderInfoMap"; // output build version -console.log("%c Next2D Framework %c 1.5.10 %c https://next2d.app", +console.log("%c Next2D Framework %c 1.6.1 %c https://next2d.app", "color: #fff; background: #5f5f5f", "color: #fff; background: #4bc729", "");