create-ollie-shop 0.2.2 → 1.0.0
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +22 -0
- package/README.md +57 -84
- package/dist/index.js +164 -185
- package/dist/template/.vscode/extensions.json +1 -1
- package/dist/template/.vscode/settings.json +1 -16
- package/dist/template/_gitignore +42 -0
- package/dist/template/_package.json +17 -0
- package/dist/template/components/HelloWorld/index.tsx +0 -3
- package/dist/template/components/HelloWorld/meta.json +3 -0
- package/dist/template/ollie.json +3 -0
- package/package.json +3 -5
- package/src/create-project.ts +154 -0
- package/src/index.ts +104 -114
- package/template/.vscode/extensions.json +1 -1
- package/template/.vscode/settings.json +1 -16
- package/template/_gitignore +42 -0
- package/template/_package.json +17 -0
- package/template/components/HelloWorld/index.tsx +0 -3
- package/template/components/HelloWorld/meta.json +1 -4
- package/template/ollie.json +1 -7
- package/tsup.config.ts +1 -22
- package/dist/template/package.json +0 -17
- package/dist/template/preview.config.ts +0 -3
- package/src/commands/create-project.ts +0 -114
- package/src/types/index.ts +0 -17
- package/src/utils/prompts.ts +0 -85
- package/template/package-lock.json +0 -3030
- package/template/package.json +0 -17
- package/template/preview.config.ts +0 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> create-ollie-shop@0.
|
|
2
|
+
> create-ollie-shop@1.0.0 build /home/runner/work/ollie-shop/ollie-shop/packages/create-ollie-shop
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m5.83 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 426ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# create-ollie-shop
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 3b0ed1c: Create studio experience refactoring the previous flow. Remove the previewjs dependency
|
|
8
|
+
|
|
9
|
+
## 0.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- af65e8f: fix(security): update Next.js to 15.5.9 for RSC security vulnerabilities
|
|
14
|
+
|
|
15
|
+
Addresses critical security vulnerabilities in Next.js App Router (React Server Components):
|
|
16
|
+
|
|
17
|
+
- **CVE-2025-55184** (High): DoS via infinite loop in Server Functions deserialization
|
|
18
|
+
- **CVE-2025-67779** (High): DoS via malicious HTTP requests (complete fix)
|
|
19
|
+
- **CVE-2025-55183** (Medium): Source code exposure of Server Functions
|
|
20
|
+
|
|
21
|
+
Updated Next.js from 15.5.7 to 15.5.9 across all 14 affected packages.
|
|
22
|
+
|
|
23
|
+
Reference: https://nextjs.org/blog/security-update-2025-12-11
|
|
24
|
+
|
|
3
25
|
## 0.2.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,129 +1,102 @@
|
|
|
1
1
|
# create-ollie-shop
|
|
2
2
|
|
|
3
|
-
A CLI tool to
|
|
3
|
+
A CLI tool to scaffold a new Ollie Shop checkout customization project.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
`create-ollie-shop` is a scaffolding tool that helps you quickly set up a new e-commerce project using the Ollie Shop framework. It provides a selection of templates, components, and configurations to kickstart your online store development.
|
|
8
|
-
|
|
9
|
-
## Requirements
|
|
10
|
-
|
|
11
|
-
- Node.js 20.x or higher
|
|
12
|
-
- pnpm 7.x or higher (recommended package manager)
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
### Using pnpm create
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
pnpm create ollie-shop [project-name]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Or use directly with npx
|
|
5
|
+
## Quick Start
|
|
23
6
|
|
|
24
7
|
```bash
|
|
25
|
-
npx create-ollie-shop
|
|
8
|
+
npx create-ollie-shop
|
|
26
9
|
```
|
|
27
10
|
|
|
28
|
-
|
|
11
|
+
You'll be prompted for:
|
|
12
|
+
1. **Project directory** (default: `my-checkout`)
|
|
13
|
+
2. **Store ID** (your Ollie Shop store UUID)
|
|
14
|
+
3. **Version ID** (optional, press Enter to skip)
|
|
29
15
|
|
|
30
|
-
|
|
31
|
-
- `--version-id <id>` - Specify an Ollie store version ID
|
|
32
|
-
- `--help` - Display help information
|
|
33
|
-
- `--version` - Display version information
|
|
16
|
+
## Usage
|
|
34
17
|
|
|
35
|
-
###
|
|
18
|
+
### Interactive mode
|
|
36
19
|
|
|
37
20
|
```bash
|
|
38
|
-
# Start interactive project bootstrapping
|
|
39
21
|
npx create-ollie-shop
|
|
40
|
-
|
|
41
|
-
# Create a new project with a custom name
|
|
42
|
-
npx create-ollie-shop my-awesome-store
|
|
43
|
-
|
|
44
|
-
# Create a new project with store configuration
|
|
45
|
-
npx create-ollie-shop my-store --store-id 7217542a-d7c6-40d3-a20e-db13b310a781 --version-id 882c8c18-550c-4ac5-9d3b-015d7dd25741
|
|
46
22
|
```
|
|
47
23
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Ollie Shop projects were designed to be previewed using the Preview.js plugin for VS Code. This tool allows developers to visualize and interact with components in isolation during development.
|
|
51
|
-
|
|
52
|
-
### Installation
|
|
53
|
-
|
|
54
|
-
Simply install the Preview.js extension from the VS Code marketplace:
|
|
55
|
-
[VS Code Extension](https://marketplace.visualstudio.com/items?itemName=zenclabs.previewjs)
|
|
24
|
+
```
|
|
25
|
+
🛍️ Create Ollie Shop
|
|
56
26
|
|
|
57
|
-
|
|
27
|
+
Project directory (my-checkout): my-store
|
|
28
|
+
Store ID: 7217542a-d7c6-40d3-a20e-db13b310a781
|
|
29
|
+
Version ID (optional, press Enter to skip):
|
|
58
30
|
|
|
59
|
-
|
|
31
|
+
🚀 Creating Ollie Shop project "my-store"...
|
|
32
|
+
📁 Copying template files...
|
|
33
|
+
🔧 Initializing git repository...
|
|
60
34
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
2. Click the Preview.js icon in the editor or press the keyboard shortcut
|
|
64
|
-
3. A live preview of your component will appear, reflecting any changes you make in real-time
|
|
35
|
+
✅ Ollie Shop project created in my-store:
|
|
36
|
+
$ cd my-store
|
|
65
37
|
|
|
66
|
-
|
|
38
|
+
Install dependencies:
|
|
39
|
+
$ npm install
|
|
67
40
|
|
|
68
|
-
|
|
41
|
+
Start development:
|
|
42
|
+
$ npm start
|
|
69
43
|
|
|
70
|
-
|
|
44
|
+
🛍️ Happy building with Ollie Shop!
|
|
45
|
+
```
|
|
71
46
|
|
|
72
|
-
|
|
47
|
+
### With store ID flag
|
|
73
48
|
|
|
74
49
|
```bash
|
|
75
|
-
|
|
76
|
-
cd ollie-shop
|
|
50
|
+
npx create-ollie-shop --store-id 7217542a-d7c6-40d3-a20e-db13b310a781
|
|
77
51
|
```
|
|
78
52
|
|
|
79
|
-
|
|
53
|
+
### With version ID (optional)
|
|
80
54
|
|
|
81
55
|
```bash
|
|
82
|
-
|
|
56
|
+
npx create-ollie-shop --store-id 7217542a-d7c6-40d3-a20e-db13b310a781 --version-id abc12345-d7c6-40d3-a20e-db13b310a781
|
|
83
57
|
```
|
|
84
58
|
|
|
85
|
-
|
|
59
|
+
### Options
|
|
86
60
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
61
|
+
| Option | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `--store-id <uuid>` | Store ID (skips prompt if provided) |
|
|
64
|
+
| `--version-id <uuid>` | Version ID (optional, for version-specific development) |
|
|
65
|
+
| `--help` | Display help |
|
|
66
|
+
| `--version` | Display version |
|
|
90
67
|
|
|
91
|
-
|
|
92
|
-
pnpm link --global
|
|
68
|
+
## Project Structure
|
|
93
69
|
|
|
94
|
-
|
|
95
|
-
# For example, to link the ollie-shop library:
|
|
96
|
-
cd ../ollie-shop
|
|
97
|
-
pnpm link --global
|
|
70
|
+
After scaffolding, your project will have:
|
|
98
71
|
|
|
99
|
-
# Then, in the create-ollie-shop directory:
|
|
100
|
-
pnpm link --global ollie-shop
|
|
101
72
|
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
73
|
+
my-checkout/
|
|
74
|
+
├── .vscode/ # VS Code settings (Biome formatter)
|
|
75
|
+
├── components/ # Your checkout components
|
|
76
|
+
│ └── HelloWorld/ # Example component
|
|
77
|
+
├── types/ # TypeScript type definitions
|
|
78
|
+
├── .gitignore
|
|
79
|
+
├── ollie.json # Ollie Shop configuration
|
|
80
|
+
├── package.json
|
|
81
|
+
└── tsconfig.json
|
|
109
82
|
```
|
|
110
83
|
|
|
111
|
-
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
After creating your project:
|
|
112
87
|
|
|
113
88
|
```bash
|
|
114
|
-
|
|
89
|
+
cd my-checkout
|
|
90
|
+
npm install
|
|
91
|
+
npm start
|
|
115
92
|
```
|
|
116
93
|
|
|
117
|
-
|
|
94
|
+
This starts the Ollie Studio development server and opens it in your browser.
|
|
118
95
|
|
|
119
|
-
|
|
96
|
+
## Requirements
|
|
120
97
|
|
|
121
|
-
|
|
122
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
123
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
124
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
125
|
-
5. Open a Pull Request
|
|
98
|
+
- Node.js 20.x or higher
|
|
126
99
|
|
|
127
100
|
## License
|
|
128
101
|
|
|
129
|
-
MIT
|
|
102
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -2,210 +2,189 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import path2 from "path";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import process from "process";
|
|
6
|
+
import readline from "readline/promises";
|
|
7
|
+
import meow from "meow";
|
|
8
|
+
import { z } from "zod";
|
|
8
9
|
|
|
9
|
-
// src/
|
|
10
|
-
import
|
|
10
|
+
// src/create-project.ts
|
|
11
|
+
import { exec } from "child_process";
|
|
12
|
+
import fs from "fs/promises";
|
|
11
13
|
import path from "path";
|
|
12
14
|
import { fileURLToPath } from "url";
|
|
13
15
|
import { promisify } from "util";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
async function
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
overwrite: true
|
|
35
|
-
});
|
|
36
|
-
const pkgPath = path.join(targetDir, "package.json");
|
|
37
|
-
const pkg = await fs.readJSON(path.join(targetDir, "package.json"));
|
|
38
|
-
pkg.name = projectName;
|
|
39
|
-
await fs.writeJSON(pkgPath, pkg, { spaces: 2 });
|
|
40
|
-
const ollieConfigPath = path.join(targetDir, "ollie.json");
|
|
41
|
-
await fs.writeJSON(
|
|
42
|
-
ollieConfigPath,
|
|
43
|
-
{
|
|
44
|
-
storeId: storeId || null,
|
|
45
|
-
versionId: versionId || null,
|
|
46
|
-
platform,
|
|
47
|
-
platformStoreId: platformStoreId || null
|
|
48
|
-
},
|
|
49
|
-
{ spaces: 2 }
|
|
50
|
-
);
|
|
51
|
-
try {
|
|
52
|
-
await exec("git init", { cwd: targetDir });
|
|
53
|
-
} catch (e) {
|
|
54
|
-
console.log("\n\u274C Error initializing git:", e);
|
|
16
|
+
import fsExtra from "fs-extra";
|
|
17
|
+
import slugify from "slugify";
|
|
18
|
+
var execAsync = promisify(exec);
|
|
19
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
async function copyWithTemplate(from, to, variables) {
|
|
21
|
+
const dirname = path.dirname(to);
|
|
22
|
+
await fsExtra.ensureDir(dirname);
|
|
23
|
+
const source = await fs.readFile(from, "utf8");
|
|
24
|
+
let content = source;
|
|
25
|
+
content = content.replace(/%NAME%/g, variables.name);
|
|
26
|
+
content = content.replace(/%STORE_ID%/g, variables.storeId);
|
|
27
|
+
await fs.writeFile(to, content);
|
|
28
|
+
}
|
|
29
|
+
function getDestinationFilename(filename) {
|
|
30
|
+
if (filename.startsWith("_")) {
|
|
31
|
+
const rest = filename.slice(1);
|
|
32
|
+
if (!rest.includes(".")) {
|
|
33
|
+
return `.${rest}`;
|
|
34
|
+
}
|
|
35
|
+
return rest;
|
|
55
36
|
}
|
|
56
|
-
|
|
57
|
-
projectName,
|
|
58
|
-
storeId,
|
|
59
|
-
versionId,
|
|
60
|
-
platform,
|
|
61
|
-
platformStoreId
|
|
62
|
-
);
|
|
37
|
+
return filename;
|
|
63
38
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
39
|
+
async function copyTemplateDir(templateDir, targetDir, variables) {
|
|
40
|
+
const entries = await fs.readdir(templateDir, { withFileTypes: true });
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
const srcPath = path.join(templateDir, entry.name);
|
|
43
|
+
const destName = getDestinationFilename(entry.name);
|
|
44
|
+
const destPath = path.join(targetDir, destName);
|
|
45
|
+
if (entry.isDirectory()) {
|
|
46
|
+
await fsExtra.ensureDir(destPath);
|
|
47
|
+
await copyTemplateDir(srcPath, destPath, variables);
|
|
48
|
+
} else {
|
|
49
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
50
|
+
const textExtensions = [
|
|
51
|
+
".json",
|
|
52
|
+
".ts",
|
|
53
|
+
".tsx",
|
|
54
|
+
".js",
|
|
55
|
+
".jsx",
|
|
56
|
+
".md",
|
|
57
|
+
".css",
|
|
58
|
+
".html",
|
|
59
|
+
""
|
|
60
|
+
];
|
|
61
|
+
if (textExtensions.includes(ext) || entry.name.startsWith("_")) {
|
|
62
|
+
await copyWithTemplate(srcPath, destPath, variables);
|
|
63
|
+
} else {
|
|
64
|
+
await fs.copyFile(srcPath, destPath);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function createProject(projectPath, options) {
|
|
70
|
+
const { storeId, versionId } = options;
|
|
71
|
+
const projectName = slugify(path.basename(projectPath), { lower: true });
|
|
72
|
+
const exists = await fsExtra.pathExists(projectPath);
|
|
73
|
+
if (exists) {
|
|
74
|
+
throw new Error(`Directory "${projectPath}" already exists.`);
|
|
83
75
|
}
|
|
76
|
+
console.log(`\u{1F680} Creating Ollie Shop project "${projectName}"...`);
|
|
77
|
+
await fsExtra.ensureDir(projectPath);
|
|
78
|
+
const templateDir = path.join(__dirname, "..", "template");
|
|
79
|
+
const variables = {
|
|
80
|
+
name: projectName,
|
|
81
|
+
storeId,
|
|
82
|
+
versionId
|
|
83
|
+
};
|
|
84
|
+
console.log("\u{1F4C1} Copying template files...");
|
|
85
|
+
await copyTemplateDir(templateDir, projectPath, variables);
|
|
84
86
|
if (versionId) {
|
|
85
|
-
|
|
87
|
+
const ollieConfigPath = path.join(projectPath, "ollie.json");
|
|
88
|
+
const ollieConfig = JSON.parse(await fs.readFile(ollieConfigPath, "utf8"));
|
|
89
|
+
ollieConfig.versionId = versionId;
|
|
90
|
+
await fs.writeFile(ollieConfigPath, JSON.stringify(ollieConfig, null, 2));
|
|
91
|
+
}
|
|
92
|
+
console.log("\u{1F527} Initializing git repository...");
|
|
93
|
+
try {
|
|
94
|
+
await execAsync("git init", { cwd: projectPath });
|
|
95
|
+
} catch {
|
|
96
|
+
console.log(" \u26A0\uFE0F Could not initialize git repository");
|
|
86
97
|
}
|
|
87
|
-
console.log("\n\u{1F6CD}\uFE0F Happy development with Ollie Shop! \u{1F6CD}\uFE0F\n");
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// src/utils/prompts.ts
|
|
91
|
-
import chalk2 from "chalk";
|
|
92
|
-
import prompts from "prompts";
|
|
93
|
-
import { z } from "zod";
|
|
94
|
-
async function promptForProjectName(defaultValue = "my-ollie-shop") {
|
|
95
|
-
const { value } = await prompts({
|
|
96
|
-
type: "text",
|
|
97
|
-
name: "value",
|
|
98
|
-
message: "Project name:",
|
|
99
|
-
initial: defaultValue,
|
|
100
|
-
validate: (value2) => z.string().nonempty().safeParse(value2).success
|
|
101
|
-
});
|
|
102
|
-
return value || defaultValue;
|
|
103
|
-
}
|
|
104
|
-
async function promptForOverwrite(dirName) {
|
|
105
|
-
const { overwrite } = await prompts({
|
|
106
|
-
type: "confirm",
|
|
107
|
-
name: "overwrite",
|
|
108
|
-
message: `Directory ${chalk2.cyan(dirName)} already exists. Overwrite?`,
|
|
109
|
-
initial: false
|
|
110
|
-
});
|
|
111
|
-
return overwrite;
|
|
112
|
-
}
|
|
113
|
-
async function promptForStoreId() {
|
|
114
|
-
const { value } = await prompts({
|
|
115
|
-
type: "text",
|
|
116
|
-
name: "value",
|
|
117
|
-
message: "Store ID (optional):",
|
|
118
|
-
hint: "Leave empty if you want to set up the workspace manually",
|
|
119
|
-
validate: (value2) => z.string().uuid().or(z.literal("")).safeParse(value2).success || "Please enter a valid UUID or leave empty"
|
|
120
|
-
});
|
|
121
|
-
return value && value.trim() !== "" ? value : void 0;
|
|
122
|
-
}
|
|
123
|
-
async function promptForPlatformStoreId(platform) {
|
|
124
|
-
const { platformStoreId } = await prompts({
|
|
125
|
-
type: "text",
|
|
126
|
-
name: "platformStoreId",
|
|
127
|
-
message: `Enter your ${platform.toUpperCase()} account name:`,
|
|
128
|
-
validate: (value) => z.string().min(1).safeParse(value).success || "Account name cannot be empty"
|
|
129
|
-
});
|
|
130
|
-
return platformStoreId;
|
|
131
|
-
}
|
|
132
|
-
async function promptForVersionId() {
|
|
133
|
-
const { value } = await prompts({
|
|
134
|
-
type: "text",
|
|
135
|
-
name: "value",
|
|
136
|
-
message: "Version ID (optional):",
|
|
137
|
-
validate: (value2) => z.string().uuid().or(z.literal("")).safeParse(value2).success
|
|
138
|
-
});
|
|
139
|
-
return value && value.trim() !== "" ? value : void 0;
|
|
140
98
|
}
|
|
141
99
|
|
|
142
100
|
// src/index.ts
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
chalk3.bold.blue(
|
|
146
|
-
"\u{1F6CD}\uFE0F Create Ollie Shop - Bootstrap a new Ollie Shop project"
|
|
147
|
-
)
|
|
148
|
-
);
|
|
149
|
-
const program = new Command().name("create-ollie-shop").description(
|
|
150
|
-
"Bootstrap a new Ollie Shop project with optional store configuration"
|
|
151
|
-
).version("0.1.0").argument("[project-name]", "Project folder name", "my-ollie-shop").option("--store-id <id>", "Specify an Ollie store ID").option("--version-id <id>", "Specify an Ollie store version ID").addHelpText(
|
|
152
|
-
"after",
|
|
153
|
-
`
|
|
154
|
-
Examples:
|
|
155
|
-
$ create-ollie-shop
|
|
156
|
-
$ create-ollie-shop my-awesome-store
|
|
157
|
-
$ create-ollie-shop my-store --store-id 7217542a-d7c6-40d3-a20e-db13b310a781 --version-id 882c8c18-550c-4ac5-9d3b-015d7dd25741
|
|
101
|
+
var uuidSchema = z.string().uuid("Invalid store ID format. Must be a valid UUID.");
|
|
102
|
+
var cli = meow(
|
|
158
103
|
`
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
104
|
+
Usage
|
|
105
|
+
$ create-ollie-shop [--store-id <uuid>] [--version-id <uuid>]
|
|
106
|
+
|
|
107
|
+
Options
|
|
108
|
+
--store-id Store ID (must be a valid UUID)
|
|
109
|
+
--version-id Version ID (optional, must be a valid UUID)
|
|
110
|
+
|
|
111
|
+
Examples
|
|
112
|
+
$ create-ollie-shop
|
|
113
|
+
$ create-ollie-shop --store-id 7217542a-d7c6-40d3-a20e-db13b310a781
|
|
114
|
+
$ create-ollie-shop --store-id 7217542a-d7c6-40d3-a20e-db13b310a781 --version-id abc12345-d7c6-40d3-a20e-db13b310a781
|
|
115
|
+
`,
|
|
116
|
+
{
|
|
117
|
+
importMeta: import.meta,
|
|
118
|
+
flags: {
|
|
119
|
+
storeId: {
|
|
120
|
+
type: "string"
|
|
121
|
+
},
|
|
122
|
+
versionId: {
|
|
123
|
+
type: "string"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
165
126
|
}
|
|
127
|
+
);
|
|
128
|
+
async function prompt(question, defaultValue) {
|
|
129
|
+
const rl = readline.createInterface({
|
|
130
|
+
input: process.stdin,
|
|
131
|
+
output: process.stdout
|
|
132
|
+
});
|
|
133
|
+
const suffix = defaultValue ? ` (${defaultValue})` : "";
|
|
134
|
+
const answer = await rl.question(`${question}${suffix}: `);
|
|
135
|
+
rl.close();
|
|
136
|
+
return answer.trim() || defaultValue || "";
|
|
166
137
|
}
|
|
167
|
-
async function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (!projectName) {
|
|
175
|
-
projectName = await promptForProjectName();
|
|
138
|
+
async function main() {
|
|
139
|
+
console.log("\n\u{1F6CD}\uFE0F Create Ollie Shop\n");
|
|
140
|
+
const projectDirectory = await prompt("Project directory", "my-checkout");
|
|
141
|
+
const projectPath = path2.resolve(process.cwd(), projectDirectory);
|
|
142
|
+
let storeId = cli.flags.storeId;
|
|
143
|
+
if (!storeId) {
|
|
144
|
+
storeId = await prompt("Store ID");
|
|
176
145
|
}
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
console.log(chalk3.red("\u274C Operation cancelled"));
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
await fs2.emptyDir(targetDir);
|
|
146
|
+
const storeIdResult = uuidSchema.safeParse(storeId);
|
|
147
|
+
if (!storeIdResult.success) {
|
|
148
|
+
console.error(`
|
|
149
|
+
\u274C ${storeIdResult.error.errors[0]?.message}`);
|
|
150
|
+
process.exit(1);
|
|
186
151
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
);
|
|
195
|
-
|
|
152
|
+
let versionId = cli.flags.versionId;
|
|
153
|
+
if (!versionId) {
|
|
154
|
+
versionId = await prompt("Version ID (optional, press Enter to skip)");
|
|
155
|
+
}
|
|
156
|
+
if (versionId) {
|
|
157
|
+
const versionIdResult = uuidSchema.safeParse(versionId);
|
|
158
|
+
if (!versionIdResult.success) {
|
|
159
|
+
console.error("\n\u274C Invalid version ID format. Must be a valid UUID.");
|
|
160
|
+
process.exit(1);
|
|
196
161
|
}
|
|
197
162
|
}
|
|
198
|
-
|
|
199
|
-
|
|
163
|
+
const finalVersionId = versionId || void 0;
|
|
164
|
+
try {
|
|
165
|
+
console.log();
|
|
166
|
+
await createProject(projectPath, { storeId, versionId: finalVersionId });
|
|
167
|
+
const relativePath = path2.relative(process.cwd(), projectPath);
|
|
168
|
+
console.log(
|
|
169
|
+
[
|
|
170
|
+
"",
|
|
171
|
+
`\u2705 Ollie Shop project created in ${relativePath || "the current directory"}:`,
|
|
172
|
+
relativePath ? ` $ cd ${relativePath}` : void 0,
|
|
173
|
+
"",
|
|
174
|
+
"Install dependencies:",
|
|
175
|
+
" $ npm install",
|
|
176
|
+
"",
|
|
177
|
+
"Start development:",
|
|
178
|
+
" $ npm start",
|
|
179
|
+
"",
|
|
180
|
+
"\u{1F6CD}\uFE0F Happy building with Ollie Shop!",
|
|
181
|
+
""
|
|
182
|
+
].filter((line) => line !== void 0).join("\n")
|
|
183
|
+
);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error(`
|
|
186
|
+
\u274C ${error instanceof Error ? error.message : error}`);
|
|
187
|
+
process.exit(1);
|
|
200
188
|
}
|
|
201
|
-
const config = {
|
|
202
|
-
projectName,
|
|
203
|
-
storeId,
|
|
204
|
-
versionId,
|
|
205
|
-
platform,
|
|
206
|
-
platformStoreId,
|
|
207
|
-
targetDir
|
|
208
|
-
};
|
|
209
|
-
await createProject(config);
|
|
210
189
|
}
|
|
211
190
|
main();
|
|
@@ -5,22 +5,7 @@
|
|
|
5
5
|
"source.fixAll.biome": "explicit",
|
|
6
6
|
"source.organizeImports.biome": "explicit"
|
|
7
7
|
},
|
|
8
|
-
"[typescript]": {
|
|
9
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
10
|
-
},
|
|
11
|
-
"[typescriptreact]": {
|
|
12
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
13
|
-
},
|
|
14
|
-
"[javascript]": {
|
|
15
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
16
|
-
},
|
|
17
|
-
"[javascriptreact]": {
|
|
18
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
19
|
-
},
|
|
20
|
-
"[json]": {
|
|
21
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
22
|
-
},
|
|
23
|
-
"[jsonc]": {
|
|
8
|
+
"[typescript][typescriptreact][javascript][javascriptreact][json][jsonc]": {
|
|
24
9
|
"editor.defaultFormatter": "biomejs.biome"
|
|
25
10
|
}
|
|
26
11
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# Dependencies
|
|
4
|
+
node_modules
|
|
5
|
+
.pnp
|
|
6
|
+
.pnp.js
|
|
7
|
+
|
|
8
|
+
# Local env files
|
|
9
|
+
.env
|
|
10
|
+
.env.local
|
|
11
|
+
.env.development.local
|
|
12
|
+
.env.test.local
|
|
13
|
+
.env.production.local
|
|
14
|
+
|
|
15
|
+
# Testing
|
|
16
|
+
coverage
|
|
17
|
+
|
|
18
|
+
# Turbo
|
|
19
|
+
.turbo
|
|
20
|
+
|
|
21
|
+
# Vercel
|
|
22
|
+
.vercel
|
|
23
|
+
|
|
24
|
+
# Build Outputs
|
|
25
|
+
.next/
|
|
26
|
+
out/
|
|
27
|
+
build
|
|
28
|
+
dist
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Debug
|
|
32
|
+
npm-debug.log*
|
|
33
|
+
yarn-debug.log*
|
|
34
|
+
yarn-error.log*
|
|
35
|
+
|
|
36
|
+
# Misc
|
|
37
|
+
.DS_Store
|
|
38
|
+
*.pem
|
|
39
|
+
|
|
40
|
+
*storybook.log
|
|
41
|
+
|
|
42
|
+
storybook-static/
|