Skip to content

Commit

Permalink
chore(root): changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev committed Apr 17, 2024
1 parent fbb211b commit cb79a04
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/clean-olives-cross.md
@@ -0,0 +1,8 @@
---
"@nextui-org/react": patch
"@nextui-org/system": patch
"@nextui-org/system-rsc": patch
"@nextui-org/react-rsc-utils": patch
---

Named exports for rsc packages, "use client;" directive added to "@nextui-org/react" package
1 change: 1 addition & 0 deletions packages/core/react/package.json
Expand Up @@ -30,6 +30,7 @@
"url": "https://github.com/nextui-org/nextui/issues"
},
"scripts": {
"prebuild": "node src/scripts/prebuild.js",
"build": "tsup --dts",
"postbuild": "node src/scripts/postbuild.js",
"dev": "pnpm build:fast --watch",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/react/src/index.ts
@@ -1,3 +1,6 @@
"use client";
// only for development purpose, this directive is added by tsup at build time

export * from "@nextui-org/system";
export * from "@nextui-org/theme";
export * from "@nextui-org/accordion";
Expand Down
19 changes: 19 additions & 0 deletions packages/core/react/src/scripts/postbuild.js
Expand Up @@ -15,6 +15,9 @@ const appsRoutesJsonPath = path.resolve(appsConfigDir, 'routes.json'); // Apps r

const docsComponentsDir = path.resolve(rootDir, 'apps/docs/content/docs/components'); // Docs components directory path

const filePath = './src/index.ts'; // Updated file path
const backupFilePath = filePath + '.backup.ts'; // Backup file

const themeDir = path.resolve(packagesDir, 'core/theme'); // Theme directory path

const baseDocs = 'https://nextui.org/docs/components';
Expand Down Expand Up @@ -68,6 +71,22 @@ function generateComponents() {
}

function main() {
// Restore the original file from the backup
fs.copyFile(backupFilePath, filePath, (err) => {
if (err) {
return console.log(err);
}
console.log('The original file has been restored.');

// Delete the backup file
fs.unlink(backupFilePath, (err) => {
if (err) {
return console.log(err);
}
console.log('The backup file has been deleted.');
});
});

// Generate the components meta data
try {
generateComponents()
Expand Down
27 changes: 27 additions & 0 deletions packages/core/react/src/scripts/prebuild.js
@@ -0,0 +1,27 @@
/* eslint-disable no-console */
const fs = require('fs');

const filePath = './src/index.ts'; // Updated file path
const backupFilePath = filePath + '.backup.ts'; // Backup file

// Create a backup of the original file
fs.copyFile(filePath, backupFilePath, (err) => {
if (err) {
return console.log(err);
}

// Read the original file and remove the "use client" directive
fs.readFile(filePath, 'utf8', function(err, data) {
if (err) {
return console.log(err);
}
const result = data.replace('"use client";\n', '');

fs.writeFile(filePath, result, 'utf8', function(err) {
if (err) {
return console.log(err);
}
console.log('The "use client" directive was removed.');
});
});
});

0 comments on commit cb79a04

Please sign in to comment.