build: monorepo for themes

This commit is contained in:
07akioni 2021-02-10 20:35:50 +08:00
parent 10d5efb402
commit aa7f718aa8
13 changed files with 93 additions and 23 deletions

5
.gitignore vendored
View File

@ -16,5 +16,6 @@ coverage
/fonts
/site
/package
/lib
/es
lib
es
*.tsbuildinfo

View File

@ -7,8 +7,8 @@
"scripts": {
"start": "npm run dev",
"deprecated:build:icons": "npm run clean && node scripts/pre-build/deprecated-build-icons.js",
"build:js": "npm run gen-version && npm run clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/post-build",
"build:package": "npm run gen-version && npm run clean && node scripts/pre-build/deprecated-build-icons.js && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/post-build",
"build:js": "npm run gen-version && npm run clean && tsc -b tsconfig.esm.json && tsc -b tsconfig.cjs.json && node scripts/post-build",
"build:package": "npm run gen-version && npm run clean && node scripts/pre-build/deprecated-build-icons.js && tsc -b tsconfig.esm.json && tsc -b tsconfig.cjs.json && node scripts/post-build",
"build:site": "npm run build:package && ./scripts/pre-build-site/pre-build-site.sh && node scripts/pre-build-site/restore-side-effects && cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 vite build && rm -rf node_modules/naive-ui && cp site/index.html site/404.html && node scripts/post-build-site/clear-side-effects",
"clean": "rm -rf site lib es node_modules/naive-ui",
"dev": "npm run clean && npm run gen-version && cross-env NODE_ENV=development vite",

View File

@ -1,9 +1,15 @@
import type { Locale } from 'date-fns'
import { enUS } from 'date-fns/locale'
const dateEnUs = {
interface NDateLocale {
name: string
locale: Locale
}
const dateEnUs: NDateLocale = {
name: 'en-US',
locale: enUS
}
export type NDateLocale = typeof dateEnUs
export { NDateLocale }
export default dateEnUs

View File

@ -1,6 +1,9 @@
import { zhCN } from 'date-fns/locale'
import { NDateLocale } from './enUS'
export default {
const dateZhCN: NDateLocale = {
name: 'zh-CN',
locale: zhCN
}
export default dateZhCN

10
src/tsconfig.cjs.json Normal file
View File

@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"exclude": ["./**/*.spec.*"],
"compilerOptions": {
"rootDir": ".",
"outDir": "../lib",
"module": "CommonJS",
"target": "ES6"
}
}

10
src/tsconfig.esm.json Normal file
View File

@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"exclude": ["./**/*.spec.*"],
"compilerOptions": {
"rootDir": ".",
"outDir": "../es",
"module": "ES6",
"target": "ES6"
}
}

View File

@ -1,3 +1,11 @@
{
"name": "@naive-ui/tusimple-theme"
"name": "@naive-ui/tusimple-theme",
"main": "lib/index.js",
"module": "es/index.js",
"version": "2.0.0-beta.5",
"author": "07akioni",
"license": "MIT",
"publishConfig": {
"registry": "***REMOVED***"
}
}

View File

@ -0,0 +1 @@
export { default as TsConfigProvider } from './ts-config-provider'

View File

@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib",
"module": "CommonJS",
"target": "ES6"
},
"references": [
{ "path": "../../src/tsconfig.cjs.json" }
]
}

View File

@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./es",
"module": "ES6",
"target": "ES6"
},
"references": [
{ "path": "../../src/tsconfig.esm.json" }
]
}

View File

@ -1,9 +1,11 @@
{
"extends": "./tsconfig.json",
"exclude": ["src/**/*.spec.ts"],
"compilerOptions": {
"outDir": "lib",
"module": "CommonJS",
"target": "ES6"
}
"files": [],
"references": [
{
"path": "./src/tsconfig.cjs.json"
},
{
"path": "./themes/tusimple/tsconfig.cjs.json"
}
]
}

View File

@ -1,9 +1,11 @@
{
"extends": "./tsconfig.json",
"exclude": ["src/**/*.spec.ts"],
"compilerOptions": {
"outDir": "es",
"module": "ES6",
"target": "ES6"
}
"files": [],
"references": [
{
"path": "./src/tsconfig.esm.json"
},
{
"path": "./themes/tusimple/tsconfig.esm.json"
}
]
}

View File

@ -1,6 +1,8 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"paths": {
"naive-ui": ["./src"]
},
"strict": true,
"strictNullChecks": true,
"jsx": "react",
@ -10,6 +12,7 @@
"moduleResolution": "Node",
"declaration": true,
"forceConsistentCasingInFileNames": true,
"composite": true,
"lib": [
"ESNext",
"DOM"