@salty-css/core 0.1.0-alpha.5 → 0.1.0-alpha.6

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.
@@ -0,0 +1,21 @@
1
+ import { PathLike } from 'fs';
2
+ export declare const defaultPackageJsonPath: string;
3
+ export interface PackageJson {
4
+ name?: string;
5
+ version?: string;
6
+ scripts?: Record<string, string>;
7
+ dependencies?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ [key: string]: unknown;
10
+ }
11
+ export declare const readPackageJson: (filePath?: PathLike) => Promise<PackageJson>;
12
+ export declare const updatePackageJson: (content: string | object, filePath?: PathLike) => Promise<void>;
13
+ export declare const readThisPackageJson: () => Promise<PackageJson>;
14
+ export declare const corePackages: {
15
+ core: (version: string) => string;
16
+ eslintConfigCore: (version: string) => string;
17
+ };
18
+ export declare const addPrepareScript: (pkg: PackageJson) => {
19
+ changed: boolean;
20
+ pkg: PackageJson;
21
+ };
@@ -0,0 +1,30 @@
1
+ import { RCFile } from '../types/cli-types';
2
+ export declare const SALTYRC_FILENAME = ".saltyrc.json";
3
+ export declare const SALTYRC_SCHEMA = "./node_modules/@salty-css/core/.saltyrc.schema.json";
4
+ export declare const SALTYRC_INFO = "This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.";
5
+ export interface ProjectEntry {
6
+ dir: string;
7
+ framework: string;
8
+ [key: string]: unknown;
9
+ }
10
+ export declare const saltyrcPath: (rootDir?: string) => string;
11
+ export declare const readRc: (rootDir?: string) => Promise<RCFile>;
12
+ export declare const readRawRc: (rootDir?: string) => Promise<string | undefined>;
13
+ export declare const getDefaultProject: (rootDir?: string) => Promise<string | undefined>;
14
+ /**
15
+ * Pure transform: returns the new saltyrc content for an upsert. Does not touch the filesystem.
16
+ * - If `existingRaw` is undefined, returns a fresh file with the project as the only entry.
17
+ * - If the project entry already exists, returns the same content (no-op).
18
+ * - Otherwise appends the new entry and returns updated content.
19
+ */
20
+ export declare const upsertProjectInRc: (existingRaw: string | undefined, relativeProjectPath: string, framework: string) => {
21
+ content: string;
22
+ changed: boolean;
23
+ created: boolean;
24
+ };
25
+ /**
26
+ * Writes the saltyrc file, creating or updating the project entry for the given dir.
27
+ * Returns true when a write occurred.
28
+ */
29
+ export declare const writeProjectToRc: (rootDir: string, relativeProjectPath: string, framework: string) => Promise<boolean>;
30
+ export declare const getProjectFramework: (rc: RCFile, relativeProjectPath: string) => string | undefined;
@@ -0,0 +1,14 @@
1
+ declare const templateLoaders: {
2
+ readonly 'salty.config.ts': () => Promise<any>;
3
+ readonly 'saltygen/index.css': () => Promise<any>;
4
+ readonly 'react/styled-file.ts': () => Promise<any>;
5
+ readonly 'react/vanilla-file.ts': () => Promise<any>;
6
+ readonly 'astro/styled-file.ts': () => Promise<any>;
7
+ readonly 'astro/component.astro': () => Promise<any>;
8
+ };
9
+ export type TemplateKey = keyof typeof templateLoaders;
10
+ export declare const readTemplate: <T extends object>(key: TemplateKey, options?: T) => Promise<{
11
+ fileName: "salty.config.ts" | "saltygen/index.css" | "react/styled-file.ts" | "react/vanilla-file.ts" | "astro/styled-file.ts" | "astro/component.astro";
12
+ content: string;
13
+ }>;
14
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.6",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const styledFile = `import { styled } from "@salty-css/astro/styled";
4
+
5
+ export const <%- name %> = styled('<%- tag %>', {
6
+ <% if(className) { %>className: '<%- className %>',<% } %>
7
+ base: {
8
+ // Add your styles here
9
+ }
10
+ })
11
+ `;
12
+ exports.default = styledFile;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactStyledFile = `import { styled } from "@salty-css/react/styled";
3
+ const styledFile = `import { styled } from "@salty-css/react/styled";
4
4
 
5
5
  export const <%- name %> = styled('<%- tag %>', {
6
6
  <% if(className) { %>className: '<%- className %>',<% } %>
@@ -8,4 +8,4 @@ export const <%- name %> = styled('<%- tag %>', {
8
8
  // Add your styles here
9
9
  }
10
10
  })`;
11
- exports.default = reactStyledFile;
11
+ exports.default = styledFile;
@@ -1,4 +1,4 @@
1
- const reactStyledFile = `import { styled } from "@salty-css/react/styled";
1
+ const styledFile = `import { styled } from "@salty-css/react/styled";
2
2
 
3
3
  export const <%- name %> = styled('<%- tag %>', {
4
4
  <% if(className) { %>className: '<%- className %>',<% } %>
@@ -7,5 +7,5 @@ export const <%- name %> = styled('<%- tag %>', {
7
7
  }
8
8
  })`;
9
9
  export {
10
- reactStyledFile as default
10
+ styledFile as default
11
11
  };
@@ -0,0 +1,12 @@
1
+ const styledFile = `import { styled } from "@salty-css/astro/styled";
2
+
3
+ export const <%- name %> = styled('<%- tag %>', {
4
+ <% if(className) { %>className: '<%- className %>',<% } %>
5
+ base: {
6
+ // Add your styles here
7
+ }
8
+ })
9
+ `;
10
+ export {
11
+ styledFile as default
12
+ };
@@ -1,4 +1,4 @@
1
- const reactVanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
1
+ const vanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
2
2
 
3
3
  interface <%- componentName %>Props {
4
4
  text?: string;
@@ -14,5 +14,5 @@ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName
14
14
 
15
15
  export default <%- componentName %>;`;
16
16
  export {
17
- reactVanillaFile as default
17
+ vanillaFile as default
18
18
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactVanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
3
+ const vanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
4
4
 
5
5
  interface <%- componentName %>Props {
6
6
  text?: string;
@@ -15,4 +15,4 @@ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName
15
15
  };
16
16
 
17
17
  export default <%- componentName %>;`;
18
- exports.default = reactVanillaFile;
18
+ exports.default = vanillaFile;