create-presolve 0.1.0-alpha.7
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/LICENSE +21 -0
- package/README.md +13 -0
- package/bin/create-presolve.mjs +79 -0
- package/package.json +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Presolve contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# create-presolve
|
|
2
|
+
|
|
3
|
+
Create a new Presolve application with pnpm:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm create presolve my-app
|
|
7
|
+
cd my-app
|
|
8
|
+
pnpm install
|
|
9
|
+
pnpm dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The generated project includes the public authoring package, compiler CLI,
|
|
13
|
+
TypeScript 7 configuration, file routes, and a VS Code extension recommendation.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { mkdir, writeFile, access } from "node:fs/promises";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import { basename, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
const targetArgument = process.argv[2];
|
|
7
|
+
if (!targetArgument || targetArgument.startsWith("-")) {
|
|
8
|
+
console.error("Usage: pnpm create presolve <project-directory>");
|
|
9
|
+
process.exit(2);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const root = resolve(targetArgument);
|
|
13
|
+
try {
|
|
14
|
+
await access(root, constants.F_OK);
|
|
15
|
+
console.error(`Refusing to overwrite existing path: ${root}`);
|
|
16
|
+
process.exit(2);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if (error?.code !== "ENOENT") throw error;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const name = packageName(basename(root));
|
|
22
|
+
await mkdir(root, { recursive: true });
|
|
23
|
+
for (const [relativePath, contents] of Object.entries(template(name))) {
|
|
24
|
+
const path = resolve(root, relativePath);
|
|
25
|
+
await mkdir(resolve(path, ".."), { recursive: true });
|
|
26
|
+
await writeFile(path, contents, "utf8");
|
|
27
|
+
}
|
|
28
|
+
console.log(`Created ${name}.`);
|
|
29
|
+
console.log("Next: `cd " + name + " && pnpm install && pnpm dev`.");
|
|
30
|
+
|
|
31
|
+
function packageName(value) {
|
|
32
|
+
const normalized = value
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.replace(/[^a-z0-9-]+/g, "-")
|
|
35
|
+
.replace(/^-+|-+$/g, "");
|
|
36
|
+
return normalized || "presolve-app";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function template(name) {
|
|
40
|
+
return {
|
|
41
|
+
"package.json": `${JSON.stringify({
|
|
42
|
+
name,
|
|
43
|
+
private: true,
|
|
44
|
+
type: "module",
|
|
45
|
+
packageManager: "pnpm@11.17.0",
|
|
46
|
+
scripts: {
|
|
47
|
+
dev: "presolve dev",
|
|
48
|
+
build: "presolve build",
|
|
49
|
+
check: "presolve check",
|
|
50
|
+
deploy: "presolve deploy cloudflare",
|
|
51
|
+
"deploy:prepare": "presolve deploy cloudflare --prepare",
|
|
52
|
+
},
|
|
53
|
+
dependencies: { "@presolve/core": "0.1.0-alpha.7" },
|
|
54
|
+
devDependencies: {
|
|
55
|
+
"@presolve/cli": "0.1.0-alpha.7",
|
|
56
|
+
"typescript": "npm:typescript@^7.0.2",
|
|
57
|
+
"wrangler": "^4.0.0",
|
|
58
|
+
},
|
|
59
|
+
}, null, 2)}\n`,
|
|
60
|
+
".gitignore": "node_modules/\ndist/\n.presolve/\n.dev.vars\n.env*\n",
|
|
61
|
+
"README.md": `# ${name}\n\nA Presolve application.\n\n## Development\n\n\`pnpm dev\` builds and serves compiler-published routes.\n\n\`pnpm build\` emits immutable artifacts in \`dist/\`.\n\n\`pnpm deploy:prepare\` validates a Cloudflare Workers Static Assets deployment without uploading.\n\n\`pnpm deploy\` deploys the prepared compiler artifact inventory through Wrangler.\n\nVS Code will use the TypeScript configuration in this project. Install the **Presolve** extension for compiler-language tooling as it becomes available during the alpha.\n`,
|
|
62
|
+
"tsconfig.json": `${JSON.stringify({
|
|
63
|
+
compilerOptions: {
|
|
64
|
+
target: "ES2022",
|
|
65
|
+
module: "NodeNext",
|
|
66
|
+
moduleResolution: "NodeNext",
|
|
67
|
+
strict: true,
|
|
68
|
+
noEmit: true,
|
|
69
|
+
jsx: "preserve",
|
|
70
|
+
skipLibCheck: true,
|
|
71
|
+
},
|
|
72
|
+
include: ["app/**/*.ts", "app/**/*.tsx"],
|
|
73
|
+
}, null, 2)}\n`,
|
|
74
|
+
".vscode/extensions.json": `${JSON.stringify({ recommendations: ["fierstdev.presolve-vscode"] }, null, 2)}\n`,
|
|
75
|
+
"app/routes/index.tsx": `import { component, Component } from "@presolve/core";\n\n@component()\nexport class Home extends Component {\n render() {\n return <main><h1>${name}</h1><p>Built by the Presolve compiler.</p><a href="/docs/">Read the docs</a></main>;\n }\n}\n`,
|
|
76
|
+
"app/routes/docs/index.tsx": `import { component, Component } from "@presolve/core";\n\n@component()\nexport class Docs extends Component {\n render() {\n return <main><h1>Presolve documentation</h1><p>Start with compiler-owned components, routes, and deployment.</p><a href="/docs/getting-started/">Getting started</a></main>;\n }\n}\n`,
|
|
77
|
+
"app/routes/docs/getting-started.tsx": `import { component, Component } from "@presolve/core";\n\n@component()\nexport class GettingStarted extends Component {\n render() {\n return <main><h1>Getting started</h1><p>Author components. Presolve publishes static HTML and the minimal runtime artifacts required by your application.</p></main>;\n }\n}\n`,
|
|
78
|
+
};
|
|
79
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-presolve",
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
|
+
"description": "Create a Presolve application.",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/fierstdev/presolve.git",
|
|
9
|
+
"directory": "packages/create-presolve"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"tag": "alpha"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"bin": {
|
|
21
|
+
"create-presolve": "./bin/create-presolve.mjs"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "node --test test/*.test.mjs"
|
|
25
|
+
}
|
|
26
|
+
}
|