create-cubing-app 0.36.0 → 0.36.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.
@@ -7,6 +7,8 @@ import { exit, stderr } from "process";
7
7
  import { createInterface } from "readline";
8
8
  import { promisify } from "util";
9
9
 
10
+ const CREATE_CUBING_APP_PACKAGE_JSON = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf-8"));
11
+
10
12
  function execPromise(cmd, options) {
11
13
  return new Promise((resolve, reject) => {
12
14
  const childProcess = exec(cmd, options, (error, stdout, stderr) => {
@@ -79,8 +81,8 @@ await mkdir(projectPath, { recursive: true });
79
81
  const initialPackageJSON = {
80
82
  type: "module",
81
83
  scripts: {
82
- "build": "node script/build.js",
83
- "dev": "node script/dev.js",
84
+ "build": CREATE_CUBING_APP_PACKAGE_JSON.scripts["build"],
85
+ "dev": CREATE_CUBING_APP_PACKAGE_JSON.scripts["dev"],
84
86
  clean: "rm -rf ./dist",
85
87
  "upgrade-cubing": "npm install --save cubing@latest",
86
88
  },
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "create-cubing-app",
3
- "version": "0.36.0",
3
+ "version": "0.36.2",
4
4
  "type": "module",
5
5
  "bin": "./bin/create-cubing-app.js",
6
6
  "scripts": {
7
7
  "build": "node script/build.js",
8
- "dev": "node script/dev.js",
8
+ "dev": "node script/build.js -- --dev",
9
9
  "roll-cubing-commit": "./script/roll-cubing-commit.bash",
10
10
  "clean": "rm -rf ./dist"
11
11
  },
package/script/build.js CHANGED
@@ -2,18 +2,26 @@
2
2
 
3
3
  import {barelyServe} from "barely-a-dev-server";
4
4
 
5
- const outDir = "./dist/web";
6
- export const COMMON_OPTIONS = {
5
+ export const COMMON_BUILD_OPTIONS = {
7
6
  entryRoot: "./src",
8
7
  esbuildOptions: {chunkNames: "chunks/[name]-[hash]"}
9
8
  }
10
9
 
11
- await barelyServe({
12
- ...COMMON_OPTIONS,
13
- dev: false,
14
- outDir,
15
- });
10
+ if (process.argv.at(-1) === "--dev") {
16
11
 
17
- console.log(`
18
- Your app has been built in: ${outDir}
19
- `)
12
+ barelyServe(COMMON_BUILD_OPTIONS);
13
+
14
+ } else {
15
+
16
+ const outDir = "./dist/web";
17
+ await barelyServe({
18
+ ...COMMON_BUILD_OPTIONS,
19
+ dev: false,
20
+ outDir,
21
+ });
22
+
23
+ console.log(`
24
+ Your app has been built in: ${outDir}
25
+
26
+ `)
27
+ }
@@ -0,0 +1,4 @@
1
+ export const COMMON_BUILD_OPTIONS = {
2
+ entryRoot: "./src",
3
+ esbuildOptions: {chunkNames: "chunks/[name]-[hash]"}
4
+ }
package/script/dev.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {barelyServe} from "barely-a-dev-server";
4
- import { COMMON_OPTIONS } from "./build.js";
4
+ import { COMMON_BUILD_OPTIONS } from "./common-build-options.js";
5
5
 
6
- barelyServe(COMMON_OPTIONS);
6
+ barelyServe(COMMON_BUILD_OPTIONS);