npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fessional/razor

v0.2.2

Published

Use front-end tech (Nuxt/Ts) to build multi-platform from one codebase, suitable for small team and app to write app once, apply almost anywhere.

Downloads

1,222

Readme

Razor - Nuxt CrossPlatform Hybrid Layers

With a deadly lightning storm at his command, Razor charges into battle.

English 🇺🇸 | 中文 🇨🇳

razor

Use front-end tech (Nuxt/Ts) to build multi-platform from one codebase,

  • Mobile (H5/App) - Web, Android, iOS
  • Desktop (PC/Exe) - Web, MacOS, Linux, Window

Suitable for teams and app scenarios such as,

  • small team with some web skills but little mobile experience
  • small app with simple interactions, but multi-platform and similar
  • The MC layer can be reused, but the V layer UX is different

The goal is Write App once, Apply almost anywhere

1.Tech Arch

2.Code Style

Based on the Vue Style and Nuxt Eslint, with the principles of type safety, readability, and consistency, add the following conventions,

Rule1 - camel in js, kebab in html

First, html and http are case-insensitive, and mac and win OS are case-insensitive by default.

  • camel - smallCamel and BigCamel/PascalCase
  • kebab - kebab-case all lowercase
  • *.vue and its file - MUST be BigCamel, consistent with Vue
  • dir and non-vue file - MUST be kebab consistent with index.js
  • source code - js MUST be camel, html attr and css MUST be kebab
  • component tag - SHOULD be BigCamel, to distinguish from original html
  • component prop - in js MUST be smallCamel, in html MUST be kebab
  • emit event - MUST be kebab, treated as string, no auto-conversion
  • i18n - SHOULD use js instead of json, key SHOULD be camel

Rule2 - single in js, double in html

Since double quotes are usually used in html which may contain simple js code,

  • js content - MUST be single quotes
  • html content - MUST be double quotes

Rule3 - semicolon and comma, same as main language

semicolon, same as your main language, or otherwise as they are.

  • java - keep the semicolon at the end
  • kotlin, scala, etc - without semicolon

comma, as much as possible to easy to add, sub and reorder,

  • arrays, objects, ts, etc. support comma endings

Rule4 - Component name must not be Index.*

Components named Index are hard to read, debug and develop.

  • prefer to use the full name (import and export via index.ts)
  • or specify the name attribute (auto inference is recommended)

Rule5 - Use singular for whole, plural for fragment

According to the official Vue naming rules, most things are plural,

  • for a single entity, use singular, e.g. store, route
  • for multiple fragments, use plural, e.g. views, components

Rule6 - ts coding convention

  • to define function, function is better than arrow lambda
  • try to specify type, unknown instead of any
  • undefined in definition, null in usage
  • entity code is in *.ts, type-only is in *.d.ts
  • TypeX[] instead of Array<TypeX> when no type inference
  • Use if for flow control, || or ?? for expression
  • Use absolute path (@,~), relative path is only ./ and ../
  • Use & for layer path alias

Rule7 - vue coding convention

  • emits, using the ts specification, event name without on prefix
  • props, use do prefix for handle when passthrough Function
  • interface/type in SFC, can be in same-name .d.ts, but enum in .ts

3.DoIt Yourself

## ✅ for CI
## install pnpm-hoist-layer to devDep
pnpm -w i --no-frozen-lockfile --ignore-pnpmfile
## reset the ci lockfile
git restore pnpm-lock.yaml
## install all deps by lockfile
pnpm i --frozen-lockfile

## 💚 for Dev
pnpm -w i --ignore-pnpmfile
pnpm i

## 🧪 testing
pnpm dev:test
## play web
pnpm play:web

## 💎 others
## reset by bash
pnpm store prune
find . -name "node_modules" -type d -prune -exec rm -rf {} +
find . -name "pnpm-lock.yaml" -type f -exec rm -f {} +
asdf install
pnpm -w i --ignore-pnpmfile
pnpm i

## rm .nuxt, .output, dist
pnpm del:gen
## rm node_modules
pnpm del:dep
## rm node_modules, pnpm-lock.yaml
pnpm del:all