build(aio): ignore example files that are gitignored
Rather than hard coding excludes into the dgeni config, use the fact that we are already ignoring the boilerplate and generated files via the .gitignore file.
This commit is contained in:
parent
e894f5c399
commit
3db6b6ca7a
|
@ -83,6 +83,7 @@
|
|||
"hast-util-to-string": "^1.0.0",
|
||||
"html": "^1.0.0",
|
||||
"http-server": "^0.9.0",
|
||||
"ignore": "^3.3.3",
|
||||
"image-size": "^0.5.1",
|
||||
"jasmine-core": "~2.5.2",
|
||||
"jasmine-spec-reporter": "~3.2.0",
|
||||
|
|
|
@ -6,17 +6,29 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
const Package = require('dgeni').Package;
|
||||
|
||||
const globby = require('globby');
|
||||
const ignore = require('ignore');
|
||||
const fs = require('fs');
|
||||
const path = require('canonical-path');
|
||||
const basePackage = require('../angular-base-package');
|
||||
const contentPackage = require('../content-package');
|
||||
|
||||
const { CONTENTS_PATH } = require('../config');
|
||||
const { CONTENTS_PATH, GUIDE_EXAMPLES_PATH } = require('../config');
|
||||
|
||||
module.exports = new Package('angular-content', [basePackage, contentPackage])
|
||||
|
||||
// Where do we get the source files?
|
||||
.config(function(readFilesProcessor, collectExamples) {
|
||||
|
||||
const gitignoreFile = fs.readFileSync(path.resolve(GUIDE_EXAMPLES_PATH, '.gitignore'), 'utf8');
|
||||
const gitignore = ignore().add(gitignoreFile);
|
||||
|
||||
const examplePaths = globby.sync('**/*', { cwd: GUIDE_EXAMPLES_PATH, mark: true, dot: true })
|
||||
.filter(filePath => filePath !== '.gitignore') // we are not interested in the .gitignore file itself
|
||||
.filter(filePath => !/\/$/.test(filePath)); // this filter removes the folders, leaving only files
|
||||
const filteredExamplePaths = gitignore.filter(examplePaths) // filter out files that match the .gitignore rules
|
||||
.map(filePath => path.resolve(GUIDE_EXAMPLES_PATH, filePath)); // we need the full paths for the filereader
|
||||
|
||||
readFilesProcessor.sourceFiles = readFilesProcessor.sourceFiles.concat([
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
|
@ -36,26 +48,7 @@ module.exports = new Package('angular-content', [basePackage, contentPackage])
|
|||
},
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
include: CONTENTS_PATH + '/examples/**/*',
|
||||
exclude: [
|
||||
'**/*plnkr.no-link.html',
|
||||
'**/node_modules/**',
|
||||
// boilerplate files
|
||||
'**/*/src/systemjs-angular-loader.js',
|
||||
'**/*/src/systemjs.config.js',
|
||||
'**/*/src/tsconfig.json',
|
||||
'**/*/bs-config.e2e.json',
|
||||
'**/*/bs-config.json',
|
||||
'**/*/package.json',
|
||||
'**/*/tslint.json',
|
||||
// example files
|
||||
'**/_test-output',
|
||||
'**/protractor-helpers.js',
|
||||
'**/e2e-spec.js',
|
||||
'**/ts/**/*.js',
|
||||
'**/js-es6*/**/*.js',
|
||||
'**/ts-snippets/**/*.js',
|
||||
],
|
||||
include: filteredExamplePaths,
|
||||
fileReader: 'exampleFileReader'
|
||||
},
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ const AIO_PATH = resolve(PROJECT_ROOT, 'aio');
|
|||
const TEMPLATES_PATH = resolve(AIO_PATH, 'tools/transforms/templates');
|
||||
const API_TEMPLATES_PATH = resolve(TEMPLATES_PATH, 'api');
|
||||
const CONTENTS_PATH = resolve(AIO_PATH, 'content');
|
||||
const GUIDE_EXAMPLES_PATH = resolve(CONTENTS_PATH, 'examples');
|
||||
const SRC_PATH = resolve(AIO_PATH, 'src');
|
||||
const OUTPUT_PATH = resolve(SRC_PATH, 'generated');
|
||||
const DOCS_OUTPUT_PATH = resolve(OUTPUT_PATH, 'docs');
|
||||
|
@ -18,5 +19,5 @@ function requireFolder(dirname, folderPath) {
|
|||
.map(p => require(resolve(absolutePath, p)));
|
||||
}
|
||||
|
||||
module.exports = { PROJECT_ROOT, AIO_PATH, TEMPLATES_PATH, API_TEMPLATES_PATH, CONTENTS_PATH, SRC_PATH, OUTPUT_PATH, DOCS_OUTPUT_PATH, API_SOURCE_PATH, requireFolder };
|
||||
module.exports = { PROJECT_ROOT, AIO_PATH, TEMPLATES_PATH, API_TEMPLATES_PATH, CONTENTS_PATH, GUIDE_EXAMPLES_PATH, SRC_PATH, OUTPUT_PATH, DOCS_OUTPUT_PATH, API_SOURCE_PATH, requireFolder };
|
||||
|
||||
|
|
|
@ -3366,6 +3366,10 @@ ignore@^3.2.0:
|
|||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.0.tgz#3812d22cbe9125f2c2b4915755a1b8abd745a001"
|
||||
|
||||
ignore@^3.3.3:
|
||||
version "3.3.3"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d"
|
||||
|
||||
ignorefs@^1.0.0, ignorefs@^1.1.1:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ignorefs/-/ignorefs-1.2.0.tgz#da59fb858976e4a5e43702ccd1f282fdbc9e5756"
|
||||
|
|
Loading…
Reference in New Issue