juo 0.0.2-pre.1 → 0.1.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/README.md +1 -1
- package/dist/{analytics-CyANz2YH.js → analytics-CgHTVQWO.js} +5 -5
- package/dist/commands/create.d.ts +4 -4
- package/dist/commands/create.js +9 -10
- package/dist/commands/generate.js +2 -2
- package/dist/commands/publish/index.d.ts +2 -2
- package/dist/{generate-Be3Ctuvv.js → generate-vpUPJZRH.js} +1 -1
- package/dist/hooks/postrun.js +31 -3
- package/dist/hooks/prerun.js +1 -1
- package/dist/{juoTemplateGenerator-C0le5FdK.js → juoTemplateGenerator-MZ8llr7w.js} +3 -3
- package/dist/lib/index.js +2 -2
- package/dist/{packageGenerator-8E_-V5CL.js → packageGenerator-Dno-ecHh.js} +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/config.ts
|
|
4
|
-
const MIXPANEL_TOKEN = "";
|
|
5
|
-
const MIXPANEL_API_URL = "https://api.mixpanel.com";
|
|
6
|
-
const CUSTOMERIO_BETA_FORM_URL = "";
|
|
7
|
-
const CUSTOMERIO_SITE_ID = "";
|
|
8
|
-
const CUSTOMERIO_API_KEY = "";
|
|
4
|
+
const MIXPANEL_TOKEN = "919dd811a5e2137983cc8fc304b8584b";
|
|
5
|
+
const MIXPANEL_API_URL = "https://api-eu.mixpanel.com";
|
|
6
|
+
const CUSTOMERIO_BETA_FORM_URL = "https://track-cio.juo.io/api/v1/forms/3c02106b-9746-4ebe-a116-553e47494eb4/submit";
|
|
7
|
+
const CUSTOMERIO_SITE_ID = "60da89062ce61084fc27";
|
|
8
|
+
const CUSTOMERIO_API_KEY = "1d54688e66cddda9ea72";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/utils/analytics.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _oclif_core_interfaces7 from "@oclif/core/interfaces";
|
|
3
3
|
|
|
4
4
|
//#region src/commands/create.d.ts
|
|
5
5
|
declare class Create extends Command {
|
|
6
6
|
static description: string;
|
|
7
7
|
static flags: {
|
|
8
|
-
quickstart:
|
|
9
|
-
storybook:
|
|
10
|
-
verbose:
|
|
8
|
+
quickstart: _oclif_core_interfaces7.BooleanFlag<boolean>;
|
|
9
|
+
storybook: _oclif_core_interfaces7.BooleanFlag<boolean>;
|
|
10
|
+
verbose: _oclif_core_interfaces7.BooleanFlag<boolean>;
|
|
11
11
|
};
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
private getProjectConfig;
|
package/dist/commands/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as BaseTemplateGenerator } from "../juoTemplateGenerator-
|
|
2
|
-
import { t as PackageGenerator } from "../packageGenerator-
|
|
3
|
-
import { t as Generate } from "../generate-
|
|
1
|
+
import { r as BaseTemplateGenerator } from "../juoTemplateGenerator-MZ8llr7w.js";
|
|
2
|
+
import { t as PackageGenerator } from "../packageGenerator-Dno-ecHh.js";
|
|
3
|
+
import { t as Generate } from "../generate-vpUPJZRH.js";
|
|
4
4
|
import { Command, Flags } from "@oclif/core";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
@@ -20,7 +20,7 @@ var ConfigFilesGenerator = class extends BaseTemplateGenerator {
|
|
|
20
20
|
//#region src/utils/storybookGenerator.ts
|
|
21
21
|
const COMMAND_CONFIG = {
|
|
22
22
|
npm: "npx",
|
|
23
|
-
pnpm: "
|
|
23
|
+
pnpm: "pnpm dlx",
|
|
24
24
|
yarn: "yarn dlx"
|
|
25
25
|
};
|
|
26
26
|
var StorybookGenerator = class extends BaseTemplateGenerator {
|
|
@@ -274,7 +274,6 @@ var Create = class Create extends Command {
|
|
|
274
274
|
process.chdir(originalCwd);
|
|
275
275
|
}
|
|
276
276
|
outro(`Run \`cd ${packageName}\` to start developing your project.`);
|
|
277
|
-
process.exit(0);
|
|
278
277
|
}
|
|
279
278
|
async getProjectConfig(quickstart, storybookFlag) {
|
|
280
279
|
if (quickstart) return {
|
|
@@ -293,7 +292,7 @@ var Create = class Create extends Command {
|
|
|
293
292
|
if (!/^[a-z0-9-]+$/.test(value)) return `Invalid package name`;
|
|
294
293
|
}
|
|
295
294
|
});
|
|
296
|
-
if (isCancel(packageName))
|
|
295
|
+
if (isCancel(packageName)) this.exit(0);
|
|
297
296
|
const packageManager = await select({
|
|
298
297
|
initialValue: "npm",
|
|
299
298
|
message: "What package manager to use?",
|
|
@@ -312,7 +311,7 @@ var Create = class Create extends Command {
|
|
|
312
311
|
}
|
|
313
312
|
]
|
|
314
313
|
});
|
|
315
|
-
if (isCancel(packageManager))
|
|
314
|
+
if (isCancel(packageManager)) this.exit(0);
|
|
316
315
|
const framework = await select({
|
|
317
316
|
initialValue: "react",
|
|
318
317
|
message: "What framework to use?",
|
|
@@ -324,7 +323,7 @@ var Create = class Create extends Command {
|
|
|
324
323
|
value: "preact"
|
|
325
324
|
}]
|
|
326
325
|
});
|
|
327
|
-
if (isCancel(framework))
|
|
326
|
+
if (isCancel(framework)) this.exit(0);
|
|
328
327
|
const tailwind = await select({
|
|
329
328
|
initialValue: true,
|
|
330
329
|
message: "Do you want to use Tailwind CSS?",
|
|
@@ -336,14 +335,14 @@ var Create = class Create extends Command {
|
|
|
336
335
|
value: false
|
|
337
336
|
}]
|
|
338
337
|
});
|
|
339
|
-
if (isCancel(tailwind))
|
|
338
|
+
if (isCancel(tailwind)) this.exit(0);
|
|
340
339
|
let storybook;
|
|
341
340
|
if (storybookFlag === void 0) {
|
|
342
341
|
const storybookAnswer = await confirm({
|
|
343
342
|
initialValue: false,
|
|
344
343
|
message: "Do you want Storybook?"
|
|
345
344
|
});
|
|
346
|
-
if (isCancel(storybookAnswer))
|
|
345
|
+
if (isCancel(storybookAnswer)) this.exit(0);
|
|
347
346
|
storybook = storybookAnswer;
|
|
348
347
|
} else storybook = storybookFlag;
|
|
349
348
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command, Interfaces } from "@oclif/core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _oclif_core_interfaces5 from "@oclif/core/interfaces";
|
|
3
3
|
|
|
4
4
|
//#region src/base-command.d.ts
|
|
5
5
|
interface BaseConfig {
|
|
@@ -30,7 +30,7 @@ declare class Publish extends BaseCommand<typeof Publish> {
|
|
|
30
30
|
static description: string;
|
|
31
31
|
static examples: string[];
|
|
32
32
|
static flags: {
|
|
33
|
-
theme:
|
|
33
|
+
theme: _oclif_core_interfaces5.OptionFlag<string, _oclif_core_interfaces5.CustomOptions>;
|
|
34
34
|
};
|
|
35
35
|
getAllFiles(dirPath: string, basePath: string): string[];
|
|
36
36
|
run(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as JuoTemplateGenerator } from "./juoTemplateGenerator-
|
|
1
|
+
import { t as JuoTemplateGenerator } from "./juoTemplateGenerator-MZ8llr7w.js";
|
|
2
2
|
import { Command, Flags } from "@oclif/core";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
package/dist/hooks/postrun.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { a as CUSTOMERIO_BETA_FORM_URL, i as CUSTOMERIO_API_KEY, n as trackCommandCompleted, o as CUSTOMERIO_SITE_ID, t as trackBetaSignup } from "../analytics-
|
|
1
|
+
import { a as CUSTOMERIO_BETA_FORM_URL, i as CUSTOMERIO_API_KEY, n as trackCommandCompleted, o as CUSTOMERIO_SITE_ID, t as trackBetaSignup } from "../analytics-CgHTVQWO.js";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import { confirm, isCancel, text } from "@clack/prompts";
|
|
3
5
|
import debug from "debug";
|
|
4
6
|
|
|
5
7
|
//#region src/utils/betaSignup.ts
|
|
6
8
|
const log$1 = debug("juo:betaSignup");
|
|
9
|
+
let promptedThisSession = false;
|
|
7
10
|
async function sendToCustomerIO(email) {
|
|
8
11
|
if (!CUSTOMERIO_BETA_FORM_URL || !CUSTOMERIO_SITE_ID || !CUSTOMERIO_API_KEY) return;
|
|
9
12
|
try {
|
|
@@ -25,12 +28,36 @@ async function sendToCustomerIO(email) {
|
|
|
25
28
|
log$1("Error sending beta signup to CustomerIO: %O", error);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
|
-
|
|
31
|
+
function getBetaSignupStatePath(configDir) {
|
|
32
|
+
return path.join(configDir, "beta-signup.json");
|
|
33
|
+
}
|
|
34
|
+
function hasUserRespondedToBetaSignup(configDir) {
|
|
35
|
+
try {
|
|
36
|
+
const statePath = getBetaSignupStatePath(configDir);
|
|
37
|
+
if (!existsSync(statePath)) return false;
|
|
38
|
+
return JSON.parse(readFileSync(statePath, "utf8")).responded === true;
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function markUserRespondedToBetaSignup(configDir) {
|
|
44
|
+
try {
|
|
45
|
+
if (!existsSync(configDir)) mkdirSync(configDir, { recursive: true });
|
|
46
|
+
writeFileSync(getBetaSignupStatePath(configDir), JSON.stringify({ responded: true }), "utf8");
|
|
47
|
+
} catch (error) {
|
|
48
|
+
log$1("Failed to persist beta signup state: %O", error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function promptBetaSignup(commandContext, configDir) {
|
|
52
|
+
if (promptedThisSession) return;
|
|
53
|
+
if (hasUserRespondedToBetaSignup(configDir)) return;
|
|
54
|
+
promptedThisSession = true;
|
|
29
55
|
try {
|
|
30
56
|
const shouldSignup = await confirm({
|
|
31
57
|
initialValue: true,
|
|
32
58
|
message: "Would you like to request access to the private beta?"
|
|
33
59
|
});
|
|
60
|
+
markUserRespondedToBetaSignup(configDir);
|
|
34
61
|
if (isCancel(shouldSignup) || !shouldSignup) return;
|
|
35
62
|
const email = await text({
|
|
36
63
|
message: "Enter your email address:",
|
|
@@ -54,7 +81,8 @@ async function promptBetaSignup(commandContext) {
|
|
|
54
81
|
//#region src/hooks/postrun.ts
|
|
55
82
|
const hook = async function(options) {
|
|
56
83
|
if (options.Command) trackCommandCompleted(options.Command.id || options.Command.name || "unknown", true);
|
|
57
|
-
|
|
84
|
+
const isInteractive = process.stdin.isTTY && process.stdout.isTTY && !process.env.CI && !process.env.NO_INTERACTIVE;
|
|
85
|
+
if (options.Command && isInteractive) await promptBetaSignup(options.Command.id || options.Command.name || "unknown", options.config.configDir);
|
|
58
86
|
};
|
|
59
87
|
var postrun_default = hook;
|
|
60
88
|
|
package/dist/hooks/prerun.js
CHANGED
|
@@ -57,7 +57,7 @@ var StoryGenerator = class extends BaseTemplateGenerator {
|
|
|
57
57
|
}
|
|
58
58
|
async generateBlockTemplate(destDir, options) {
|
|
59
59
|
const scope = { block: {
|
|
60
|
-
clsName: slugify(options.name, { lower: true }).split("-").map((item) => `${item[0].toUpperCase()}${item.slice(1)}`).join(""),
|
|
60
|
+
clsName: slugify(options.name, { lower: true }).split("-").filter(Boolean).map((item) => `${item[0].toUpperCase()}${item.slice(1)}`).join(""),
|
|
61
61
|
framework: options.framework,
|
|
62
62
|
name: options.name,
|
|
63
63
|
slug: slugify(options.name, { lower: true })
|
|
@@ -69,7 +69,7 @@ var StoryGenerator = class extends BaseTemplateGenerator {
|
|
|
69
69
|
}
|
|
70
70
|
async generateThemeTemplate(destDir, options) {
|
|
71
71
|
const themeScope = { theme: {
|
|
72
|
-
clsName: slugify(options.name, { lower: true }).split("-").map((item) => `${item[0].toUpperCase()}${item.slice(1)}`).join(""),
|
|
72
|
+
clsName: slugify(options.name, { lower: true }).split("-").filter(Boolean).map((item) => `${item[0].toUpperCase()}${item.slice(1)}`).join(""),
|
|
73
73
|
framework: options.framework,
|
|
74
74
|
name: options.name,
|
|
75
75
|
slug: slugify(options.name, { lower: true })
|
|
@@ -94,7 +94,7 @@ var JuoTemplateGenerator = class extends BaseTemplateGenerator {
|
|
|
94
94
|
}
|
|
95
95
|
async generateBlockTemplate(destDir, options) {
|
|
96
96
|
const scope = { block: {
|
|
97
|
-
clsName: slugify(options.name, { lower: true }).split("-").map((item) => `${item[0].toUpperCase()}${item.slice(1)}`).join(""),
|
|
97
|
+
clsName: slugify(options.name, { lower: true }).split("-").filter(Boolean).map((item) => `${item[0].toUpperCase()}${item.slice(1)}`).join(""),
|
|
98
98
|
framework: options.framework,
|
|
99
99
|
name: options.name,
|
|
100
100
|
slug: slugify(options.name, { lower: true }),
|
package/dist/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as StoryGenerator, r as BaseTemplateGenerator, t as JuoTemplateGenerator } from "../juoTemplateGenerator-
|
|
2
|
-
import { t as PackageGenerator } from "../packageGenerator-
|
|
1
|
+
import { n as StoryGenerator, r as BaseTemplateGenerator, t as JuoTemplateGenerator } from "../juoTemplateGenerator-MZ8llr7w.js";
|
|
2
|
+
import { t as PackageGenerator } from "../packageGenerator-Dno-ecHh.js";
|
|
3
3
|
|
|
4
4
|
export { BaseTemplateGenerator, JuoTemplateGenerator, PackageGenerator, StoryGenerator };
|
package/oclif.manifest.json
CHANGED