Skip to content

Commit e6e8877

Browse files
committed
feat: migrate to lerna monorepo
1 parent f84b5f1 commit e6e8877

23 files changed

+2859
-200
lines changed

.eslintignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
coverage
22
node_modules
3-
/lib
4-
/test
5-
!/test/insert.spec.ts
3+
lib
4+
packages/*/test
5+
!/packages/*/test/*.ts

.github/workflows/nodejs.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
yarn global add codecov codacy-coverage
3737
codecov
38-
cat ./coverage/lcov.info | codacy-coverage -u rx-ts -n rollup-plugin-insert
38+
cat ./coverage/lcov.info | codacy-coverage -u rx-ts -n rollup
3939
env:
4040
CI: 'true'
4141
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -53,10 +53,22 @@ jobs:
5353

5454
- name: Publish GitHub Release and npm Package
5555
if: matrix.os == 'macOS-latest' && github.event_name == 'push' && github.ref == 'refs/heads/master'
56-
run: bash deploy.sh
56+
run: |
57+
git remote set-url origin "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git"
58+
git checkout master
59+
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
60+
yarn lerna publish --create-release github --yes
61+
env:
62+
CI: 'true'
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
65+
66+
- name: Publish beta npm Package
67+
if: matrix.os == 'macOS-latest' && github.event_name == 'push' && github.ref == 'refs/heads/develop'
68+
run: |
69+
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
70+
yarn lerna publish --canary --conventional-prerelease --force-publish --preid beta --pre-dist-tag beta --yes
5771
env:
5872
CI: 'true'
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
GH_BRANCH: master
61-
GH_REPO: ${{ github.repository }}
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6274
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
1-
# Changelog
1+
# CHANGELOG
22

3-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
45

5-
## [1.2.0](https://github.com/JounQin/rollup-plugin-insert/compare/v1.1.0...v1.2.0) (2020-01-29)
6-
7-
## 1.0.0
8-
9-
- Enable sourceMap support (#39 @danielgindi)
10-
- Support return string or MagicString after transforming
11-
- fix failed test cases, add more test cases
12-
- all test coverage indicators reach 100%
13-
- bump all dependencies
14-
15-
## 1.0.1
16-
17-
- add more module import usages
18-
- fix `transform` usage in README
19-
- build on CI for testing
20-
21-
## 1.1.0
22-
23-
- migrate code base to TypeScript :tada:
6+
- [rollup-plugin-insert](./packages/insert/CHANGELOG.md)

README.md

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
# rollup-plugin-insert
1+
# @rxts/rollup
22

33
[![GitHub Actions](https://github.com/rx-ts/rollup-plugin-insert/workflows/Node%20CI/badge.svg)](https://github.com/rx-ts/rollup-plugin-insert/actions?query=workflow%3A%22Node+CI%22)
4-
[![Codecov](https://img.shields.io/codecov/c/github/rx-ts/rollup-plugin-insert.svg)](https://codecov.io/gh/rx-ts/rollup-plugin-insert)
5-
[![Codacy Grade](https://img.shields.io/codacy/grade/8060dfc2d0f84494b715af1fc08e4c50)](https://www.codacy.com/gh/rx-ts/rollup-plugin-insert)
4+
[![Codecov](https://img.shields.io/codecov/c/github/rx-ts/rollup.svg)](https://codecov.io/gh/rx-ts/rollup)
5+
[![Codacy Grade](https://img.shields.io/codacy/grade/8060dfc2d0f84494b715af1fc08e4c50)](https://www.codacy.com/gh/rx-ts/rollup)
66
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Frx-ts%2Frollup-plugin-insert%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
7-
[![npm](https://img.shields.io/npm/v/rollup-plugin-insert.svg)](https://www.npmjs.com/package/rollup-plugin-insert)
87
[![GitHub Release](https://img.shields.io/github/release/rx-ts/rollup-plugin-insert)](https://github.com/rx-ts/rollup-plugin-insert/releases)
9-
10-
[![David Peer](https://img.shields.io/david/peer/rx-ts/rollup-plugin-insert.svg)](https://david-dm.org/rx-ts/rollup-plugin-insert?type=peer)
11-
[![David](https://img.shields.io/david/rx-ts/rollup-plugin-insert.svg)](https://david-dm.org/rx-ts/rollup-plugin-insert)
128
[![David Dev](https://img.shields.io/david/dev/rx-ts/rollup-plugin-insert.svg)](https://david-dm.org/rx-ts/rollup-plugin-insert?type=dev)
139

1410
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
@@ -17,73 +13,25 @@
1713
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
1814
[![codechecks.io](https://raw.githubusercontent.com/codechecks/docs/master/images/badges/badge-default.svg?sanitize=true)](https://codechecks.io)
1915

20-
> string mutation plugin for rollup
21-
22-
## Usage
23-
24-
```bash
25-
# npm
26-
npm install -D rollup-plugin-insert
27-
28-
# yarn
29-
yarn add -D rollup-plugin-insert
30-
```
31-
32-
```js
33-
// all of following is fine
34-
import * as insert from 'rollup-plugin-insert'
35-
import insert from 'rollup-plugin-insert'
36-
import { append, prepend, wrap, transform } from 'rollup-plugin-insert'
37-
38-
const insert = require('rollup-plugin-insert')
39-
```
40-
41-
## Common Usage
42-
43-
All following methods have an optional last argument `options` which is an object and contains key `include`, `exclude` and `sourceMap` which is enabled by default.
44-
45-
It can be used to filter files as you like. For example you can wrapper your html template as following:
46-
47-
```js
48-
insert.transform(
49-
(magicString, code, id) =>
50-
`export default ${JSON.stringify(`<!--add some comments-->${code}`)}`,
51-
{
52-
include: '**/*.html',
53-
},
54-
)
55-
```
56-
57-
If you do not need `sourceMap` at all, just change it to be `false`.
58-
59-
## Append
60-
61-
Appends a string onto the contents.
62-
63-
```js
64-
insert.append('world') // Appends 'world' to the contents of every file
65-
```
66-
67-
## Prepend
16+
> Incredible Rollup plugins, make Rollup greater
6817
69-
Prepends a string onto the contents.
18+
## Packages
7019

71-
```js
72-
insert.prepend('Hello') // Prepends 'Hello' to the contents of every file
73-
```
20+
This repository is a monorepo managed by [Lerna][] what means we actually publish several packages to npm from same codebase, including:
7421

75-
## Wrap
22+
| Package | Description | Version | Peer Dependencies | Dependencies |
23+
| ------------------------------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
24+
| [`rollup-plugin-insert`](/packages/insert) | string mutation plugin for Rollup | [![npm](https://img.shields.io/npm/v/rollup-plugin-insert.svg)](https://www.npmjs.com/package/rollup-plugin-insert) | [![David Peer](https://img.shields.io/david/peer/rx-ts/rollup.svg?path=packages/insert)](https://david-dm.org/rx-ts/rollup?path=packages/insert&type=peer) | [![David](https://img.shields.io/david/rx-ts/rollup.svg?path=packages/insert)](https://david-dm.org/rx-ts/rollup?path=packages/insert) |
7625

77-
Wraps the contents with two strings.
26+
## Changelog
7827

79-
```js
80-
insert.wrap('Hello', 'World') // prepends 'hello' and appends 'world' to the contents
81-
```
28+
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
8229

83-
## Transform
30+
## License
8431

85-
Calls a function with the contents of the file.
32+
[MIT][] © [JounQin][]@[1stG.me][]
8633

87-
```js
88-
insert.transform((magicString, code, id) => code.toUpperCase()) // should return a string or MagicString
89-
```
34+
[1stg.me]: https://www.1stg.me
35+
[jounqin]: https://GitHub.com/JounQin
36+
[lerna]: https://github.com/lerna/lerna
37+
[mit]: http://opensource.org/licenses/MIT

codechecks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ checks:
22
- name: build-size-watcher
33
options:
44
files:
5-
- path: lib/index.js
5+
- path: packages/*/lib/index.js
66
- name: type-coverage-watcher
77
options:
88
atLeast: 100

deploy.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

lerna.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "http://json.schemastore.org/lerna",
3+
"version": "independent",
4+
"npmClient": "yarn",
5+
"useWorkspaces": true,
6+
"changelog": {
7+
"cacheDir": ".cache",
8+
"ignoreCommitters": [
9+
"*bot"
10+
],
11+
"nextVersion": "Unreleased"
12+
},
13+
"command": {
14+
"version": {
15+
"allowBranch": [
16+
"develop",
17+
"master"
18+
],
19+
"conventionalCommits": true,
20+
"gitReset": false,
21+
"message": "chore: release package(s)"
22+
},
23+
"publish": {
24+
"ignoreChanges": [
25+
"**/test/**",
26+
"**/tsconfig.json",
27+
"**/*.md",
28+
"**/*.tsbuildinfo"
29+
]
30+
}
31+
}
32+
}

now.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "rollup",
33
"version": 2,
4+
"alias": [
5+
"rollup.now.sh"
6+
],
47
"github": {
58
"silent": true
69
},

package.json

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
11
{
2-
"name": "rollup-plugin-insert",
3-
"version": "1.2.0",
4-
"description": "string mutation plugin for rollup",
5-
"repository": "https://github.com/JounQin/rollup-plugin-insert.git",
2+
"name": "@rxts/rollup",
3+
"version": "0.0.0",
4+
"description": "Incredible Rollup plugins, make Rollup greater",
5+
"repository": "https://github.com/rx-ts/rollup.git",
66
"author": "JounQin <[email protected]>",
77
"license": "MIT",
8-
"engines": {
9-
"node": ">=8.0.0"
10-
},
11-
"main": "lib/cjs",
12-
"module": "lib",
13-
"es2015": "lib/es2015",
14-
"fesm5": "lib/esm",
15-
"types": "lib",
16-
"files": [
17-
"lib",
18-
"!lib/*.tsbuildinfo"
8+
"workspaces": [
9+
"packages/*"
1910
],
11+
"private": true,
2012
"scripts": {
2113
"build": "run-p build:*",
2214
"build:r": "r -e named -p",
2315
"build:ts": "tsc -b",
24-
"clean": "rimraf lib",
16+
"clean": "rimraf packages/*/lib",
2517
"lint": "eslint . --cache --ext .js,.ts --max-warnings 10 -f friendly",
2618
"prepublishOnly": "yarn test && yarn build",
2719
"pretest": "yarn clean",
2820
"test": "jest",
2921
"type-coverage": "type-coverage --cache --detail --ignore-catch --ignore-files '**/*.d.ts' --strict"
3022
},
31-
"peerDependencies": {
32-
"rollup": "*"
33-
},
34-
"dependencies": {
35-
"magic-string": "^0.25.6",
36-
"rollup-pluginutils": "^2.8.2"
37-
},
3823
"devDependencies": {
3924
"@1stg/lib-config": "^0.1.21",
4025
"@types/jest": "^25.1.0",
4126
"@types/node": "^13.5.1",
27+
"lerna": "^3.20.2",
4228
"npm-run-all": "^4.1.5",
4329
"rimraf": "^3.0.1",
4430
"ts-jest": "^25.0.0",

packages/insert/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4+
5+
## [1.2.0](https://github.com/JounQin/rollup-plugin-insert/compare/v1.1.0...v1.2.0) (2020-01-29)
6+
7+
## 1.0.0
8+
9+
- Enable sourceMap support (#39 @danielgindi)
10+
- Support return string or MagicString after transforming
11+
- fix failed test cases, add more test cases
12+
- all test coverage indicators reach 100%
13+
- bump all dependencies
14+
15+
## 1.0.1
16+
17+
- add more module import usages
18+
- fix `transform` usage in README
19+
- build on CI for testing
20+
21+
## 1.1.0
22+
23+
- migrate code base to TypeScript :tada:

0 commit comments

Comments
 (0)