hyperspan 0.0.1 → 0.0.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/package.json CHANGED
@@ -1,22 +1,41 @@
1
1
  {
2
2
  "name": "hyperspan",
3
- "version": "0.0.1",
4
- "description": "Simple full-stack JS framework",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.0.2",
4
+ "description": "Hyperspan CLI - for @hyperspan/framework",
5
+ "type": "module",
6
+ "public": true,
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "main": "dist/index.js",
11
+ "types": "src/index.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./src/index.ts",
15
+ "default": "./dist/index.js"
16
+ }
8
17
  },
18
+ "bin": {
19
+ "hyperspan": "dist/index.js"
20
+ },
21
+ "author": "Vance Lucas <vance@vancelucas.com>",
22
+ "license": "BSD-3-Clause",
23
+ "homepage": "https://www.hyperspan.dev",
9
24
  "repository": {
10
25
  "type": "git",
11
26
  "url": "git+https://github.com/vlucas/hyperspan.git"
12
27
  },
13
- "keywords": [
14
- "hyperspan"
15
- ],
16
- "author": "Vance Lucas",
17
- "license": "BSD-3-Clause",
18
28
  "bugs": {
19
29
  "url": "https://github.com/vlucas/hyperspan/issues"
20
30
  },
21
- "homepage": "https://github.com/vlucas/hyperspan#readme"
31
+ "scripts": {
32
+ "test": "bun test",
33
+ "build": "bun build src/index.ts --outdir dist --target node",
34
+ "prepack": "npm run build"
35
+ },
36
+ "dependencies": {
37
+ "@types/degit": "^2.8.6",
38
+ "commander": "^14.0.0",
39
+ "degit": "^2.8.4"
40
+ }
22
41
  }
package/src/index.ts ADDED
@@ -0,0 +1,59 @@
1
+ import { Command } from 'commander';
2
+ import degit from 'degit';
3
+ import fs from 'node:fs';
4
+ import { execSync } from 'node:child_process';
5
+ import packageJson from '../package.json';
6
+
7
+ const program = new Command();
8
+
9
+ program.name('hyperspan').description('CLI for @hyperspan/framework').version(packageJson.version);
10
+
11
+ /**
12
+ * Create a new hyperspan project
13
+ */
14
+ program
15
+ .command('create')
16
+ .description('Create a new hyperspan project')
17
+ .argument('<string>', 'project name')
18
+ .action(async (name) => {
19
+ console.log(`Creating project ${name}`);
20
+
21
+ const emitter = degit('vlucas/hyperspan/packages/starter-template', {
22
+ cache: true,
23
+ force: true,
24
+ verbose: false,
25
+ });
26
+
27
+ await emitter.clone(`${name}`);
28
+ console.log(`Hyperspan project created in ${name}`);
29
+ console.log(`Installing dependencies...`);
30
+ execSync(`cd ${name} && bun install`, { stdio: 'inherit' });
31
+ console.log(`Dependencies installed`);
32
+ console.log(`Running dev server...`);
33
+ execSync(`cd ${name} && bun dev`, { stdio: 'inherit' });
34
+ });
35
+
36
+ /**
37
+ * Build the project for SSG
38
+ */
39
+ program
40
+ .command('build:ssg')
41
+ .option('--dir <path>', 'directory of your hyperspan project', './')
42
+ .description('Build the project for SSG')
43
+ .action(async (options) => {
44
+ // Ensure we are in a hyperspan project
45
+ const serverFile = `${options.dir}/app/server.ts`;
46
+
47
+ if (!fs.existsSync(serverFile)) {
48
+ console.error(
49
+ 'Error: Could not find app/server.ts - Are you in a Hyperspan project directory?'
50
+ );
51
+ process.exit(1);
52
+ }
53
+
54
+ const server = await import(serverFile);
55
+
56
+ console.log(server);
57
+ });
58
+
59
+ program.parse();
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Hyperspan
2
-
3
- The simple JS framework.
4
-
5
- https://www.hyperspan.dev
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- // Placeholder for hyperspan.dev
2
- module.exports = {
3
- url: "https://www.hyperspan.dev",
4
- };