feat(core): migrate prettier to v2.3.1 (#5623)
This commit is contained in:
parent
3c833e44fe
commit
fe97444d78
@ -5,8 +5,7 @@ module.exports = {
|
|||||||
{ value: 'docs', name: 'docs: Documentation only changes' },
|
{ value: 'docs', name: 'docs: Documentation only changes' },
|
||||||
{
|
{
|
||||||
value: 'cleanup',
|
value: 'cleanup',
|
||||||
name:
|
name: 'cleanup: A code change that neither fixes a bug nor adds a feature',
|
||||||
'cleanup: A code change that neither fixes a bug nor adds a feature',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'chore',
|
value: 'chore',
|
||||||
@ -64,8 +63,7 @@ module.exports = {
|
|||||||
customScope: 'Denote the SCOPE of this change:',
|
customScope: 'Denote the SCOPE of this change:',
|
||||||
subject:
|
subject:
|
||||||
'Write a SHORT, IMPERATIVE (lowercase) description of the change:\n',
|
'Write a SHORT, IMPERATIVE (lowercase) description of the change:\n',
|
||||||
body:
|
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
|
||||||
'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
|
|
||||||
breaking: 'List any BREAKING CHANGES (optional):\n',
|
breaking: 'List any BREAKING CHANGES (optional):\n',
|
||||||
footer:
|
footer:
|
||||||
'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
|
'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
|
||||||
|
|||||||
@ -21,9 +21,8 @@ export class ProjectList {
|
|||||||
|
|
||||||
setCheckedProjects(selectedProjects: string[]) {
|
setCheckedProjects(selectedProjects: string[]) {
|
||||||
Object.keys(this.checkboxes).forEach((projectName) => {
|
Object.keys(this.checkboxes).forEach((projectName) => {
|
||||||
this.checkboxes[projectName].checked = selectedProjects.includes(
|
this.checkboxes[projectName].checked =
|
||||||
projectName
|
selectedProjects.includes(projectName);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,16 +43,14 @@ export class SidebarComponent {
|
|||||||
);
|
);
|
||||||
this.displayOptionsPanel.render(displayOptionsPanelContainer);
|
this.displayOptionsPanel.render(displayOptionsPanelContainer);
|
||||||
|
|
||||||
const focusedProjectPanelContainer = document.getElementById(
|
const focusedProjectPanelContainer =
|
||||||
'focused-project'
|
document.getElementById('focused-project');
|
||||||
);
|
|
||||||
this.focusedProjectPanel = new FocusedProjectPanel(
|
this.focusedProjectPanel = new FocusedProjectPanel(
|
||||||
focusedProjectPanelContainer
|
focusedProjectPanelContainer
|
||||||
);
|
);
|
||||||
|
|
||||||
const textFilterPanelContainer = document.getElementById(
|
const textFilterPanelContainer =
|
||||||
'text-filter-panel'
|
document.getElementById('text-filter-panel');
|
||||||
);
|
|
||||||
this.textFilterPanel = new TextFilterPanel(textFilterPanelContainer);
|
this.textFilterPanel = new TextFilterPanel(textFilterPanelContainer);
|
||||||
|
|
||||||
const projectListContainer = document.getElementById('project-lists');
|
const projectListContainer = document.getElementById('project-lists');
|
||||||
|
|||||||
@ -85,38 +85,32 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.html',
|
||||||
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.html',
|
|
||||||
hash: 'fd5fa276dc13f789ae5d7a37703a296753aec8be',
|
hash: 'fd5fa276dc13f789ae5d7a37703a296753aec8be',
|
||||||
ext: '.html',
|
ext: '.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.scss',
|
||||||
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.scss',
|
|
||||||
hash: '98fbca8900da6d5c5f6373558f5bd69efe190780',
|
hash: '98fbca8900da6d5c5f6373558f5bd69efe190780',
|
||||||
ext: '.scss',
|
ext: '.scss',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.spec.ts',
|
||||||
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.spec.ts',
|
|
||||||
hash: 'e8390b7218d2dca9eb4be8d2b1cc08e1b1c0de1b',
|
hash: 'e8390b7218d2dca9eb4be8d2b1cc08e1b1c0de1b',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.ts',
|
||||||
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.ts',
|
|
||||||
hash: 'c20bd27b12494827624a3835b1ec6475efaf0913',
|
hash: 'c20bd27b12494827624a3835b1ec6475efaf0913',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/product-detail-page/src/lib/products-product-detail-page.module.spec.ts',
|
||||||
'libs/products/product-detail-page/src/lib/products-product-detail-page.module.spec.ts',
|
|
||||||
hash: '01541f218a3a1b95b056fd9d2d1b578e5a2e3d9a',
|
hash: '01541f218a3a1b95b056fd9d2d1b578e5a2e3d9a',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/product-detail-page/src/lib/products-product-detail-page.module.ts',
|
||||||
'libs/products/product-detail-page/src/lib/products-product-detail-page.module.ts',
|
|
||||||
hash: '5c06b527e7ffe870f1960a74a845106beca79b6b',
|
hash: '5c06b527e7ffe870f1960a74a845106beca79b6b',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
@ -262,44 +256,37 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/+state/products.actions.ts',
|
||||||
'libs/shared/product/state/src/lib/+state/products.actions.ts',
|
|
||||||
hash: '4c0efeeec1adfcecd34b20bda87fce5f24a64675',
|
hash: '4c0efeeec1adfcecd34b20bda87fce5f24a64675',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/+state/products.reducer.spec.ts',
|
||||||
'libs/shared/product/state/src/lib/+state/products.reducer.spec.ts',
|
|
||||||
hash: 'b2821f72394868ca503eb637f2891564851583eb',
|
hash: 'b2821f72394868ca503eb637f2891564851583eb',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/+state/products.reducer.ts',
|
||||||
'libs/shared/product/state/src/lib/+state/products.reducer.ts',
|
|
||||||
hash: '9168586d19b76b0dd462dafbb5b6998c4da5ba53',
|
hash: '9168586d19b76b0dd462dafbb5b6998c4da5ba53',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/+state/products.selectors.spec.ts',
|
||||||
'libs/shared/product/state/src/lib/+state/products.selectors.spec.ts',
|
|
||||||
hash: '25cd673e1ff8b591f92f734944cd20adf965b612',
|
hash: '25cd673e1ff8b591f92f734944cd20adf965b612',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/+state/products.selectors.ts',
|
||||||
'libs/shared/product/state/src/lib/+state/products.selectors.ts',
|
|
||||||
hash: '74fd5c163037dd51d33316cb2ce1c816728edea1',
|
hash: '74fd5c163037dd51d33316cb2ce1c816728edea1',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/shared-product-state.module.spec.ts',
|
||||||
'libs/shared/product/state/src/lib/shared-product-state.module.spec.ts',
|
|
||||||
hash: '713543b7a36b2027985904f9a74124f79406108c',
|
hash: '713543b7a36b2027985904f9a74124f79406108c',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/state/src/lib/shared-product-state.module.ts',
|
||||||
'libs/shared/product/state/src/lib/shared-product-state.module.ts',
|
|
||||||
hash: '144207d2b4609204b8ceab1ae81d1079d61b3949',
|
hash: '144207d2b4609204b8ceab1ae81d1079d61b3949',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
@ -450,38 +437,32 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/home-page/src/lib/home-page/home-page.component.html',
|
||||||
'libs/products/home-page/src/lib/home-page/home-page.component.html',
|
|
||||||
hash: '8bd27770e5974269e766d95762fef74b5bd89841',
|
hash: '8bd27770e5974269e766d95762fef74b5bd89841',
|
||||||
ext: '.html',
|
ext: '.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/home-page/src/lib/home-page/home-page.component.scss',
|
||||||
'libs/products/home-page/src/lib/home-page/home-page.component.scss',
|
|
||||||
hash: 'ba4f1655a2c0791670384de48367caded0d6e601',
|
hash: 'ba4f1655a2c0791670384de48367caded0d6e601',
|
||||||
ext: '.scss',
|
ext: '.scss',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/home-page/src/lib/home-page/home-page.component.spec.ts',
|
||||||
'libs/products/home-page/src/lib/home-page/home-page.component.spec.ts',
|
|
||||||
hash: '66eb455b3e71b30c0bd16a4769cc34b81133b667',
|
hash: '66eb455b3e71b30c0bd16a4769cc34b81133b667',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/home-page/src/lib/home-page/home-page.component.ts',
|
||||||
'libs/products/home-page/src/lib/home-page/home-page.component.ts',
|
|
||||||
hash: 'bd081eedbf10a2cd04c95609379d131e5e8d60a1',
|
hash: 'bd081eedbf10a2cd04c95609379d131e5e8d60a1',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/home-page/src/lib/products-home-page.module.spec.ts',
|
||||||
'libs/products/home-page/src/lib/products-home-page.module.spec.ts',
|
|
||||||
hash: '1d9cf1c8c46ebe69275def67ccf6f04c0f967856',
|
hash: '1d9cf1c8c46ebe69275def67ccf6f04c0f967856',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/products/home-page/src/lib/products-home-page.module.ts',
|
||||||
'libs/products/home-page/src/lib/products-home-page.module.ts',
|
|
||||||
hash: 'db6a06b6d0063c4a1fff6c7953be09a680592184',
|
hash: 'db6a06b6d0063c4a1fff6c7953be09a680592184',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
@ -563,14 +544,12 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/ui/src/lib/product-price/product-price.element.spec.ts',
|
||||||
'libs/shared/product/ui/src/lib/product-price/product-price.element.spec.ts',
|
|
||||||
hash: '34be17f44c09cfa01a9fd4dc7ada68c7bafded6e',
|
hash: '34be17f44c09cfa01a9fd4dc7ada68c7bafded6e',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/product/ui/src/lib/product-price/product-price.element.ts',
|
||||||
'libs/shared/product/ui/src/lib/product-price/product-price.element.ts',
|
|
||||||
hash: '8c626d1213b1b47bc2bdf221554fb38bb9f9bfae',
|
hash: '8c626d1213b1b47bc2bdf221554fb38bb9f9bfae',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
@ -672,8 +651,7 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/cart/state/src/lib/+state/cart.selectors.spec.ts',
|
||||||
'libs/shared/cart/state/src/lib/+state/cart.selectors.spec.ts',
|
|
||||||
hash: 'dc5a869677b1db84446492fc6a1045cd33c0d661',
|
hash: 'dc5a869677b1db84446492fc6a1045cd33c0d661',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
@ -683,8 +661,7 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/cart/state/src/lib/shared-cart-state.module.spec.ts',
|
||||||
'libs/shared/cart/state/src/lib/shared-cart-state.module.spec.ts',
|
|
||||||
hash: 'caef812f0d76e3f3ca6849d53dc0d011cd2e902a',
|
hash: 'caef812f0d76e3f3ca6849d53dc0d011cd2e902a',
|
||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
@ -825,14 +802,12 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.ts',
|
ext: '.ts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.spec.tsx',
|
||||||
'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.spec.tsx',
|
|
||||||
hash: 'ccef1ef28fac14fdaa45c523108862d70d28825b',
|
hash: 'ccef1ef28fac14fdaa45c523108862d70d28825b',
|
||||||
ext: '.tsx',
|
ext: '.tsx',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.tsx',
|
||||||
'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.tsx',
|
|
||||||
hash: '83a824d0bafcc3d4edf94490664351fe99cdef3f',
|
hash: '83a824d0bafcc3d4edf94490664351fe99cdef3f',
|
||||||
ext: '.tsx',
|
ext: '.tsx',
|
||||||
},
|
},
|
||||||
@ -945,8 +920,7 @@ export const nxExamplesGraph: ProjectGraphCache = {
|
|||||||
ext: '.jpg',
|
ext: '.jpg',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
file:
|
file: 'libs/shared/assets/src/assets/images/a-dance-with-dragons.jpg',
|
||||||
'libs/shared/assets/src/assets/images/a-dance-with-dragons.jpg',
|
|
||||||
hash: 'ea6706f36b4e3a579bd97b8e506fbc7345ef8635',
|
hash: 'ea6706f36b4e3a579bd97b8e506fbc7345ef8635',
|
||||||
ext: '.jpg',
|
ext: '.jpg',
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -46,11 +46,10 @@ xdescribe('Nrwl Convert to Nx Workspace', () => {
|
|||||||
|
|
||||||
// update angular-cli.json
|
// update angular-cli.json
|
||||||
const angularCLIJson = readJson('angular.json');
|
const angularCLIJson = readJson('angular.json');
|
||||||
angularCLIJson.projects[
|
angularCLIJson.projects[proj].architect.build.options.scripts =
|
||||||
proj
|
angularCLIJson.projects[proj].architect.test.options.scripts = [
|
||||||
].architect.build.options.scripts = angularCLIJson.projects[
|
'src/scripts.ts',
|
||||||
proj
|
];
|
||||||
].architect.test.options.scripts = ['src/scripts.ts'];
|
|
||||||
angularCLIJson.projects[proj].architect.test.options.styles = [
|
angularCLIJson.projects[proj].architect.test.options.styles = [
|
||||||
'src/styles.css',
|
'src/styles.css',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -178,9 +178,8 @@ describe('Linter', () => {
|
|||||||
expect(stdout).not.toContain('Unexpected console statement');
|
expect(stdout).not.toContain('Unexpected console statement');
|
||||||
expect(() => checkFilesExist(outputFile)).not.toThrow();
|
expect(() => checkFilesExist(outputFile)).not.toThrow();
|
||||||
const outputContents = JSON.parse(readFile(outputFile));
|
const outputContents = JSON.parse(readFile(outputFile));
|
||||||
const outputForApp: any = Object.values(
|
const outputForApp: any = Object.values(outputContents).filter(
|
||||||
outputContents
|
(result: any) =>
|
||||||
).filter((result: any) =>
|
|
||||||
result.filePath.includes(path.normalize(`${myapp}/src/main.ts`))
|
result.filePath.includes(path.normalize(`${myapp}/src/main.ts`))
|
||||||
)[0];
|
)[0];
|
||||||
expect(outputForApp.errorCount).toBe(1);
|
expect(outputForApp.errorCount).toBe(1);
|
||||||
|
|||||||
@ -108,8 +108,7 @@ function createAnchorContent(node) {
|
|||||||
'stroke-linecap': 'round',
|
'stroke-linecap': 'round',
|
||||||
'stroke-linejoin': 'round',
|
'stroke-linejoin': 'round',
|
||||||
'stroke-width': '2',
|
'stroke-width': '2',
|
||||||
d:
|
d: 'M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1',
|
||||||
'M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1',
|
|
||||||
},
|
},
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -40,9 +40,8 @@ export function DocumentationPage({
|
|||||||
isFallback,
|
isFallback,
|
||||||
}: DocumentationPageProps) {
|
}: DocumentationPageProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { value: storedFlavor, setValue: setStoredFlavor } = useStorage(
|
const { value: storedFlavor, setValue: setStoredFlavor } =
|
||||||
'flavor'
|
useStorage('flavor');
|
||||||
);
|
|
||||||
const { setValue: setStoredVersion } = useStorage('version');
|
const { setValue: setStoredVersion } = useStorage('version');
|
||||||
const [dialogOpen, setDialogOpen] = useState(false);
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
const [navIsOpen, setNavIsOpen] = useState(false);
|
const [navIsOpen, setNavIsOpen] = useState(false);
|
||||||
|
|||||||
@ -98,7 +98,7 @@
|
|||||||
"@types/jest": "26.0.8",
|
"@types/jest": "26.0.8",
|
||||||
"@types/marked": "^2.0.0",
|
"@types/marked": "^2.0.0",
|
||||||
"@types/node": "14.14.37",
|
"@types/node": "14.14.37",
|
||||||
"@types/prettier": "2.0.0",
|
"@types/prettier": "2.3.0",
|
||||||
"@types/react": "17.0.3",
|
"@types/react": "17.0.3",
|
||||||
"@types/react-dom": "17.0.3",
|
"@types/react-dom": "17.0.3",
|
||||||
"@types/react-router-dom": "5.1.7",
|
"@types/react-router-dom": "5.1.7",
|
||||||
@ -122,7 +122,6 @@
|
|||||||
"conventional-changelog-cli": "^2.0.23",
|
"conventional-changelog-cli": "^2.0.23",
|
||||||
"copy-webpack-plugin": "6.0.3",
|
"copy-webpack-plugin": "6.0.3",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"cosmiconfig": "^4.0.0",
|
|
||||||
"cypress": "^7.3.0",
|
"cypress": "^7.3.0",
|
||||||
"cytoscape": "^3.18.2",
|
"cytoscape": "^3.18.2",
|
||||||
"cytoscape-dagre": "^2.3.2",
|
"cytoscape-dagre": "^2.3.2",
|
||||||
@ -187,7 +186,7 @@
|
|||||||
"postcss": "8.3.0",
|
"postcss": "8.3.0",
|
||||||
"postcss-import": "14.0.2",
|
"postcss-import": "14.0.2",
|
||||||
"precise-commits": "1.0.2",
|
"precise-commits": "1.0.2",
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.3.1",
|
||||||
"pretty-quick": "^3.1.0",
|
"pretty-quick": "^3.1.0",
|
||||||
"protractor": "5.4.3",
|
"protractor": "5.4.3",
|
||||||
"raw-loader": "3.1.0",
|
"raw-loader": "3.1.0",
|
||||||
|
|||||||
@ -15,12 +15,12 @@ describe('DelegateBuild executor', () => {
|
|||||||
let delegateTarget: Target;
|
let delegateTarget: Target;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
(buildableLibsUtils.calculateProjectDependencies as jest.Mock).mockImplementation(
|
(
|
||||||
() => ({
|
buildableLibsUtils.calculateProjectDependencies as jest.Mock
|
||||||
|
).mockImplementation(() => ({
|
||||||
target: { data: { root: '/root' } },
|
target: { data: { root: '/root' } },
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
(buildableLibsUtils.createTmpTsConfig as jest.Mock).mockImplementation(
|
(buildableLibsUtils.createTmpTsConfig as jest.Mock).mockImplementation(
|
||||||
() => '/my-app/tsconfig.app.generated.json'
|
() => '/my-app/tsconfig.app.generated.json'
|
||||||
);
|
);
|
||||||
@ -52,9 +52,9 @@ describe('DelegateBuild executor', () => {
|
|||||||
afterEach(() => jest.clearAllMocks());
|
afterEach(() => jest.clearAllMocks());
|
||||||
|
|
||||||
it('should return unsuccessful result when deps have not been built', async () => {
|
it('should return unsuccessful result when deps have not been built', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
false
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(false);
|
||||||
|
|
||||||
const result = await delegateBuildExecutor(options, context).next();
|
const result = await delegateBuildExecutor(options, context).next();
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ describe('DelegateBuild executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should build the app when deps have been built', async () => {
|
it('should build the app when deps have been built', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
(devkit.runExecutor as any).mockImplementation(function* () {
|
(devkit.runExecutor as any).mockImplementation(function* () {
|
||||||
yield { success: true };
|
yield { success: true };
|
||||||
});
|
});
|
||||||
@ -82,9 +82,9 @@ describe('DelegateBuild executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return unsuccessful result when build fails', async () => {
|
it('should return unsuccessful result when build fails', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
(devkit.runExecutor as any).mockImplementation(function* () {
|
(devkit.runExecutor as any).mockImplementation(function* () {
|
||||||
yield { success: false };
|
yield { success: false };
|
||||||
});
|
});
|
||||||
@ -100,9 +100,9 @@ describe('DelegateBuild executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should support watch mode builds', async () => {
|
it('should support watch mode builds', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
(devkit.runExecutor as any).mockImplementation(function* () {
|
(devkit.runExecutor as any).mockImplementation(function* () {
|
||||||
yield { success: true };
|
yield { success: true };
|
||||||
yield { success: true };
|
yield { success: true };
|
||||||
|
|||||||
@ -36,11 +36,8 @@ export const nxCompileNgcTransformFactory = (
|
|||||||
// Compile TypeScript sources
|
// Compile TypeScript sources
|
||||||
const { esm2015, declarations } = entryPoint.data.destinationFiles;
|
const { esm2015, declarations } = entryPoint.data.destinationFiles;
|
||||||
const { moduleResolutionCache } = entryPoint.cache;
|
const { moduleResolutionCache } = entryPoint.cache;
|
||||||
const {
|
const { basePath, cssUrl, styleIncludePaths } =
|
||||||
basePath,
|
entryPoint.data.entryPoint;
|
||||||
cssUrl,
|
|
||||||
styleIncludePaths,
|
|
||||||
} = entryPoint.data.entryPoint;
|
|
||||||
const stylesheetProcessor = new StylesheetProcessor(
|
const stylesheetProcessor = new StylesheetProcessor(
|
||||||
basePath,
|
basePath,
|
||||||
cssUrl,
|
cssUrl,
|
||||||
|
|||||||
@ -33,12 +33,12 @@ describe('NgPackagrLite executor', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
(ng.readConfiguration as jest.Mock).mockImplementation(() => tsConfig);
|
(ng.readConfiguration as jest.Mock).mockImplementation(() => tsConfig);
|
||||||
(buildableLibsUtils.calculateProjectDependencies as jest.Mock).mockImplementation(
|
(
|
||||||
() => ({
|
buildableLibsUtils.calculateProjectDependencies as jest.Mock
|
||||||
|
).mockImplementation(() => ({
|
||||||
target: {},
|
target: {},
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
ngPackagrBuildMock = jest.fn(() => Promise.resolve());
|
ngPackagrBuildMock = jest.fn(() => Promise.resolve());
|
||||||
ngPackagerWatchSubject = new BehaviorSubject<void>(undefined);
|
ngPackagerWatchSubject = new BehaviorSubject<void>(undefined);
|
||||||
ngPackagrWatchMock = jest.fn(() => ngPackagerWatchSubject.asObservable());
|
ngPackagrWatchMock = jest.fn(() => ngPackagerWatchSubject.asObservable());
|
||||||
@ -64,9 +64,9 @@ describe('NgPackagrLite executor', () => {
|
|||||||
afterEach(() => jest.clearAllMocks());
|
afterEach(() => jest.clearAllMocks());
|
||||||
|
|
||||||
it('should return unsuccessful result when deps have not been built', async () => {
|
it('should return unsuccessful result when deps have not been built', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
false
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(false);
|
||||||
|
|
||||||
const result = await ngPackagrLiteExecutor(options, context);
|
const result = await ngPackagrLiteExecutor(options, context);
|
||||||
|
|
||||||
@ -74,9 +74,9 @@ describe('NgPackagrLite executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should build the library when deps have been built', async () => {
|
it('should build the library when deps have been built', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
|
|
||||||
const result = await ngPackagrLiteExecutor(options, context);
|
const result = await ngPackagrLiteExecutor(options, context);
|
||||||
|
|
||||||
@ -85,9 +85,9 @@ describe('NgPackagrLite executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should instantiate NgPackager with the right providers and set to use the right build transformation provider', async () => {
|
it('should instantiate NgPackager with the right providers and set to use the right build transformation provider', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
|
|
||||||
const result = await ngPackagrLiteExecutor(options, context);
|
const result = await ngPackagrLiteExecutor(options, context);
|
||||||
|
|
||||||
@ -102,9 +102,9 @@ describe('NgPackagrLite executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should process tsConfig for incremental builds when tsConfig options is set', async () => {
|
it('should process tsConfig for incremental builds when tsConfig options is set', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
const tsConfigPath = '/root/my-lib/tsconfig.app.json';
|
const tsConfigPath = '/root/my-lib/tsconfig.app.json';
|
||||||
|
|
||||||
const result = await ngPackagrLiteExecutor(
|
const result = await ngPackagrLiteExecutor(
|
||||||
@ -123,9 +123,9 @@ describe('NgPackagrLite executor', () => {
|
|||||||
|
|
||||||
describe('--watch', () => {
|
describe('--watch', () => {
|
||||||
it('should emit results everytime there are changes', async () => {
|
it('should emit results everytime there are changes', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
|
|
||||||
const results = ngPackagrLiteExecutor(
|
const results = ngPackagrLiteExecutor(
|
||||||
{ ...options, watch: true },
|
{ ...options, watch: true },
|
||||||
|
|||||||
@ -27,12 +27,12 @@ describe('Package executor', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
(ng.readConfiguration as jest.Mock).mockImplementation(() => tsConfig);
|
(ng.readConfiguration as jest.Mock).mockImplementation(() => tsConfig);
|
||||||
(buildableLibsUtils.calculateProjectDependencies as jest.Mock).mockImplementation(
|
(
|
||||||
() => ({
|
buildableLibsUtils.calculateProjectDependencies as jest.Mock
|
||||||
|
).mockImplementation(() => ({
|
||||||
target: {},
|
target: {},
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
ngPackagrBuildMock = jest.fn(() => Promise.resolve());
|
ngPackagrBuildMock = jest.fn(() => Promise.resolve());
|
||||||
ngPackagerWatchSubject = new BehaviorSubject<void>(undefined);
|
ngPackagerWatchSubject = new BehaviorSubject<void>(undefined);
|
||||||
ngPackagrWatchMock = jest.fn(() => ngPackagerWatchSubject.asObservable());
|
ngPackagrWatchMock = jest.fn(() => ngPackagerWatchSubject.asObservable());
|
||||||
@ -56,9 +56,9 @@ describe('Package executor', () => {
|
|||||||
afterEach(() => jest.clearAllMocks());
|
afterEach(() => jest.clearAllMocks());
|
||||||
|
|
||||||
it('should return unsuccessful result when deps have not been built', async () => {
|
it('should return unsuccessful result when deps have not been built', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
false
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(false);
|
||||||
|
|
||||||
const result = await packageExecutor(options, context);
|
const result = await packageExecutor(options, context);
|
||||||
|
|
||||||
@ -66,9 +66,9 @@ describe('Package executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should build the library when deps have been built', async () => {
|
it('should build the library when deps have been built', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
|
|
||||||
const result = await packageExecutor(options, context);
|
const result = await packageExecutor(options, context);
|
||||||
|
|
||||||
@ -77,9 +77,9 @@ describe('Package executor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should process tsConfig for incremental builds when tsConfig options is set', async () => {
|
it('should process tsConfig for incremental builds when tsConfig options is set', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
const tsConfigPath = '/root/my-lib/tsconfig.app.json';
|
const tsConfigPath = '/root/my-lib/tsconfig.app.json';
|
||||||
|
|
||||||
const result = await packageExecutor(
|
const result = await packageExecutor(
|
||||||
@ -98,9 +98,9 @@ describe('Package executor', () => {
|
|||||||
|
|
||||||
describe('--watch', () => {
|
describe('--watch', () => {
|
||||||
it('should emit results everytime there are changes', async () => {
|
it('should emit results everytime there are changes', async () => {
|
||||||
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
|
(
|
||||||
true
|
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
|
||||||
);
|
).mockReturnValue(true);
|
||||||
|
|
||||||
const results = packageExecutor(
|
const results = packageExecutor(
|
||||||
{ ...options, watch: true },
|
{ ...options, watch: true },
|
||||||
|
|||||||
@ -22,8 +22,10 @@ export function componentCypressSpecGenerator(
|
|||||||
componentName,
|
componentName,
|
||||||
} = options;
|
} = options;
|
||||||
const e2eProjectName = cypressProject || `${projectName}-e2e`;
|
const e2eProjectName = cypressProject || `${projectName}-e2e`;
|
||||||
const e2eProjectRoot = readProjectConfiguration(tree, e2eProjectName)
|
const e2eProjectRoot = readProjectConfiguration(
|
||||||
.sourceRoot;
|
tree,
|
||||||
|
e2eProjectName
|
||||||
|
).sourceRoot;
|
||||||
const e2eLibIntegrationFolderPath = joinPathFragments(
|
const e2eLibIntegrationFolderPath = joinPathFragments(
|
||||||
e2eProjectRoot,
|
e2eProjectRoot,
|
||||||
'integration'
|
'integration'
|
||||||
|
|||||||
@ -8,12 +8,8 @@ export function componentStoryGenerator(
|
|||||||
tree: Tree,
|
tree: Tree,
|
||||||
options: ComponentStoryGeneratorOptions
|
options: ComponentStoryGeneratorOptions
|
||||||
): void {
|
): void {
|
||||||
const {
|
const { componentFileName, componentName, componentPath, projectPath } =
|
||||||
componentFileName,
|
options;
|
||||||
componentName,
|
|
||||||
componentPath,
|
|
||||||
projectPath,
|
|
||||||
} = options;
|
|
||||||
|
|
||||||
const templatesDir = joinPathFragments(__dirname, 'files');
|
const templatesDir = joinPathFragments(__dirname, 'files');
|
||||||
const destinationDir = joinPathFragments(projectPath, componentPath);
|
const destinationDir = joinPathFragments(projectPath, componentPath);
|
||||||
|
|||||||
@ -472,9 +472,9 @@ describe('lib', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
|
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
|
||||||
expect(
|
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
|
||||||
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
|
['libs/my-dir/my-lib/src/index.ts']
|
||||||
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
|
);
|
||||||
expect(
|
expect(
|
||||||
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
@ -505,9 +505,9 @@ describe('lib', () => {
|
|||||||
// ASSERT
|
// ASSERT
|
||||||
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
|
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
|
||||||
|
|
||||||
expect(
|
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
|
||||||
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
|
['libs/my-dir/my-lib/src/index.ts']
|
||||||
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
|
);
|
||||||
expect(
|
expect(
|
||||||
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
|||||||
@ -11,7 +11,8 @@ export function getModuleDeclaredComponents(
|
|||||||
projectName: string
|
projectName: string
|
||||||
): string[] {
|
): string[] {
|
||||||
const ngModuleDecorator = getNgModuleDecorator(file, moduleFilePath);
|
const ngModuleDecorator = getNgModuleDecorator(file, moduleFilePath);
|
||||||
const declarationsPropertyAssignment = getNgModuleDeclarationsPropertyAssignment(
|
const declarationsPropertyAssignment =
|
||||||
|
getNgModuleDeclarationsPropertyAssignment(
|
||||||
ngModuleDecorator,
|
ngModuleDecorator,
|
||||||
moduleFilePath,
|
moduleFilePath,
|
||||||
projectName
|
projectName
|
||||||
|
|||||||
@ -12,26 +12,22 @@ function createAngularCLIPoweredWorkspace() {
|
|||||||
describe('Remove ngcc flags from postinstall script', () => {
|
describe('Remove ngcc flags from postinstall script', () => {
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
test:
|
test: 'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points',
|
||||||
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points',
|
|
||||||
expected:
|
expected:
|
||||||
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main',
|
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test:
|
test: 'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && echo "hi"',
|
||||||
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && echo "hi"',
|
|
||||||
expected:
|
expected:
|
||||||
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main && echo "hi"',
|
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main && echo "hi"',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test:
|
test: 'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js && echo "hi"',
|
||||||
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js && echo "hi"',
|
|
||||||
expected:
|
expected:
|
||||||
'ngcc --properties es2015 browser module main && node ./decorate-angular-cli.js && echo "hi"',
|
'ngcc --properties es2015 browser module main && node ./decorate-angular-cli.js && echo "hi"',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test:
|
test: 'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js',
|
||||||
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js',
|
|
||||||
expected:
|
expected:
|
||||||
'ngcc --properties es2015 browser module main && node ./decorate-angular-cli.js',
|
'ngcc --properties es2015 browser module main && node ./decorate-angular-cli.js',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -111,12 +111,8 @@ function updateTargetsConfigurations(
|
|||||||
configurationOptions: any
|
configurationOptions: any
|
||||||
) {
|
) {
|
||||||
for (const [configurationName, options] of configurationOptions) {
|
for (const [configurationName, options] of configurationOptions) {
|
||||||
const {
|
const { buildTarget, tsConfig, outputPath, ...delegateTargetOptions } =
|
||||||
buildTarget,
|
options;
|
||||||
tsConfig,
|
|
||||||
outputPath,
|
|
||||||
...delegateTargetOptions
|
|
||||||
} = options;
|
|
||||||
|
|
||||||
const configurationBuildTarget = extractConfigurationBuildTarget(
|
const configurationBuildTarget = extractConfigurationBuildTarget(
|
||||||
projectName,
|
projectName,
|
||||||
@ -153,12 +149,8 @@ function updateTargetsOptions(
|
|||||||
buildTargetName: string
|
buildTargetName: string
|
||||||
) {
|
) {
|
||||||
if (target.options) {
|
if (target.options) {
|
||||||
const {
|
const { buildTarget, tsConfig, outputPath, ...delegateTargetOptions } =
|
||||||
buildTarget,
|
target.options;
|
||||||
tsConfig,
|
|
||||||
outputPath,
|
|
||||||
...delegateTargetOptions
|
|
||||||
} = target.options;
|
|
||||||
// Update build target options by overwriting them
|
// Update build target options by overwriting them
|
||||||
project.targets[buildTargetName].options = {
|
project.targets[buildTargetName].options = {
|
||||||
...project.targets[buildTargetName].options,
|
...project.targets[buildTargetName].options,
|
||||||
|
|||||||
@ -29,12 +29,12 @@ function migrateAngularEsLintRules({ overrides, rules }: Linter.Config) {
|
|||||||
);
|
);
|
||||||
migrateToAccessibilityLabelHasAssociatedControlName(rules);
|
migrateToAccessibilityLabelHasAssociatedControlName(rules);
|
||||||
addEqeqeqIfNeeded(rules);
|
addEqeqeqIfNeeded(rules);
|
||||||
for (const override of overrides ?? []) {
|
for (const o of overrides ?? []) {
|
||||||
migrateToAccessibilityLabelHasAssociatedControlSchema(
|
migrateToAccessibilityLabelHasAssociatedControlSchema(
|
||||||
override.rules?.['@angular-eslint/template/accessibility-label-for']
|
o.rules?.['@angular-eslint/template/accessibility-label-for']
|
||||||
);
|
);
|
||||||
migrateToAccessibilityLabelHasAssociatedControlName(override.rules);
|
migrateToAccessibilityLabelHasAssociatedControlName(o.rules);
|
||||||
addEqeqeqIfNeeded(override.rules);
|
addEqeqeqIfNeeded(o.rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,9 +45,8 @@ function migrateToAccessibilityLabelHasAssociatedControlName(
|
|||||||
const accessibilityLabelForRule =
|
const accessibilityLabelForRule =
|
||||||
rules['@angular-eslint/template/accessibility-label-for'];
|
rules['@angular-eslint/template/accessibility-label-for'];
|
||||||
delete rules['@angular-eslint/template/accessibility-label-for'];
|
delete rules['@angular-eslint/template/accessibility-label-for'];
|
||||||
rules[
|
rules['@angular-eslint/template/accessibility-label-has-associated-control'] =
|
||||||
'@angular-eslint/template/accessibility-label-has-associated-control'
|
accessibilityLabelForRule;
|
||||||
] = accessibilityLabelForRule;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrateToAccessibilityLabelHasAssociatedControlSchema(
|
function migrateToAccessibilityLabelHasAssociatedControlSchema(
|
||||||
|
|||||||
@ -73,11 +73,8 @@ function rewriteBootstrapLogic(options: Schema): Rule {
|
|||||||
}
|
}
|
||||||
function addEntryComponentsToModule(options: Schema): Rule {
|
function addEntryComponentsToModule(options: Schema): Rule {
|
||||||
return (host: Tree) => {
|
return (host: Tree) => {
|
||||||
const {
|
const { modulePath, moduleSource, bootstrapComponentClassName } =
|
||||||
modulePath,
|
readBootstrapInfo(host, options.project);
|
||||||
moduleSource,
|
|
||||||
bootstrapComponentClassName,
|
|
||||||
} = readBootstrapInfo(host, options.project);
|
|
||||||
insert(
|
insert(
|
||||||
host,
|
host,
|
||||||
modulePath,
|
modulePath,
|
||||||
|
|||||||
@ -144,7 +144,9 @@ function _addSymbolToNgModuleMetadata(
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
// Get all the children property assignment of object literals.
|
// Get all the children property assignment of object literals.
|
||||||
const matchingProperties: ts.ObjectLiteralElement[] = (node as ts.ObjectLiteralExpression).properties
|
const matchingProperties: ts.ObjectLiteralElement[] = (
|
||||||
|
node as ts.ObjectLiteralExpression
|
||||||
|
).properties
|
||||||
.filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)
|
.filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)
|
||||||
// Filter out every fields that's not "metadataField". Also handles string literals
|
// Filter out every fields that's not "metadataField". Also handles string literals
|
||||||
// (but not expressions).
|
// (but not expressions).
|
||||||
@ -218,7 +220,7 @@ function _addSymbolToNgModuleMetadata(
|
|||||||
|
|
||||||
const isArray = Array.isArray(node);
|
const isArray = Array.isArray(node);
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
const nodeArray = (node as {}) as Array<ts.Node>;
|
const nodeArray = node as {} as Array<ts.Node>;
|
||||||
const symbolsArray = nodeArray.map((node) => node.getText());
|
const symbolsArray = nodeArray.map((node) => node.getText());
|
||||||
if (symbolsArray.includes(expression)) {
|
if (symbolsArray.includes(expression)) {
|
||||||
return [];
|
return [];
|
||||||
@ -435,8 +437,9 @@ function getListOfRoutes(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (routesDeclaration) {
|
if (routesDeclaration) {
|
||||||
return (routesDeclaration.initializer as ts.ArrayLiteralExpression)
|
return (
|
||||||
.elements;
|
routesDeclaration.initializer as ts.ArrayLiteralExpression
|
||||||
|
).elements;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,7 +142,9 @@ function _addSymbolToNgModuleMetadata(
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
// Get all the children property assignment of object literals.
|
// Get all the children property assignment of object literals.
|
||||||
const matchingProperties: ts.ObjectLiteralElement[] = (node as ts.ObjectLiteralExpression).properties
|
const matchingProperties: ts.ObjectLiteralElement[] = (
|
||||||
|
node as ts.ObjectLiteralExpression
|
||||||
|
).properties
|
||||||
.filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)
|
.filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)
|
||||||
// Filter out every fields that's not "metadataField". Also handles string literals
|
// Filter out every fields that's not "metadataField". Also handles string literals
|
||||||
// (but not expressions).
|
// (but not expressions).
|
||||||
@ -212,7 +214,7 @@ function _addSymbolToNgModuleMetadata(
|
|||||||
|
|
||||||
const isArray = Array.isArray(node);
|
const isArray = Array.isArray(node);
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
const nodeArray = (node as {}) as Array<ts.Node>;
|
const nodeArray = node as {} as Array<ts.Node>;
|
||||||
const symbolsArray = nodeArray.map((node) => node.getText());
|
const symbolsArray = nodeArray.map((node) => node.getText());
|
||||||
if (symbolsArray.includes(expression)) {
|
if (symbolsArray.includes(expression)) {
|
||||||
return source;
|
return source;
|
||||||
@ -434,8 +436,9 @@ function getListOfRoutes(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (routesDeclaration) {
|
if (routesDeclaration) {
|
||||||
return (routesDeclaration.initializer as ts.ArrayLiteralExpression)
|
return (
|
||||||
.elements;
|
routesDeclaration.initializer as ts.ArrayLiteralExpression
|
||||||
|
).elements;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,8 +17,8 @@ export function initLocal(workspace: Workspace) {
|
|||||||
require('@nrwl/workspace/src/utilities/perf-logging');
|
require('@nrwl/workspace/src/utilities/perf-logging');
|
||||||
|
|
||||||
//nx-ignore-next-line
|
//nx-ignore-next-line
|
||||||
const supportedNxCommands = require('@nrwl/workspace/src/command-line/supported-nx-commands')
|
const supportedNxCommands =
|
||||||
.supportedNxCommands;
|
require('@nrwl/workspace/src/command-line/supported-nx-commands').supportedNxCommands;
|
||||||
|
|
||||||
const runOpts = runOneOptions(workspace);
|
const runOpts = runOneOptions(workspace);
|
||||||
const running = runOpts !== false;
|
const running = runOpts !== false;
|
||||||
|
|||||||
@ -551,8 +551,7 @@ async function askAboutNxCloud(parsedArgs: any) {
|
|||||||
choices: [
|
choices: [
|
||||||
{
|
{
|
||||||
name: 'Yes',
|
name: 'Yes',
|
||||||
hint:
|
hint: 'Faster builds, run details, Github integration. Learn more at https://nx.app',
|
||||||
'Faster builds, run details, Github integration. Learn more at https://nx.app',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@ -121,9 +121,8 @@ async function* startDevServer(
|
|||||||
{ project, target, configuration },
|
{ project, target, configuration },
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
const targetSupportsWatchOpt = Object.keys(devServerTargetOpts).includes(
|
const targetSupportsWatchOpt =
|
||||||
'watch'
|
Object.keys(devServerTargetOpts).includes('watch');
|
||||||
);
|
|
||||||
|
|
||||||
for await (const output of await runExecutor<{
|
for await (const output of await runExecutor<{
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
|||||||
@ -202,10 +202,12 @@ async function updatePlugins(host: Tree, context: SchematicContext) {
|
|||||||
statement.expression.right.parameters.length >= 2
|
statement.expression.right.parameters.length >= 2
|
||||||
) {
|
) {
|
||||||
if (isBlock(statement.expression.right.body)) {
|
if (isBlock(statement.expression.right.body)) {
|
||||||
const onParamName = statement.expression.right.parameters[0].name.getText(
|
const onParamName =
|
||||||
|
statement.expression.right.parameters[0].name.getText(
|
||||||
sourceFile
|
sourceFile
|
||||||
);
|
);
|
||||||
const configParamName = statement.expression.right.parameters[1].name.getText(
|
const configParamName =
|
||||||
|
statement.expression.right.parameters[1].name.getText(
|
||||||
sourceFile
|
sourceFile
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
import { getWebpackConfig, preprocessTypescript } from './preprocessor';
|
import { getWebpackConfig, preprocessTypescript } from './preprocessor';
|
||||||
jest.mock('@cypress/webpack-preprocessor', () => {
|
jest.mock('@cypress/webpack-preprocessor', () => {
|
||||||
return jest.fn(() => (...args) => Promise.resolve());
|
return jest.fn(
|
||||||
|
() =>
|
||||||
|
(...args) =>
|
||||||
|
Promise.resolve()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
jest.mock('tsconfig-paths-webpack-plugin');
|
jest.mock('tsconfig-paths-webpack-plugin');
|
||||||
import * as wp from '@cypress/webpack-preprocessor';
|
import * as wp from '@cypress/webpack-preprocessor';
|
||||||
@ -8,9 +12,9 @@ import TsConfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
|
|||||||
|
|
||||||
describe('getWebpackConfig', () => {
|
describe('getWebpackConfig', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
(<any>(
|
(<any>TsConfigPathsPlugin).mockImplementation(
|
||||||
TsConfigPathsPlugin
|
function MockPathsPlugin() {}
|
||||||
)).mockImplementation(function MockPathsPlugin() {});
|
);
|
||||||
});
|
});
|
||||||
it('should load typescript', () => {
|
it('should load typescript', () => {
|
||||||
const config = getWebpackConfig({
|
const config = getWebpackConfig({
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import { sortObjectByKeys } from '@nrwl/tao/src/utils/object-sort';
|
|||||||
export async function formatFiles(host: Tree): Promise<void> {
|
export async function formatFiles(host: Tree): Promise<void> {
|
||||||
let prettier: typeof Prettier;
|
let prettier: typeof Prettier;
|
||||||
try {
|
try {
|
||||||
prettier = require('prettier');
|
prettier = await import('prettier');
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
updateWorkspaceJsonToMatchFormatVersion(host);
|
updateWorkspaceJsonToMatchFormatVersion(host);
|
||||||
@ -29,7 +29,7 @@ export async function formatFiles(host: Tree): Promise<void> {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
Array.from(files).map(async (file) => {
|
Array.from(files).map(async (file) => {
|
||||||
const systemPath = path.join(host.root, file.path);
|
const systemPath = path.join(host.root, file.path);
|
||||||
let options: any = {
|
let options: Prettier.Options = {
|
||||||
filepath: systemPath,
|
filepath: systemPath,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ export async function formatFiles(host: Tree): Promise<void> {
|
|||||||
...resolvedOptions,
|
...resolvedOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
const support = await prettier.getFileInfo(systemPath, options);
|
const support = await prettier.getFileInfo(systemPath);
|
||||||
if (support.ignored || !support.inferredParser) {
|
if (support.ignored || !support.inferredParser) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -112,13 +112,8 @@ export function updateWorkspaceConfiguration(
|
|||||||
host: Tree,
|
host: Tree,
|
||||||
workspaceConfig: WorkspaceConfiguration
|
workspaceConfig: WorkspaceConfiguration
|
||||||
): void {
|
): void {
|
||||||
const {
|
const { version, cli, defaultProject, generators, ...nxJson } =
|
||||||
version,
|
workspaceConfig;
|
||||||
cli,
|
|
||||||
defaultProject,
|
|
||||||
generators,
|
|
||||||
...nxJson
|
|
||||||
} = workspaceConfig;
|
|
||||||
const workspace: Omit<Required<WorkspaceJsonConfiguration>, 'projects'> = {
|
const workspace: Omit<Required<WorkspaceJsonConfiguration>, 'projects'> = {
|
||||||
version,
|
version,
|
||||||
cli,
|
cli,
|
||||||
@ -210,11 +205,8 @@ function setProjectConfiguration(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { tags, implicitDependencies, ...workspaceConfiguration } =
|
||||||
tags,
|
projectConfiguration;
|
||||||
implicitDependencies,
|
|
||||||
...workspaceConfiguration
|
|
||||||
} = projectConfiguration;
|
|
||||||
addProjectToWorkspaceJson(host, projectName, workspaceConfiguration, mode);
|
addProjectToWorkspaceJson(host, projectName, workspaceConfiguration, mode);
|
||||||
addProjectToNxJson(
|
addProjectToNxJson(
|
||||||
host,
|
host,
|
||||||
|
|||||||
@ -11,9 +11,11 @@ import type { NxJsonConfiguration } from '@nrwl/tao/src/shared/nx';
|
|||||||
* `{ appsDir: 'apps', libsDir: 'libs', npmScope: 'myorg' }`
|
* `{ appsDir: 'apps', libsDir: 'libs', npmScope: 'myorg' }`
|
||||||
* @param host - file system tree
|
* @param host - file system tree
|
||||||
*/
|
*/
|
||||||
export function getWorkspaceLayout(
|
export function getWorkspaceLayout(host: Tree): {
|
||||||
host: Tree
|
appsDir: string;
|
||||||
): { appsDir: string; libsDir: string; npmScope: string } {
|
libsDir: string;
|
||||||
|
npmScope: string;
|
||||||
|
} {
|
||||||
const nxJson = readJson<NxJsonConfiguration>(host, 'nx.json');
|
const nxJson = readJson<NxJsonConfiguration>(host, 'nx.json');
|
||||||
return {
|
return {
|
||||||
appsDir: nxJson.workspaceLayout?.appsDir ?? 'apps',
|
appsDir: nxJson.workspaceLayout?.appsDir ?? 'apps',
|
||||||
|
|||||||
@ -9,9 +9,7 @@
|
|||||||
* ```
|
* ```
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
export function names(
|
export function names(name: string): {
|
||||||
name: string
|
|
||||||
): {
|
|
||||||
name: string;
|
name: string;
|
||||||
className: string;
|
className: string;
|
||||||
propertyName: string;
|
propertyName: string;
|
||||||
|
|||||||
@ -73,7 +73,8 @@ export function addOrUpdateProperty(
|
|||||||
propertyAssignment.initializer.kind ===
|
propertyAssignment.initializer.kind ===
|
||||||
ts.SyntaxKind.ArrayLiteralExpression
|
ts.SyntaxKind.ArrayLiteralExpression
|
||||||
) {
|
) {
|
||||||
const arrayLiteral = propertyAssignment.initializer as ts.ArrayLiteralExpression;
|
const arrayLiteral =
|
||||||
|
propertyAssignment.initializer as ts.ArrayLiteralExpression;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
arrayLiteral.elements.some((element) => {
|
arrayLiteral.elements.some((element) => {
|
||||||
|
|||||||
@ -87,7 +87,8 @@ export function addOrUpdateProperty(
|
|||||||
propertyAssignment.initializer.kind ===
|
propertyAssignment.initializer.kind ===
|
||||||
ts.SyntaxKind.ArrayLiteralExpression
|
ts.SyntaxKind.ArrayLiteralExpression
|
||||||
) {
|
) {
|
||||||
const arrayLiteral = propertyAssignment.initializer as ts.ArrayLiteralExpression;
|
const arrayLiteral =
|
||||||
|
propertyAssignment.initializer as ts.ArrayLiteralExpression;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
arrayLiteral.elements.some((element) => {
|
arrayLiteral.elements.some((element) => {
|
||||||
|
|||||||
@ -85,9 +85,9 @@ export default async function run(
|
|||||||
throw new Error('Invalid lint configuration. Nothing to lint.');
|
throw new Error('Invalid lint configuration. Nothing to lint.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatter: CLIEngine.Formatter = (projectESLint.CLIEngine as any).getFormatter(
|
const formatter: CLIEngine.Formatter = (
|
||||||
options.format
|
projectESLint.CLIEngine as any
|
||||||
);
|
).getFormatter(options.format);
|
||||||
|
|
||||||
const bundledReport: CLIEngine.LintReport = {
|
const bundledReport: CLIEngine.LintReport = {
|
||||||
errorCount: 0,
|
errorCount: 0,
|
||||||
|
|||||||
@ -526,10 +526,10 @@ export function updateOverridesAndRemoveDuplication(
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
json.overrides = json.overrides.filter((override) => {
|
json.overrides = json.overrides.filter((o) => {
|
||||||
for (const extendedOverride of configBeingExtended.overrides) {
|
for (const extendedOverride of configBeingExtended.overrides) {
|
||||||
try {
|
try {
|
||||||
assert.deepStrictEqual(override, extendedOverride);
|
assert.deepStrictEqual(o, extendedOverride);
|
||||||
return false;
|
return false;
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,15 +17,15 @@ function updateRootESLintConfig(host: Tree) {
|
|||||||
* configuration (instead of there being a silent, much slower fallback).
|
* configuration (instead of there being a silent, much slower fallback).
|
||||||
*/
|
*/
|
||||||
if (json.overrides) {
|
if (json.overrides) {
|
||||||
json.overrides = json.overrides.map((override) => {
|
json.overrides = json.overrides.map((o) => {
|
||||||
if (override.parserOptions && override.parserOptions.project) {
|
if (o.parserOptions && o.parserOptions.project) {
|
||||||
delete override.parserOptions.project;
|
delete o.parserOptions.project;
|
||||||
// If the parserOptions object is now empty as a result, delete it too
|
// If the parserOptions object is now empty as a result, delete it too
|
||||||
if (Object.keys(override.parserOptions).length === 0) {
|
if (Object.keys(o.parserOptions).length === 0) {
|
||||||
delete override.parserOptions;
|
delete o.parserOptions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return override;
|
return o;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
@ -73,8 +73,7 @@ function updateProjectESLintConfigs(host: Tree) {
|
|||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
!json.overrides.some(
|
!json.overrides.some(
|
||||||
(override) =>
|
(o) => o.parserOptions && o.parserOptions.project
|
||||||
override.parserOptions && override.parserOptions.project
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
json.overrides.unshift({
|
json.overrides.unshift({
|
||||||
|
|||||||
@ -19,7 +19,8 @@ function convertTSLintRuleSeverity(
|
|||||||
if (tslintSeverity === 'default') {
|
if (tslintSeverity === 'default') {
|
||||||
tslintSeverity = tslintConfig.defaultSeverity || 'error';
|
tslintSeverity = tslintConfig.defaultSeverity || 'error';
|
||||||
}
|
}
|
||||||
const narrowedTslintSeverity = tslintSeverity as TSLintRuleSeverityNonDefaultString;
|
const narrowedTslintSeverity =
|
||||||
|
tslintSeverity as TSLintRuleSeverityNonDefaultString;
|
||||||
return narrowedTslintSeverity === 'warning' ? 'warn' : narrowedTslintSeverity;
|
return narrowedTslintSeverity === 'warning' ? 'warn' : narrowedTslintSeverity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -144,9 +144,9 @@ export async function convertToESLintConfig(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const summarizedConfiguration = await (createESLintConfiguration as typeof CreateESLintConfiguration)(
|
const summarizedConfiguration = await (
|
||||||
originalConfigurations
|
createESLintConfiguration as typeof CreateESLintConfiguration
|
||||||
);
|
)(originalConfigurations);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We are expecting it to not find a converter for nx-enforce-module-boundaries
|
* We are expecting it to not find a converter for nx-enforce-module-boundaries
|
||||||
|
|||||||
@ -170,7 +170,8 @@ export class ProjectConverter {
|
|||||||
delete convertedRootESLintConfig.parser;
|
delete convertedRootESLintConfig.parser;
|
||||||
delete convertedRootESLintConfig.parserOptions;
|
delete convertedRootESLintConfig.parserOptions;
|
||||||
if (convertedRootESLintConfig.plugins) {
|
if (convertedRootESLintConfig.plugins) {
|
||||||
convertedRootESLintConfig.plugins = convertedRootESLintConfig.plugins.filter(
|
convertedRootESLintConfig.plugins =
|
||||||
|
convertedRootESLintConfig.plugins.filter(
|
||||||
(p) => p !== '@typescript-eslint/tslint'
|
(p) => p !== '@typescript-eslint/tslint'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -188,14 +189,14 @@ export class ProjectConverter {
|
|||||||
if (!json.overrides) {
|
if (!json.overrides) {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
for (const override of json.overrides) {
|
for (const o of json.overrides) {
|
||||||
if (!override.rules) {
|
if (!o.rules) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!override.rules[nxRuleName]) {
|
if (!o.rules[nxRuleName]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
override.rules[nxRuleName] = nxEnforceModuleBoundariesRule;
|
o.rules[nxRuleName] = nxEnforceModuleBoundariesRule;
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
@ -273,7 +274,8 @@ export class ProjectConverter {
|
|||||||
delete convertedProjectESLintConfig.parser;
|
delete convertedProjectESLintConfig.parser;
|
||||||
delete convertedProjectESLintConfig.parserOptions;
|
delete convertedProjectESLintConfig.parserOptions;
|
||||||
if (convertedProjectESLintConfig.plugins) {
|
if (convertedProjectESLintConfig.plugins) {
|
||||||
convertedProjectESLintConfig.plugins = convertedProjectESLintConfig.plugins.filter(
|
convertedProjectESLintConfig.plugins =
|
||||||
|
convertedProjectESLintConfig.plugins.filter(
|
||||||
(p) => p !== '@typescript-eslint/tslint'
|
(p) => p !== '@typescript-eslint/tslint'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,19 +104,17 @@ export function deduplicateOverrides(
|
|||||||
overrides: Linter.Config['overrides'] = []
|
overrides: Linter.Config['overrides'] = []
|
||||||
) {
|
) {
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
for (const override of overrides) {
|
for (const o of overrides) {
|
||||||
const mapKey: string =
|
const mapKey: string =
|
||||||
typeof override.files === 'string'
|
typeof o.files === 'string' ? o.files : o.files.join(',');
|
||||||
? override.files
|
|
||||||
: override.files.join(',');
|
|
||||||
const existing: Set<Linter.ConfigOverride> = map.get(mapKey);
|
const existing: Set<Linter.ConfigOverride> = map.get(mapKey);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
existing.add(override);
|
existing.add(o);
|
||||||
map.set(mapKey, existing);
|
map.set(mapKey, existing);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const set = new Set();
|
const set = new Set();
|
||||||
set.add(override);
|
set.add(o);
|
||||||
map.set(mapKey, set);
|
map.set(mapKey, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,10 +127,10 @@ export function deduplicateOverrides(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let mergedOverride = {};
|
let mergedOverride = {};
|
||||||
for (const override of overridesArr) {
|
for (const o of overridesArr) {
|
||||||
mergedOverride = {
|
mergedOverride = {
|
||||||
...mergedOverride,
|
...mergedOverride,
|
||||||
...(override as any),
|
...(o as any),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
dedupedOverrides.push(mergedOverride);
|
dedupedOverrides.push(mergedOverride);
|
||||||
|
|||||||
@ -56,9 +56,9 @@ export function removeParserOptionsProjectIfNotRequired(
|
|||||||
function getAllRulesInConfig(json: Linter.Config): string[] {
|
function getAllRulesInConfig(json: Linter.Config): string[] {
|
||||||
let allRules = json.rules ? Object.keys(json.rules) : [];
|
let allRules = json.rules ? Object.keys(json.rules) : [];
|
||||||
if (json.overrides?.length > 0) {
|
if (json.overrides?.length > 0) {
|
||||||
for (const override of json.overrides) {
|
for (const o of json.overrides) {
|
||||||
if (override.rules) {
|
if (o.rules) {
|
||||||
allRules = [...allRules, ...Object.keys(override.rules)];
|
allRules = [...allRules, ...Object.keys(o.rules)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -321,9 +321,9 @@ describe('lib', () => {
|
|||||||
appTree
|
appTree
|
||||||
);
|
);
|
||||||
const tsconfigJson = readJsonInTree(tree, '/tsconfig.base.json');
|
const tsconfigJson = readJsonInTree(tree, '/tsconfig.base.json');
|
||||||
expect(
|
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
|
||||||
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
|
['libs/my-dir/my-lib/src/index.ts']
|
||||||
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
|
);
|
||||||
expect(
|
expect(
|
||||||
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
|||||||
@ -11,9 +11,8 @@ export function tsNodeRegister(file: string = '', tsConfig?: string) {
|
|||||||
|
|
||||||
// Register paths in tsConfig
|
// Register paths in tsConfig
|
||||||
const tsconfigPaths = require('tsconfig-paths');
|
const tsconfigPaths = require('tsconfig-paths');
|
||||||
const { absoluteBaseUrl: baseUrl, paths } = tsconfigPaths.loadConfig(
|
const { absoluteBaseUrl: baseUrl, paths } =
|
||||||
tsConfig
|
tsconfigPaths.loadConfig(tsConfig);
|
||||||
);
|
|
||||||
if (baseUrl && paths) {
|
if (baseUrl && paths) {
|
||||||
tsconfigPaths.register({ baseUrl, paths });
|
tsconfigPaths.register({ baseUrl, paths });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,10 +109,8 @@ async function killProcess() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const promisifiedTreeKill: (
|
const promisifiedTreeKill: (pid: number, signal: string) => Promise<void> =
|
||||||
pid: number,
|
promisify(treeKill);
|
||||||
signal: string
|
|
||||||
) => Promise<void> = promisify(treeKill);
|
|
||||||
try {
|
try {
|
||||||
await promisifiedTreeKill(subProcess.pid, 'SIGTERM');
|
await promisifiedTreeKill(subProcess.pid, 'SIGTERM');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -54,8 +54,7 @@ describe('app', () => {
|
|||||||
fileReplacements: [
|
fileReplacements: [
|
||||||
{
|
{
|
||||||
replace: 'apps/my-node-app/src/environments/environment.ts',
|
replace: 'apps/my-node-app/src/environments/environment.ts',
|
||||||
with:
|
with: 'apps/my-node-app/src/environments/environment.prod.ts',
|
||||||
'apps/my-node-app/src/environments/environment.prod.ts',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -195,9 +195,9 @@ describe('lib', () => {
|
|||||||
it('should update tsconfig.json', async () => {
|
it('should update tsconfig.json', async () => {
|
||||||
await libraryGenerator(tree, { name: 'myLib', directory: 'myDir' });
|
await libraryGenerator(tree, { name: 'myLib', directory: 'myDir' });
|
||||||
const tsconfigJson = readJson(tree, '/tsconfig.base.json');
|
const tsconfigJson = readJson(tree, '/tsconfig.base.json');
|
||||||
expect(
|
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
|
||||||
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
|
['libs/my-dir/my-lib/src/index.ts']
|
||||||
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
|
);
|
||||||
expect(
|
expect(
|
||||||
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
|||||||
@ -21,9 +21,9 @@ describe('getBaseWebpackPartial', () => {
|
|||||||
root: '/root',
|
root: '/root',
|
||||||
statsJson: false,
|
statsJson: false,
|
||||||
};
|
};
|
||||||
(<any>(
|
(<any>TsConfigPathsPlugin).mockImplementation(
|
||||||
TsConfigPathsPlugin
|
function MockPathsPlugin() {}
|
||||||
)).mockImplementation(function MockPathsPlugin() {});
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('unconditional options', () => {
|
describe('unconditional options', () => {
|
||||||
@ -346,7 +346,8 @@ describe('getBaseWebpackPartial', () => {
|
|||||||
showCircularDependencies: true,
|
showCircularDependencies: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const circularDependencyPlugin: CircularDependencyPlugin = result.plugins.find(
|
const circularDependencyPlugin: CircularDependencyPlugin =
|
||||||
|
result.plugins.find(
|
||||||
(plugin) => plugin instanceof CircularDependencyPlugin
|
(plugin) => plugin instanceof CircularDependencyPlugin
|
||||||
);
|
);
|
||||||
expect(circularDependencyPlugin.options.exclude).toEqual(
|
expect(circularDependencyPlugin.options.exclude).toEqual(
|
||||||
|
|||||||
@ -87,13 +87,13 @@ export function getBaseWebpackPartial(
|
|||||||
|
|
||||||
if (options.extractLicenses) {
|
if (options.extractLicenses) {
|
||||||
extraPlugins.push(
|
extraPlugins.push(
|
||||||
(new LicenseWebpackPlugin({
|
new LicenseWebpackPlugin({
|
||||||
stats: {
|
stats: {
|
||||||
errors: false,
|
errors: false,
|
||||||
},
|
},
|
||||||
perChunkOutput: false,
|
perChunkOutput: false,
|
||||||
outputFilename: `3rdpartylicenses.txt`,
|
outputFilename: `3rdpartylicenses.txt`,
|
||||||
}) as unknown) as webpack.Plugin
|
}) as unknown as webpack.Plugin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,9 @@ describe('getNodePartial', () => {
|
|||||||
fileReplacements: [],
|
fileReplacements: [],
|
||||||
statsJson: false,
|
statsJson: false,
|
||||||
};
|
};
|
||||||
(<any>(
|
(<any>TsConfigPathsPlugin).mockImplementation(
|
||||||
TsConfigPathsPlugin
|
function MockPathsPlugin() {}
|
||||||
)).mockImplementation(function MockPathsPlugin() {});
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('unconditionally', () => {
|
describe('unconditionally', () => {
|
||||||
|
|||||||
@ -67,10 +67,8 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema {
|
|||||||
const { npmScope } = getWorkspaceLayout(host);
|
const { npmScope } = getWorkspaceLayout(host);
|
||||||
const { fileName, className } = names(options.name);
|
const { fileName, className } = names(options.name);
|
||||||
|
|
||||||
const {
|
const { root: projectRoot, sourceRoot: projectSourceRoot } =
|
||||||
root: projectRoot,
|
readProjectConfiguration(host, options.project);
|
||||||
sourceRoot: projectSourceRoot,
|
|
||||||
} = readProjectConfiguration(host, options.project);
|
|
||||||
|
|
||||||
let description: string;
|
let description: string;
|
||||||
if (options.description) {
|
if (options.description) {
|
||||||
|
|||||||
@ -23,10 +23,8 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema {
|
|||||||
const { npmScope } = getWorkspaceLayout(host);
|
const { npmScope } = getWorkspaceLayout(host);
|
||||||
const { fileName, className } = names(options.name);
|
const { fileName, className } = names(options.name);
|
||||||
|
|
||||||
const {
|
const { root: projectRoot, sourceRoot: projectSourceRoot } =
|
||||||
root: projectRoot,
|
readProjectConfiguration(host, options.project);
|
||||||
sourceRoot: projectSourceRoot,
|
|
||||||
} = readProjectConfiguration(host, options.project);
|
|
||||||
|
|
||||||
const npmPackageName = `@${npmScope}/${options.project}`;
|
const npmPackageName = `@${npmScope}/${options.project}`;
|
||||||
|
|
||||||
|
|||||||
@ -27,10 +27,8 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema {
|
|||||||
|
|
||||||
const description: string = options.description ?? name;
|
const description: string = options.description ?? name;
|
||||||
|
|
||||||
const {
|
const { root: projectRoot, sourceRoot: projectSourceRoot } =
|
||||||
root: projectRoot,
|
readProjectConfiguration(host, options.project);
|
||||||
sourceRoot: projectSourceRoot,
|
|
||||||
} = readProjectConfiguration(host, options.project);
|
|
||||||
|
|
||||||
const normalized: NormalizedSchema = {
|
const normalized: NormalizedSchema = {
|
||||||
...options,
|
...options,
|
||||||
|
|||||||
@ -232,9 +232,9 @@ describe('lib', () => {
|
|||||||
it('should update tsconfig.base.json', async () => {
|
it('should update tsconfig.base.json', async () => {
|
||||||
await libraryGenerator(appTree, { ...defaultSchema, directory: 'myDir' });
|
await libraryGenerator(appTree, { ...defaultSchema, directory: 'myDir' });
|
||||||
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
|
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
|
||||||
expect(
|
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
|
||||||
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
|
['libs/my-dir/my-lib/src/index.ts']
|
||||||
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
|
);
|
||||||
expect(
|
expect(
|
||||||
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
|||||||
@ -315,10 +315,8 @@ function updateAppRoutes(host: Tree, options: NormalizedSchema) {
|
|||||||
|
|
||||||
// addInitialAppRoutes
|
// addInitialAppRoutes
|
||||||
{
|
{
|
||||||
const {
|
const { content: componentContent, source: componentSource } =
|
||||||
content: componentContent,
|
readComponent(host, appComponentPath);
|
||||||
source: componentSource,
|
|
||||||
} = readComponent(host, appComponentPath);
|
|
||||||
const isComponentRouterPresent = componentContent.match(/react-router-dom/);
|
const isComponentRouterPresent = componentContent.match(/react-router-dom/);
|
||||||
if (!isComponentRouterPresent) {
|
if (!isComponentRouterPresent) {
|
||||||
const changes = applyChangesToString(
|
const changes = applyChangesToString(
|
||||||
@ -331,10 +329,8 @@ function updateAppRoutes(host: Tree, options: NormalizedSchema) {
|
|||||||
|
|
||||||
// addNewAppRoute
|
// addNewAppRoute
|
||||||
{
|
{
|
||||||
const {
|
const { content: componentContent, source: componentSource } =
|
||||||
content: componentContent,
|
readComponent(host, appComponentPath);
|
||||||
source: componentSource,
|
|
||||||
} = readComponent(host, appComponentPath);
|
|
||||||
const { npmScope } = getWorkspaceLayout(host);
|
const { npmScope } = getWorkspaceLayout(host);
|
||||||
const changes = applyChangesToString(
|
const changes = applyChangesToString(
|
||||||
componentContent,
|
componentContent,
|
||||||
|
|||||||
@ -498,8 +498,9 @@ export function getComponentPropsInterface(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (propsParam && propsParam.type) {
|
if (propsParam && propsParam.type) {
|
||||||
propsTypeName = ((propsParam.type as ts.TypeReferenceNode)
|
propsTypeName = (
|
||||||
.typeName as ts.Identifier).text;
|
(propsParam.type as ts.TypeReferenceNode).typeName as ts.Identifier
|
||||||
|
).text;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
(cmpDeclaration as ts.VariableDeclaration).initializer &&
|
(cmpDeclaration as ts.VariableDeclaration).initializer &&
|
||||||
@ -513,8 +514,9 @@ export function getComponentPropsInterface(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (propsParam && propsParam.type) {
|
if (propsParam && propsParam.type) {
|
||||||
propsTypeName = ((propsParam.type as ts.TypeReferenceNode)
|
propsTypeName = (
|
||||||
.typeName as ts.Identifier).text;
|
(propsParam.type as ts.TypeReferenceNode).typeName as ts.Identifier
|
||||||
|
).text;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
// do we have a class component extending from React.Component
|
// do we have a class component extending from React.Component
|
||||||
@ -533,8 +535,9 @@ export function getComponentPropsInterface(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (propsTypeExpression && propsTypeExpression.typeArguments) {
|
if (propsTypeExpression && propsTypeExpression.typeArguments) {
|
||||||
propsTypeName = (propsTypeExpression
|
propsTypeName = (
|
||||||
.typeArguments[0] as ts.TypeReferenceNode).typeName.getText();
|
propsTypeExpression.typeArguments[0] as ts.TypeReferenceNode
|
||||||
|
).typeName.getText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import * as prettier from 'prettier';
|
import { format } from 'prettier';
|
||||||
import { stripIndents } from '@nrwl/devkit';
|
import { stripIndents } from '@nrwl/devkit';
|
||||||
|
|
||||||
export function formatFile(content, ...values) {
|
export function formatFile(content, ...values) {
|
||||||
return prettier.format(stripIndents(content, values), {
|
return format(stripIndents(content, values), {
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
parser: 'typescript',
|
parser: 'typescript',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -22,8 +22,10 @@ export function getStorybookFrameworkPath(uiFramework) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isStorybookV62onwards(uiFramework) {
|
function isStorybookV62onwards(uiFramework) {
|
||||||
const storybookPackageVersion = require(join(uiFramework, 'package.json'))
|
const storybookPackageVersion = require(join(
|
||||||
.version;
|
uiFramework,
|
||||||
|
'package.json'
|
||||||
|
)).version;
|
||||||
|
|
||||||
return gte(storybookPackageVersion, '6.2.0-rc.4');
|
return gte(storybookPackageVersion, '6.2.0-rc.4');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -258,13 +258,13 @@ function updateLintConfig(tree: Tree, schema: StorybookConfigureSchema) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const overrides = json.overrides || [];
|
const overrides = json.overrides || [];
|
||||||
for (const override of overrides) {
|
for (const o of overrides) {
|
||||||
if (typeof override.parserOptions?.project === 'string') {
|
if (typeof o.parserOptions?.project === 'string') {
|
||||||
override.parserOptions.project = [override.parserOptions.project];
|
o.parserOptions.project = [o.parserOptions.project];
|
||||||
}
|
}
|
||||||
if (Array.isArray(override.parserOptions?.project)) {
|
if (Array.isArray(o.parserOptions?.project)) {
|
||||||
override.parserOptions.project = dedupe([
|
o.parserOptions.project = dedupe([
|
||||||
...override.parserOptions.project,
|
...o.parserOptions.project,
|
||||||
join(root, '.storybook/tsconfig.json'),
|
join(root, '.storybook/tsconfig.json'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,9 +51,7 @@ export async function migrateStoriesTo62Generator(tree: Tree) {
|
|||||||
await formatFiles(tree);
|
await formatFiles(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findAllAngularProjectsWithStorybookConfiguration(
|
export function findAllAngularProjectsWithStorybookConfiguration(tree: Tree): {
|
||||||
tree: Tree
|
|
||||||
): {
|
|
||||||
name: string;
|
name: string;
|
||||||
configFolder: string;
|
configFolder: string;
|
||||||
projectRoot: string;
|
projectRoot: string;
|
||||||
|
|||||||
@ -162,11 +162,8 @@ export async function taoNew(cwd: string, args: string[], isVerbose = false) {
|
|||||||
return handleErrors(isVerbose, async () => {
|
return handleErrors(isVerbose, async () => {
|
||||||
const opts = parseGenerateOpts(args, 'new', null);
|
const opts = parseGenerateOpts(args, 'new', null);
|
||||||
|
|
||||||
const {
|
const { normalizedGeneratorName, schema, implementationFactory } =
|
||||||
normalizedGeneratorName,
|
ws.readGenerator(opts.collectionName, opts.generatorName);
|
||||||
schema,
|
|
||||||
implementationFactory,
|
|
||||||
} = ws.readGenerator(opts.collectionName, opts.generatorName);
|
|
||||||
|
|
||||||
const combinedOpts = await combineOptionsForGenerator(
|
const combinedOpts = await combineOptionsForGenerator(
|
||||||
opts.generatorOptions,
|
opts.generatorOptions,
|
||||||
@ -223,11 +220,8 @@ export async function generate(
|
|||||||
readDefaultCollection(workspaceDefinition)
|
readDefaultCollection(workspaceDefinition)
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const { normalizedGeneratorName, schema, implementationFactory } =
|
||||||
normalizedGeneratorName,
|
ws.readGenerator(opts.collectionName, opts.generatorName);
|
||||||
schema,
|
|
||||||
implementationFactory,
|
|
||||||
} = ws.readGenerator(opts.collectionName, opts.generatorName);
|
|
||||||
|
|
||||||
if (opts.help) {
|
if (opts.help) {
|
||||||
printGenHelp(opts, schema);
|
printGenHelp(opts, schema);
|
||||||
|
|||||||
@ -666,12 +666,9 @@ async function runMigrations(
|
|||||||
if (m.cli === 'nx') {
|
if (m.cli === 'nx') {
|
||||||
await runNxMigration(root, m.package, m.name);
|
await runNxMigration(root, m.package, m.name);
|
||||||
} else {
|
} else {
|
||||||
await (await import('./ngcli-adapter')).runMigration(
|
await (
|
||||||
root,
|
await import('./ngcli-adapter')
|
||||||
m.package,
|
).runMigration(root, m.package, m.name, isVerbose);
|
||||||
m.name,
|
|
||||||
isVerbose
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
logger.info(`Successfully finished ${m.name}`);
|
logger.info(`Successfully finished ${m.name}`);
|
||||||
logger.info(`---------------------------------------------------------`);
|
logger.info(`---------------------------------------------------------`);
|
||||||
|
|||||||
@ -281,9 +281,7 @@ export class NxScopedHost extends virtualFs.ScopedHost<any> {
|
|||||||
.toPromise();
|
.toPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected context(
|
protected context(path: string): Observable<{
|
||||||
path: string
|
|
||||||
): Observable<{
|
|
||||||
isWorkspaceConfig: boolean;
|
isWorkspaceConfig: boolean;
|
||||||
actualConfigFileName: any;
|
actualConfigFileName: any;
|
||||||
isNewFormat: boolean;
|
isNewFormat: boolean;
|
||||||
@ -516,8 +514,8 @@ export async function runMigration(
|
|||||||
schematic: string,
|
schematic: string,
|
||||||
isVerbose: boolean
|
isVerbose: boolean
|
||||||
) {
|
) {
|
||||||
const NodeModulesEngineHost = require('@angular-devkit/schematics/tools')
|
const NodeModulesEngineHost =
|
||||||
.NodeModulesEngineHost;
|
require('@angular-devkit/schematics/tools').NodeModulesEngineHost;
|
||||||
|
|
||||||
class MigrationEngineHost extends NodeModulesEngineHost {
|
class MigrationEngineHost extends NodeModulesEngineHost {
|
||||||
private nodeInstallLogPrinted = false;
|
private nodeInstallLogPrinted = false;
|
||||||
|
|||||||
@ -55,11 +55,8 @@ function parseRunOpts(
|
|||||||
throwInvalidInvocation();
|
throwInvalidInvocation();
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let [project, target, configuration]: [
|
let [project, target, configuration]: [string, string, string] =
|
||||||
string,
|
runOptions._[0].split(':');
|
||||||
string,
|
|
||||||
string
|
|
||||||
] = runOptions._[0].split(':');
|
|
||||||
if (!project && defaultProjectName) {
|
if (!project && defaultProjectName) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`No project name specified. Using default project : ${chalk.bold(
|
`No project name specified. Using default project : ${chalk.bold(
|
||||||
@ -245,7 +242,9 @@ async function runExecutorInternal<T extends { success: boolean }>(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
require('../compat/compat');
|
require('../compat/compat');
|
||||||
const observable = await (await import('./ngcli-adapter')).scheduleTarget(
|
const observable = await (
|
||||||
|
await import('./ngcli-adapter')
|
||||||
|
).scheduleTarget(
|
||||||
root,
|
root,
|
||||||
{
|
{
|
||||||
project,
|
project,
|
||||||
|
|||||||
@ -17,11 +17,13 @@ if (!patched) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
require('@angular-devkit/build-angular/src/utils/version').Version.assertCompatibleAngularVersion = () => {};
|
require('@angular-devkit/build-angular/src/utils/version').Version.assertCompatibleAngularVersion =
|
||||||
|
() => {};
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
require('@angular-devkit/build-angular/src/utils/version').assertCompatibleAngularVersion = () => {};
|
require('@angular-devkit/build-angular/src/utils/version').assertCompatibleAngularVersion =
|
||||||
|
() => {};
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
patched = true;
|
patched = true;
|
||||||
|
|||||||
@ -561,7 +561,9 @@ async function promptForValues(opts: Options, schema: Schema) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return await (await import('enquirer'))
|
return await (
|
||||||
|
await import('enquirer')
|
||||||
|
)
|
||||||
.prompt(prompts)
|
.prompt(prompts)
|
||||||
.then((values) => ({ ...opts, ...values }))
|
.then((values) => ({ ...opts, ...values }))
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|||||||
@ -322,11 +322,8 @@ export class Workspaces {
|
|||||||
|
|
||||||
readGenerator(collectionName: string, generatorName: string) {
|
readGenerator(collectionName: string, generatorName: string) {
|
||||||
try {
|
try {
|
||||||
const {
|
const { generatorsFilePath, generatorsJson, normalizedGeneratorName } =
|
||||||
generatorsFilePath,
|
this.readGeneratorsJson(collectionName, generatorName);
|
||||||
generatorsJson,
|
|
||||||
normalizedGeneratorName,
|
|
||||||
} = this.readGeneratorsJson(collectionName, generatorName);
|
|
||||||
const generatorsDir = path.dirname(generatorsFilePath);
|
const generatorsDir = path.dirname(generatorsFilePath);
|
||||||
const generatorConfig =
|
const generatorConfig =
|
||||||
generatorsJson.generators?.[normalizedGeneratorName] ||
|
generatorsJson.generators?.[normalizedGeneratorName] ||
|
||||||
@ -338,9 +335,8 @@ export class Workspaces {
|
|||||||
}
|
}
|
||||||
generatorConfig.implementation =
|
generatorConfig.implementation =
|
||||||
generatorConfig.implementation || generatorConfig.factory;
|
generatorConfig.implementation || generatorConfig.factory;
|
||||||
const [modulePath, exportName] = generatorConfig.implementation.split(
|
const [modulePath, exportName] =
|
||||||
'#'
|
generatorConfig.implementation.split('#');
|
||||||
);
|
|
||||||
const implementationFactory = () => {
|
const implementationFactory = () => {
|
||||||
const module = require(path.join(generatorsDir, modulePath));
|
const module = require(path.join(generatorsDir, modulePath));
|
||||||
return module[exportName || 'default'] as Generator;
|
return module[exportName || 'default'] as Generator;
|
||||||
|
|||||||
@ -23,9 +23,9 @@ describe('getBaseWebpackPartial', () => {
|
|||||||
sourceRoot: '/root/src',
|
sourceRoot: '/root/src',
|
||||||
statsJson: false,
|
statsJson: false,
|
||||||
};
|
};
|
||||||
(<any>(
|
(<any>TsconfigPathsPlugin).mockImplementation(
|
||||||
TsconfigPathsPlugin
|
function MockPathsPlugin() {}
|
||||||
)).mockImplementation(function MockPathsPlugin() {});
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('unconditional options', () => {
|
describe('unconditional options', () => {
|
||||||
@ -340,7 +340,8 @@ describe('getBaseWebpackPartial', () => {
|
|||||||
showCircularDependencies: true,
|
showCircularDependencies: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const circularDependencyPlugin: CircularDependencyPlugin = result.plugins.find(
|
const circularDependencyPlugin: CircularDependencyPlugin =
|
||||||
|
result.plugins.find(
|
||||||
(plugin) => plugin instanceof CircularDependencyPlugin
|
(plugin) => plugin instanceof CircularDependencyPlugin
|
||||||
);
|
);
|
||||||
expect(circularDependencyPlugin.options.exclude).toEqual(
|
expect(circularDependencyPlugin.options.exclude).toEqual(
|
||||||
|
|||||||
@ -119,13 +119,13 @@ export function getBaseWebpackPartial(
|
|||||||
|
|
||||||
if (options.extractLicenses) {
|
if (options.extractLicenses) {
|
||||||
extraPlugins.push(
|
extraPlugins.push(
|
||||||
(new LicenseWebpackPlugin({
|
new LicenseWebpackPlugin({
|
||||||
stats: {
|
stats: {
|
||||||
errors: false,
|
errors: false,
|
||||||
},
|
},
|
||||||
perChunkOutput: false,
|
perChunkOutput: false,
|
||||||
outputFilename: `3rdpartylicenses.txt`,
|
outputFilename: `3rdpartylicenses.txt`,
|
||||||
}) as unknown) as webpack.Plugin
|
}) as unknown as webpack.Plugin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,9 +61,9 @@ describe('getDevServerConfig', () => {
|
|||||||
allowedHosts: null,
|
allowedHosts: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
(<any>(
|
(<any>TsConfigPathsPlugin).mockImplementation(
|
||||||
TsConfigPathsPlugin
|
function MockPathsPlugin() {}
|
||||||
)).mockImplementation(function MockPathsPlugin() {});
|
);
|
||||||
|
|
||||||
mockCompilerOptions = {
|
mockCompilerOptions = {
|
||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
|
|||||||
@ -46,10 +46,8 @@ function getDevServerPartial(
|
|||||||
): WebpackDevServerConfiguration {
|
): WebpackDevServerConfiguration {
|
||||||
const servePath = buildServePath(buildOptions);
|
const servePath = buildServePath(buildOptions);
|
||||||
|
|
||||||
const {
|
const { scripts: scriptsOptimization, styles: stylesOptimization } =
|
||||||
scripts: scriptsOptimization,
|
buildOptions.optimization as OptimizationOptions;
|
||||||
styles: stylesOptimization,
|
|
||||||
} = buildOptions.optimization as OptimizationOptions;
|
|
||||||
|
|
||||||
const config: WebpackDevServerConfiguration = {
|
const config: WebpackDevServerConfiguration = {
|
||||||
host: options.host,
|
host: options.host,
|
||||||
|
|||||||
@ -23,10 +23,8 @@ export function getBrowserConfig(
|
|||||||
const extraPlugins = [];
|
const extraPlugins = [];
|
||||||
|
|
||||||
let isEval = false;
|
let isEval = false;
|
||||||
const {
|
const { styles: stylesOptimization, scripts: scriptsOptimization } =
|
||||||
styles: stylesOptimization,
|
buildOptions.optimization;
|
||||||
scripts: scriptsOptimization,
|
|
||||||
} = buildOptions.optimization;
|
|
||||||
const {
|
const {
|
||||||
styles: stylesSourceMap,
|
styles: stylesSourceMap,
|
||||||
scripts: scriptsSourceMap,
|
scripts: scriptsSourceMap,
|
||||||
|
|||||||
@ -51,10 +51,8 @@ const g: any = typeof global !== 'undefined' ? global : {};
|
|||||||
// tslint:disable-next-line:no-big-function
|
// tslint:disable-next-line:no-big-function
|
||||||
export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
|
export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
|
||||||
const { root, projectRoot, buildOptions, tsConfig } = wco;
|
const { root, projectRoot, buildOptions, tsConfig } = wco;
|
||||||
const {
|
const { styles: stylesOptimization, scripts: scriptsOptimization } =
|
||||||
styles: stylesOptimization,
|
buildOptions.optimization;
|
||||||
scripts: scriptsOptimization,
|
|
||||||
} = buildOptions.optimization;
|
|
||||||
const {
|
const {
|
||||||
styles: stylesSourceMap,
|
styles: stylesSourceMap,
|
||||||
scripts: scriptsSourceMap,
|
scripts: scriptsSourceMap,
|
||||||
@ -88,7 +86,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
|
|||||||
tsConfig.options.target || ScriptTarget.ES5
|
tsConfig.options.target || ScriptTarget.ES5
|
||||||
);
|
);
|
||||||
|
|
||||||
differentialLoadingNeeded = buildBrowserFeatures.isDifferentialLoadingNeeded();
|
differentialLoadingNeeded =
|
||||||
|
buildBrowserFeatures.isDifferentialLoadingNeeded();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(buildOptions.scriptTargetOverride || tsConfig.options.target) ===
|
(buildOptions.scriptTargetOverride || tsConfig.options.target) ===
|
||||||
|
|||||||
@ -18,7 +18,8 @@ export class RemoveHashPlugin {
|
|||||||
|
|
||||||
apply(compiler: Compiler): void {
|
apply(compiler: Compiler): void {
|
||||||
compiler.hooks.compilation.tap('remove-hash-plugin', (compilation) => {
|
compiler.hooks.compilation.tap('remove-hash-plugin', (compilation) => {
|
||||||
const mainTemplate = compilation.mainTemplate as compilation.MainTemplate & {
|
const mainTemplate =
|
||||||
|
compilation.mainTemplate as compilation.MainTemplate & {
|
||||||
hooks: compilation.CompilationHooks;
|
hooks: compilation.CompilationHooks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -44,9 +44,9 @@ describe('getWebConfig', () => {
|
|||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
paths: { path: ['mapped/path'] },
|
paths: { path: ['mapped/path'] },
|
||||||
};
|
};
|
||||||
(<any>(
|
(<any>TsConfigPathsPlugin).mockImplementation(
|
||||||
TsConfigPathsPlugin
|
function MockPathsPlugin() {}
|
||||||
)).mockImplementation(function MockPathsPlugin() {});
|
);
|
||||||
|
|
||||||
jest.spyOn(ts, 'readConfigFile').mockImplementation(() => ({
|
jest.spyOn(ts, 'readConfigFile').mockImplementation(() => ({
|
||||||
config: {
|
config: {
|
||||||
|
|||||||
@ -879,6 +879,15 @@
|
|||||||
"alwaysAddToPackageJson": false
|
"alwaysAddToPackageJson": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"12.5.0": {
|
||||||
|
"version": "12.5.0",
|
||||||
|
"packages": {
|
||||||
|
"prettier": {
|
||||||
|
"version": "^2.3.1",
|
||||||
|
"alwaysAddToPackageJson": false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,14 +52,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"prettier": "^2.0.4"
|
"prettier": "^2.3.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nrwl/cli": "*",
|
"@nrwl/cli": "*",
|
||||||
"@nrwl/devkit": "*",
|
"@nrwl/devkit": "*",
|
||||||
"@nrwl/jest": "*",
|
"@nrwl/jest": "*",
|
||||||
"@nrwl/linter": "*",
|
"@nrwl/linter": "*",
|
||||||
"cosmiconfig": "^4.0.0",
|
|
||||||
"fs-extra": "^9.1.0",
|
"fs-extra": "^9.1.0",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"glob": "7.1.4",
|
"glob": "7.1.4",
|
||||||
|
|||||||
@ -49,7 +49,9 @@ export async function connectToNxCloudCommand(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function connectToNxCloudPrompt() {
|
async function connectToNxCloudPrompt() {
|
||||||
return await (await import('enquirer'))
|
return await (
|
||||||
|
await import('enquirer')
|
||||||
|
)
|
||||||
.prompt([
|
.prompt([
|
||||||
{
|
{
|
||||||
name: 'NxCloud',
|
name: 'NxCloud',
|
||||||
@ -58,8 +60,7 @@ async function connectToNxCloudPrompt() {
|
|||||||
choices: [
|
choices: [
|
||||||
{
|
{
|
||||||
name: 'Yes',
|
name: 'Yes',
|
||||||
hint:
|
hint: 'Faster builds, run details, GitHub integration. Learn more at https://nx.app',
|
||||||
'Faster builds, run details, GitHub integration. Learn more at https://nx.app',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'No',
|
name: 'No',
|
||||||
|
|||||||
@ -65,8 +65,9 @@ function getProjects(
|
|||||||
|
|
||||||
if (includeDeps) {
|
if (includeDeps) {
|
||||||
const s = require(`../core/project-graph`);
|
const s = require(`../core/project-graph`);
|
||||||
const deps = s.onlyWorkspaceProjects(s.withDeps(projectGraph, projects))
|
const deps = s.onlyWorkspaceProjects(
|
||||||
.nodes;
|
s.withDeps(projectGraph, projects)
|
||||||
|
).nodes;
|
||||||
const projectsWithTarget = Object.values(deps).filter((p: any) =>
|
const projectsWithTarget = Object.values(deps).filter((p: any) =>
|
||||||
projectHasTarget(p, target)
|
projectHasTarget(p, target)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -94,9 +94,10 @@ function gitLsTree(path: string): Map<string, string> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gitStatus(
|
function gitStatus(path: string): {
|
||||||
path: string
|
status: Map<string, string>;
|
||||||
): { status: Map<string, string>; deletedFiles: string[] } {
|
deletedFiles: string[];
|
||||||
|
} {
|
||||||
const deletedFiles: string[] = [];
|
const deletedFiles: string[] = [];
|
||||||
const filesToHash: string[] = [];
|
const filesToHash: string[] = [];
|
||||||
parseGitStatus(path).forEach((changeType: string, filename: string) => {
|
parseGitStatus(path).forEach((changeType: string, filename: string) => {
|
||||||
|
|||||||
@ -178,9 +178,9 @@ function updateAngularCLIJson(host: Tree, options: Schema) {
|
|||||||
if (defaultProject.targets.server) {
|
if (defaultProject.targets.server) {
|
||||||
const serverOptions = defaultProject.targets.server.options;
|
const serverOptions = defaultProject.targets.server.options;
|
||||||
convertServerOptions(serverOptions);
|
convertServerOptions(serverOptions);
|
||||||
Object.values(
|
Object.values(defaultProject.targets.server.configurations).forEach(
|
||||||
defaultProject.targets.server.configurations
|
(config) => convertServerOptions(config)
|
||||||
).forEach((config) => convertServerOptions(config));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultProject.targets.e2e) {
|
if (defaultProject.targets.e2e) {
|
||||||
|
|||||||
@ -239,9 +239,9 @@ describe('lib', () => {
|
|||||||
directory: 'myDir',
|
directory: 'myDir',
|
||||||
});
|
});
|
||||||
const tsconfigJson = readJson(tree, '/tsconfig.base.json');
|
const tsconfigJson = readJson(tree, '/tsconfig.base.json');
|
||||||
expect(
|
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
|
||||||
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
|
['libs/my-dir/my-lib/src/index.ts']
|
||||||
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
|
);
|
||||||
expect(
|
expect(
|
||||||
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
|||||||
@ -43,9 +43,9 @@ export function updateEslintrcJson(
|
|||||||
updateJson<PartialEsLintRcJson>(tree, eslintRcPath, (eslintRcJson) => {
|
updateJson<PartialEsLintRcJson>(tree, eslintRcPath, (eslintRcJson) => {
|
||||||
eslintRcJson.extends = `${offset}.eslintrc.json`;
|
eslintRcJson.extends = `${offset}.eslintrc.json`;
|
||||||
|
|
||||||
eslintRcJson.overrides?.forEach((override) => {
|
eslintRcJson.overrides?.forEach((o) => {
|
||||||
if (override.parserOptions?.project) {
|
if (o.parserOptions?.project) {
|
||||||
override.parserOptions.project = [`${destination}/tsconfig.*?.json`];
|
o.parserOptions.project = [`${destination}/tsconfig.*?.json`];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ Object {
|
|||||||
"@nrwl/workspace": "*",
|
"@nrwl/workspace": "*",
|
||||||
"@types/node": "14.14.33",
|
"@types/node": "14.14.33",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"prettier": "2.2.1",
|
"prettier": "^2.3.1",
|
||||||
"ts-node": "~9.1.1",
|
"ts-node": "~9.1.1",
|
||||||
"typescript": "~4.2.4",
|
"typescript": "~4.2.4",
|
||||||
},
|
},
|
||||||
@ -57,7 +57,7 @@ Object {
|
|||||||
"@nrwl/workspace": "*",
|
"@nrwl/workspace": "*",
|
||||||
"@types/node": "14.14.33",
|
"@types/node": "14.14.33",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"prettier": "2.2.1",
|
"prettier": "^2.3.1",
|
||||||
"ts-node": "~9.1.1",
|
"ts-node": "~9.1.1",
|
||||||
"typescript": "~4.2.4",
|
"typescript": "~4.2.4",
|
||||||
},
|
},
|
||||||
@ -103,7 +103,7 @@ Object {
|
|||||||
"@nrwl/workspace": "*",
|
"@nrwl/workspace": "*",
|
||||||
"@types/node": "14.14.33",
|
"@types/node": "14.14.33",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"prettier": "2.2.1",
|
"prettier": "^2.3.1",
|
||||||
"ts-node": "~9.1.1",
|
"ts-node": "~9.1.1",
|
||||||
"typescript": "~4.2.4",
|
"typescript": "~4.2.4",
|
||||||
},
|
},
|
||||||
|
|||||||
@ -57,7 +57,8 @@ export function updateJestConfig(
|
|||||||
`Could not remove ${projectToRemove} from projects in /jest.config.js. Please remove ${projectToRemove} from your projects.`
|
`Could not remove ${projectToRemove} from projects in /jest.config.js. Please remove ${projectToRemove} from your projects.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const projectsArray = projectsAssignment.initializer as ArrayLiteralExpression;
|
const projectsArray =
|
||||||
|
projectsAssignment.initializer as ArrayLiteralExpression;
|
||||||
|
|
||||||
const project = projectsArray.elements.find(
|
const project = projectsArray.elements.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
|
|||||||
@ -103,9 +103,8 @@ export default function (schema: any): Rule {
|
|||||||
if (extendedTsconfigPath === normalize('tsconfig.json')) {
|
if (extendedTsconfigPath === normalize('tsconfig.json')) {
|
||||||
return updateExtend(file);
|
return updateExtend(file);
|
||||||
} else if (basename(json.extends) === 'tsconfig.json') {
|
} else if (basename(json.extends) === 'tsconfig.json') {
|
||||||
let extendedTsconfig = originalExtendedTsconfigMap.get(
|
let extendedTsconfig =
|
||||||
extendedTsconfigPath
|
originalExtendedTsconfigMap.get(extendedTsconfigPath);
|
||||||
);
|
|
||||||
|
|
||||||
if (!extendedTsconfig) {
|
if (!extendedTsconfig) {
|
||||||
extendedTsconfig = readJsonInTree(host, extendedTsconfigPath);
|
extendedTsconfig = readJsonInTree(host, extendedTsconfigPath);
|
||||||
|
|||||||
@ -13,9 +13,8 @@ export default function (): Rule {
|
|||||||
let needsAngularExtension = false;
|
let needsAngularExtension = false;
|
||||||
|
|
||||||
for (let [, project] of workspace.projects) {
|
for (let [, project] of workspace.projects) {
|
||||||
needsAngularExtension = Array.from(
|
needsAngularExtension = Array.from(project.targets).some(
|
||||||
project.targets
|
([, targetDefinition]) =>
|
||||||
).some(([, targetDefinition]) =>
|
|
||||||
targetDefinition.builder.startsWith('@angular-devkit')
|
targetDefinition.builder.startsWith('@angular-devkit')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -46,9 +46,8 @@ const addCacheableOperations = updateJsonInTree('nx.json', (nxJson) => {
|
|||||||
cacheableOperations.add('test');
|
cacheableOperations.add('test');
|
||||||
cacheableOperations.add('e2e');
|
cacheableOperations.add('e2e');
|
||||||
|
|
||||||
nxJson.tasksRunnerOptions.default.options.cacheableOperations = Array.from(
|
nxJson.tasksRunnerOptions.default.options.cacheableOperations =
|
||||||
cacheableOperations
|
Array.from(cacheableOperations);
|
||||||
);
|
|
||||||
|
|
||||||
return nxJson;
|
return nxJson;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,8 @@ describe('createTasksForProjectToRun', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should create the tasks for multiple projects passed with configuration', () => {
|
it('should create the tasks for multiple projects passed with configuration', () => {
|
||||||
projectGraph.nodes.app1.data.targets.build.configurations = projectGraph.nodes.lib1.data.targets.build.configurations = {
|
projectGraph.nodes.app1.data.targets.build.configurations =
|
||||||
|
projectGraph.nodes.lib1.data.targets.build.configurations = {
|
||||||
production: {},
|
production: {},
|
||||||
};
|
};
|
||||||
const tasks = createTasksForProjectToRun(
|
const tasks = createTasksForProjectToRun(
|
||||||
|
|||||||
@ -365,7 +365,8 @@ describe('TaskGraphCreator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should create task graph (builds depend on build of dependencies, builds depend on prebuilds)', () => {
|
it('should create task graph (builds depend on build of dependencies, builds depend on prebuilds)', () => {
|
||||||
projectGraph.nodes.common1.data.targets = projectGraph.nodes.common2.data.targets = {
|
projectGraph.nodes.common1.data.targets =
|
||||||
|
projectGraph.nodes.common2.data.targets = {
|
||||||
prebuild: {},
|
prebuild: {},
|
||||||
build: {
|
build: {
|
||||||
dependsOn: [
|
dependsOn: [
|
||||||
@ -380,7 +381,8 @@ describe('TaskGraphCreator', () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
projectGraph.nodes.app1.data.targets = projectGraph.nodes.app2.data.targets = {
|
projectGraph.nodes.app1.data.targets =
|
||||||
|
projectGraph.nodes.app2.data.targets = {
|
||||||
build: {
|
build: {
|
||||||
dependsOn: [
|
dependsOn: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -263,9 +263,8 @@ export class TaskOrchestrator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private storeEndTime(t: Task) {
|
private storeEndTime(t: Task) {
|
||||||
this.timings[
|
this.timings[`${t.target.project}:${t.target.target}`].end =
|
||||||
`${t.target.project}:${t.target.target}`
|
new Date().getTime();
|
||||||
].end = new Date().getTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private pipeOutputCapture(task: Task) {
|
private pipeOutputCapture(task: Task) {
|
||||||
|
|||||||
@ -325,9 +325,8 @@ export function updateBuildableProjectPackageJsonDependencies(
|
|||||||
|
|
||||||
depVersion = entry.node.data.version;
|
depVersion = entry.node.data.version;
|
||||||
|
|
||||||
packageJson[typeOfDependency][
|
packageJson[typeOfDependency][entry.node.data.packageName] =
|
||||||
entry.node.data.packageName
|
depVersion;
|
||||||
] = depVersion;
|
|
||||||
}
|
}
|
||||||
updatePackageJson = true;
|
updatePackageJson = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -1,31 +1,32 @@
|
|||||||
|
import { resolveConfig, resolveConfigFile } from 'prettier';
|
||||||
import type { Options } from 'prettier';
|
import type { Options } from 'prettier';
|
||||||
import * as cosmiconfig from 'cosmiconfig';
|
import { NormalModuleReplacementPlugin } from 'webpack';
|
||||||
|
|
||||||
export interface ExistingPrettierConfig {
|
export interface ExistingPrettierConfig {
|
||||||
sourceFilepath: string;
|
sourceFilepath: string;
|
||||||
config: Options;
|
config: Options;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveUserExistingPrettierConfig(): Promise<ExistingPrettierConfig | null> {
|
export async function resolveUserExistingPrettierConfig(): Promise<ExistingPrettierConfig | null> {
|
||||||
const explorer = cosmiconfig('prettier', {
|
try {
|
||||||
sync: true,
|
const filepath = await resolveConfigFile();
|
||||||
cache: false,
|
if (!filepath) {
|
||||||
rcExtensions: true,
|
|
||||||
stopDir: process.cwd(),
|
|
||||||
transform: (result) => {
|
|
||||||
if (result && result.config) {
|
|
||||||
delete result.config.$schema;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return Promise.resolve(explorer.load(process.cwd())).then((result) => {
|
|
||||||
if (!result) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
sourceFilepath: result.filepath,
|
const config = await resolveConfig(process.cwd(), {
|
||||||
config: result.config,
|
useCache: false,
|
||||||
};
|
config: filepath,
|
||||||
});
|
});
|
||||||
|
if (!config) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
sourceFilepath: filepath,
|
||||||
|
config: config,
|
||||||
|
};
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -290,9 +290,8 @@ export function updateBuildableProjectPackageJsonDependencies(
|
|||||||
|
|
||||||
depVersion = entry.node.data.version;
|
depVersion = entry.node.data.version;
|
||||||
|
|
||||||
packageJson[typeOfDependency][
|
packageJson[typeOfDependency][entry.node.data.packageName] =
|
||||||
entry.node.data.packageName
|
depVersion;
|
||||||
] = depVersion;
|
|
||||||
}
|
}
|
||||||
updatePackageJson = true;
|
updatePackageJson = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -141,10 +141,8 @@ export function addLintFiles(
|
|||||||
* so as well as applying the extension from the root lint config, we also
|
* so as well as applying the extension from the root lint config, we also
|
||||||
* adjust the config to make extends come first.
|
* adjust the config to make extends come first.
|
||||||
*/
|
*/
|
||||||
const {
|
const { extends: extendsVal, ...localConfigExceptExtends } =
|
||||||
extends: extendsVal,
|
options.localConfig;
|
||||||
...localConfigExceptExtends
|
|
||||||
} = options.localConfig;
|
|
||||||
|
|
||||||
const extendsOption = extendsVal
|
const extendsOption = extendsVal
|
||||||
? Array.isArray(extendsVal)
|
? Array.isArray(extendsVal)
|
||||||
|
|||||||
@ -28,12 +28,12 @@ interface NormalizedRenameDescriptors {
|
|||||||
inPackageJson: boolean;
|
inPackageJson: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizeToDescriptors = (packageJson: any) => ([
|
const normalizeToDescriptors =
|
||||||
packageName,
|
(packageJson: any) =>
|
||||||
newPackageNameConfig,
|
([packageName, newPackageNameConfig]): NormalizedRenameDescriptors => {
|
||||||
]): NormalizedRenameDescriptors => {
|
|
||||||
const isDevDep =
|
const isDevDep =
|
||||||
!!packageJson.devDependencies && packageName in packageJson.devDependencies;
|
!!packageJson.devDependencies &&
|
||||||
|
packageName in packageJson.devDependencies;
|
||||||
const inPackageJson =
|
const inPackageJson =
|
||||||
(packageJson.dependencies && packageName in packageJson.dependencies) ||
|
(packageJson.dependencies && packageName in packageJson.dependencies) ||
|
||||||
isDevDep;
|
isDevDep;
|
||||||
@ -53,7 +53,7 @@ const normalizeToDescriptors = (packageJson: any) => ([
|
|||||||
isDevDep,
|
isDevDep,
|
||||||
inPackageJson,
|
inPackageJson,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates all the imports in the workspace, and adjust the package.json appropriately.
|
* Updates all the imports in the workspace, and adjust the package.json appropriately.
|
||||||
|
|||||||
@ -16,8 +16,8 @@ export function setDefaultCollection(collectionName: string): Rule {
|
|||||||
((workspace.extensions.cli as JsonObject).defaultCollection as string);
|
((workspace.extensions.cli as JsonObject).defaultCollection as string);
|
||||||
|
|
||||||
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
|
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
|
||||||
(workspace.extensions
|
(workspace.extensions.cli as JsonObject).defaultCollection =
|
||||||
.cli as JsonObject).defaultCollection = collectionName;
|
collectionName;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user