@scaffscript/create-project 0.1.4 → 0.1.6

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
@@ -1,6 +1,9 @@
1
1
  # @scaffscript/create-project
2
2
 
3
- A CLI tool for initializing a new ScaffScript project.
3
+ A CLI tool for initializing a new **ScaffScript** project.
4
+
5
+ > [!WARNING]
6
+ > This project is still in early development. The syntax and features are subject to change. Use at your own risk.
4
7
 
5
8
  ## Usage
6
9
 
package/dist/cli.js CHANGED
@@ -594,6 +594,9 @@ async function getIDEVersion() {
594
594
  return res;
595
595
  }
596
596
 
597
+ // src/index.ts
598
+ import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
599
+
597
600
  // src/fs.ts
598
601
  import { cp, mkdir, access, rename, readFile, writeFile } from "fs/promises";
599
602
  import { dirname, join, resolve } from "path";
@@ -691,8 +694,14 @@ async function initializeGit(targetDir) {
691
694
  return false;
692
695
  }
693
696
  }
697
+ async function getLatestVersion() {
698
+ const res = await fetch(`https://registry.npmjs.org/@scaffscript/core/latest`);
699
+ const data = await res.json();
700
+ return data.version;
701
+ }
694
702
 
695
703
  // src/index.ts
704
+ var COMPILER_VERSION = "0.1.3";
696
705
  async function main() {
697
706
  log.info("Initializing ScaffScript project...");
698
707
  const args = process.argv.slice(2);
@@ -700,6 +709,9 @@ async function main() {
700
709
  if (!input)
701
710
  process.exit(1);
702
711
  const copied = await copyTemplate(`../templates/${input.template}`, input.targetPath);
712
+ const latestVersion = await getLatestVersion();
713
+ const pkg = (await readFile2(`${input.targetPath}/package.json`, "utf8")).replace("{LATEST_VERSION}", latestVersion).replace("{COMPILER_VERSION}", COMPILER_VERSION);
714
+ await writeFile2(`${input.targetPath}/package.json`, pkg);
703
715
  const installed = await installDependencies(input.template, input.targetPath);
704
716
  if (input.initGit) {
705
717
  const initGit = await initializeGit(input.targetPath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scaffscript/create-project",
3
3
  "description": "ScaffScript project initializer",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
7
7
  "type": "module",
package/src/index.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { log } from "./utils";
3
3
  import { parseArgs } from "./args";
4
+ import { readFile, writeFile } from "node:fs/promises";
4
5
  import * as fs from "./fs";
5
- import { installDependencies, initializeGit } from "./init";
6
+ import { installDependencies, initializeGit, getLatestVersion } from "./init";
7
+
8
+ const COMPILER_VERSION = "0.1.3";
6
9
 
7
10
  async function main() {
8
11
  log.info("Initializing ScaffScript project...");
@@ -14,6 +17,13 @@ async function main() {
14
17
  process.exit(1);
15
18
 
16
19
  const copied = await fs.copyTemplate(`../templates/${input.template}`, input.targetPath);
20
+
21
+ const latestVersion = await getLatestVersion();
22
+ const pkg = (await readFile(`${input.targetPath}/package.json`, "utf8"))
23
+ .replace("{LATEST_VERSION}", latestVersion)
24
+ .replace("{COMPILER_VERSION}", COMPILER_VERSION);
25
+ await writeFile(`${input.targetPath}/package.json`, pkg);
26
+
17
27
  const installed = await installDependencies(input.template, input.targetPath);
18
28
 
19
29
  if (input.initGit) {
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "scaffscript-compiler",
3
- "version": "0.1.2",
3
+ "version": "{COMPILER_VERSION}",
4
4
  "description": "A ScaffScript compiler",
5
5
  "license": "MIT",
6
6
  "author": "Undervolta",
7
7
  "type": "module",
8
8
  "private": true,
9
9
  "devDependencies": {
10
- "@scaffscript/core": "^0.1.5",
10
+ "@scaffscript/core": "{LATEST_VERSION}",
11
11
  "@types/bun": "latest"
12
12
  },
13
13
  "scripts": {
14
- "generate": "scaff gen ./src to ./my-game.yyp",
14
+ "generate": "scaff gen ./src ./my-game.yyp",
15
15
  "help": "scaff help",
16
16
  "scaff": "scaff"
17
17
  },
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "scaffscript-compiler",
3
- "version": "0.1.2",
3
+ "version": "{COMPILER_VERSION}",
4
4
  "description": "A ScaffScript compiler",
5
5
  "license": "MIT",
6
6
  "author": "Undervolta",
7
7
  "type": "commonjs",
8
8
  "scripts": {
9
- "generate": "scaff gen ./src to ./my-game.yyp",
9
+ "generate": "scaff gen ./src ./my-game.yyp",
10
10
  "help": "scaff help",
11
11
  "scaff": "scaff"
12
12
  },
13
13
  "devDependencies": {
14
- "@scaffscript/core": "^0.1.5"
14
+ "@scaffscript/core": "{LATEST_VERSION}"
15
15
  }
16
16
  }
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "scaffscript-compiler",
3
- "version": "0.1.2",
3
+ "version": "{COMPILER_VERSION}",
4
4
  "description": "A ScaffScript compiler",
5
5
  "license": "MIT",
6
6
  "author": "Undervolta",
7
7
  "type": "commonjs",
8
8
  "scripts": {
9
- "generate": "scaff gen ./src to ./my-game.yyp",
9
+ "generate": "scaff gen ./src ./my-game.yyp",
10
10
  "help": "scaff help",
11
11
  "scaff": "scaff"
12
12
  },
13
13
  "devDependencies": {
14
- "@scaffscript/core": "^0.1.5"
14
+ "@scaffscript/core": "{LATEST_VERSION}"
15
15
  }
16
16
  }