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

Add callback functions to CLI #55

Closed
lake2 opened this issue Sep 10, 2024 · 1 comment · Fixed by #56
Closed

Add callback functions to CLI #55

lake2 opened this issue Sep 10, 2024 · 1 comment · Fixed by #56

Comments

@lake2
Copy link
Contributor

lake2 commented Sep 10, 2024

I want to integrate @swc/cli in my project as follows:

    const swc: any = require('@swc/cli/lib/swc/dir').default;

    const swcOptions: Config = {
        jsc: {
            target: 'esnext',
            externalHelpers: true,
        },
        module: {
            type: 'commonjs',
        },
    };

    swc({
        cliOptions: {
            outDir: './dist2',
            watch: true,
            filenames: ['./src'],
            extensions: ['.ts'],
            onSuccess: () => {
                // restart an express project
                // run  typescript type check
            },
            onFail: () => {
                // log reason
            },
        },
        swcOptions,
    });

But now onSuccess and onFail callbacks are missing.
Is this reasonable? I will make a pr if this is possible.

@lake2 lake2 changed the title Add callback function to CLI Add callback functions to CLI Sep 10, 2024
@kdy1
Copy link
Member

kdy1 commented Sep 10, 2024

Yeah, I think it's acceptable

@kdy1 kdy1 closed this as completed in #56 Sep 14, 2024
kdy1 pushed a commit that referenced this issue Sep 14, 2024
Closes #55

I rename `packages/cli/src/swc/index.ts` to
`packages/cli/src/swc/bin.ts`, and export `swcDir` function via new
`packages/cli/src/swc/index.ts`

add doc here: swc-project/website#261
kdy1 added a commit that referenced this issue Oct 22, 2024
kdy1 added a commit that referenced this issue Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants