Skip to content

Commit

Permalink
chore(build): add banner to output bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Aug 15, 2020
1 parent b3ac23b commit 76bbac4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions scripts/bundles/cli.ts
Expand Up @@ -9,6 +9,7 @@ import { relativePathPlugin } from './plugins/relative-path-plugin';
import { BuildOptions } from '../utils/options';
import { RollupOptions, OutputOptions } from 'rollup';
import { writePkgJson } from '../utils/write-pkg-json';
import { getBanner } from '../utils/banner';

export async function cli(opts: BuildOptions) {
const inputDir = join(opts.buildDir, 'cli');
Expand All @@ -21,12 +22,14 @@ export async function cli(opts: BuildOptions) {
format: 'es',
file: join(outputDir, esmFilename),
preferConst: true,
banner: getBanner(opts, `Stencil CLI`, true),
};

const cjsOutput: OutputOptions = {
format: 'cjs',
file: join(outputDir, cjsFilename),
preferConst: true,
banner: getBanner(opts, `Stencil CLI (CommonJS)`, true),
};

// create public d.ts
Expand Down
6 changes: 4 additions & 2 deletions scripts/bundles/dev-server.ts
Expand Up @@ -12,6 +12,7 @@ import type { RollupOptions, OutputChunk, Plugin } from 'rollup';
import { minify } from 'terser';
import ts from 'typescript';
import { prettyMinifyPlugin } from './plugins/pretty-minify';
import { getBanner } from '../utils/banner';

export async function devServer(opts: BuildOptions) {
const inputDir = join(opts.buildDir, 'dev-server');
Expand Down Expand Up @@ -56,7 +57,7 @@ export async function devServer(opts: BuildOptions) {
preferBuiltins: true,
}),
rollupCommonjs(),
prettyMinifyPlugin(opts),
prettyMinifyPlugin(opts, getBanner(opts, `Stencil Dev Server`, true)),
],
treeshake: {
moduleSideEffects: false,
Expand Down Expand Up @@ -95,7 +96,7 @@ export async function devServer(opts: BuildOptions) {
}),
rollupCommonjs(),
replacePlugin(opts),
prettyMinifyPlugin(opts),
prettyMinifyPlugin(opts, getBanner(opts, `Stencil Dev Server`, true)),
],
treeshake: {
moduleSideEffects: false,
Expand Down Expand Up @@ -213,6 +214,7 @@ export async function devServer(opts: BuildOptions) {
output: {
format: 'esm',
file: join(opts.output.devServerDir, 'client', 'index.js'),
banner: getBanner(opts, `Stencil Dev Server Client`, true),
},
plugins: [appErrorCssPlugin(), replacePlugin(opts), rollupResolve()],
};
Expand Down
5 changes: 4 additions & 1 deletion scripts/bundles/mock-doc.ts
Expand Up @@ -9,6 +9,7 @@ import { replacePlugin } from './plugins/replace-plugin';
import { RollupOptions, OutputOptions } from 'rollup';
import { sizzlePlugin } from './plugins/sizzle-plugin';
import { writePkgJson } from '../utils/write-pkg-json';
import { getBanner } from '../utils/banner';

export async function mockDoc(opts: BuildOptions) {
const inputDir = join(opts.buildDir, 'mock-doc');
Expand All @@ -29,6 +30,7 @@ export async function mockDoc(opts: BuildOptions) {
format: 'es',
file: join(outputDir, 'index.js'),
preferConst: true,
banner: getBanner(opts, `Stencil Mock Doc`, true),
};

const cjsOutput: OutputOptions = {
Expand All @@ -38,11 +40,12 @@ export async function mockDoc(opts: BuildOptions) {
outro: CJS_OUTRO,
strict: false,
esModule: false,
banner: getBanner(opts, `Stencil Mock Doc (CommonJS)`, true),
};

const mockDocBundle: RollupOptions = {
input: join(inputDir, 'index.js'),
output: [esOutput, cjsOutput] as any,
output: [esOutput, cjsOutput],
plugins: [parse5Plugin(opts), sizzlePlugin(opts), aliasPlugin(opts), replacePlugin(opts), rollupResolve(), rollupCommonjs()],
};

Expand Down
5 changes: 3 additions & 2 deletions scripts/bundles/sys-node.ts
Expand Up @@ -10,6 +10,7 @@ import { relativePathPlugin } from './plugins/relative-path-plugin';
import { aliasPlugin } from './plugins/alias-plugin';
import { prettyMinifyPlugin } from './plugins/pretty-minify';
import { writePkgJson } from '../utils/write-pkg-json';
import { getBanner } from '../utils/banner';

export async function sysNode(opts: BuildOptions) {
const inputDir = join(opts.buildDir, 'sys', 'node');
Expand Down Expand Up @@ -49,7 +50,7 @@ export async function sysNode(opts: BuildOptions) {
rollupCommonjs({
transformMixedEsModules: false,
}),
prettyMinifyPlugin(opts),
prettyMinifyPlugin(opts, getBanner(opts, `Stencil Node System`, true)),
],
treeshake: {
moduleSideEffects: false,
Expand Down Expand Up @@ -85,7 +86,7 @@ export async function sysNode(opts: BuildOptions) {
preferBuiltins: true,
}),
aliasPlugin(opts),
prettyMinifyPlugin(opts),
prettyMinifyPlugin(opts, getBanner(opts, `Stencil Node System Worker`, true)),
],
};

Expand Down
3 changes: 2 additions & 1 deletion scripts/bundles/testing.ts
Expand Up @@ -10,6 +10,7 @@ import { replacePlugin } from './plugins/replace-plugin';
import { writePkgJson } from '../utils/write-pkg-json';
import { RollupOptions, OutputOptions } from 'rollup';
import { prettyMinifyPlugin } from './plugins/pretty-minify';
import { getBanner } from '../utils/banner';

export async function testing(opts: BuildOptions) {
const inputDir = join(opts.buildDir, 'testing');
Expand Down Expand Up @@ -102,7 +103,7 @@ export async function testing(opts: BuildOptions) {
rollupJson({
preferConst: true,
}),
prettyMinifyPlugin(opts),
prettyMinifyPlugin(opts, getBanner(opts, `Stencil Testing`, true)),
],
treeshake: {
moduleSideEffects: false,
Expand Down

0 comments on commit 76bbac4

Please sign in to comment.