|
1 | 1 | const patterns = require('@freesewing/pattern-info').list |
2 | | -const options = require('@freesewing/pattern-info').options |
3 | | - |
4 | | -const addDupe = (option, from, to) => { |
5 | | - let slug = `/docs/patterns/${from}/options/${option.toLowerCase()}/` |
6 | | - if (!patternOptions[slug]) patternOptions[slug] = { find: from, replace: [to] } |
7 | | - else patternOptions[slug].replace.push(to) |
8 | | -} |
9 | | - |
10 | | -// this will be populated by addDupe() |
11 | | -const patternOptions = {} |
12 | | - |
13 | | -const dupes = { |
14 | | - brian: [ |
15 | | - { |
16 | | - options: [ |
17 | | - 'sleevecapbackfactorx', |
18 | | - 'sleevecapbackfactory', |
19 | | - 'sleevecapease', |
20 | | - 'sleevecapfrontfactorx', |
21 | | - 'sleevecapfrontfactory', |
22 | | - 'sleevecapq1offset', |
23 | | - 'sleevecapq1spread1', |
24 | | - 'sleevecapq1spread2', |
25 | | - 'sleevecapq2offset', |
26 | | - 'sleevecapq2spread1', |
27 | | - 'sleevecapq2spread2', |
28 | | - 'sleevecapq3offset', |
29 | | - 'sleevecapq3spread1', |
30 | | - 'sleevecapq3spread2', |
31 | | - 'sleevecapq4offset', |
32 | | - 'sleevecapq4spread1', |
33 | | - 'sleevecapq4spread2', |
34 | | - 'sleevecaptopfactorx', |
35 | | - 'sleevecaptopfactory', |
36 | | - 'sleevewidthguarantee', |
37 | | - ], |
38 | | - to: ['huey', 'simon', 'simone', 'sven', 'diana', 'teagan'], |
39 | | - }, |
40 | | - { |
41 | | - options: ['backneckcutout', 'frontarmholedeeper', 'shoulderslopereduction'], |
42 | | - to: ['bent', 'carlita', 'carlton', 'huey', 'hugo', 'jaeger', 'simon', 'sven'], |
43 | | - }, |
44 | | - { |
45 | | - options: ['sleevelengthbonus'], |
46 | | - to: ['huey', 'hugo'], |
47 | | - }, |
48 | | - { |
49 | | - options: ['sleevecapheight'], |
50 | | - to: ['carlita', 'carlton', 'jaeger'], |
51 | | - }, |
52 | | - { |
53 | | - options: ['acrossbackfactor'], |
54 | | - to: ['bent', 'diana', 'huey', 'hugo', 'teagan'], |
55 | | - }, |
56 | | - { |
57 | | - options: ['armholedepthfactor'], |
58 | | - to: ['bent', 'huey', 'sven', 'wahid', 'teagan'], |
59 | | - }, |
60 | | - { |
61 | | - options: ['acrossbackfactor'], |
62 | | - to: ['bent', 'diana', 'huey', 'hugo', 'teagan'], |
63 | | - }, |
64 | | - { |
65 | | - options: ['bicepsease'], |
66 | | - to: ['bent', 'huey', 'hugo', 'jaeger'], |
67 | | - }, |
68 | | - { |
69 | | - options: ['chestease', 'cuffease', 'lengthbonus'], |
70 | | - to: ['bent', 'huey', 'hugo'], |
71 | | - }, |
72 | | - { |
73 | | - options: ['collarease'], |
74 | | - to: ['bent', 'huey', 'jaeger', 'sven'], |
75 | | - }, |
76 | | - { |
77 | | - options: ['shoulderease'], |
78 | | - to: ['bent', 'huey', 'jaeger', 'simon'], |
79 | | - }, |
80 | | - ], |
81 | | - huey: [ |
82 | | - { |
83 | | - options: ['ribbingheight'], |
84 | | - to: ['hugo'], |
85 | | - }, |
86 | | - ], |
87 | | - carlita: [ |
88 | | - { |
89 | | - options: [ |
90 | | - 'frontoverlap', |
91 | | - 'pocketradius', |
92 | | - 'innerpocketdepth', |
93 | | - 'innerpocketplacement', |
94 | | - 'innerpocketweltheight', |
95 | | - 'innerpocketwidth', |
96 | | - 'lapelreduction', |
97 | | - ], |
98 | | - to: ['carlton', 'jaeger'], |
99 | | - }, |
100 | | - ], |
101 | | - titan: [ |
102 | | - { |
103 | | - options: [ |
104 | | - 'waistease', |
105 | | - 'seatease', |
106 | | - 'kneeease', |
107 | | - 'waistheight', |
108 | | - 'lengthbonus', |
109 | | - 'crotchdrop', |
110 | | - 'crossseamcurvestart', |
111 | | - 'crossseamcurvebend', |
112 | | - 'crossseamcurveangle', |
113 | | - 'crotchseamcurvestart', |
114 | | - 'crotchseamcurvebend', |
115 | | - 'crotchseamcurveangle', |
116 | | - 'grainlineposition', |
117 | | - 'legbalance', |
118 | | - 'waistbalance', |
119 | | - 'waistbandwidth', |
120 | | - ], |
121 | | - to: ['paco', 'charlie'], |
122 | | - }, |
123 | | - ], |
124 | | -} |
125 | | - |
126 | | -for (let from in dupes) { |
127 | | - for (let set of dupes[from]) { |
128 | | - for (let to of set.to) { |
129 | | - for (let option of set.options) addDupe(option, from, to) |
130 | | - } |
131 | | - } |
132 | | -} |
133 | | - |
134 | | -// Breanna inherits almost all options from Brian |
135 | | -for (let option of options.brian) { |
136 | | - if (['lengthBonus', 'sleeveWidthGuarantee'].indexOf(option) === -1) |
137 | | - addDupe(option, 'brian', 'breanna') |
138 | | -} |
139 | | - |
140 | | -// Carton inherits almost all options from Carlita |
141 | | -for (let option of options.carlita) { |
142 | | - if (option !== 'contour') addDupe(option, 'carlita', 'carlton') |
143 | | -} |
144 | | - |
145 | | -// Simone inherits all options from Simon |
146 | | -for (let option of options.simon) addDupe(option, 'simon', 'simone') |
147 | | - |
148 | | -const getDuplicates = () => { |
149 | | - let dupes = {} |
150 | | - for (let slug in patternOptions) { |
151 | | - dupes[slug] = [] |
152 | | - for (let insert of patternOptions[slug].replace) { |
153 | | - dupes[slug].push(slug.replace(patternOptions[slug].find, insert)) |
154 | | - } |
155 | | - } |
156 | | - |
157 | | - return dupes |
158 | | -} |
159 | 2 |
|
160 | 3 | /* This matches a route pattern with the page component */ |
161 | 4 | const routes = { |
@@ -211,7 +54,6 @@ const routes = { |
211 | 54 | '/patterns/:pattern/save-as': 'patterns/_pattern/save-as.js', |
212 | 55 | '/recreate/gist/:gist': 'recreate/gist/_gist.js', |
213 | 56 | }, |
214 | | - duplicates: getDuplicates(), |
215 | 57 | redirects: { |
216 | 58 | '/recreate/': '/create/', |
217 | 59 | '/contact/': '/docs/about/contact/', |
|
0 commit comments