Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏗 Update how to execute jscodeshift (#32996)
- Loading branch information
1 parent
4fefdf8
commit 3aa6c2c
Showing
7 changed files
with
475 additions
and
22 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
3 changes: 0 additions & 3 deletions
3
build-system/tasks/sweep-experiments/jscodeshift/parser-config.json
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
# [jscodeshift](https://github.com/facebook/jscodeshift) | ||
|
||
This directory holds shared configuration and utils for **jscodeshift**. | ||
|
||
- [`parser-config.json`](./parser-config.json) is mostly taken from [the default babylon configuration](https://github.com/facebook/jscodeshift/blob/48f5d6d6e5e769639b958f1a955c83c68157a5fa/parser/babylon.js). | ||
|
||
Different build tasks can hold local transforms, [you may search each of them.](https://github.com/ampproject/amphtml/search?l=JavaScript&q=jscodeshift) |
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,33 @@ | ||
/** | ||
* Copyright 2021 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
const {getOutput} = require('../../common/exec'); | ||
|
||
/** | ||
* @param {Array<string>} args | ||
* @return {string} | ||
*/ | ||
const jscodeshift = (args = []) => | ||
getOutput( | ||
[ | ||
'npx jscodeshift', | ||
'--parser babylon', | ||
`--parser-config ${__dirname}/parser-config.json`, | ||
...args, | ||
].join(' ') | ||
); | ||
|
||
module.exports = {jscodeshift}; |
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,33 @@ | ||
{ | ||
"sourceType": "module", | ||
"allowImportExportEverywhere": true, | ||
"allowReturnOutsideFunction": true, | ||
"startLine": 1, | ||
"tokens": true, | ||
"plugins": [ | ||
["flow", {"all": true}], | ||
"flowComments", | ||
"jsx", | ||
"asyncGenerators", | ||
"bigInt", | ||
"classProperties", | ||
"classPrivateProperties", | ||
"classPrivateMethods", | ||
["decorators", {"decoratorsBeforeExport": false}], | ||
"doExpressions", | ||
"dynamicImport", | ||
"exportDefaultFrom", | ||
"exportNamespaceFrom", | ||
"functionBind", | ||
"functionSent", | ||
"importMeta", | ||
"logicalAssignment", | ||
"nullishCoalescingOperator", | ||
"numericSeparator", | ||
"objectRestSpread", | ||
"optionalCatchBinding", | ||
"optionalChaining", | ||
["pipelineOperator", {"proposal": "minimal"}], | ||
"throwExpressions" | ||
] | ||
} |
Oops, something went wrong.