Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ts] add script to verify that all ts is in a project
- Loading branch information
spalger
committed
Mar 7, 2019
1 parent
115e47e
commit 88ab98c
Showing
7 changed files
with
105 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
require('../src/setup_node_env'); | ||
require('../src/dev/typescript/run_check_ts_projects_cli').runCheckTsProjectsCli(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { resolve } from 'path'; | ||
|
||
import execa from 'execa'; | ||
|
||
import { run } from '../run'; | ||
|
||
const REPO_ROOT = resolve(__dirname, '../../../'); | ||
import { File } from '../file'; | ||
import { getTsProjectForAbsolutePath } from './get_ts_project_for_absolute_path'; | ||
|
||
export async function runCheckTsProjectsCli() { | ||
run( | ||
async ({ log }) => { | ||
const files = await execa.stdout('git', ['ls-tree', '--name-only', '-r', 'HEAD'], { | ||
cwd: REPO_ROOT, | ||
}); | ||
|
||
for (const lineRaw of files.split('\n')) { | ||
const line = lineRaw.trim(); | ||
|
||
if (!line) { | ||
continue; | ||
} | ||
|
||
const file = new File(resolve(REPO_ROOT, line)); | ||
if (!file.isTypescript() || file.isFixture()) { | ||
continue; | ||
} | ||
|
||
log.verbose('Checking %s', file.getAbsolutePath()); | ||
getTsProjectForAbsolutePath(file.getAbsolutePath()); | ||
} | ||
|
||
log.success('All ts files belong to a ts project'); | ||
}, | ||
{ | ||
helpDescription: | ||
'Check that all .ts and .tsx files in the repository are assigned to a tsconfig.json file', | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters