olum-compiler 1.6.0 → 1.6.2

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/README.md CHANGED
@@ -6,4 +6,4 @@
6
6
  </p>
7
7
 
8
8
  # Olum-Compiler
9
- See [Documentation](https://olumjs.github.io/docs)
9
+ See [Documentation](https://olumjs.top/docs)
package/bin/index.js CHANGED
@@ -1,11 +1,13 @@
1
+ #!/usr/bin/env node
1
2
  const path = require("path");
2
3
  const spawn = require("../lib/cross-spawn");
3
4
  const script = process.argv[2];
4
5
 
5
6
  if (script == "dev") process.env.NODE_ENV = "development";
6
- else if (script == "build") process.env.NODE_ENV = "production";
7
+ else if (["build", "start"].includes(script))
8
+ process.env.NODE_ENV = "production";
7
9
 
8
- if (typeof script !== undefined && ["dev", "build"].includes(script)) {
10
+ if (typeof script !== undefined && ["dev", "build", "start"].includes(script)) {
9
11
  const result = spawn.sync("node", [path.resolve(__dirname, script + ".js")], {
10
12
  stdio: "inherit",
11
13
  });
package/bin/server.js CHANGED
@@ -40,7 +40,7 @@ function getPath(entry, url) {
40
40
  return null;
41
41
  }
42
42
 
43
- function serve(entry, port) {
43
+ function serve(entry, port, mode = "development") {
44
44
  return new Promise((resolve, reject) => {
45
45
  const PORT = Number(port || process.env.PORT || 3000);
46
46
 
@@ -60,8 +60,10 @@ function serve(entry, port) {
60
60
  }
61
61
  const dom = new jsdom.JSDOM(content.toString()).window.document;
62
62
  const html = dom.querySelector("html");
63
- const wsContent = handleWsFile();
64
- dom.body.insertAdjacentHTML("beforeend", wsContent);
63
+ if (mode == "development") {
64
+ const wsContent = handleWsFile();
65
+ dom.body.insertAdjacentHTML("beforeend", wsContent);
66
+ }
65
67
  res.writeHead(200, {
66
68
  "content-type": "text/html",
67
69
  "cache-control": "no-cache",
package/bin/start.js ADDED
@@ -0,0 +1,20 @@
1
+ const serve = require("./server");
2
+ const colors = require("../lib/colors");
3
+ const path = require("path");
4
+
5
+ const cwd = process.cwd();
6
+ const root = cwd.replace(/\/module$/, "");
7
+ const outDir = path.resolve(root, "dist");
8
+
9
+ serve(outDir, undefined, "production").then(({ server, PORT, log }) => {
10
+ const bootAt = Date.now();
11
+ server.on("error", (e) => {
12
+ if (e.code === "EADDRINUSE") server.listen(++PORT);
13
+ });
14
+ server.listen(PORT, () =>
15
+ console.log(
16
+ log.replace(/port \d+/, "port " + PORT),
17
+ colors("white", `(ready in ${Date.now() - bootAt}ms)`),
18
+ ),
19
+ );
20
+ });
package/lib/changes.txt CHANGED
@@ -0,0 +1,2 @@
1
+ change /home/eissapk/olum/template-compiler/src/page.html
2
+ change /home/eissapk/olum/template-compiler/src/page.html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olum-compiler",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "A module for compiling/bundling olumjs projects",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -1,13 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run *)",
5
- "Bash(cd *)",
6
- "Bash(echo \"exit: $?\")",
7
- "Bash(git add *)",
8
- "Bash(git commit *)",
9
- "Bash(git check-ignore *)",
10
- "Bash(git reset *)"
11
- ]
12
- }
13
- }