@lamppost/create-ink-player 1.0.7 → 1.0.9

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/index.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  cpSync,
5
5
  existsSync,
6
6
  mkdirSync,
7
- renameSync,
8
7
  readFileSync,
8
+ renameSync,
9
9
  rmSync,
10
10
  writeFileSync,
11
11
  } from "node:fs";
@@ -18,11 +18,13 @@ const __filename = fileURLToPath(import.meta.url);
18
18
  const __dirname = dirname(__filename);
19
19
 
20
20
  async function main() {
21
+ const incomingName = process.argv[2];
22
+
21
23
  // Ask for the directory name
22
24
  const rl = readline.createInterface({ input, output });
23
25
 
24
- let directoryName = "";
25
- while (true) {
26
+ let directoryName = incomingName || "";
27
+ while (directoryName.length === 0) {
26
28
  const answer = await rl.question(
27
29
  "What directory name would you like to use? ",
28
30
  );
@@ -54,8 +56,8 @@ async function main() {
54
56
  }
55
57
 
56
58
  // Ask for the game name
57
- let gameName = "";
58
- while (true) {
59
+ let gameName = incomingName || "";
60
+ while (gameName.length === 0) {
59
61
  const answer = await rl.question("What is the name of your game? ");
60
62
  const trimmed = answer.trim();
61
63
 
@@ -92,7 +94,7 @@ async function main() {
92
94
  // Update package.json
93
95
  const packageJsonPath = join(targetDir, "package.json");
94
96
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
95
- packageJson.name = gameName;
97
+ packageJson.name = directoryName;
96
98
  writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
97
99
 
98
100
  // Update the gameName in the src/index.ts file
@@ -111,6 +113,19 @@ async function main() {
111
113
  );
112
114
  writeFileSync(readmeMdPath, readmeMd);
113
115
 
116
+ if (incomingName) {
117
+ console.log("Skipping installation and update of ink-player...");
118
+ console.log(`\nTo get started:`);
119
+ console.log(` cd ${directoryName}`);
120
+ console.log(` pnpm install`);
121
+ console.log(` pnpm update-ink-player`);
122
+ console.log(` pnpm dev`);
123
+ console.log(
124
+ `\nThis will start the development server and open the game in your browser. You can now start working on your game.`,
125
+ );
126
+ process.exit(0);
127
+ }
128
+
114
129
  console.log("Installing dependencies...");
115
130
 
116
131
  // Run pnpm install
@@ -124,6 +139,16 @@ async function main() {
124
139
  process.exit(1);
125
140
  }
126
141
 
142
+ // Run pnpm update-ink-player
143
+ try {
144
+ execSync("pnpm update-ink-player", {
145
+ cwd: targetDir,
146
+ stdio: "inherit",
147
+ });
148
+ } catch (error) {
149
+ console.error("Error updating ink-player:", error.message);
150
+ }
151
+
127
152
  console.log(`\n${gameName} setup complete!`);
128
153
  console.log(`\nTo get started:`);
129
154
  console.log(` cd ${directoryName}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lamppost/create-ink-player",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,6 +10,7 @@ This is a web player for running [Ink](https://github.com/inkle/ink) stories cre
10
10
  * Update the About page in `src/About.tsx` to include some information about your game (or remove that page entirely by updating `src/index.ts`).
11
11
  * Add any custom CSS styling inside the `src/styles.scss` file.
12
12
  * Run `pnpm build` to create the final HTML/JS/CSS/Image files needed to display the game. The files will be output to the `dist/` directory. You can then bundle them or upload them to the location of your choice.
13
+ * To update your game to the latest version of the ink player you can run `pnpm update-ink-player`.
13
14
 
14
15
  ## Next Steps
15
16
 
@@ -6,7 +6,7 @@ import { pluginSvgr } from "@rsbuild/plugin-svgr";
6
6
 
7
7
  export default defineConfig({
8
8
  output: {
9
- assetPrefix: "./",
9
+ assetPrefix: "auto",
10
10
  },
11
11
  dev: {
12
12
  hmr: false,
@@ -1,8 +1,8 @@
1
1
  import { init } from "@lamppost/ink-player";
2
+ import darkModePlugin from "@lamppost/ink-player/plugins/dark-mode";
3
+ import historyPlugin from "@lamppost/ink-player/plugins/history";
2
4
  import locationPlugin from "@lamppost/ink-player/plugins/location";
3
5
  import textInputPlugin from "@lamppost/ink-player/plugins/text-input";
4
- import historyPlugin from "@lamppost/ink-player/plugins/history";
5
- import darkModePlugin from "@lamppost/ink-player/plugins/dark-mode";
6
6
 
7
7
  import "@lamppost/ink-player/styles.css";
8
8
  import "./styles.scss";