Skip to content

Commit

Permalink
Merge pull request #6 from avolutions/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
avolutions authored Sep 23, 2024
2 parents 9d8daa4 + 2e03f74 commit 485d2f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avolutions/colorado",
"version": "0.3.0",
"version": "0.3.1",
"description": "Colorado is a lightweight, intuitive and dependency free JavaScript library for handling and converting color values. Seamlessly switch between RGB and Hex formats with simple methods and generate clean string outputs for your web projects.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand All @@ -12,7 +12,7 @@
}
},
"scripts": {
"build:cjs": "tsc --project tsconfig.cjs.json && echo {\"type\": \"commonjs\"} > dist/cjs/package.json",
"build:cjs": "tsc --project tsconfig.cjs.json && node scripts/generate-cjs-package.js",
"build:esm": "tsc --project tsconfig.esm.json",
"build": "npm run build:cjs && npm run build:esm",
"lint": "eslint",
Expand Down
19 changes: 19 additions & 0 deletions scripts/generate-cjs-package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { promises as fs } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

// Use fileURLToPath to get the directory for ES modules
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Define the package.json content
const packageJsonContent = {
type: "commonjs"
};

// Define the path to the output package.json
const outputPath = path.join(__dirname, '..', 'dist', 'cjs', 'package.json');

// Ensure the directory exists and write the file asynchronously
await fs.mkdir(path.dirname(outputPath), { recursive: true });
await fs.writeFile(outputPath, JSON.stringify(packageJsonContent, null, 2));

0 comments on commit 485d2f8

Please sign in to comment.