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", "");