juo 0.0.1-alpha.2 → 0.0.1-alpha.4
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 +42 -2
- package/bin/dev.js +1 -1
- package/dist/analytics-B2gwRg5Q.js +69 -0
- package/dist/commands/create.d.ts +15 -0
- package/dist/commands/create.js +465 -0
- package/dist/commands/generate.d.ts +20 -0
- package/dist/commands/generate.js +3 -0
- package/dist/commands/publish/index.d.ts +41 -13
- package/dist/commands/publish/index.js +193 -114
- package/dist/generate-D7J6nPBd.js +252 -0
- package/dist/hooks/postrun.d.ts +6 -0
- package/dist/hooks/postrun.js +62 -0
- package/dist/hooks/prerun.d.ts +6 -0
- package/dist/hooks/prerun.js +15 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/oclif.manifest.json +89 -1
- package/package.json +13 -4
- package/templates/.storybook/preview-head.html.liquid +11 -0
- package/templates/block/preact/index.ts.liquid +40 -0
- package/templates/block/preact/{{block.clsName}}.tsx.liquid +200 -0
- package/templates/block/react/index.ts.liquid +41 -0
- package/templates/block/react/state.ts.liquid +105 -0
- package/templates/block/react/{{block.clsName}}.tsx.liquid +91 -0
- package/templates/configFiles/.env.liquid +0 -0
- package/templates/configFiles/.gitignore.liquid +6 -0
- package/templates/configFiles/.prettierignore.liquid +45 -0
- package/templates/configFiles/.prettierrc.liquid +1 -0
- package/templates/configFiles/vite-env.d.ts.liquid +2 -0
- package/templates/css/styles.css +71 -0
- package/templates/stories/{{block.clsName}}.stories.tsx.liquid +24 -0
- package/templates/tailwind/src/tailwind.css.liquid +1 -0
- package/templates/tailwind/vite.config.ts.liquid +23 -0
- package/dist/base-command.d.ts +0 -23
- package/dist/base-command.js +0 -122
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Lock files
|
|
5
|
+
pnpm-lock.yaml
|
|
6
|
+
package-lock.json
|
|
7
|
+
yarn.lock
|
|
8
|
+
|
|
9
|
+
# Build outputs
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
*.tsbuildinfo
|
|
13
|
+
|
|
14
|
+
# Generated files
|
|
15
|
+
coverage/
|
|
16
|
+
.nyc_output/
|
|
17
|
+
|
|
18
|
+
# Logs
|
|
19
|
+
*.log
|
|
20
|
+
npm-debug.log*
|
|
21
|
+
yarn-debug.log*
|
|
22
|
+
yarn-error.log*
|
|
23
|
+
|
|
24
|
+
# OS files
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# IDE
|
|
29
|
+
.vscode/
|
|
30
|
+
.idea/
|
|
31
|
+
*.swp
|
|
32
|
+
*.swo
|
|
33
|
+
*~
|
|
34
|
+
|
|
35
|
+
# Assets (images, fonts, etc.)
|
|
36
|
+
*.png
|
|
37
|
+
*.jpg
|
|
38
|
+
*.jpeg
|
|
39
|
+
*.gif
|
|
40
|
+
*.svg
|
|
41
|
+
*.ico
|
|
42
|
+
*.woff
|
|
43
|
+
*.woff2
|
|
44
|
+
*.ttf
|
|
45
|
+
*.eot
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.counter-button {
|
|
2
|
+
padding: 0.5rem 1rem;
|
|
3
|
+
border-radius: 0.125rem;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.container {
|
|
8
|
+
font-weight: 540;
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: 2rem;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: 2.5rem;
|
|
14
|
+
border-radius: 0.5rem;
|
|
15
|
+
border: 1px solid #9ca3af;
|
|
16
|
+
background-color: #fafafa;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 0.875rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.icon-container {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 0.5rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.framework-icon {
|
|
32
|
+
width: 2.25rem;
|
|
33
|
+
height: 2.25rem;
|
|
34
|
+
fill: currentColor;
|
|
35
|
+
color: black;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.typescript-icon {
|
|
39
|
+
width: 2.5rem;
|
|
40
|
+
height: 2.5rem;
|
|
41
|
+
fill: currentColor;
|
|
42
|
+
color: black;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.text-container {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-self: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.subtitle {
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
line-height: 1rem;
|
|
54
|
+
color: #696969;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.title {
|
|
58
|
+
font-size: 15px;
|
|
59
|
+
line-height: 1;
|
|
60
|
+
color: #111;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.counter-button-custom {
|
|
64
|
+
font-size: 0.75rem;
|
|
65
|
+
line-height: 0.75rem;
|
|
66
|
+
color: white;
|
|
67
|
+
background-color: #111;
|
|
68
|
+
border-radius: 0.375rem;
|
|
69
|
+
padding: 0.375rem 0.5rem;
|
|
70
|
+
min-width: 5.5rem;
|
|
71
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { {{ block.clsName }} } from "../src/blocks/{{block.slug}}/{{ block.clsName }}";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof {{ block.clsName }}> = {
|
|
5
|
+
title: "Blocks/{{ block.name }}",
|
|
6
|
+
component: {{ block.clsName }},
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
},
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof {{ block.clsName }}>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
title: "{{ block.framework | capitalize }} + Typescript",
|
|
19
|
+
subtitle: "Starter Block",
|
|
20
|
+
initialCount: 0,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
+
import svgr from "vite-plugin-svgr";
|
|
4
|
+
{% if framework == "react" %}
|
|
5
|
+
import react from "@vitejs/plugin-react";
|
|
6
|
+
{% elsif framework == "preact" %}
|
|
7
|
+
import preact from "@preact/preset-vite";
|
|
8
|
+
{% endif %}
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [tailwindcss(){% if framework == "react" %}, react(){% endif %}{% if framework == "preact" %}, preact(){% endif %},
|
|
12
|
+
svgr({
|
|
13
|
+
svgrOptions: {
|
|
14
|
+
icon: true,
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
build: {
|
|
19
|
+
rollupOptions: {
|
|
20
|
+
external: ["@juo/orion-core"],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
package/dist/base-command.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Command, Flags, Interfaces } from '@oclif/core';
|
|
2
|
-
export interface OrionConfig {
|
|
3
|
-
JUO_API_KEY: string;
|
|
4
|
-
JUO_API_URL: string;
|
|
5
|
-
}
|
|
6
|
-
type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>;
|
|
7
|
-
type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
8
|
-
export declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
9
|
-
static baseFlags: {
|
|
10
|
-
reconfigure: Interfaces.BooleanFlag<boolean>;
|
|
11
|
-
};
|
|
12
|
-
protected args: Args<T>;
|
|
13
|
-
protected flags: Flags<T>;
|
|
14
|
-
protected get configFileName(): string;
|
|
15
|
-
protected get configFilePath(): string;
|
|
16
|
-
protected configExists(): boolean;
|
|
17
|
-
protected ensureConfig(reconfigure?: boolean): Promise<OrionConfig>;
|
|
18
|
-
init(): Promise<void>;
|
|
19
|
-
protected loadConfig(): Partial<OrionConfig>;
|
|
20
|
-
protected saveConfig(config: Partial<OrionConfig>): void;
|
|
21
|
-
protected validateConfig(config: Partial<OrionConfig>): config is OrionConfig;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
package/dist/base-command.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { Command, Flags } from '@oclif/core';
|
|
2
|
-
import inquirer from 'inquirer';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
export class BaseCommand extends Command {
|
|
6
|
-
static baseFlags = {
|
|
7
|
-
reconfigure: Flags.boolean({
|
|
8
|
-
default: false,
|
|
9
|
-
description: 'Reconfigure settings',
|
|
10
|
-
helpGroup: 'GLOBAL',
|
|
11
|
-
}),
|
|
12
|
-
};
|
|
13
|
-
args;
|
|
14
|
-
flags;
|
|
15
|
-
get configFileName() {
|
|
16
|
-
return 'config.json';
|
|
17
|
-
}
|
|
18
|
-
get configFilePath() {
|
|
19
|
-
return path.join(this.config.configDir, this.configFileName);
|
|
20
|
-
}
|
|
21
|
-
configExists() {
|
|
22
|
-
return fs.existsSync(this.configFilePath);
|
|
23
|
-
}
|
|
24
|
-
async ensureConfig(reconfigure = false) {
|
|
25
|
-
let config = {};
|
|
26
|
-
if (this.configExists()) {
|
|
27
|
-
try {
|
|
28
|
-
config = this.loadConfig();
|
|
29
|
-
if (this.validateConfig(config) && !reconfigure) {
|
|
30
|
-
this.log(`Found configuration at ${this.configFilePath}`);
|
|
31
|
-
return config;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
this.log(`Warning: Could not parse existing config at ${this.configFilePath}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (reconfigure && this.validateConfig(config)) {
|
|
39
|
-
this.log('Reconfiguring settings...');
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this.log('Configuration incomplete. Setting up...');
|
|
43
|
-
}
|
|
44
|
-
const questions = [];
|
|
45
|
-
if (!config.JUO_API_URL || reconfigure) {
|
|
46
|
-
questions.push({
|
|
47
|
-
default: config.JUO_API_URL,
|
|
48
|
-
message: 'Enter the Juo API URL:',
|
|
49
|
-
name: 'JUO_API_URL',
|
|
50
|
-
type: 'input',
|
|
51
|
-
validate(input) {
|
|
52
|
-
if (!input.trim()) {
|
|
53
|
-
return 'Juo API URL is required';
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (!config.JUO_API_KEY || reconfigure) {
|
|
60
|
-
questions.push({
|
|
61
|
-
message: 'Enter your Juo API key:',
|
|
62
|
-
name: 'JUO_API_KEY',
|
|
63
|
-
type: 'password',
|
|
64
|
-
validate(input) {
|
|
65
|
-
if (!input.trim()) {
|
|
66
|
-
return 'Juo API key is required';
|
|
67
|
-
}
|
|
68
|
-
return true;
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
if (questions.length === 0) {
|
|
73
|
-
return config;
|
|
74
|
-
}
|
|
75
|
-
const response = await inquirer.prompt(questions);
|
|
76
|
-
if (response.JUO_API_URL) {
|
|
77
|
-
config.JUO_API_URL = response.JUO_API_URL.trim();
|
|
78
|
-
}
|
|
79
|
-
if (response.JUO_API_KEY) {
|
|
80
|
-
config.JUO_API_KEY = response.JUO_API_KEY.trim();
|
|
81
|
-
}
|
|
82
|
-
this.saveConfig(config);
|
|
83
|
-
this.log(`Saved configuration to ${this.configFilePath}`);
|
|
84
|
-
if (this.validateConfig(config)) {
|
|
85
|
-
return config;
|
|
86
|
-
}
|
|
87
|
-
throw new Error('Failed to create valid configuration');
|
|
88
|
-
}
|
|
89
|
-
async init() {
|
|
90
|
-
await super.init();
|
|
91
|
-
const { args, flags } = await this.parse({
|
|
92
|
-
args: this.ctor.args,
|
|
93
|
-
baseFlags: super.ctor.baseFlags,
|
|
94
|
-
flags: this.ctor.flags,
|
|
95
|
-
strict: this.ctor.strict,
|
|
96
|
-
});
|
|
97
|
-
this.flags = flags;
|
|
98
|
-
this.args = args;
|
|
99
|
-
}
|
|
100
|
-
loadConfig() {
|
|
101
|
-
if (!this.configExists()) {
|
|
102
|
-
throw new Error(`Configuration file not found at ${this.configFilePath}`);
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
const configContent = fs.readFileSync(this.configFilePath, 'utf8');
|
|
106
|
-
return JSON.parse(configContent);
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
throw new Error(`Failed to parse configuration file at ${this.configFilePath}: ${error}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
saveConfig(config) {
|
|
113
|
-
fs.mkdirSync(this.config.configDir, { recursive: true });
|
|
114
|
-
fs.writeFileSync(this.configFilePath, JSON.stringify(config, null, 2), { encoding: 'utf8' });
|
|
115
|
-
}
|
|
116
|
-
validateConfig(config) {
|
|
117
|
-
return Boolean(config.JUO_API_KEY &&
|
|
118
|
-
config.JUO_API_KEY.length > 0 &&
|
|
119
|
-
config.JUO_API_URL &&
|
|
120
|
-
config.JUO_API_URL.length > 0);
|
|
121
|
-
}
|
|
122
|
-
}
|