@styleframe/cli 1.0.1 → 1.0.3

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.
@@ -1,74 +0,0 @@
1
- import consola from "consola";
2
- import { defineCommand } from "citty";
3
- import { readFile, writeFile } from "fs/promises";
4
- import path from "path";
5
- import { fileExists } from "../utils";
6
-
7
- const styleframeConfigTemplate = `import { styleframe } from "styleframe";
8
-
9
- const s = styleframe();
10
-
11
- s.variable("color--primary", "blue");
12
-
13
- export default s;
14
- `;
15
-
16
- export async function initializeConfigFile(cwd: string) {
17
- const styleframeConfigPath = path.join(cwd, "styleframe.config.ts");
18
-
19
- if (await fileExists(styleframeConfigPath)) {
20
- consola.warn(
21
- `Skipped creating "styleframe.config.ts" because it already exists.`,
22
- );
23
- } else {
24
- await writeFile(styleframeConfigPath, styleframeConfigTemplate);
25
- consola.success(`Created "styleframe.config.ts".`);
26
- }
27
- }
28
-
29
- export async function addPackageJsonDependencies(cwd: string) {
30
- const packageJsonPath = path.join(cwd, "package.json");
31
- if (await fileExists(packageJsonPath)) {
32
- const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
33
-
34
- if (!packageJson.dependencies) packageJson.dependencies = {};
35
- packageJson.dependencies["styleframe"] = "^1.0.0";
36
- packageJson.dependencies["@styleframe/theme"] = "^1.0.0";
37
-
38
- if (!packageJson.devDependencies) packageJson.devDependencies = {};
39
- packageJson.devDependencies["@styleframe/cli"] = "^1.0.0";
40
-
41
- await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
42
-
43
- consola.success(`Added dependencies to "package.json".`);
44
- } else {
45
- consola.warn(
46
- `Skipped adding styleframe to dependencies because package.json could not be found.`,
47
- );
48
- }
49
- }
50
-
51
- export default defineCommand({
52
- meta: {
53
- name: "init",
54
- description: "Initialize a new styleframe project.",
55
- },
56
- args: {
57
- cwd: {
58
- type: "string",
59
- required: false,
60
- default: process.cwd(),
61
- description: "The directory where the project will be initialized",
62
- alias: ["d", "dir"],
63
- valueHint: "path",
64
- },
65
- },
66
- async run({ args }) {
67
- const { cwd } = args;
68
-
69
- consola.info("Initializing...");
70
-
71
- await initializeConfigFile(cwd);
72
- await addPackageJsonDependencies(cwd);
73
- },
74
- });
package/src/index.ts DELETED
@@ -1,18 +0,0 @@
1
- import { defineCommand, runMain } from "citty";
2
- import { description, version } from "./package";
3
-
4
- const main = defineCommand({
5
- meta: {
6
- name: "styleframe",
7
- version,
8
- description,
9
- },
10
- subCommands: {
11
- init: () => import("./commands/init").then((m) => m.default),
12
- build: () => import("./commands/build").then((m) => m.default),
13
- },
14
- });
15
-
16
- export default function run() {
17
- runMain(main);
18
- }
package/src/package.ts DELETED
@@ -1,2 +0,0 @@
1
- export const version = "1.0.0";
2
- export const description = "A command-line interface for styleframe.";
@@ -1,14 +0,0 @@
1
- import path from "node:path";
2
- import build from "../commands/build";
3
-
4
- const __dirname = new URL(".", import.meta.url).pathname;
5
-
6
- (async () => {
7
- await build.run?.({
8
- args: {
9
- entry: path.resolve(__dirname, "styleframe.config.ts"),
10
- outputDir: path.resolve(__dirname, "styleframe"),
11
- },
12
- // biome-ignore lint/suspicious/noExplicitAny: No need for explicit type
13
- } as any);
14
- })();
@@ -1,15 +0,0 @@
1
- import { copyFile } from "node:fs/promises";
2
- import path from "node:path";
3
- import init from "../commands/init";
4
-
5
- const __dirname = new URL(".", import.meta.url).pathname;
6
-
7
- (async () => {
8
- await copyFile(
9
- path.join(__dirname, "package.template.json"),
10
- path.join(__dirname, "package.json"),
11
- );
12
-
13
- // biome-ignore lint/suspicious/noExplicitAny: No need for explicit type
14
- await init.run?.({ args: { cwd: __dirname } } as any);
15
- })();
@@ -1,12 +0,0 @@
1
- {
2
- "name": "styleframe-playground",
3
- "version": "0.0.0",
4
- "description": "Styleframe playground",
5
- "main": "index.js",
6
- "scripts": {
7
- "start": "node index.js"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC"
12
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --color--primary: blue;
3
- }
@@ -1,7 +0,0 @@
1
- import { styleframe } from "@styleframe/core";
2
-
3
- const s = styleframe();
4
-
5
- s.variable("color--primary", "blue");
6
-
7
- export default s;
package/src/utils.ts DELETED
@@ -1,11 +0,0 @@
1
- import { access } from "node:fs/promises";
2
- import { constants } from "node:fs";
3
-
4
- export async function fileExists(path: string) {
5
- try {
6
- await access(path, constants.F_OK);
7
- return true;
8
- } catch {
9
- return false;
10
- }
11
- }
package/src/vite-env.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "@styleframe/config-typescript",
3
- "compilerOptions": {
4
- "tsBuildInfoFile": ".tsbuildinfo"
5
- },
6
- "include": ["src/**/*.ts", "tsup.config.ts", "vite.config.ts"]
7
- }
package/vite.config.ts DELETED
@@ -1,13 +0,0 @@
1
- import { createViteConfig } from "@styleframe/config-vite";
2
- import { VitePluginNode } from "vite-plugin-node";
3
-
4
- const __dirname = new URL(".", import.meta.url).pathname;
5
-
6
- export default createViteConfig("cli", __dirname, {
7
- plugins: [
8
- VitePluginNode({
9
- appPath: "./src/index.ts",
10
- adapter: "express",
11
- }),
12
- ],
13
- });