rsf-zero 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/start.d.ts.map +1 -1
- package/dist/cli/start.js +2 -1
- package/dist/cli/utils.d.ts +2 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +21 -0
- package/dist/cli.js +2 -0
- package/dist/options.d.ts +0 -4
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +10 -16
- package/package.json +1 -1
package/dist/cli/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/cli/start.ts"],"names":[],"mappings":"AAGA,OAAO,eAAe,CAAC;AAIvB,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/cli/start.ts"],"names":[],"mappings":"AAGA,OAAO,eAAe,CAAC;AAIvB,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAIlD,eAAO,MAAM,KAAK,GAAU,SAAS,cAAc,kBAyBlD,CAAA"}
|
package/dist/cli/start.js
CHANGED
|
@@ -11,6 +11,7 @@ import express from "express";
|
|
|
11
11
|
import morgan from "morgan";
|
|
12
12
|
import "dotenv/config";
|
|
13
13
|
import { createActionRoute } from "./start/createActionRoute.js";
|
|
14
|
+
import { debug } from "../debug.js";
|
|
14
15
|
export const start = async (options) => {
|
|
15
16
|
const app = express();
|
|
16
17
|
const port = 3000;
|
|
@@ -18,7 +19,7 @@ export const start = async (options) => {
|
|
|
18
19
|
app.use(express.json());
|
|
19
20
|
// Client
|
|
20
21
|
const staticPath = path.join(process.cwd(), 'dist/client/');
|
|
21
|
-
|
|
22
|
+
debug('Serving static files from: ' + staticPath);
|
|
22
23
|
app.use(express.static('dist/client/', options.startStatic ?? {}));
|
|
23
24
|
// Server
|
|
24
25
|
// - create action route
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,YAsBlB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
export const banner = () => {
|
|
3
|
+
const pkgUrl = new URL('../../package.json', import.meta.url);
|
|
4
|
+
const pkg = JSON.parse(fs.readFileSync(pkgUrl, 'utf-8'));
|
|
5
|
+
const version = pkg.version ?? 'dev';
|
|
6
|
+
console.log(`
|
|
7
|
+
___ ___ ___ ___ ___ ___ ___
|
|
8
|
+
/ /\\ / /\\ / /\\ / /\\ / /\\ / /\\ / /\\
|
|
9
|
+
/ /::\\ / /:/_ / /:/_ / /::| / /:/_ / /::\\ / /::\\
|
|
10
|
+
/ /:/\\:\\ / /:/ /\\ / /:/ /\\ / /:/:| / /:/ /\\ / /:/\\:\\ / /:/\\:\\
|
|
11
|
+
/ /:/~/:/ / /:/ /::\\ / /:/ /:/ / /:/|:|__ / /:/ /:/_ / /:/~/:/ / /:/ \\:\\
|
|
12
|
+
/__/:/ /:/___ /__/:/ /:/\\:\\ /__/:/ /:/ /__/:/ |:| /\\ /__/:/ /:/ /\\ /__/:/ /:/___ /__/:/ \\__\\:\\
|
|
13
|
+
\\ \\:\\/:::::/ \\ \\:\\/:/~/:/ \\ \\:\\/:/ \\__\\/ |:|/:/ \\ \\:\\/:/ /:/ \\ \\:\\/:::::/ \\ \\:\\ / /:/
|
|
14
|
+
\\ \\::/~~~~ \\ \\::/ /:/ \\ \\::/ | |:/:/ \\ \\::/ /:/ \\ \\::/~~~~ \\ \\:\\ /:/
|
|
15
|
+
\\ \\:\\ \\__\\/ /:/ \\ \\:\\ | |::/ \\ \\:\\/:/ \\ \\:\\ \\ \\:\\/:/
|
|
16
|
+
\\ \\:\\ /__/:/ \\ \\:\\ | |:/ \\ \\::/ \\ \\:\\ \\ \\::/
|
|
17
|
+
\\__\\/ \\__\\/ \\__\\/ |__|/ \\__\\/ \\__\\/ \\__\\/
|
|
18
|
+
|
|
19
|
+
[1m[36mRSF Zero[0m v${version}
|
|
20
|
+
`);
|
|
21
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -3,8 +3,10 @@ import { dev } from "./cli/dev.js";
|
|
|
3
3
|
import { build } from "./cli/build.js";
|
|
4
4
|
import { start } from "./cli/start.js";
|
|
5
5
|
import { loadOptions } from "./options.js";
|
|
6
|
+
import { banner } from "./cli/utils.js";
|
|
6
7
|
const args = process.argv.slice(2);
|
|
7
8
|
const command = args[0];
|
|
9
|
+
banner();
|
|
8
10
|
const options = await loadOptions();
|
|
9
11
|
if (command === 'dev') {
|
|
10
12
|
await dev();
|
package/dist/options.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { RsfZeroOptions } from "./export-types.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Locate rsf0-config.js in the current project root (process.cwd()).
|
|
4
|
-
*/
|
|
5
|
-
export declare function findOptionsFile(cwd?: string): string | null;
|
|
6
2
|
/**
|
|
7
3
|
* Load RSF options from rsf0-config.js at project root.
|
|
8
4
|
* Returns an empty object if no file is found or on safe failure.
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAenD;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC,CAoB3D"}
|
package/dist/options.js
CHANGED
|
@@ -13,13 +13,6 @@ import { debug } from "./debug.js";
|
|
|
13
13
|
const defaultOptions = {
|
|
14
14
|
startStatic: {},
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Locate rsf0-config.js in the current project root (process.cwd()).
|
|
18
|
-
*/
|
|
19
|
-
export function findOptionsFile(cwd = process.cwd()) {
|
|
20
|
-
const jsPath = path.join(cwd, 'rsf0-config.js');
|
|
21
|
-
return fs.existsSync(jsPath) ? jsPath : null;
|
|
22
|
-
}
|
|
23
16
|
/**
|
|
24
17
|
* Dynamically import a JS module by absolute file path.
|
|
25
18
|
*/
|
|
@@ -32,21 +25,22 @@ async function importJsModule(absPath) {
|
|
|
32
25
|
* Returns an empty object if no file is found or on safe failure.
|
|
33
26
|
*/
|
|
34
27
|
export async function loadOptions() {
|
|
35
|
-
const configPath =
|
|
36
|
-
if (!configPath)
|
|
37
|
-
|
|
28
|
+
const configPath = path.join(process.cwd(), 'rsf0-config.js');
|
|
29
|
+
if (!fs.existsSync(configPath)) {
|
|
30
|
+
debug('No config file found at: ' + configPath);
|
|
31
|
+
return defaultOptions;
|
|
32
|
+
}
|
|
38
33
|
try {
|
|
39
34
|
const mod = await importJsModule(configPath);
|
|
40
|
-
const options = (mod &&
|
|
35
|
+
const options = (mod && mod.default);
|
|
41
36
|
if (options && typeof options === 'object') {
|
|
42
|
-
debug('
|
|
37
|
+
debug('Config loaded: ' + configPath);
|
|
43
38
|
return options;
|
|
44
39
|
}
|
|
45
|
-
|
|
40
|
+
throw new Error('Invalid');
|
|
46
41
|
}
|
|
47
42
|
catch (err) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return defaultOptions;
|
|
43
|
+
console.log('Rsf Zero Error: Invalid config file at: ' + configPath);
|
|
44
|
+
throw err;
|
|
51
45
|
}
|
|
52
46
|
}
|
package/package.json
CHANGED