Skip to content

Commit

Permalink
Note: Packages @promptbook/cli and @promptbook/types are not mark…
Browse files Browse the repository at this point in the history
…ed as devDependencies in `promptbook` package to ensure that they are installed
  • Loading branch information
hejny committed Apr 28, 2024
1 parent 4433ac0 commit 5ffb8dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
10 changes: 2 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@ export const packages = readdirSync(join(__dirname, 'src/_packages'), { recursiv
dependencies: [
// Note: Dependencies will be added automatically in generate-packages script
],
devDependencies: [
// Note: Dependencies will be added automatically in generate-packages script
],
};
});

const devDependencies = ['@promptbook/cli', '@promptbook/types'];
// Note: Packages `@promptbook/cli` and `@promptbook/types` are not marked as devDependencies in `promptbook` package to ensure that they are installed

packages.push({
isBuilded: false,
packageScope: null,
packageName: 'promptbook',
packageFullname: 'promptbook',
dependencies: packages
.map(({ packageFullname }) => packageFullname)
.filter((packageFullname) => !devDependencies.includes(packageFullname)),
devDependencies,
dependencies: packages.map(({ packageFullname }) => packageFullname),
});

packages.push({
Expand Down
10 changes: 1 addition & 9 deletions scripts/generate-packages/generate-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function generatePackages({ isCommited }: { isCommited: boolean }) {

const mainReadme = await readFile('./README.md', 'utf-8');

for (const { isBuilded, packageFullname, packageName, dependencies, devDependencies } of packages) {
for (const { isBuilded, packageFullname, packageName, dependencies } of packages) {
let packageReadme = mainReadme;
const packageReadmeExtra = await readFile(`./src/_packages/${packageName}.readme.md`, 'utf-8');

Expand Down Expand Up @@ -163,14 +163,6 @@ async function generatePackages({ isCommited }: { isCommited: boolean }) {
...(packageJson.dependencies || {}),
...Object.fromEntries(dependencies.map((dependency) => [dependency, packageJson.version])),
};
packageJson.devDependencies = {
...(packageJson.devDependencies || {}),
...Object.fromEntries(devDependencies.map((dependency) => [dependency, packageJson.version])),
};

if (Object.keys(packageJson.devDependencies).length === 0) {
delete packageJson.devDependencies;
}

if (isBuilded) {
packageJson.main = `./umd/index.umd.js`;
Expand Down

0 comments on commit 5ffb8dd

Please sign in to comment.