diff --git a/.github/workflows/test-component-starter.yml b/.github/workflows/test-component-starter.yml index ff6e3f93994..0fbc2f01a32 100644 --- a/.github/workflows/test-component-starter.yml +++ b/.github/workflows/test-component-starter.yml @@ -103,3 +103,34 @@ jobs: run: npm run test -- --no-build # the project was just built, don't build it again working-directory: ./tmp-component-starter shell: bash + + - name: Test npx stencil generate + # `stencil generate` doesn't have a way to skip file generation, so we provide it with a component name and run + # `echo` with a newline to select "all files" to generate (and use -e to interpret that backslash for a newline) + run: echo -e '\n' | npm run generate -- hello-world + working-directory: ./tmp-component-starter + shell: bash + + - name: Verify Files Exist + run: | + file_list=( + src/components/hello-world/hello-world.tsx + src/components/hello-world/hello-world.css + src/components/hello-world/test/hello-world.spec.tsx + src/components/hello-world/test/hello-world.e2e.ts + ) + for file in "${file_list[@]}"; do + if [ -f "$file" ]; then + echo "File '$file' exists." + else + echo "File '$file' does not exist." + exit 1 + fi + done + working-directory: ./tmp-component-starter + shell: bash + + - name: Test Generated Files + run: npm run test + working-directory: ./tmp-component-starter + shell: bash diff --git a/scripts/esbuild/cli.ts b/scripts/esbuild/cli.ts index 9cb3b8b8469..9c39b80b91b 100644 --- a/scripts/esbuild/cli.ts +++ b/scripts/esbuild/cli.ts @@ -27,6 +27,8 @@ export async function buildCli(opts: BuildOptions) { const dtsFilename = 'index.d.ts'; const cliAliases = getEsbuildAliases(); + // this isn't strictly necessary to alias - however, this minimizes cuts down the bundle size by ~70kb. + cliAliases['prompts'] = 'prompts/lib/index.js'; const external = getEsbuildExternalModules(opts, opts.output.cliDir); diff --git a/scripts/esbuild/util.ts b/scripts/esbuild/util.ts index 50926983abe..9a8f1ced419 100644 --- a/scripts/esbuild/util.ts +++ b/scripts/esbuild/util.ts @@ -26,10 +26,9 @@ export function getEsbuildAliases(): Record { // mapping node.js module names to `sys/node` "cache" // - // these allow us to bundle and ship a dependency (like `prompts`) as part + // these allow us to bundle and ship a dependency (like `glob`) as part // of the Stencil distributable but also have our separate bundles // reference the same file - prompts: './sys/node/prompts.js', glob: './sys/node/glob.js', // dev server related aliases