1.2.3 • Published 7 months ago

@gluwa/frontend-util v1.2.3

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

@gluwa/frontend-util

@gluwa/frontend-util is JavaScript utility library for Gluwa frontend projects

Publishing Process

Version Control Flow

  1. Feature Branch

    • Update version in package.json (e.g., 1.0.1)
    • Follow SemVer guidelines:
      • MAJOR: incompatible API changes
      • MINOR: backward compatible features
      • PATCH: backward compatible fixes
  2. Dev Branch

    • Merge Feature → Dev
    • Automatic RC version publish
    • Example: 1.0.1-rc.1, 1.0.1-rc.2, etc.
  3. Main Branch

    • Merge Dev → Main
    • Automatic stable version publish
    • Example: 1.0.1

Installing Packages

# Latest Stable Version
npm install @gluwa/frontend-util
yarn add @gluwa/frontend-util
pnpm add @gluwa/frontend-util
bun add @gluwa/frontend-util

# Release Candidate Version
npm install @gluwa/frontend-util@rc
yarn add @gluwa/frontend-util@rc
pnpm add @gluwa/frontend-util@rc
bun add @gluwa/frontend-util@rc

Checking Versions

# Check RC Version
npm view @gluwa/frontend-util@rc version

Usage Examples

React Functional Component

import { getYear } from '@gluwa/frontend-util';
import { useEffect, useState } from 'react';

export default function Footer() {
  const [year, setYear] = useState<number | null>(null);

  useEffect(() => {
    async function fetchYear() {
      try {
        const fetchedYear = await getYear();
        setYear(fetchedYear);
      } catch (err) {
        setYear(null);
        console.error(err);
      }
    }

    fetchYear();
  }, []);

  return (
    <footer>
      <p>© Copyright {year ?? ''} Gluwa™</p>
    </footer>
  );
}

React Class Component

import { getYear } from '@gluwa/frontend-util';
import React, { Component } from 'react';

class Footer extends Component {
  state = {
    year: null,
  };

  async componentDidMount() {
    try {
      const fetchedYear = await getYear();
      this.setState({ year: fetchedYear });
    } catch (err) {
      this.setState({ year: null });
      console.error(err);
    }
  }

  render() {
    const { year } = this.state;
    return (
      <footer>
        <p>© Copyright {year ?? ''} Gluwa™</p>
      </footer>
    );
  }
}

export default Footer;
1.2.3

7 months ago

1.2.3-rc.6

7 months ago

1.2.3-rc.5

7 months ago

1.2.3-rc.4

7 months ago

1.2.3-rc.3

7 months ago

1.2.3-rc.2

7 months ago

1.2.3-rc.1

7 months ago

1.2.2

7 months ago

1.2.2-rc.2

8 months ago

1.2.2-rc.1

8 months ago

1.2.1-rc.2

9 months ago

1.2.1

10 months ago

1.2.1-rc.1

10 months ago

1.2.0

10 months ago

1.2.0-rc.4

10 months ago

1.2.0-rc.3

10 months ago

1.2.0-rc.2

10 months ago

1.2.0-rc.1

10 months ago

1.1.0-rc.3

10 months ago

1.0.10-rc.2

10 months ago

1.0.10-rc.1

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago