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

refactor(build): remove dependencies.json generation #4066

Merged
merged 1 commit into from
Feb 17, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
with:
name: stencil-core
output: stencil-core-build.zip
paths: build cli compiler dependencies.json dev-server internal mock-doc scripts/build screenshot sys testing
paths: build cli compiler dev-server internal mock-doc scripts/build screenshot sys testing
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ dist/
test/**/www/*
test/**/hydrate/*
.stencil
/dependencies.json
coverage/**

# TODO(STENCIL-446): Remove these once `strictNullChecks` is enabled
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# auto-generated dependencies list
/dependencies.json

# npm packages in the root of the project and subdirectories
node_modules/

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"bin/",
"cli/",
"compiler/",
"dependencies.json",
"dev-server/",
"internal/",
"mock-doc/",
Expand Down
2 changes: 0 additions & 2 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { testing } from './bundles/testing';
import { createLicense } from './license';
import { release } from './release';
import { validateBuild } from './test/validate-build';
import { updateDependenciesJson } from './utils/dependencies-json';
import { BuildOptions } from './utils/options';

/**
Expand Down Expand Up @@ -54,7 +53,6 @@ export async function createBuild(opts: BuildOptions): Promise<readonly RollupOp
emptyDir(opts.output.mockDocDir),
emptyDir(opts.output.sysNodeDir),
emptyDir(opts.output.testingDir),
updateDependenciesJson(opts),
]);

await sysNodeExternalBundles(opts);
Expand Down
10 changes: 9 additions & 1 deletion scripts/bundles/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import sourcemaps from 'rollup-plugin-sourcemaps';
import { minify, MinifyOptions } from 'terser';

import { getBanner } from '../utils/banner';
import { getTypeScriptDefaultLibNames } from '../utils/dependencies-json';
import type { BuildOptions } from '../utils/options';
import { writePkgJson } from '../utils/write-pkg-json';
import { aliasPlugin } from './plugins/alias-plugin';
Expand Down Expand Up @@ -228,3 +227,12 @@ async function minifyStencilCompiler(code: string, opts: BuildOptions) {

return code;
}

/**
* Helper function that reads in the `lib.*.d.ts` files in the TypeScript lib/ directory on disk.
* @param opts the Stencil build options, which includes the location of the TypeScript lib/
* @returns all file names that match the `lib.*.d.ts` format
*/
async function getTypeScriptDefaultLibNames(opts: BuildOptions): Promise<string[]> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (await fs.readdir(opts.typescriptLibDir)).filter((f) => f.startsWith('lib.') && f.endsWith('.d.ts'));
}
90 changes: 0 additions & 90 deletions scripts/utils/dependencies-json.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/cli/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { hasError, isFunction, shouldIgnoreError } from '@utils';

import { dependencies } from '../compiler/sys/dependencies.json';
import { createLogger } from '../compiler/sys/logger/console-logger';
import type * as d from '../declarations';
import { ValidatedConfig } from '../declarations';
Expand Down Expand Up @@ -53,17 +52,6 @@ export const run = async (init: d.CliInitOptions) => {
return sys.exit(1);
}

const ensureDepsResults = await sys.ensureDependencies({
rootDir: findConfigResults.rootDir,
logger,
dependencies: dependencies as any,
});

if (hasError(ensureDepsResults.diagnostics)) {
logger.printDiagnostics(ensureDepsResults.diagnostics);
return sys.exit(1);
}

const coreCompiler = await loadCoreCompiler(sys);

if (task === 'version' || flags.version) {
Expand Down Expand Up @@ -100,8 +88,6 @@ export const run = async (init: d.CliInitOptions) => {
sys.applyGlobalPatch(validated.config.rootDir);
}

await sys.ensureResources({ rootDir: validated.config.rootDir, logger, dependencies: dependencies as any });

await telemetryAction(sys, validated.config, coreCompiler, async () => {
await runTask(coreCompiler, validated.config, task, sys);
});
Expand Down
1 change: 0 additions & 1 deletion src/compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export { loadConfig } from './config/load-config';
export { optimizeCss } from './optimize/optimize-css';
export { optimizeJs } from './optimize/optimize-js';
export { createPrerenderer } from './prerender/prerender-main';
export { dependencies } from './sys/dependencies.json';
export { path } from './sys/modules/path';
export { nodeRequire } from './sys/node-require';
export { createSystem } from './sys/stencil-sys';
Expand Down
123 changes: 0 additions & 123 deletions src/compiler/sys/dependencies.json

This file was deleted.

9 changes: 9 additions & 0 deletions src/declarations/stencil-public-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,20 @@ export interface CompilerSystem {
*/
createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
encodeToBase64(str: string): string;

// TODO(STENCIL-727): Remove this from the sys interface
/**
* @deprecated
*/
ensureDependencies?(opts: {
rootDir: string;
logger: Logger;
dependencies: CompilerDependency[];
}): Promise<{ stencilPath: string; diagnostics: Diagnostic[] }>;
// TODO(STENCIL-727): Remove this from the sys interface
/**
* @deprecated
*/
ensureResources?(opts: { rootDir: string; logger: Logger; dependencies: CompilerDependency[] }): Promise<void>;
/**
* process.exit()
Expand Down
9 changes: 8 additions & 1 deletion src/sys/node/node-sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,19 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
return Buffer.from(str).toString('base64');
},
async ensureDependencies() {
// TODO(STENCIL-727): Remove this from the sys interface
console.warn(`ensureDependencies will be removed in a future version of Stencil.`);
console.warn(`To get the stencilPath, please use getCompilerExecutingPath().`);

return {
stencilPath: sys.getCompilerExecutingPath(),
diagnostics: [],
};
},
async ensureResources() {},
async ensureResources() {
// TODO(STENCIL-727): Remove this from the sys interface
console.warn(`ensureResources is a no-op, and will be removed in a future version of Stencil`);
},
exit: async (exitCode) => {
await runInterruptsCallbacks();
exit(exitCode);
Expand Down