Skip to content

Commit

Permalink
Fix ci [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Aug 29, 2022
1 parent f2bad57 commit c18b233
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- uses: xhyrom/setup-bun@v0.1.7
- run: bun install
- run: bun ci
- uses: ArnaudBarre/npm-publish@v1
- uses: ArnaudBarre/npm-publish@v1.1
with:
working-directory: dist
npm-token: ${{ secrets.NPM_TOKEN }}
26 changes: 26 additions & 0 deletions .idea/jsonSchemas.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
"license": "MIT",
"scripts": {
"postinstall": "cd playground/vite && bun install",
"dev": "scripts/bundle.ts --dev",
"build": "scripts/bundle.ts",
"test": "tests/run-tests.ts --update-snapshots",
"test-ci": "tests/run-tests.ts",
"tsc": "tsc",
"lint": "bun run lint-ci --fix --cache",
"lint-ci": "eslint src scripts tests --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"prettier": "bun run prettier-ci --write",
Expand Down
2 changes: 1 addition & 1 deletion playground/vite/downwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownwindConfig } from "../../dist";
import type { DownwindConfig } from "../../src/types";

export const config: DownwindConfig = {
shortcuts: {
Expand Down
6 changes: 5 additions & 1 deletion src/esbuildPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const esbuildPlugin: typeof declaration = ({ scannedExtension } = {}) => ({
name: "downwind",
setup: async (build) => {
const targets = convertTargets(build.initialOptions.target);
const downwind = await initDownwind({ targets, scannedExtension });
const downwind = await initDownwind({
targets,
scannedExtension,
root: build.initialOptions.absWorkingDir,
});
const cssModulesMap: Record<string, string> = {};
let hasBase = false;
let hasUtils = false;
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { readFileSync } from "fs";
import { relative } from "node:path";
import { loadConfig } from "@arnaud-barre/config-loader";
import { CSSModuleExports, Dependency, transform } from "@parcel/css";

Expand Down Expand Up @@ -66,6 +67,7 @@ export const initDownwindWithConfig = ({
config: userConfig,
targets = forceDownlevelNesting,
scannedExtension = "tsx",
root = process.cwd(),
}: {
config: UserConfig | undefined;
} & Parameters<typeof initDownwindDeclaration>[0]) => {
Expand Down Expand Up @@ -403,7 +405,7 @@ export const initDownwindWithConfig = ({
readFileSync(path, "utf-8"),
);
const result = transform({
filename: path,
filename: relative(root, path),
code: Buffer.from(content),
analyzeDependencies: opts?.analyzeDependencies,
cssModules: path.endsWith(".module.css"),
Expand Down
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type ParcelTargets = NonNullable<TransformOptions["targets"]>;
export declare const initDownwind: (opts?: {
targets?: ParcelTargets;
scannedExtension?: string;
root?: string;
}) => Promise<Downwind>;

export type Downwind = {
Expand Down
6 changes: 5 additions & 1 deletion src/vitePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ const vitePlugin: typeof declaration = ({
// Common
const configResolved = async (config: ResolvedConfig) => {
targets = convertTargets(config.build.cssTarget);
downwind = await initDownwind({ targets, scannedExtension });
downwind = await initDownwind({
targets,
scannedExtension,
root: config.root,
});
};

let hasBase = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/esbuildPlugin-hash.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/snapshots/esbuildPlugin-minify.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/snapshots/esbuildPlugin-no-write.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/snapshots/esbuildPlugin-simple.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c18b233

Please sign in to comment.