Skip to content

Commit 880d89e

Browse files
authored
v1.8.0 (#7)
* v1.7.2 * react version from 18.2.0 -> 18.3.1 * 1.8.0 * v1.8.0
1 parent 13833b9 commit 880d89e

File tree

7 files changed

+104
-87
lines changed

7 files changed

+104
-87
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ versions
1515
archive
1616
node_modules/
1717
flow/
18+
tests
19+
plugins/esbuild-svelte
20+
sergeant_create_app

CLI_ANNOUNCE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# v1.8.0 port RangeStart can be specified via --port for serving apps
2+
# v1.7.2 *NEW*
13
# v1.7.1 Do: sergeant create app_builder myawesomeapp
24
# v1.7.0 Added windows support. Stable version.
35
# v1.6.0 Support for data: svg url import resolution Stable version

README.md

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
# About Sergeant
22

3-
A lightweight micro-services producing deno-[p]react SSG-first SEO-friendly framework.
3+
A lightweight micro-services producing deno-[p]react SSG-first SEO-friendly
4+
framework.
45

5-
For a new era of frontend development with NO node_modules (Save GB+ files on disk).
6+
For a new era of frontend development with NO node_modules (Save GB+ files on
7+
disk).
68

7-
+ Produces bundles within seconds for 100s of apps.
8-
+ Cross-compile from multiple projects
9-
+ Supports scss
10-
+ Scaffolding
11-
+ Has livereload
12-
+ denocacheusage: 10MB only, bundle sizes less than 20KB (if u use preact), and 200KB for react.
9+
- Produces bundles within seconds for 100s of apps.
10+
- Cross-compile from multiple projects
11+
- Supports scss
12+
- Scaffolding
13+
- Has livereload
14+
- denocacheusage: 10MB only, bundle sizes less than 20KB (if u use preact), and
15+
200KB for react.
1316

1417
Compare this with 200MB-400MB node_modules for a react hello world project.
1518

1619
Finally, you can `rimraf node_modules`.
1720

1821
# Sergeant is production ready from Day-1
1922

20-
✨ Sergeant 🫡 A front-end microservices framework!
23+
✨ Sergeant 🫡 A front-end microservices framework!
2124

2225
```
2326
███████╗███████╗██████╗ ██████╗ ███████╗ █████╗ ███╗ ██╗████████╗
@@ -52,15 +55,18 @@ Done
5255
```
5356

5457
## Philosophy
58+
5559
1. No breaking changes (versioned imports)
5660
2. SSG over SSR
5761
3. Always bundle to one-file for 1-SPA
5862

5963
### More...
64+
6065
4. Support bundling multiple apps, SPAs via micro-services / app-routing
6166
5. Support progressive and offline apps
6267

6368
# Commands
69+
6470
```
6571
sergeant
6672
sergeant build
@@ -69,64 +75,71 @@ sergeant serve --dev
6975
```
7076

7177
# Install
78+
7279
Only need deno to install sergeant (esbuild is automatically imported):
7380

7481
## sergeant
7582

7683
```
77-
deno install -A -f https://cdn.jsdelivr.net/gh/scriptmaster/sergeant@1.7.1/sergeant.ts
84+
deno install -A -f https://cdn.jsdelivr.net/gh/scriptmaster/sergeant@1.8.0/sergeant.ts
7885
```
7986

8087
Only need deno and sergeant and you can do `sergeant` or `sergeant serve`
8188

8289
### Build All apps:
90+
8391
`sergeant build`
8492

8593
### Live Dev Server all apps:
86-
`sergeant serve`
8794

95+
`sergeant serve`
8896

8997
### Build specific app:
98+
9099
`sergeant build`
91100

92101
### Live Dev Server specific app:
93-
`sergeant serve`
94102

103+
`sergeant serve`
95104

96105
## Installing Deno
106+
97107
https://docs.deno.com/runtime/manual/getting_started/installation
98108

99-
### Windows x64:
100-
Using PowerShell (Windows):
101-
irm https://deno.land/install.ps1 | iex
109+
### Windows x64:
110+
111+
Using PowerShell (Windows): irm https://deno.land/install.ps1 | iex
102112

103113
#### Or Using Chocolatey:
114+
104115
choco install deno
105116

106117
### MacOS: brew install deno
107118

108-
109119
# Deno Plugins:
110-
Uses:
111-
https://github.com/scriptmaster/esbuild_deno_loader
120+
121+
Uses: https://github.com/scriptmaster/esbuild_deno_loader
112122
https://deno.land/x/esbuild_plugin_sass_deno
113123
https://github.com/esbuild/community-plugins#plugins-for-deno
114124

115125
# Security of packages
116126

117127
How packages are downloaded?
118128

119-
Packages are primarily downloaded as ESM modules from https://esm.sh/package/ (instead of registry.npmjs.org).
120-
+ It can be swapped to use enterprise ESM packages repository.
121-
+ Packages
129+
Packages are primarily downloaded as ESM modules from https://esm.sh/package/
130+
(instead of registry.npmjs.org).
122131

123-
The package can be looked up in ./vendor/ and ./node_modules/ in the format mod.ts index.mjs index.cjs index.js
132+
- It can be swapped to use enterprise ESM packages repository.
133+
- Packages
124134

135+
The package can be looked up in ./vendor/ and ./node_modules/ in the format
136+
mod.ts index.mjs index.cjs index.js
125137

126138
# DI
127139

128-
React Context API is an incorrect implementation of a simple DI with prop drilling.
129-
In apps containing 20+ dependencies to provider, the context pattern could become 20+ nested nodes.
140+
React Context API is an incorrect implementation of a simple DI with prop
141+
drilling. In apps containing 20+ dependencies to provider, the context pattern
142+
could become 20+ nested nodes.
130143

131144
DI enables you to directly provide the service/implementation for the consumer.
132145

@@ -136,12 +149,12 @@ Extra watch dirs
136149

137150
Create app level deno.json and configure watching extra deps:
138151

139-
{
140-
"watch": "emeraldcss"
141-
}
152+
{ "watch": "emeraldcss" }
142153

143154
# mithril
144-
if an app dir contains mithril dir, its files (i.e., apps/appname/mithril/*.html or src/mithril/*.html) will be compiled as mithril files.
155+
156+
if an app dir contains mithril dir, its files (i.e., apps/appname/mithril/_.html
157+
or src/mithril/_.html) will be compiled as mithril files.
145158

146159
# web framework
147160

apps/app_joy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit c97d003fa9de8778218cdf79dee0c501214583eb

deno.json

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
{
2-
"imports": {
3-
"react": "https://esm.sh/react@18.2.0?prod",
4-
"react-dom": "https://esm.sh/react-dom@18.2.0?prod",
5-
"preact": "https://esm.sh/preact@10.17.1",
6-
"preact-router": "https://esm.sh/preact-router@4.1.2",
7-
"preact-render-to-string/jsx": "https://esm.sh/preact-render-to-string@6.2.1/jsx",
8-
"@preact/compat": "https://esm.sh/@preact/compat@17.1.2",
9-
"react-redux": "./vendor/github.com/react-redux/src/index.ts",
10-
"vue": "https://esm.sh/vue@3.3.4",
11-
"d3": "https://esm.sh/d3@7.8.5",
12-
"emeraldcss": "https://unpkg.com/emeraldcss@1.0.1",
13-
"emeraldcss/": "https://unpkg.com/emeraldcss@1.0.1/",
14-
"antd": "https://esm.sh/antd",
15-
"@angular/cli": "https://esm.sh/@angular/cli",
16-
"vendor": "https://esm.sh/vendor",
17-
"react-router-dom": "https://esm.sh/react-router-dom"
18-
},
19-
"compilerOptions": {
20-
"jsx": "react-jsx"
21-
},
22-
"tasks": {
23-
"build": "deno run -A sergeant.ts",
24-
"install": "deno install -A -f -n sergeant sergeant.ts",
25-
"install_vendor": "deno install -A -f -n vendor vendor.ts",
26-
"debug": "deno run -A sergeant.ts nn",
27-
"ssg": "deno task build ssg; denoliver dist/ssg/static/ -p 3300"
28-
},
29-
"deploy": {
30-
"project": "8ced75ac-cfa0-4a9b-9783-c8a8e1b3aaf9",
31-
"exclude": [
32-
"**/node_modules"
33-
],
34-
"entrypoint": "https://deno.land/std@0.217.0/http/file_server.ts"
35-
}
36-
}
2+
"imports": {
3+
"react": "https://esm.sh/react@18.3.1",
4+
"react-dom": "https://esm.sh/react-dom@18.3.1",
5+
"react-dom/": "https://esm.sh/react-dom@18.3.1/",
6+
"preact": "https://esm.sh/preact@10.17.1",
7+
"preact-router": "https://esm.sh/preact-router@4.1.2",
8+
"preact-render-to-string/jsx": "https://esm.sh/preact-render-to-string@6.2.1/jsx",
9+
"@preact/compat": "https://esm.sh/@preact/compat@17.1.2",
10+
"react-redux": "./vendor/github.com/react-redux/src/index.ts",
11+
"vue": "https://esm.sh/vue@3.3.4",
12+
"d3": "https://esm.sh/d3@7.8.5",
13+
"emeraldcss": "https://unpkg.com/emeraldcss@1.0.1",
14+
"emeraldcss/": "https://unpkg.com/emeraldcss@1.0.1/",
15+
"antd": "https://esm.sh/antd",
16+
"@angular/cli": "https://esm.sh/@angular/cli",
17+
"vendor": "https://esm.sh/vendor",
18+
"react-router-dom": "https://esm.sh/react-router-dom"
19+
},
20+
"compilerOptions": {
21+
"jsx": "react-jsx"
22+
},
23+
"tasks": {
24+
"build": "deno run -A sergeant.ts",
25+
"install": "deno install -A -f -n sergeant sergeant.ts",
26+
"install_vendor": "deno install -A -f -n vendor vendor.ts",
27+
"debug": "deno run -A sergeant.ts nn",
28+
"ssg": "deno task build ssg; denoliver dist/ssg/static/ -p 3300"
29+
},
30+
"deploy": {
31+
"project": "8ced75ac-cfa0-4a9b-9783-c8a8e1b3aaf9",
32+
"exclude": [
33+
"**/node_modules"
34+
],
35+
"entrypoint": "https://deno.land/std@0.217.0/http/file_server.ts"
36+
}
37+
}

deno.lock

Lines changed: 2 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sergeant.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ import {
5656
// To get started:
5757
// deno install -f -A sergeant.ts; sergeant serve
5858

59-
const portRangeStart = 3000;
60-
const VERSION = "v1.7.2";
59+
const port = { RangeStart: 3000 };
60+
const VERSION = "v1.8.0";
6161
const ESBUILD_MODE = Deno.env.get("ESBUILD_PLATFORM") ||
6262
Deno.env.get("ESBUILD_MODE") || "neutral";
6363
const ESBUILD_FORMAT = Deno.env.get("ESBUILD_FORMAT") || "esm";
@@ -266,14 +266,28 @@ async function buildApps(appName = "") {
266266
}
267267

268268
async function serveApps(appName: string) {
269+
if (args.includes("--port")) {
270+
const portIndex = args.indexOf("--port");
271+
if (args[portIndex + 1] && parseInt(args[portIndex + 1], 10)) {
272+
port.RangeStart = parseInt(args[portIndex + 1], 10);
273+
// console.log("port RangeStart:", port.RangeStart);
274+
}
275+
}
276+
if (args.includes("-p")) {
277+
const portIndex = args.indexOf("-p");
278+
if (args[portIndex + 1] && parseInt(args[portIndex + 1], 10)) {
279+
port.RangeStart = parseInt(args[portIndex + 1], 10);
280+
// console.log("port RangeStart:", port.RangeStart);
281+
}
282+
}
269283
if (appName && appName[0] != "-") { //do not mistake for a flag like: --dev
270284
if (!existsSync(app(appName))) {
271285
return console.log("No such app: ", app(appName));
272286
}
273-
return await serveRefresh(appName, portRangeStart);
287+
return await serveRefresh(appName, port.RangeStart);
274288
} else if (appsDir == "src") {
275289
console.log("Serving .");
276-
await serveRefresh(".", portRangeStart);
290+
await serveRefresh(".", port.RangeStart);
277291
return;
278292
}
279293

@@ -283,7 +297,7 @@ async function serveApps(appName: string) {
283297
for await (const dirEntry of Deno.readDir(appsDir)) {
284298
if (dirEntry.isDirectory && dirEntry.name[0] != ".") {
285299
// const appDir = join(appsDir, dirEntry.name);
286-
await serveRefresh(dirEntry.name, portRangeStart + servers);
300+
await serveRefresh(dirEntry.name, port.RangeStart + servers);
287301
servers++;
288302
}
289303
}

0 commit comments

Comments
 (0)