Skip to content

Commit

Permalink
Merge pull request #37 from expressots/feature/auto-version
Browse files Browse the repository at this point in the history
feat: add automatic versioning
  • Loading branch information
rsaz committed Oct 9, 2023
2 parents c7e4340 + 78ce2f5 commit 0730efe
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 188 deletions.
19 changes: 10 additions & 9 deletions docs/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ Current available resources:
| dto | d |
| provider | p |
| service | s |
| entity | e |

## Usage Example

| Command | Expected result |
| -------------------------- | ----------------------------------------------------------------------------------------- |
| expressots g u user/find | Use case to be created in the folder `useCases` with this folder structure: user/find |
| expressots g c user/find | Controller to be created in the folder `useCases` inside of user/find |
| expressots g d user/find | DTO to be created in the folder `useCases` inside of user/find |
| expressots g p email/email | Provider to be created in the folder `providers` inside of user/find |
| Command | Expected result |
| -------------------------- | ---------------------------------------------------------------------------------------- |
| expressots g u user/find | Use case to be created in the folder `useCases` with this folder structure: user/find |
| expressots g c user/find | Controller to be created in the folder `useCases` inside of user/find |
| expressots g d user/find | DTO to be created in the folder `useCases` inside of user/find |
| expressots g p email/email | Provider to be created in the folder `providers` inside of user/find |
| expressots g s user/find | Service creates usecase, controller and DTO and add them in the desired folder user/find |

All resources can be created using the structure `folder/subfolder/resource`.
Expand All @@ -85,9 +86,9 @@ Here is the current configuration file with all the available options:
import { ExpressoConfig, Pattern } from "@expressots/core";

const config: ExpressoConfig = {
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: false,
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: false,
};

export default config;
Expand Down
324 changes: 171 additions & 153 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,175 +4,193 @@
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Expresso TS",
tagline: "A lightweight, fast and easy to use TypeScript framework",
favicon: "img/favicon.ico",
const { default: axios } = require("axios");

// Set the production url of your site here
url: "https://doc.expresso-ts.com", //'https://expressots.github.io/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
module.exports = async () => {
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Expresso TS",
tagline: "A lightweight, fast and easy to use TypeScript framework",
favicon: "img/favicon.ico",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "expressots", // Usually your GitHub org/user name.
projectName: "expresso-site-doc", // Usually your repo name.
deploymentBranch: "gh-pages",
trailingSlash: false,
// Set the production url of your site here
url: "https://doc.expresso-ts.com", //'https://expressots.github.io/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",

onBrokenLinks: "warn", // 'throw' | 'warn' | 'ignore'
onBrokenMarkdownLinks: "warn",
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "expressots", // Usually your GitHub org/user name.
projectName: "expresso-site-doc", // Usually your repo name.
deploymentBranch: "gh-pages",
trailingSlash: false,

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en", "pt"],
localeConfigs: {
en: {
label: "English",
},
pt: {
label: "Português",
},
},
},
onBrokenLinks: "warn", // 'throw' | 'warn' | 'ignore'
onBrokenMarkdownLinks: "warn",

presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en", "pt"],
localeConfigs: {
en: {
label: "English",
},
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: "img/expressots-discord-banner-darkbg.png",
metadata: [
{
name: "keywords",
content: "expressots, framework, nodejs, typescript, javascript",
pt: {
label: "Português",
},
],
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false,
},
algolia: {
apiKey: "dbc1e8899aa815b7cfdf66b7d4627e74",
indexName: "expresso-ts",
contextualSearch: true,
insights: true,
placeholder: "Search the docs (Press / to focus)",
appId: "3UANWN5EUQ",
},
navbar: {
title: "Expresso TS",
hideOnScroll: true,
logo: {
alt: "Expresso TS",
src: "img/logo.png",
},
items: [
{
type: "doc",
docId: "hello",
position: "right",
label: "Documentation",
},
{
type: "doc",
docId: "governance",
position: "right",
label: "Governance",
},

presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
},
{
href: "https://github.com/expressots/expressots",
label: "GitHub",
position: "right",
"aria-label": "GitHub repository",
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: "img/expressots-discord-banner-darkbg.png",
metadata: [
{
type: "localeDropdown",
label: "Language",
position: "right",
name: "keywords",
content: "expressots, framework, nodejs, typescript, javascript",
},
],
},
announcementBar: {
id: "supportus",
content: "Current Version: v2.0.0",
backgroundColor: "#111",
textColor: "#19CE59",
isCloseable: false,
},
stylesheets: [
{
href: "/css/custom.css",
type: "text/css",
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false,
},
],
footer: {
style: "light",
links: [
{
title: "Docs",
items: [
{
label: "Tutorial",
to: "docs/category/tutorials",
},
],
},
{
title: "Community",
items: [
{
label: "Twitch TV",
href: "https://www.twitch.tv/richardzampieri",
},
],
algolia: {
apiKey: "dbc1e8899aa815b7cfdf66b7d4627e74",
indexName: "expresso-ts",
contextualSearch: true,
insights: true,
placeholder: "Search the docs (Press / to focus)",
appId: "3UANWN5EUQ",
},
navbar: {
title: "Expresso TS",
hideOnScroll: true,
logo: {
alt: "Expresso TS",
src: "img/logo.png",
},
items: [
{
type: "doc",
docId: "hello",
position: "right",
label: "Documentation",
},
{
type: "doc",
docId: "governance",
position: "right",
label: "Governance",
},
{
href: "https://github.com/expressots/expressots",
label: "GitHub",
position: "right",
"aria-label": "GitHub repository",
},
{
type: "localeDropdown",
label: "Language",
position: "right",
},
],
},
announcementBar: {
id: "supportus",
content: "Current Version: v2.0.0",
backgroundColor: "#111",
textColor: "#19CE59",
isCloseable: false,
},
stylesheets: [
{
title: "Code",
items: [
{
label: "NPM Core",
href: "https://www.npmjs.com/package/@expressots/core",
},
{
label: "NPM CLI",
href: "https://www.npmjs.com/package/@expressots/cli",
},
{
label: "GitHub",
href: "https://github.com/expressots",
},
],
href: "/css/custom.css",
type: "text/css",
},
],
copyright: `Copyright © ${new Date().getFullYear()} Official ExpressoTS, Released under the MIT License.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
footer: {
style: "light",
links: [
{
title: "Docs",
items: [
{
label: "Tutorial",
to: "docs/category/tutorials",
},
],
},
{
title: "Community",
items: [
{
label: "Twitch TV",
href: "https://www.twitch.tv/richardzampieri",
},
],
},
{
title: "Code",
items: [
{
label: "NPM Core",
href: "https://www.npmjs.com/package/@expressots/core",
},
{
label: "NPM CLI",
href: "https://www.npmjs.com/package/@expressots/cli",
},
{
label: "GitHub",
href: "https://github.com/expressots",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Official ExpressoTS, Released under the MIT License.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};

// Fetch the content asynchronously using Axios
try {
const response = await axios.get("https://api.github.com/repos/expressots/expressots/releases");
const latestRelease = response.data[0];
const version = latestRelease.tag_name;

module.exports = config;
const newContent = `Current Version: v${version}`;
// @ts-ignore
config.themeConfig.announcementBar.content = newContent;

return config;
} catch (error) {
console.error("Error fetching current Version from Github:", error);
return config;
}
};
Loading

0 comments on commit 0730efe

Please sign in to comment.