@salty-css/core 0.2.0-fix-astro-fixes-06-2026.4 → 0.2.1
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/bin/main.cjs +6 -7
- package/bin/main.js +6 -7
- package/compiler/salty-compiler.cjs +1 -1
- package/compiler/salty-compiler.js +1 -1
- package/package.json +1 -1
package/bin/main.cjs
CHANGED
|
@@ -613,7 +613,7 @@ const ensureGitignoreSaltygen = async (rootDir) => {
|
|
|
613
613
|
compiler_saltyCompiler.logger.info("Edit file: " + path$1);
|
|
614
614
|
await promises.writeFile(path$1, existing + "\n\n# Salty-CSS\nsaltygen\n");
|
|
615
615
|
};
|
|
616
|
-
const importSaltygenIntoCss = async (projectDir,
|
|
616
|
+
const importSaltygenIntoCss = async (projectDir, explicitCssFile) => {
|
|
617
617
|
const target = explicitCssFile ?? await findGlobalCssFile(projectDir);
|
|
618
618
|
if (!target) {
|
|
619
619
|
compiler_saltyCompiler.logger.warn("Could not find a CSS file to import the generated CSS. Please add it manually.");
|
|
@@ -624,7 +624,7 @@ const importSaltygenIntoCss = async (projectDir, saltygenDir, explicitCssFile) =
|
|
|
624
624
|
if (cssFileContent === void 0) return;
|
|
625
625
|
if (cssFileContent.includes("saltygen")) return;
|
|
626
626
|
const cssFileFolder = path.join(cssFilePath, "..");
|
|
627
|
-
const relPath = path.relative(cssFileFolder, path.join(
|
|
627
|
+
const relPath = path.relative(cssFileFolder, path.join(projectDir, "saltygen/index.css"));
|
|
628
628
|
compiler_saltyCompiler.logger.info("Adding global import statement to CSS file: " + cssFilePath);
|
|
629
629
|
await promises.writeFile(cssFilePath, `@import '${relPath}';
|
|
630
630
|
` + cssFileContent);
|
|
@@ -649,7 +649,6 @@ const registerInitCommand = (program) => {
|
|
|
649
649
|
compiler_saltyCompiler.logger.info("Initializing a new Salty-CSS project!");
|
|
650
650
|
const framework = await detectFramework(ctx);
|
|
651
651
|
compiler_saltyCompiler.logger.info(`Detected framework: ${framework.name}`);
|
|
652
|
-
const sourceDir = path.join(ctx.projectDir, framework.srcDirectory);
|
|
653
652
|
const plannedIntegrations = await planIntegrations(ctx);
|
|
654
653
|
if (!ctx.skipInstall) {
|
|
655
654
|
const packages = [
|
|
@@ -661,8 +660,8 @@ const registerInitCommand = (program) => {
|
|
|
661
660
|
await npmInstall(...packages);
|
|
662
661
|
}
|
|
663
662
|
const projectFiles = await Promise.all([readTemplate("salty.config.ts"), readTemplate("saltygen/index.css")]);
|
|
664
|
-
await promises.mkdir(
|
|
665
|
-
await Promise.all(projectFiles.map(({ fileName, content }) => writeProjectFile(
|
|
663
|
+
await promises.mkdir(ctx.projectDir, { recursive: true });
|
|
664
|
+
await Promise.all(projectFiles.map(({ fileName, content }) => writeProjectFile(ctx.projectDir, fileName, content)));
|
|
666
665
|
const pathDefaults = computePathDefaults({
|
|
667
666
|
framework: framework.name,
|
|
668
667
|
integrations: plannedIntegrations.map((p) => p.name),
|
|
@@ -670,11 +669,11 @@ const registerInitCommand = (program) => {
|
|
|
670
669
|
});
|
|
671
670
|
await writeProjectToRc(ctx.cwd, ctx.relativeProjectPath, framework, pathDefaults);
|
|
672
671
|
await ensureGitignoreSaltygen(ctx.cwd);
|
|
673
|
-
await importSaltygenIntoCss(ctx.projectDir,
|
|
672
|
+
await importSaltygenIntoCss(ctx.projectDir, opts.cssFile);
|
|
674
673
|
await applyIntegrationPlans(plannedIntegrations);
|
|
675
674
|
await wirePrepareScript();
|
|
676
675
|
compiler_saltyCompiler.logger.info("Running the build to generate initial CSS...");
|
|
677
|
-
const compiler = new compiler_saltyCompiler.SaltyCompiler(
|
|
676
|
+
const compiler = new compiler_saltyCompiler.SaltyCompiler(ctx.projectDir);
|
|
678
677
|
await compiler.generateCss();
|
|
679
678
|
compiler_saltyCompiler.logger.info("🎉 Salty CSS project initialized successfully!");
|
|
680
679
|
compiler_saltyCompiler.logger.info("Next steps:");
|
package/bin/main.js
CHANGED
|
@@ -610,7 +610,7 @@ const ensureGitignoreSaltygen = async (rootDir) => {
|
|
|
610
610
|
logger.info("Edit file: " + path);
|
|
611
611
|
await writeFile(path, existing + "\n\n# Salty-CSS\nsaltygen\n");
|
|
612
612
|
};
|
|
613
|
-
const importSaltygenIntoCss = async (projectDir,
|
|
613
|
+
const importSaltygenIntoCss = async (projectDir, explicitCssFile) => {
|
|
614
614
|
const target = explicitCssFile ?? await findGlobalCssFile(projectDir);
|
|
615
615
|
if (!target) {
|
|
616
616
|
logger.warn("Could not find a CSS file to import the generated CSS. Please add it manually.");
|
|
@@ -621,7 +621,7 @@ const importSaltygenIntoCss = async (projectDir, saltygenDir, explicitCssFile) =
|
|
|
621
621
|
if (cssFileContent === void 0) return;
|
|
622
622
|
if (cssFileContent.includes("saltygen")) return;
|
|
623
623
|
const cssFileFolder = join(cssFilePath, "..");
|
|
624
|
-
const relPath = relative(cssFileFolder, join(
|
|
624
|
+
const relPath = relative(cssFileFolder, join(projectDir, "saltygen/index.css"));
|
|
625
625
|
logger.info("Adding global import statement to CSS file: " + cssFilePath);
|
|
626
626
|
await writeFile(cssFilePath, `@import '${relPath}';
|
|
627
627
|
` + cssFileContent);
|
|
@@ -646,7 +646,6 @@ const registerInitCommand = (program) => {
|
|
|
646
646
|
logger.info("Initializing a new Salty-CSS project!");
|
|
647
647
|
const framework = await detectFramework(ctx);
|
|
648
648
|
logger.info(`Detected framework: ${framework.name}`);
|
|
649
|
-
const sourceDir = join(ctx.projectDir, framework.srcDirectory);
|
|
650
649
|
const plannedIntegrations = await planIntegrations(ctx);
|
|
651
650
|
if (!ctx.skipInstall) {
|
|
652
651
|
const packages = [
|
|
@@ -658,8 +657,8 @@ const registerInitCommand = (program) => {
|
|
|
658
657
|
await npmInstall(...packages);
|
|
659
658
|
}
|
|
660
659
|
const projectFiles = await Promise.all([readTemplate("salty.config.ts"), readTemplate("saltygen/index.css")]);
|
|
661
|
-
await mkdir(
|
|
662
|
-
await Promise.all(projectFiles.map(({ fileName, content }) => writeProjectFile(
|
|
660
|
+
await mkdir(ctx.projectDir, { recursive: true });
|
|
661
|
+
await Promise.all(projectFiles.map(({ fileName, content }) => writeProjectFile(ctx.projectDir, fileName, content)));
|
|
663
662
|
const pathDefaults = computePathDefaults({
|
|
664
663
|
framework: framework.name,
|
|
665
664
|
integrations: plannedIntegrations.map((p) => p.name),
|
|
@@ -667,11 +666,11 @@ const registerInitCommand = (program) => {
|
|
|
667
666
|
});
|
|
668
667
|
await writeProjectToRc(ctx.cwd, ctx.relativeProjectPath, framework, pathDefaults);
|
|
669
668
|
await ensureGitignoreSaltygen(ctx.cwd);
|
|
670
|
-
await importSaltygenIntoCss(ctx.projectDir,
|
|
669
|
+
await importSaltygenIntoCss(ctx.projectDir, opts.cssFile);
|
|
671
670
|
await applyIntegrationPlans(plannedIntegrations);
|
|
672
671
|
await wirePrepareScript();
|
|
673
672
|
logger.info("Running the build to generate initial CSS...");
|
|
674
|
-
const compiler = new SaltyCompiler(
|
|
673
|
+
const compiler = new SaltyCompiler(ctx.projectDir);
|
|
675
674
|
await compiler.generateCss();
|
|
676
675
|
logger.info("🎉 Salty CSS project initialized successfully!");
|
|
677
676
|
logger.info("Next steps:");
|
|
@@ -278,7 +278,7 @@ ${currentFile}`;
|
|
|
278
278
|
const destDir = await this.getDestDir();
|
|
279
279
|
const coreConfigDest = path.join(destDir, "salty.config.js");
|
|
280
280
|
const { config } = await this.importFile(coreConfigDest);
|
|
281
|
-
return css_merge.mergeObjects(
|
|
281
|
+
return css_merge.mergeObjects(cached, config);
|
|
282
282
|
});
|
|
283
283
|
/**
|
|
284
284
|
* Generate CSS files based on the Salty CSS configuration and source files.
|
|
@@ -258,7 +258,7 @@ ${currentFile}`;
|
|
|
258
258
|
const destDir = await this.getDestDir();
|
|
259
259
|
const coreConfigDest = join(destDir, "salty.config.js");
|
|
260
260
|
const { config } = await this.importFile(coreConfigDest);
|
|
261
|
-
return mergeObjects(
|
|
261
|
+
return mergeObjects(cached, config);
|
|
262
262
|
});
|
|
263
263
|
/**
|
|
264
264
|
* Generate CSS files based on the Salty CSS configuration and source files.
|