Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync(yarn-plugin-library): dependencies, command adjustment #385

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
298 changes: 149 additions & 149 deletions .pnp.cjs

Large diffs are not rendered by default.

1,764 changes: 881 additions & 883 deletions .yarn/releases/yarn.cjs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1199,14 +1199,14 @@ __metadata:
"@atls/yarn-run-utils": "workspace:*"
"@atls/yarn-test-utils": "workspace:*"
"@jest/globals": "npm:29.7.0"
"@types/react": "npm:^18.3.3"
"@yarnpkg/builder": "npm:4.1.1"
"@yarnpkg/cli": "npm:4.2.2"
"@yarnpkg/core": "npm:4.0.5"
"@types/react": "npm:18.3.3"
"@yarnpkg/builder": "npm:4.1.2"
"@yarnpkg/cli": "npm:4.4.0"
"@yarnpkg/core": "npm:4.1.2"
"@yarnpkg/fslib": "npm:3.1.0"
clipanion: "npm:4.0.0-rc.3"
react: "npm:^18.3.1"
rimraf: "npm:5.0.5"
react: "npm:18.3.1"
typanion: "npm:3.14.0"
peerDependencies:
"@yarnpkg/cli": "*"
"@yarnpkg/core": "*"
Expand Down
3 changes: 2 additions & 1 deletion yarn/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
"dist"
],
"scripts": {
"build": "yarn run build:clean && yarn run build:bundle && yarn run build:fix && yarn run build:dist",
"build": "yarn run build:clean && yarn run build:bundle && yarn run build:fix && yarn run build:dist && yarn run build:releases",
"build:bundle": "builder build bundle && mv bundles/yarn.js bundles/yarn.cjs",
"build:clean": "rm -rf dist",
"build:dist": "mv bundles dist",
"build:fix": "yarn node patches/cli.patch.mjs",
"build:releases": "cp -f dist/yarn.cjs ../../.yarn/releases/yarn.cjs",
"fix": "yarn run build:fix",
"prepack": "yarn run build",
"postpack": "rm -rf dist"
Expand Down
777 changes: 0 additions & 777 deletions yarn/plugin-library/bundles/@yarnpkg/plugin-library.js

This file was deleted.

2 changes: 1 addition & 1 deletion yarn/plugin-library/integration/library-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('yarn', () => {
{
dependencies: {
'@atls/code-runtime': 'workspace:*',
typescript: '^5.0.3',
typescript: '5.4.2',
},
},
async ({ path, run, source }) => {
Expand Down
12 changes: 6 additions & 6 deletions yarn/plugin-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
"@atls/code-typescript-worker": "workspace:*",
"@atls/yarn-run-utils": "workspace:*",
"clipanion": "4.0.0-rc.3",
"react": "^18.3.1",
"rimraf": "5.0.5"
"react": "18.3.1",
"typanion": "3.14.0"
},
"devDependencies": {
"@atls/yarn-test-utils": "workspace:*",
"@jest/globals": "29.7.0",
"@types/react": "^18.3.3",
"@yarnpkg/builder": "4.1.1",
"@yarnpkg/cli": "4.2.2",
"@yarnpkg/core": "4.0.5",
"@types/react": "18.3.3",
"@yarnpkg/builder": "4.1.2",
"@yarnpkg/cli": "4.4.0",
"@yarnpkg/core": "4.1.2",
"@yarnpkg/fslib": "3.1.0"
},
"peerDependencies": {
Expand Down
10 changes: 9 additions & 1 deletion yarn/plugin-library/sources/before-workspace-packing.hook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import type { Workspace } from '@yarnpkg/core'

export const beforeWorkspacePacking = (workspace: Workspace, rawManifest: any) => {
export interface RawManifest {
exports: Record<string, any>

publishConfig: {
exports: Record<string, any>
}
}

export const beforeWorkspacePacking = (_: Workspace, rawManifest: RawManifest): void => {
if (rawManifest.publishConfig) {
if (rawManifest.publishConfig.exports) {
// eslint-disable-next-line no-param-reassign
Expand Down
18 changes: 10 additions & 8 deletions yarn/plugin-library/sources/library-bulid.command.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { access } from 'node:fs/promises'
import { rm } from 'node:fs/promises'
import { join } from 'node:path'

import { BaseCommand } from '@yarnpkg/cli'
import { Configuration } from '@yarnpkg/core'
import { StreamReport } from '@yarnpkg/core'
import { MessageName } from '@yarnpkg/core'
import { Option } from 'clipanion'
import { sync } from 'rimraf'
import { isEnum } from 'typanion'
import React from 'react'

import { ErrorInfo } from '@atls/cli-ui-error-info-component'
Expand All @@ -20,7 +20,11 @@ class LibraryBuildCommand extends BaseCommand {

target = Option.String('-t,--target', './dist')

async execute() {
module: any = Option.String('-m,--module', 'nodenext', {
validator: isEnum(['nodenext', 'commonjs']),
})

async execute(): Promise<number> {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins)

const commandReport = await StreamReport.start(
Expand All @@ -44,7 +48,7 @@ class LibraryBuildCommand extends BaseCommand {
[join(this.context.cwd, './src')],
{
outDir: join(this.context.cwd, this.target),
module: 'nodenext' as any,
module: this.module,
declaration: true,
}
)
Expand Down Expand Up @@ -72,11 +76,9 @@ class LibraryBuildCommand extends BaseCommand {
return commandReport.exitCode()
}

protected async cleanTarget() {
protected async cleanTarget(): Promise<void> {
try {
await access(this.target)

sync(this.target)
await rm(this.target, { recursive: true, force: true })
// eslint-disable-next-line no-empty
} catch {}
}
Expand Down
Loading