-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
279 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: [require.resolve('@xus/eslint-config')] | ||
} |
104 changes: 104 additions & 0 deletions
104
packages/create-lib/src/template/ts-lib-lerna/_gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const prettier = require('@xus/eslint-config/prettier') | ||
|
||
module.exports = { | ||
...prettier | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/create-lib/src/template/ts-lib-lerna/jest.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
preset: 'ts-jest', | ||
rootDir: __dirname, | ||
collectCoverage: true, | ||
collectCoverageFrom: ['packages/**/src/**/**.ts'], | ||
coverageDirectory: path.resolve(__dirname, 'coverage'), | ||
coverageReporters: ['html', 'text'], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], | ||
watchPathIgnorePatterns: ['node_modules'], | ||
testMatch: ['packages/**/__test__/**/*spec.[jt]s?(x)'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"packages": ["packages/*"], | ||
"version": "independent", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/create-lib/src/template/ts-lib-lerna/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"build": "xus lib", | ||
"lint-fix": "xus lint", | ||
"test": "jest", | ||
"changelog": "xus changelog", | ||
"release": "xus release" | ||
}, | ||
"license": "MIT", | ||
"gitHooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "xus commit-lint" | ||
}, | ||
"lint-staged": { | ||
"*.{ts}": [ | ||
"lint-fix", | ||
"prettier --parser=typescript --write" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.22", | ||
"@xus/cli": "^0.1.3", | ||
"@xus/eslint-config": "^0.1.2", | ||
"jest": "^26.6.3", | ||
"lerna": "^3.22.1", | ||
"lint-staged": "^10.2.11", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^4.1.3" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/create-lib/src/template/ts-lib-lerna/packages/core/__test__/index.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { helloWord } from '../src' | ||
|
||
describe('test index ', () => { | ||
test('test helloWord ', () => { | ||
expect(helloWord()).toBe('hello-word') | ||
}) | ||
}) |
14 changes: 14 additions & 0 deletions
14
packages/create-lib/src/template/ts-lib-lerna/packages/core/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "@scope/core", | ||
"version": "1.0.0", | ||
"description": "ts lib", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts", | ||
"keywords": [ | ||
"ts", | ||
"lib" | ||
], | ||
"author": "who am i", | ||
"license": "MIT" | ||
} |
1 change: 1 addition & 0 deletions
1
packages/create-lib/src/template/ts-lib-lerna/packages/core/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const helloWord = () => 'hello-word' |
12 changes: 12 additions & 0 deletions
12
packages/create-lib/src/template/ts-lib-lerna/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "esnext", | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, | ||
"moduleResolution": "node", | ||
"lib": ["esnext", "dom"] | ||
}, | ||
"exclude": ["**/__test__/**/*"] | ||
} |
47 changes: 47 additions & 0 deletions
47
packages/create-lib/src/template/ts-lib-lerna/xus.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { defineConfig } from '@xus/cli' | ||
|
||
export default defineConfig({ | ||
libBuild: { | ||
targets: ['esm', 'cjs', 'browser'], | ||
rollTypes: true | ||
}, | ||
lint: { | ||
eslint: { | ||
include: 'packages/**/src/**/*', | ||
ext: ['.ts'] | ||
}, | ||
stylelint: false | ||
}, | ||
release: { | ||
beforeRelease: [ | ||
{ | ||
bin: 'npm', | ||
args: ['run', 'test'], | ||
message: { | ||
start: 'Test start', | ||
succeed: 'Test succeed', | ||
failed: 'Test failed' | ||
} | ||
}, | ||
{ | ||
bin: 'npm', | ||
args: ['run', 'lint-fix'], | ||
message: { | ||
start: 'Lint start', | ||
succeed: 'Lint succeed', | ||
failed: 'Lint failed' | ||
} | ||
}, | ||
{ | ||
bin: 'npm', | ||
args: ['run', 'build'], | ||
message: { | ||
start: 'Build start', | ||
succeed: 'Build succeed', | ||
failed: 'Build failed' | ||
} | ||
} | ||
], | ||
branch: 'main' | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters