Skip to content

Commit 1b6b70c

Browse files
authored
feat: styled API; monorepo grooming (#482)
* Add Hygen template for library package creation * Make Evaluable generic * Ignore rest siblings on ESLint * Add styled package * Update structure of memo package * Upgrade yarn * Upgrade TypeScript * Upgrade ESLint * Upgrade icon generation dependencies * Upgrade jest * Upgrade Apps Engine * Upgrade development dependencies * Upgrade prettier * Remove Sass warnings * Update README files * Avoid LGTM warning
1 parent b028da8 commit 1b6b70c

File tree

145 files changed

+5424
-2532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+5424
-2532
lines changed

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
{
6464
"directory": "scripts",
6565
"changeProcessCWD": true
66+
},
67+
{
68+
"directory": "packages/styled",
69+
"changeProcessCWD": true
6670
}
6771
],
6872
"editor.codeActionsOnSave": {

.yarn/releases/yarn-berry.cjs .yarn/releases/yarn-2.4.2.cjs

+5-5
Large diffs are not rendered by default.

.yarnrc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ plugins:
66
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
77
spec: "@yarnpkg/plugin-interactive-tools"
88

9-
yarnPath: .yarn/releases/yarn-berry.cjs
9+
yarnPath: .yarn/releases/yarn-2.4.2.cjs

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@
3232
| 📦 [`@rocket.chat/peggy-loader`](/packages/@rocket.chat/peggy-loader) | Peggy loader for webpack | ![npm](https://img.shields.io/npm/v/@rocket.chat/peggy-loader?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fpeggy-loader&style=flat-square) |
3333
| 📦 [`@rocket.chat/prettier-config`](/packages/@rocket.chat/prettier-config) | Prettier configuration for Rocket.Chat repositories | ![npm](https://img.shields.io/npm/v/@rocket.chat/prettier-config?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fprettier-config&style=flat-square) |
3434
| 📦 [`@rocket.chat/string-helpers`](/packages/@rocket.chat/string-helpers) | Helper functions for string manipulation | ![npm](https://img.shields.io/npm/v/@rocket.chat/string-helpers?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fstring-helpers&style=flat-square) |
35+
| 📦 [`@rocket.chat/styled`](/packages/@rocket.chat/styled) | A simple styled API for React components | ![npm](https://img.shields.io/npm/v/@rocket.chat/styled?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fstyled&style=flat-square) |
3536
| 📦 [`@rocket.chat/ui-kit`](/packages/@rocket.chat/ui-kit) | Interactive UI elements for Rocket.Chat Apps | ![npm](https://img.shields.io/npm/v/@rocket.chat/ui-kit?style=flat-square) | ![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2Fui-kit&style=flat-square) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
to: packages/<%=package%>/.eslintignore
3+
---
4+
/node_modules
5+
/dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
to: packages/<%=package%>/.eslintrc.js
3+
---
4+
module.exports = {
5+
extends: '@rocket.chat/eslint-config-alt/typescript',
6+
env: {
7+
jest: true,
8+
},
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
to: packages/<%=package%>/.gitignore
3+
---
4+
/dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
to: packages/<%=package%>/.lintstagedrc.json
3+
---
4+
{
5+
"src/**/*.{js,ts}": [
6+
"yarn eslint --fix --"
7+
]
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
to: packages/<%=package%>/.prettierignore
3+
---
4+
/node_modules
5+
/dist
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
to: packages/<%=package%>/.prettierrc.js
3+
---
4+
module.exports = require('@rocket.chat/prettier-config/fuselage');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
to: packages/<%=package%>/CHANGELOG.md
3+
---
4+
# Change Log
5+
6+
All notable changes to this project will be documented in this file.
7+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
to: packages/<%=package%>/README.md
3+
---
4+
5+
<!--header-->
6+
7+
<p align="center">
8+
<a href="https://rocket.chat" title="Rocket.Chat">
9+
<img src="https://github.com/RocketChat/Rocket.Chat.Artwork/raw/master/Logos/2020/png/logo-horizontal-red.png" alt="Rocket.Chat" />
10+
</a>
11+
</p>
12+
13+
# `@rocket.chat/<%=package%>`
14+
15+
> <%=description%>
16+
17+
---
18+
19+
![npm@latest](https://img.shields.io/npm/v/@rocket.chat/<%=package%>/latest?style=flat-square) ![npm@next](https://img.shields.io/npm/v/@rocket.chat/<%=package%>/next?style=flat-square) ![npm downloads](https://img.shields.io/npm/dw/@rocket.chat/<%=package%>?style=flat-square) ![License: MIT](https://img.shields.io/npm/l/@rocket.chat/<%=package%>?style=flat-square)
20+
21+
![deps](https://img.shields.io/david/RocketChat/Rocket.Chat.Fuselage?path=packages%2F<%=package%>&style=flat-square) ![peer deps](https://img.shields.io/david/peer/RocketChat/Rocket.Chat.Fuselage?path=packages%2F<%=package%>&style=flat-square) ![dev deps](https://img.shields.io/david/dev/RocketChat/Rocket.Chat.Fuselage?path=packages%2F<%=package%>&style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/min/@rocket.chat/<%=package%>?style=flat-square)
22+
23+
<!--/header-->
24+
25+
## Install
26+
27+
<!--install-->
28+
29+
Add `@rocket.chat/<%=package%>` as a dependency:
30+
31+
```sh
32+
npm i @rocket.chat/<%=package%>
33+
34+
# or, if you are using yarn:
35+
36+
yarn add @rocket.chat/<%=package%>
37+
```
38+
39+
<!--/install-->
40+
41+
## Contributing
42+
43+
<!--contributing(msg)-->
44+
45+
Contributions, issues, and feature requests are welcome!<br />
46+
Feel free to check the [issues](https://github.com/RocketChat/Rocket.Chat.Fuselage/issues).
47+
48+
<!--/contributing(msg)-->
49+
50+
### Building
51+
52+
As this package dependends on others in this monorepo, before anything run the following at the root directory:
53+
54+
<!--yarn(build)-->
55+
56+
```sh
57+
yarn build
58+
```
59+
60+
<!--/yarn(build)-->
61+
62+
### Linting
63+
64+
To ensure the source is matching our coding style, we perform [linting](<https://en.wikipedia.org/wiki/Lint_(software)>).
65+
Before commiting, check if your code fits our style by running:
66+
67+
<!--yarn(lint)-->
68+
69+
```sh
70+
yarn lint
71+
```
72+
73+
<!--/yarn(lint)-->
74+
75+
Some linter warnings and errors can be automatically fixed:
76+
77+
<!--yarn(lint-fix)-->
78+
79+
```sh
80+
yarn lint-fix
81+
```
82+
83+
<!--/yarn(lint-fix)-->
84+
85+
### Running tests
86+
87+
Whenever possible, add tests to describe exactly what your code do. You can run them by yourself:
88+
89+
<!--yarn(test)-->
90+
91+
```sh
92+
yarn test
93+
```
94+
95+
<!--/yarn(test)-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
to: packages/<%=package%>/jest.config.js
3+
---
4+
module.exports = {
5+
preset: 'ts-jest',
6+
errorOnDeprecated: true,
7+
testMatch: ['<rootDir>/src/**/*.spec.ts'],
8+
globals: {
9+
'ts-jest': {
10+
tsconfig: {
11+
noUnusedLocals: false,
12+
noUnusedParameters: false,
13+
},
14+
},
15+
},
16+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
to: packages/<%=package%>/package.json
3+
---
4+
{
5+
"name": "@rocket.chat/<%=package%>",
6+
"version": "<%=version%>",
7+
"description": "<%=description%>",
8+
"author": {
9+
"name": "Rocket.Chat",
10+
"url": "https://rocket.chat/"
11+
},
12+
"homepage": "https://github.com/RocketChat/Rocket.Chat.Fuselage#readme",
13+
"license": "MIT",
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "git+https://github.com/RocketChat/Rocket.Chat.Fuselage.git",
20+
"directory": "packages/<%=package%>"
21+
},
22+
"bugs": {
23+
"url": "https://github.com/RocketChat/Rocket.Chat.Fuselage/issues"
24+
},
25+
"main": "dist/cjs/index.js",
26+
"module": "dist/esm/index.js",
27+
"types": "dist/esm/index.d.ts",
28+
"typesVersions": {
29+
"<4.1": {
30+
"*": [
31+
"dist/ts3.4/*"
32+
]
33+
}
34+
},
35+
"files": [
36+
"/dist"
37+
],
38+
"scripts": {
39+
"build": "run-s .:build:clean .:build:esm .:build:cjs .:build:ts3.4",
40+
".:build:clean": "rimraf dist",
41+
".:build:esm": "tsc -p tsconfig-esm.json",
42+
".:build:cjs": "tsc -p tsconfig-cjs.json",
43+
".:build:ts3.4": "downlevel-dts dist/esm/ dist/ts3.4/ --to=3.4",
44+
"lint": "eslint src",
45+
"lint-fix": "eslint --fix src",
46+
"lint-staged": "lint-staged",
47+
"test": "jest --runInBand",
48+
"docs": "typedoc"
49+
},
50+
"devDependencies": {
51+
"@rocket.chat/eslint-config-alt": "^0.27.0",
52+
"@rocket.chat/prettier-config": "^0.27.0",
53+
"@types/jest": "^26.0.23",
54+
"downlevel-dts": "^0.7.0",
55+
"eslint": "^7.26.0",
56+
"jest": "^26.6.3",
57+
"lint-staged": "^11.0.0",
58+
"npm-run-all": "^4.1.5",
59+
"prettier": "^2.2.1",
60+
"rimraf": "^3.0.2",
61+
"ts-jest": "^26.5.6",
62+
"typedoc": "^0.20.36",
63+
"typescript": "^4.2.4"
64+
},
65+
"dependencies": {
66+
"tslib": "^2.2.0"
67+
}
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
to: packages/<%=package%>/src/index.ts
3+
---
4+
export default undefined;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
to: packages/<%=package%>/tsconfig-cjs.json
3+
---
4+
{
5+
"extends": "./tsconfig.json",
6+
"compilerOptions": {
7+
"module": "commonjs",
8+
"outDir": "./dist/cjs"
9+
},
10+
"exclude": ["**/*.spec.ts"]
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
to: packages/<%=package%>/tsconfig-esm.json
3+
---
4+
{
5+
"extends": "./tsconfig.json",
6+
"exclude": ["**/*.spec.ts"]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
to: packages/<%=package%>/tsconfig.json
3+
---
4+
{
5+
"compilerOptions": {
6+
"target": "es5",
7+
"module": "ESNext",
8+
"declaration": true,
9+
"declarationMap": true,
10+
"sourceMap": true,
11+
"outDir": "./dist/esm",
12+
"strict": true,
13+
"esModuleInterop": true,
14+
"skipLibCheck": true,
15+
"forceConsistentCasingInFileNames": true,
16+
"moduleResolution": "node",
17+
"resolveJsonModule": true
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
to: packages/<%=package%>/typedoc.json
3+
---
4+
{
5+
"entryPoints": [
6+
"src/index.ts"
7+
],
8+
"out": "../../static/<%=package%>"
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const fs = require("fs");
2+
3+
module.exports = {
4+
prompt: async ({ prompter, args }) => {
5+
const { package } = await prompter.prompt({
6+
type: "input",
7+
name: "package",
8+
message: "What's the package name?",
9+
});
10+
11+
const { description } = await prompter.prompt({
12+
type: "input",
13+
name: "description",
14+
message: "What's the package description?",
15+
});
16+
17+
let { version } = JSON.parse(await fs.promises.readFile("lerna.json"));
18+
19+
({ version } = await prompter.prompt({
20+
type: "input",
21+
name: "version",
22+
default: version,
23+
message: "What's the package version?",
24+
}));
25+
26+
const settings = JSON.parse(
27+
await fs.promises.readFile(".vscode/settings.json")
28+
);
29+
settings["eslint.workingDirectories"].push({
30+
directory: `packages/${package}`,
31+
changeProcessCWD: true,
32+
});
33+
await fs.promises.writeFile(
34+
".vscode/settings.json",
35+
JSON.stringify(settings, null, 2),
36+
"utf-8"
37+
);
38+
39+
return {
40+
package,
41+
description,
42+
version,
43+
};
44+
},
45+
};

_templates/generator/help/index.ejs.t

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
message: |
3+
hygen {bold generator new} --name [NAME] --action [ACTION]
4+
hygen {bold generator with-prompt} --name [NAME] --action [ACTION]
5+
---

_templates/generator/new/hello.ejs.t

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t
3+
---
4+
---
5+
to: app/hello.js
6+
---
7+
const hello = ```
8+
Hello!
9+
This is your first hygen template.
10+
11+
Learn what it can do here:
12+
13+
https://github.com/jondot/hygen
14+
```
15+
16+
console.log(hello)
17+
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t
3+
---
4+
---
5+
to: app/hello.js
6+
---
7+
const hello = ```
8+
Hello!
9+
This is your first prompt based hygen template.
10+
11+
Learn what it can do here:
12+
13+
https://github.com/jondot/hygen
14+
```
15+
16+
console.log(hello)
17+
18+

0 commit comments

Comments
 (0)