Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cnchar-data

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnchar-data

cnchar的资源库

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.5K
decreased by-27.8%
Maintainers
1
Weekly downloads
 
Created
Source

cnchar 资源库

该库为cnchar的资源cdn库

也可以用于支持离线化使用cnchar部分在线资源,及生产环境部署到自己的服务器中

1. 安装

npm i cnchar-data -D

2. 运行

首先配置 package.json scripts

{
    ...,
    "scripts": {
        "cnchar-serve": "cnchar-serve 3002",
        "cnchar-prod": "cnchar-serve-prod"
    },
}

运行一个本地的服务,端口可以自定义

npm run cnchar-serve

运行成功之后可以访问一下链接查看是否正确运行

http://localhost:3002/draw/一.json

3. 开发环境使用

import cnchar from 'cnchar';
cnchar.setResourceBase('http://localhost:{port}/')

4. 生产环境使用

如需将资源部署到您的生产环境服务器

请执行

npm run cnchar-prod

会在项目根目录生成cnchar-data目录, 将改文件夹放置在您的http服务器中

假设可访问路径为 https://www.xxx.com/cnchar-data/

则对cnchar设置如下

import cnchar from 'cnchar';
cnchar.setResourceBase('https://www.xxx.com/cnchar-data/')

5. api

export const name: 'cnchar-data';

export const words: {
    dict: string;
}

export function serve(port?: number): void;

export function build(): void;

export default {
    name,
    words,
    serve,
    build,
}
import {serve} from 'cnchar-data';
serve(port);
import {build} from 'cnchar-data';
build();

6. 或者可以全局安装使用

npm i cnchar-data -g
cnchar-serve [port]
cnchar-serve-prod

FAQs

Package last updated on 09 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc