create-format 0.0.0 → 0.1.1

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,32 +1,30 @@
1
- # create-format
1
+ This package is what users will use to bootstrap a new studio project.
2
2
 
3
- **This is a bootstrap placeholder. It reserves the package name and does nothing else.**
3
+ It will need to be deployed to npm and run as an npm create script.
4
4
 
5
- Format is not released yet. Version `0.0.0` is not a usable version of this
6
- package: it contains no implementation, and installing it gets you an empty
7
- module.
5
+ Example:
8
6
 
9
- ## Why it exists
7
+ - User runs `npm create format-project@latest`
8
+ - Follows a few prompts
9
+ - Gets a new project ready to run `npm run dev`
10
10
 
11
- npm binds a package’s trusted publisher, and its staged-publishing flow, to a
12
- package that already exists. Creating these names ahead of the first release is
13
- what lets every real release go out through a reviewed, credential-free
14
- workflow rather than through a token somebody holds.
11
+ ## Local testing
15
12
 
16
- This version is published deliberately and deprecated immediately.
13
+ Fastest loop (no linking):
17
14
 
18
- ## Why a bare install resolves it
15
+ - `cd packages/create-format && pnpm dev`
16
+ - In another terminal: `cd packages && node create-format/dist/index.mjs`
19
17
 
20
- npm creates a `latest` tag on a package’s first publish and will not remove it,
21
- so `latest` points at this placeholder until Format reaches general
22
- availability. That is why the deprecation warning is there.
18
+ In dev builds, templates keep `workspace:*` versions for `@format.dev/*` deps so you can scaffold inside this monorepo and install with pnpm.
23
19
 
24
- - Beta releases go out under the `beta` tag.
25
- - General availability is when `latest` moves to a real release.
20
+ Closest to “published” install:
26
21
 
27
- ## Format
22
+ - `cd packages/create-format && pnpm dev`
23
+ - `pnpm -C packages/create-format pack --pack-destination /tmp/create-format-pack`
24
+ - `cd "$(mktemp -d)" && pnpm add /tmp/create-format-pack/*.tgz && create-format`
28
25
 
29
- - https://format.dev
30
- - https://github.com/format-hq/format-js
26
+ In prod builds, `workspace:*` versions are replaced with published semver ranges (based on the monorepo package versions at build time).
31
27
 
32
- Licensed under MIT. The full text ships beside this file.
28
+ ### Project name
29
+
30
+ `{{ name }}` in the template `package.json` is replaced with the last path segment from “Where should we create your project?”. If you enter `./` or `../`, it defaults to `my-format-project`.
package/dist/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+ import { spawn } from "node:child_process";
4
+ import { dirname, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ //#region src/index.ts
8
+ const _dirname = dirname(fileURLToPath(import.meta.url));
9
+ function resolveCliBin() {
10
+ const require = createRequire(import.meta.url);
11
+ const packageJsonPath = require.resolve("@format.dev/cli/package.json", { paths: [_dirname] });
12
+ const binRelativePath = require(packageJsonPath).bin?.format;
13
+ if (!binRelativePath) throw new Error("The installed @format.dev/cli does not expose a \"format\" bin.");
14
+ return resolve(dirname(packageJsonPath), binRelativePath);
15
+ }
16
+ spawn(process.execPath, [
17
+ resolveCliBin(),
18
+ "new",
19
+ "project",
20
+ ...process.argv.slice(2)
21
+ ], { stdio: "inherit" }).on("exit", (code) => {
22
+ process.exitCode = code ?? 0;
23
+ });
24
+
25
+ //#endregion
26
+ export { };
package/package.json CHANGED
@@ -1,28 +1,39 @@
1
1
  {
2
- "name": "create-format",
3
- "version": "0.0.0",
4
- "description": "A bootstrap placeholder reserving this package name. Format is not released yet.",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/format-hq/format-js.git",
9
- "directory": "packages/create-format"
10
- },
11
- "homepage": "https://format.dev",
12
- "files": [
13
- "LICENSE",
14
- "README.md",
15
- "bin/create-format.mjs"
16
- ],
17
- "bin": {
18
- "create-format": "./bin/create-format.mjs"
19
- },
20
- "type": "module",
21
- "engines": {
22
- "node": ">=22.12.0"
23
- },
24
- "publishConfig": {
25
- "tag": "bootstrap",
26
- "registry": "https://registry.npmjs.org/"
27
- }
28
- }
2
+ "name": "create-format",
3
+ "description": "Create a new format project",
4
+ "version": "0.1.1",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/format-hq/format-js.git",
9
+ "directory": "packages/create-format"
10
+ },
11
+ "type": "module",
12
+ "files": [
13
+ "dist",
14
+ "LICENSE"
15
+ ],
16
+ "dependencies": {
17
+ "@format.dev/cli": "0.1.1"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^24.10.4",
21
+ "rimraf": "^6.0.1",
22
+ "tsdown": "^0.18.4",
23
+ "typescript": "^5.9.3"
24
+ },
25
+ "engines": {
26
+ "node": ">=22.12.0"
27
+ },
28
+ "scripts": {
29
+ "clean": "rimraf dist",
30
+ "build": "tsdown",
31
+ "dev": "tsdown --watch",
32
+ "dev:template:react": "cd ../cli/templates/react && node ../../../../apps/studio/bin/format-studio dev",
33
+ "dev:template:vue": "cd ../cli/templates/vue && node ../../../../apps/studio/bin/format-studio dev",
34
+ "dev:template:html": "cd ../cli/templates/html && node ../../../../apps/studio/bin/format-studio dev"
35
+ },
36
+ "bin": {
37
+ "create-format": "./dist/index.mjs"
38
+ }
39
+ }
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- // This is a bootstrap placeholder. It reserves the create-format name and
3
- // scaffolds nothing. See README.md.
4
-
5
- console.error('Format is not released yet, so there is nothing to scaffold.')
6
- console.error('')
7
- console.error(' https://format.dev')
8
- console.error(' https://github.com/format-hq/format-js')
9
-
10
- process.exit(1)