Skip to content

Commit 8c8f97e

Browse files
committed
v1.4.0
1 parent 63341d1 commit 8c8f97e

File tree

7 files changed

+139
-17
lines changed

7 files changed

+139
-17
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
matrix:
1111
node:
1212
- 18
13-
- 19
1413
- 20
1514
os:
1615
- ubuntu-latest

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## [Unreleased][unreleased]
44

5+
## [1.4.0][] - 2024-03-18
6+
7+
- Packages update
8+
- Makefile actions runner
9+
- Default export hack for ESM support
10+
- Removed support of Nodejs v19
11+
- Documentation for ./dist folder
12+
513
## [1.3.0][] - 2023-11-26
614

715
- Packages update
@@ -30,8 +38,10 @@
3038
- Stable release version
3139
- Repository created
3240

33-
[unreleased]: https://github.com/astrohelm/workspace/compare/v1.2.0...HEAD
34-
[1.1.1]: https://github.com/astrohelm/workspace/compare/v1.1.1...v1.2.0
41+
[unreleased]: https://github.com/astrohelm/workspace/compare/v1.4.0...HEAD
42+
[1.4.0]: https://github.com/astrohelm/workspace/compare/v1.3.0...v1.4.0
43+
[1.3.0]: https://github.com/astrohelm/workspace/compare/v1.2.0...v1.3.0
44+
[1.2.0]: https://github.com/astrohelm/workspace/compare/v1.1.1...v1.2.0
3545
[1.1.1]: https://github.com/astrohelm/workspace/compare/v1.1.0...v1.1.1
3646
[1.1.0]: https://github.com/astrohelm/workspace/compare/release...v1.1.0
3747
[1.0.0]: https://github.com/astrohelm/workspace/releases/tag/release

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ message = First commit
55
data = data
66
repo = workspace
77

8+
actions:
9+
act -q
10+
811
search-strings:
912
grep -Hrn '${search}' ${path}
1013

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,16 @@ Congratulations, package initialized 🚀
149149

150150
This workspace have commonjs in use by default. You can switch it in package.json if you want.
151151

152-
- `dist` directory used for fronted package analog. You can use it if your package is multi-platform
153-
based.
152+
- `dist` directory used for fronted package analog. You can use it if your package is
153+
multi-platform, [readme](./dist/README.md).
154154
- `eslint` astrohelm eslint rules
155155
- `types` .d.ts library types exports
156156
- `CHANGELOG.md` in use for project history documentation
157157
- `Makefile` ultimate commands shortcuts creator
158158
- `tests` here you can put all test coverage of your package
159159
- `.github` github ci pipeline by default
160-
- `lib` folder should contain all you library logic, _WARNING !_ Remove if you not writing library.
161-
Replace with src folder.
160+
- `lib` folder should contain all you library logic,**_WARNING !_** Remove if you not writing
161+
library. Replace with **src** folder.
162162

163163
<h2 align="center">Copyright & contributors</h2>
164164

dist/README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# How to setup workspace with builder
2+
3+
> [!TIP]
4+
>
5+
> In this example we will create workspace for frontend / backend library;
6+
> This library would be accessible from any browser & nodejs.
7+
8+
9+
## Install rollup:
10+
11+
Also we install here dependency for rollup that will transliterate our commonjs modules to esm.
12+
13+
14+
```bash
15+
npm i -D rollup @rollup/plugin-commonjs
16+
```
17+
18+
## Creating gateway file:
19+
20+
> [!IMPORTANT]
21+
>
22+
> Before we will create our config - i want to create special file for exports regulation.
23+
> You can skip this step and fill input with your **entry point** javascript file.
24+
25+
```js
26+
// ./dist/exports.js
27+
'use strict';
28+
29+
const exp = {
30+
module1: require('./path/to/module1.js'),
31+
module2: require('./path/to/module2.js'),
32+
}
33+
34+
module.exports = exp;
35+
module.exports.default = exp; // For default export
36+
```
37+
38+
## Writing rollup configuration:
39+
40+
> [!IMPORTANT]
41+
>
42+
> Use you own rollup configuration, this configuration should be only your entry point configuration.
43+
> This configuration used to create cross-platform **(browser / nodejs)** libraries.
44+
45+
```js
46+
// ./dist/rollup.config.js
47+
'use strict';
48+
49+
module.exports = {
50+
input: ['./dist/exports.js'], // Our entry point
51+
output: {
52+
file: './dist/index.js',
53+
format: 'es',
54+
},
55+
plugins: [[require('@rollup/plugin-commonjs')()]],
56+
};
57+
```
58+
59+
## Finish moves:
60+
61+
> [!IMPORTANT]
62+
>
63+
> Add build script to your **package.json** file and enjoy.
64+
65+
```json
66+
{
67+
// package.json
68+
// ...
69+
"scripts": {
70+
"build": "rollup -c ./dist/rollup.config.js",
71+
//...
72+
}
73+
}
74+
```
75+
76+
### Result / Testing
77+
78+
> [!IMPORTANT]
79+
>
80+
> If you done all correctly - all should be working.
81+
> You can test it with next bash script:
82+
83+
```bash
84+
npm run build
85+
# Check ./dist folder for results
86+
ls ./dist
87+
# You will see index.js
88+
cat ./dist/index.js
89+
# Your code
90+
# ...
91+
# export { exports as default, module1, module2 }
92+
```
93+
94+
### Optional
95+
96+
> [!IMPORTANT]
97+
>
98+
> If you do all steps with me and want browser support -
99+
> You can add browser exports to your **package.json**.
100+
101+
```json
102+
{
103+
// package.json
104+
// ...
105+
"browser": {
106+
"./index.js": "./dist/index.js",
107+
//...
108+
}
109+
}
110+
```

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
const lib = require('./lib');
44

5-
module.exports = { lib };
5+
module.exports.default = module.exports = lib;

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"license": "MIT",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"type": "commonjs",
55
"name": "astrohelm-workspace",
66
"homepage": "https://astrohelm.ru",
@@ -43,13 +43,13 @@
4343
},
4444

4545
"devDependencies": {
46-
"@types/node": "^20.10.0",
47-
"eslint": "^8.54.0",
48-
"eslint-config-astrohelm": "^1.2.0",
49-
"eslint-config-prettier": "^9.0.0",
50-
"eslint-plugin-import": "^2.29.0",
51-
"eslint-plugin-prettier": "^5.0.1",
52-
"prettier": "^3.1.0",
53-
"typescript": "^5.3.2"
46+
"@types/node": "^20.11.28",
47+
"eslint": "^8.57.0",
48+
"eslint-config-astrohelm": "^1.3.0",
49+
"eslint-config-prettier": "^9.1.0",
50+
"eslint-plugin-import": "^2.29.1",
51+
"eslint-plugin-prettier": "^5.1.3",
52+
"prettier": "^3.2.5",
53+
"typescript": "^5.4.2"
5454
}
5555
}

0 commit comments

Comments
 (0)