Skip to content

Commit

Permalink
Use exports map [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed May 14, 2023
1 parent 3bfc201 commit 1a801ed
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 0.6.1

Use exports map

## 0.6.0

Publish as ESM
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -23,7 +23,7 @@ Add `import "virtual:@downwind/base.css";` and `import "virtual:@downwind/utils.
To use nesting, install [postcss-nested](https://github.com/postcss/postcss-nested) and add it to the postcss config:

```js
// postcss.config.js
// postcss.config.cjs
module.exports = {
plugins: {
"postcss-nested": {},
Expand Down
3 changes: 2 additions & 1 deletion package.json
@@ -1,8 +1,9 @@
{
"name": "@arnaud-barre/downwind",
"description": "A PostCSS-less implementation of Tailwind based on Lightning CSS",
"private": true,
"type": "module",
"version": "0.6.0",
"version": "0.6.1",
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
"license": "MIT",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions playground/vite/package.json
@@ -1,6 +1,7 @@
{
"name": "vite-playground",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"tsc": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion playground/vite/vite.config.ts
@@ -1,6 +1,6 @@
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import { downwind } from "../../dist/vite.js";
import { downwind } from "../../dist/vitePlugin.js";

// eslint-disable-next-line import/no-default-export
export default defineConfig({ plugins: [react(), downwind()] });
14 changes: 8 additions & 6 deletions scripts/bundle.ts
Expand Up @@ -39,13 +39,11 @@ await buildOrWatch({
supported: { "object-rest-spread": false },
});

execSync("cp -r LICENSE README.md dist/");
execSync(
"cp -r LICENSE README.md src/esbuildPlugin.d.ts src/vitePlugin.d.ts dist/",
);
copyFileSync("src/base/base.css", "dist/base.css");
copyFileSync("src/types.d.ts", "dist/index.d.ts");
for (const tool of ["esbuild", "vite"]) {
copyFileSync(`src/${tool}Plugin.d.ts`, `dist/${tool}.d.ts`);
execSync(`mv dist/${tool}Plugin.js dist/${tool}.js`);
}

if (
!dev &&
Expand All @@ -70,7 +68,11 @@ writeFileSync(
license: packageJSON.license,
repository: "ArnaudBarre/downwind",
keywords: ["tailwind", "lightningcss"],
main: "index.js",
exports: {
".": "./index.js",
"./esbuild": "./esbuildPlugin.js",
"./vite": "./vitePlugin.js",
},
bin: { downwind: "cli.js" },
dependencies: packageJSON.dependencies,
},
Expand Down
3 changes: 1 addition & 2 deletions src/cli.ts
@@ -1,7 +1,6 @@
#!/usr/bin/env node
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { dirname } from "node:path";
import type { Downwind } from "./types";

const firstArg = process.argv[2] as string | undefined;

Expand Down Expand Up @@ -35,7 +34,7 @@ if (!output) {
}

const module = await import("./index.ts");
const downwind: Downwind = await module.initDownwind();
const downwind = await module.initDownwind();
const dir = dirname(output);
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
writeFileSync(output, downwind.codegen({ mode }));

0 comments on commit 1a801ed

Please sign in to comment.