Add typescript/monorepo-template
* commit '27c98b5823c212c8b9726710b5188144249d7841': typescript(monorepo-template): feat: readme generation typescript(monorepo-template): ci: some github actions typescript(monorepo-template): chore: removed debug logs from template typescript(monorepo-template): chore: build and test scripts typescript(monorepo-template): build: basic rollup setup typescript(monorepo-template): chore: basic hygen template typescript(monorepo-template): chore: added semantic-release typescript(monorepo-template): Initial commit typescript(monorepo-template): chore: initial commit
This commit is contained in:
commit
fc630da031
36
typescript/monorepo-template/.github/workflows/release.yml
vendored
Normal file
36
typescript/monorepo-template/.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
name: Build and deploy 🚀
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [12.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
- name: Config pnpm for ci
|
||||||
|
run: pnpm config set verify-store-integrity false
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.pnpm-store
|
||||||
|
key: 'I wonder if anyone sees this'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm i
|
||||||
|
- name: Release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
run: pnpx semantic-release
|
38
typescript/monorepo-template/.github/workflows/test.yml
vendored
Normal file
38
typescript/monorepo-template/.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
name: Test ⛳
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [develop, master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [12.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
run: npm i -g pnpm
|
||||||
|
- name: Config pnpm for ci
|
||||||
|
run: pnpm config set verify-store-integrity false
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.pnpm-store
|
||||||
|
key: 'pnpm cache'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm i
|
||||||
|
- name: Build project
|
||||||
|
run: pnpm run build
|
||||||
|
- name: Test project
|
||||||
|
run: pnpm test
|
3
typescript/monorepo-template/.gitignore
vendored
Normal file
3
typescript/monorepo-template/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
sandbox
|
||||||
|
packages/*/dist
|
1
typescript/monorepo-template/.prettierignore
Normal file
1
typescript/monorepo-template/.prettierignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
_templates/**/*.ejs
|
5
typescript/monorepo-template/.prettierrc
Normal file
5
typescript/monorepo-template/.prettierrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
12
typescript/monorepo-template/.releaserc.json
Normal file
12
typescript/monorepo-template/.releaserc.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"extends": "semantic-release-monorepo",
|
||||||
|
"branches": ["master"],
|
||||||
|
"plugins": [
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
"@semantic-release/changelog",
|
||||||
|
"@semantic-release/npm",
|
||||||
|
"@semantic-release/git",
|
||||||
|
"@semantic-release/github"
|
||||||
|
]
|
||||||
|
}
|
17
typescript/monorepo-template/.vscode/settings.json
vendored
Normal file
17
typescript/monorepo-template/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"cSpell.words": [
|
||||||
|
"brotli",
|
||||||
|
"downlevel",
|
||||||
|
"filesize",
|
||||||
|
"hygen",
|
||||||
|
"plugin",
|
||||||
|
"pnpm",
|
||||||
|
"pnpx",
|
||||||
|
"rollup",
|
||||||
|
"show",
|
||||||
|
"size",
|
||||||
|
"sourcemap",
|
||||||
|
"ts",
|
||||||
|
"wessberg"
|
||||||
|
]
|
||||||
|
}
|
21
typescript/monorepo-template/LICENSE
Normal file
21
typescript/monorepo-template/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Matei Adriel
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
message: |
|
||||||
|
hygen {bold generator new} --name [NAME] --action [ACTION]
|
||||||
|
hygen {bold generator with-prompt} --name [NAME] --action [ACTION]
|
||||||
|
---
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t
|
||||||
|
---
|
||||||
|
---
|
||||||
|
to: app/hello.js
|
||||||
|
---
|
||||||
|
const hello = ```
|
||||||
|
Hello!
|
||||||
|
This is your first hygen template.
|
||||||
|
|
||||||
|
Learn what it can do here:
|
||||||
|
|
||||||
|
https://github.com/jondot/hygen
|
||||||
|
```
|
||||||
|
|
||||||
|
console.log(hello)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t
|
||||||
|
---
|
||||||
|
---
|
||||||
|
to: app/hello.js
|
||||||
|
---
|
||||||
|
const hello = ```
|
||||||
|
Hello!
|
||||||
|
This is your first prompt based hygen template.
|
||||||
|
|
||||||
|
Learn what it can do here:
|
||||||
|
|
||||||
|
https://github.com/jondot/hygen
|
||||||
|
```
|
||||||
|
|
||||||
|
console.log(hello)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
to: _templates/<%= name %>/<%= action || 'new' %>/prompt.js
|
||||||
|
---
|
||||||
|
|
||||||
|
// see types of prompts:
|
||||||
|
// https://github.com/enquirer/enquirer/tree/master/examples
|
||||||
|
//
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
type: 'input',
|
||||||
|
name: 'message',
|
||||||
|
message: "What's your message?"
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
to: packages/<%= name %>/README.md
|
||||||
|
---
|
||||||
|
# <%- Name %>
|
||||||
|
|
||||||
|
<%- description %>
|
10
typescript/monorepo-template/_templates/package/new/index.js
Normal file
10
typescript/monorepo-template/_templates/package/new/index.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
const packageJson = require('../../../package.json')
|
||||||
|
|
||||||
|
exports.prompt = async ({ args }) => ({
|
||||||
|
...packageJson,
|
||||||
|
...args,
|
||||||
|
org: packageJson.name,
|
||||||
|
repository: JSON.stringify(packageJson.repository),
|
||||||
|
bugs: JSON.stringify(packageJson.bugs),
|
||||||
|
description: args.description || ''
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
to: packages/<%= name %>/src/index.ts
|
||||||
|
---
|
||||||
|
export const hello = () => console.log("Hello world from the <%= name %> package!")
|
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
to: packages/<%= name %>/package.json
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"name": "@<%= org %>/<%= name %>",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "<%- description %>",
|
||||||
|
"keywords": [],
|
||||||
|
"main": "dist/bundle.cjs.js",
|
||||||
|
"module": "dist/bundle.esm.js",
|
||||||
|
"browser": "dist/bundle.umd.js",
|
||||||
|
"typings": "./dist/bundle.esm.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"build": "rollup -c ../../rollup.config.ts"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"author": "<%= author %>",
|
||||||
|
"homepage": "<%= homepage %>",
|
||||||
|
"license": "<%= license %>",
|
||||||
|
"repository": <%- repository %>,
|
||||||
|
"bugs": <%- bugs %>,
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {},
|
||||||
|
"sideEffects": false
|
||||||
|
}
|
47
typescript/monorepo-template/package.json
Normal file
47
typescript/monorepo-template/package.json
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"name": "monorepo",
|
||||||
|
"description": "Some monorepo",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/Mateiadrielrafael/monorepo-template.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "pnpm run build --filter @monorepo/*",
|
||||||
|
"test": "pnpm run test --filter @monorepo/*"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"monorepo",
|
||||||
|
"pnpm",
|
||||||
|
"typescript"
|
||||||
|
],
|
||||||
|
"author": "Matei Adriel",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Mateiadrielrafael/monorepo-temolate/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Mateiadrielrafael/monorepo-template#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-commonjs": "^11.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^6.0.0",
|
||||||
|
"@semantic-release/changelog": "^5.0.1",
|
||||||
|
"@semantic-release/git": "^9.0.0",
|
||||||
|
"@types/chai": "^4.2.7",
|
||||||
|
"@types/mocha": "^5.2.7",
|
||||||
|
"@types/node": "^12.12.21",
|
||||||
|
"@types/sinon": "^7.5.1",
|
||||||
|
"@wessberg/rollup-plugin-ts": "^1.1.83",
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"cross-env": "^7.0.2",
|
||||||
|
"hygen": "^5.0.3",
|
||||||
|
"mocha": "^6.2.2",
|
||||||
|
"rimraf": "^3.0.0",
|
||||||
|
"rollup": "^1.27.14",
|
||||||
|
"rollup-plugin-filesize": "^6.2.1",
|
||||||
|
"rollup-plugin-terser": "^5.1.3",
|
||||||
|
"semantic-release": "^17.0.7",
|
||||||
|
"semantic-release-monorepo": "^7.0.2",
|
||||||
|
"sinon": "^8.0.1",
|
||||||
|
"ts-node": "^8.5.4",
|
||||||
|
"typescript": "^3.8.3"
|
||||||
|
}
|
||||||
|
}
|
4849
typescript/monorepo-template/pnpm-lock.yaml
Normal file
4849
typescript/monorepo-template/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
2
typescript/monorepo-template/pnpm-workspace.yaml
Normal file
2
typescript/monorepo-template/pnpm-workspace.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
packages:
|
||||||
|
- "packages/**"
|
59
typescript/monorepo-template/rollup.config.ts
Normal file
59
typescript/monorepo-template/rollup.config.ts
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
import { terser } from 'rollup-plugin-terser'
|
||||||
|
import { resolve } from 'path'
|
||||||
|
import ts from '@wessberg/rollup-plugin-ts'
|
||||||
|
import nodeResolve from '@rollup/plugin-node-resolve'
|
||||||
|
import commonjs from '@rollup/plugin-commonjs'
|
||||||
|
import filesize from 'rollup-plugin-filesize'
|
||||||
|
|
||||||
|
const packageRoot = process.cwd()
|
||||||
|
const dev = Boolean(process.env.ROLLUP_WATCH)
|
||||||
|
|
||||||
|
const inputFile = resolve(packageRoot, 'src/index.ts')
|
||||||
|
|
||||||
|
const _package = require(resolve(packageRoot, 'package.json'))
|
||||||
|
const packageName = String(_package.name)
|
||||||
|
|
||||||
|
const commonPlugins = [nodeResolve(), commonjs()]
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
input: inputFile,
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
file: _package.main,
|
||||||
|
format: 'cjs',
|
||||||
|
sourcemap: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
file: _package.browser,
|
||||||
|
sourcemap: true,
|
||||||
|
format: 'umd',
|
||||||
|
name: packageName[0].toUpperCase() + packageName.substr(1)
|
||||||
|
}
|
||||||
|
],
|
||||||
|
plugins: [...commonPlugins, ts(), !dev && terser()]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: inputFile,
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
file: _package.module,
|
||||||
|
format: 'esm',
|
||||||
|
sourcemap: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
...commonPlugins,
|
||||||
|
ts({
|
||||||
|
tsconfig: {
|
||||||
|
declaration: true,
|
||||||
|
...require(resolve(__dirname, 'tsconfig.json'))['compilerOptions']
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
!dev && terser(),
|
||||||
|
filesize({
|
||||||
|
showBrotliSize: true
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
14
typescript/monorepo-template/tsconfig.json
Normal file
14
typescript/monorepo-template/tsconfig.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strictBindCallApply": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node"
|
||||||
|
},
|
||||||
|
"include": ["packages/*/src/**/*.ts"],
|
||||||
|
"exclude": ["**/node_modules/**"]
|
||||||
|
}
|
Loading…
Reference in a new issue