Skip to content

Commit

Permalink
Merge branch 'main' into rwaskiewicz/ts-4.7-jedi
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaskiewicz authored Aug 25, 2022
2 parents e1c5e55 + db07c27 commit 2102632
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 77 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
open-pull-requests-limit: 5
# Disable rebasing for pull requests, as having several open pull requests all get simultaneously rebased gets
# noisy from a notification standpoint
rebase-strategy: "disabled"
ignore:
- dependency-name: "@types/node"
versions: ["17", "18"]
- dependency-name: "typescript"
versions: ["4.8"]
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
with:
# the pull_request_target event will consider the HEAD of `main` to be the SHA to use.
# attempt to use the SHA associated with a pull request and fallback to HEAD of `main`
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
persist-credentials: false

- name: Get Core Dependencies
uses: ./.github/workflows/actions/get-core-dependencies
Expand Down
58 changes: 39 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"path-browserify": "^1.0.1",
"pixelmatch": "4.0.2",
"postcss": "^8.2.8",
"prettier": "2.5.1",
"prettier": "2.7.1",
"prompts": "2.4.0",
"puppeteer": "~10.0.0",
"rollup": "2.42.3",
Expand Down
14 changes: 13 additions & 1 deletion src/compiler/build/validate-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@ import type * as d from '../../declarations';
import { validateBuildPackageJson } from '../types/validate-build-package-json';
import { validateManifestJson } from '../html/validate-manifest-json';

export const validateBuildFiles = (config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx) => {
/**
* Validate the existence and contents of certain files that were generated after writing the results of the build to
* disk
* @param config the Stencil configuration used for the build
* @param compilerCtx the compiler context associated with the build
* @param buildCtx the build context associated with the current build
* @returns an array containing empty-Promise results
*/
export const validateBuildFiles = (
config: d.ValidatedConfig,
compilerCtx: d.CompilerCtx,
buildCtx: d.BuildCtx
): Promise<(void | void[])[]> => {
if (buildCtx.hasError) {
return null;
}
Expand Down
17 changes: 13 additions & 4 deletions src/compiler/build/write-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ import { catchError } from '@utils';
import { outputServiceWorkers } from '../output-targets/output-service-workers';
import { validateBuildFiles } from './validate-files';

export const writeBuild = async (config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx) => {
/**
* Writes files to disk as a result of compilation
* @param config the Stencil configuration used for the build
* @param compilerCtx the compiler context associated with the build
* @param buildCtx the build context associated with the current build
*/
export const writeBuild = async (
config: d.ValidatedConfig,
compilerCtx: d.CompilerCtx,
buildCtx: d.BuildCtx
): Promise<void> => {
const timeSpan = buildCtx.createTimeSpan(`writeBuildFiles started`, true);

let totalFilesWrote = 0;
Expand All @@ -21,11 +31,10 @@ export const writeBuild = async (config: d.Config, compilerCtx: d.CompilerCtx, b

// successful write
// kick off writing the cached file stuff
// await compilerCtx.cache.commit();
buildCtx.debug(`in-memory-fs: ${compilerCtx.fs.getMemoryStats()}`);
// buildCtx.debug(`cache: ${compilerCtx.cache.getMemoryStats()}`);

await outputServiceWorkers(config, buildCtx), await validateBuildFiles(config, compilerCtx, buildCtx);
await outputServiceWorkers(config, buildCtx);
await validateBuildFiles(config, compilerCtx, buildCtx);
} catch (e: any) {
catchError(buildCtx.diagnostics, e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/html/validate-manifest-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { buildError, buildJsonFileError } from '@utils';
import { dirname, join } from 'path';
import { isOutputTargetWww } from '../output-targets/output-utils';

export const validateManifestJson = (config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx) => {
export const validateManifestJson = (config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx) => {
if (config.devMode) {
return null;
}
Expand Down
9 changes: 7 additions & 2 deletions src/compiler/output-targets/output-service-workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import type * as d from '../../declarations';
import { generateServiceWorker } from '../service-worker/generate-sw';
import { isOutputTargetWww } from './output-utils';

export const outputServiceWorkers = async (config: d.Config, buildCtx: d.BuildCtx) => {
/**
* Entrypoint to creating a service worker for every `www` output target
* @param config the Stencil configuration used for the build
* @param buildCtx the build context associated with the build to mark as done
*/
export const outputServiceWorkers = async (config: d.ValidatedConfig, buildCtx: d.BuildCtx): Promise<void> => {
const wwwServiceOutputs = config.outputTargets
.filter(isOutputTargetWww)
.filter((o) => typeof o.indexHtml === 'string' && !!o.serviceWorker);
Expand All @@ -16,7 +21,7 @@ export const outputServiceWorkers = async (config: d.Config, buildCtx: d.BuildCt
if (diagnostics.length > 0) {
buildCtx.diagnostics.push(...diagnostics);
} else {
// we've ensure workbox is installed, so let's require it now
// we've ensured workbox is installed, so let's require it now
const workbox: d.Workbox = config.sys.lazyRequire.require(config.rootDir, 'workbox-build');

await Promise.all(
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/service-worker/generate-sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { buildWarn, catchError } from '@utils';
import { isOutputTargetWww } from '../output-targets/output-utils';

export const generateServiceWorker = async (
config: d.Config,
config: d.ValidatedConfig,
buildCtx: d.BuildCtx,
workbox: d.Workbox,
outputTarget: d.OutputTargetWww
) => {
): Promise<void[] | void> => {
const serviceWorker = await getServiceWorker(outputTarget);
if (serviceWorker.unregister) {
await config.sys.writeFile(serviceWorker.swDest, SELF_UNREGISTER_SW);
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/types/tests/validate-package-json.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type * as d from '@stencil/core/declarations';
import { mockBuildCtx, mockCompilerCtx, mockConfig } from '@stencil/core/testing';
import { mockBuildCtx, mockCompilerCtx, mockValidatedConfig } from '@stencil/core/testing';
import * as v from '../validate-build-package-json';
import path from 'path';
import { DIST_COLLECTION, DIST_CUSTOM_ELEMENTS, DIST_CUSTOM_ELEMENTS_BUNDLE } from '../../output-targets/output-utils';
import { normalizePath } from '../../../utils/normalize-path';

describe('validate-package-json', () => {
let config: d.Config;
let config: d.ValidatedConfig;
let compilerCtx: d.CompilerCtx;
let buildCtx: d.BuildCtx;
let collectionOutputTarget: d.OutputTargetDistCollection;
Expand All @@ -26,7 +26,7 @@ describe('validate-package-json', () => {
};

const namespace = 'SomeNamespace';
config = mockConfig({
config = mockValidatedConfig({
devMode: false,
fsNamespace: namespace.toLowerCase(),
namespace,
Expand Down
Loading

0 comments on commit 2102632

Please sign in to comment.