Skip to content

Commit f731764

Browse files
committed
Cleanup
1 parent 642f83a commit f731764

File tree

2 files changed

+7
-78
lines changed

2 files changed

+7
-78
lines changed

Diff for: package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"private": true,
66
"scripts": {
77
"test": "npm run build:jasmine && npm run test:node && npm run test:chrome-headless",
8-
"test:watch": "npx firebase-tools@latest emulators:exec --project=angularfire2-test \"ng test --watch=true --browsers=Chrome\"",
9-
"test:chrome": "npx firebase-tools@latest emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=Chrome\"",
10-
"test:firefox": "npx firebase-tools@latest emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=Firefox\"",
11-
"test:safari": "npx firebase-tools@latest emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=SafariNative\"",
12-
"test:chrome-headless": "npx firebase-tools@latest emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=ChromeHeadless\"",
13-
"test:firefox-headless": "npx firebase-tools@latest emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=FirefoxHeadless\"",
8+
"test:watch": "npx --yes firebase-tools emulators:exec --project=angularfire2-test \"ng test --watch=true --browsers=Chrome\"",
9+
"test:chrome": "npx --yes firebase-tools emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=Chrome\"",
10+
"test:firefox": "npx --yes firebase-tools emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=Firefox\"",
11+
"test:safari": "npx --yes firebase-tools emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=SafariNative\"",
12+
"test:chrome-headless": "npx --yes firebase-tools emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=ChromeHeadless\"",
13+
"test:firefox-headless": "npx --yes firebase-tools emulators:exec --project=angularfire2-test \"ng test --watch=false --browsers=FirefoxHeadless\"",
1414
"lint": "ng lint",
1515
"test:node": "node -r tsconfig-paths/register ./dist/out-tsc/jasmine/tools/jasmine.js --input-type=commonjs",
1616
"test:node-esm": "node -r tsconfig-paths/register ./dist/out-tsc/jasmine/tools/jasmine.mjs --input-type=commonjs",

Diff for: tools/build.ts

+1-72
Original file line numberDiff line numberDiff line change
@@ -244,79 +244,8 @@ function measureLibrary() {
244244
return Promise.all(UMD_NAMES.map(measure));
245245
}
246246

247-
async function buildDocs() {
248-
try {
249-
// INVESTIGATE json to stdout rather than FS?
250-
await Promise.all(
251-
MODULES.map(module =>
252-
spawnPromise('npx', ['typedoc',
253-
`${module === 'core' ?
254-
join(process.cwd(), 'src') :
255-
join(process.cwd(), 'src', module)}`,
256-
'--json',
257-
join(process.cwd(), 'dist', 'typedocs', `${module}.json`)
258-
])));
259-
const entries = await Promise.all(MODULES.map(async (module) => {
260247

261-
const buffer = await readFile(join(process.cwd(), 'dist', 'typedocs', `${module}.json`));
262-
const typedoc = JSON.parse(buffer.toString());
263-
if (!typedoc.children) {
264-
console.error('typedoc fail', module);
265-
}
266-
// TODO infer the entryPoint from the package.json
267-
const entryPoint = typedoc.children.find((c: any) => c.name === '"public_api"');
268-
const allChildren = [].concat(...typedoc.children.map(child =>
269-
// TODO chop out the working directory and filename
270-
child.children ?
271-
child.children.map(c => {
272-
return { ...c, path: dirname(child.originalName.split(process.cwd())[1]) };
273-
}) :
274-
[]
275-
));
276-
return (entryPoint.children || [])
277-
.filter(c => c.name[0] !== 'ɵ' && c.name[0] !== '_' /* private */)
278-
.map(child => ({ ...allChildren.find(c => child.target === c.id) }))
279-
.reduce((acc, child) => ({ ...acc, [encodeURIComponent(child.name)]: child }), {});
280-
}));
281-
const root = await rootPackage;
282-
const pipes = ['MonoTypeOperatorFunction', 'OperatorFunction', 'AuthPipe', 'UnaryFunction'];
283-
const tocType = child => {
284-
const decorators: string[] = child.decorators && child.decorators.map(d => d.name) || [];
285-
if (decorators.includes('NgModule')) {
286-
return 'NgModule';
287-
} else if (child.kindString === 'Type alias') {
288-
return 'Type alias';
289-
} else if (child.kindString === 'Variable' && child.defaultValue && child.defaultValue.startsWith('new InjectionToken')) {
290-
return 'InjectionToken';
291-
} else if (child.type) {
292-
return pipes.includes(child.type.name) ? 'Pipe' : child.type.name;
293-
} else if (child.signatures && child.signatures[0] && child.signatures[0].type && pipes.includes(child.signatures[0].type.name)) {
294-
return 'Pipe';
295-
} else {
296-
return child.kindString;
297-
}
298-
};
299-
const tableOfContents = entries.reduce((acc, entry, index) =>
300-
({
301-
...acc, [MODULES[index]]: {
302-
name: ENTRY_NAMES[index],
303-
exports: Object.keys(entry).reduce((acc, key) => ({ ...acc, [key]: tocType(entry[key]) }), {})
304-
}
305-
}),
306-
{}
307-
);
308-
const afdoc = entries.reduce((acc, entry, index) => ({ ...acc, [MODULES[index]]: entry }), { table_of_contents: tableOfContents });
309-
return writeFile(join(process.cwd(), `api-${root.version}.json`), JSON.stringify(afdoc, null, 2));
310-
} catch (e) {
311-
console.warn(e);
312-
return Promise.resolve();
313-
}
314-
}
315-
316-
Promise.all([
317-
buildDocs(),
318-
buildLibrary()
319-
]).then(measureLibrary).then(stats =>
248+
buildLibrary().then(measureLibrary).then(stats =>
320249
console.log(`
321250
Package Size Gzipped
322251
------------------------------------

0 commit comments

Comments
 (0)