Skip to content

Commit b61aea4

Browse files
authored
Merge pull request #14926 from ethereum/deprecate-allow-list
Deprecate allow list
2 parents e170a44 + cd4f96c commit b61aea4

File tree

2 files changed

+26
-290
lines changed

2 files changed

+26
-290
lines changed

src/lib/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import i18nConfig from "../../i18n.config.json"
66

77
import type { CommunityBlog } from "./types"
88

9-
export const OLD_CONTENT_DIR = "src/content"
9+
export const OLD_CONTENT_DIR = "src/content" // For old git commit history -- do not remove
1010
export const CONTENT_DIR = "public/content"
1111
export const TRANSLATIONS_DIR = "public/content/translations"
1212
export const TRANSLATED_IMAGES_DIR = "/content/translations"

src/lib/utils/md.ts

Lines changed: 25 additions & 289 deletions
Original file line numberDiff line numberDiff line change
@@ -18,306 +18,42 @@ import { toPosixPath } from "./relativePath"
1818

1919
import { ITutorial } from "@/pages/developers/tutorials"
2020

21-
function getCurrentDir() {
21+
function getContentRoot() {
2222
return join(process.cwd(), CONTENT_DIR)
2323
}
2424

2525
const getPostSlugs = (dir: string, files: string[] = []) => {
26-
const currentDir = getCurrentDir()
27-
const contentDir = join(currentDir, dir)
28-
// Temporal list of content pages allowed to be compiled
29-
// When a content page is migrated (and he components being used), should be added to this list
30-
const temporalAllowedPages = [
31-
// Use cases (8/8) ✅
32-
"/dao",
33-
"/decentralized-identity",
34-
"/defi",
35-
"/desci",
36-
"/nft",
37-
"/payments",
38-
"/refi",
39-
"/social-networks",
40-
// Staking (4/4) ✅
41-
"/staking/pools",
42-
"/staking/saas",
43-
"/staking/solo",
44-
"/staking/withdrawals",
45-
// Roadmap (5/5) ✅
46-
"/roadmap",
47-
"/roadmap/future-proofing",
48-
"/roadmap/scaling",
49-
"/roadmap/security",
50-
"/roadmap/user-experience",
51-
// Upgrade (2/2) ✅
52-
"/roadmap/beacon-chain",
53-
"/roadmap/merge",
54-
// Developer docs (0/95)
55-
"/developers/docs/",
56-
"/developers/docs/accounts",
57-
"/developers/docs/apis/backend",
58-
"/developers/docs/apis/javascript",
59-
"/developers/docs/apis/json-rpc",
60-
"/developers/docs/blocks",
61-
"/developers/docs/bridges",
62-
"/developers/docs/consensus-mechanisms",
63-
"/developers/docs/consensus-mechanisms/poa",
64-
"/developers/docs/consensus-mechanisms/pos",
65-
"/developers/docs/consensus-mechanisms/pos/attack-and-defense",
66-
"/developers/docs/consensus-mechanisms/pos/attestations",
67-
"/developers/docs/consensus-mechanisms/pos/block-proposal",
68-
"/developers/docs/consensus-mechanisms/pos/faqs",
69-
"/developers/docs/consensus-mechanisms/pos/gasper",
70-
"/developers/docs/consensus-mechanisms/pos/keys",
71-
"/developers/docs/consensus-mechanisms/pos/pos-vs-pow",
72-
"/developers/docs/consensus-mechanisms/pos/rewards-and-penalties",
73-
"/developers/docs/consensus-mechanisms/pos/weak-subjectivity",
74-
"/developers/docs/consensus-mechanisms/pow/",
75-
"/developers/docs/consensus-mechanisms/pow/mining",
76-
"/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms",
77-
"/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto",
78-
"/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/ethash",
79-
"/developers/docs/dapps",
80-
"/developers/docs/data-and-analytics",
81-
"/developers/docs/data-and-analytics/block-explorers",
82-
"/developers/docs/data-availability",
83-
"/developers/docs/data-availability/blockchain-data-storage-strategies",
84-
"/developers/docs/data-structures-and-encoding",
85-
"/developers/docs/data-structures-and-encoding/patricia-merkle-trie",
86-
"/developers/docs/data-structures-and-encoding/rlp",
87-
"/developers/docs/data-structures-and-encoding/ssz",
88-
"/developers/docs/data-structures-and-encoding/web3-secret-storage",
89-
"/developers/docs/design-and-ux",
90-
"/developers/docs/design-and-ux/heuristics-for-web3",
91-
"/developers/docs/design-and-ux/dex-design-best-practice",
92-
"/developers/docs/development-networks",
93-
"/developers/docs/ethereum-stack",
94-
"/developers/docs/evm",
95-
"/developers/docs/evm/opcodes",
96-
"/developers/docs/frameworks",
97-
"/developers/docs/gas",
98-
"/developers/docs/ides",
99-
"/developers/docs/intro-to-ether",
100-
"/developers/docs/intro-to-ethereum",
101-
"/developers/docs/mev",
102-
"/developers/docs/networking-layer",
103-
"/developers/docs/networking-layer/network-addresses",
104-
"/developers/docs/networking-layer/portal-network",
105-
"/developers/docs/networks",
106-
"/developers/docs/nodes-and-clients",
107-
"/developers/docs/nodes-and-clients/archive-nodes",
108-
"/developers/docs/nodes-and-clients/bootnodes",
109-
"/developers/docs/nodes-and-clients/client-diversity",
110-
"/developers/docs/nodes-and-clients/light-clients",
111-
"/developers/docs/nodes-and-clients/node-architecture",
112-
"/developers/docs/nodes-and-clients/nodes-as-a-service",
113-
"/developers/docs/nodes-and-clients/run-a-node",
114-
"/developers/docs/oracles",
115-
"/developers/docs/programming-languages",
116-
"/developers/docs/programming-languages/dart",
117-
"/developers/docs/programming-languages/delphi",
118-
"/developers/docs/programming-languages/dot-net",
119-
"/developers/docs/programming-languages/elixir",
120-
"/developers/docs/programming-languages/golang",
121-
"/developers/docs/programming-languages/java",
122-
"/developers/docs/programming-languages/javascript",
123-
"/developers/docs/programming-languages/python",
124-
"/developers/docs/programming-languages/ruby",
125-
"/developers/docs/programming-languages/rust",
126-
"/developers/docs/scaling",
127-
"/developers/docs/scaling/optimistic-rollups",
128-
"/developers/docs/scaling/plasma",
129-
"/developers/docs/scaling/sidechains",
130-
"/developers/docs/scaling/state-channels",
131-
"/developers/docs/scaling/validium",
132-
"/developers/docs/scaling/zk-rollups",
133-
"/developers/docs/smart-contracts",
134-
"/developers/docs/smart-contracts/anatomy",
135-
"/developers/docs/smart-contracts/compiling",
136-
"/developers/docs/smart-contracts/composability",
137-
"/developers/docs/smart-contracts/deploying",
138-
"/developers/docs/smart-contracts/formal-verification",
139-
"/developers/docs/smart-contracts/languages",
140-
"/developers/docs/smart-contracts/libraries",
141-
"/developers/docs/smart-contracts/security",
142-
"/developers/docs/smart-contracts/testing",
143-
"/developers/docs/smart-contracts/upgrading",
144-
"/developers/docs/smart-contracts/verifying",
145-
"/developers/docs/standards",
146-
"/developers/docs/standards/tokens",
147-
"/developers/docs/standards/tokens/erc-20",
148-
"/developers/docs/standards/tokens/erc-223",
149-
"/developers/docs/standards/tokens/erc-721",
150-
"/developers/docs/standards/tokens/erc-777",
151-
"/developers/docs/standards/tokens/erc-1155",
152-
"/developers/docs/standards/tokens/erc-4626",
153-
"/developers/docs/storage",
154-
"/developers/docs/transactions",
155-
"/developers/docs/web2-vs-web3",
156-
// Developer tutorials (53/53) ✅
157-
"/developers/tutorials/a-developers-guide-to-ethereum-part-one",
158-
"/developers/tutorials/all-you-can-cache",
159-
"/developers/tutorials/calling-a-smart-contract-from-javascript",
160-
"/developers/tutorials/create-and-deploy-a-defi-app",
161-
"/developers/tutorials/deploying-your-first-smart-contract",
162-
"/developers/tutorials/develop-and-test-dapps-with-a-multi-client-local-eth-testnet",
163-
"/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit",
164-
"/developers/tutorials/eip-1271-smart-contract-signatures",
165-
"/developers/tutorials/erc-721-vyper-annotated-code",
166-
"/developers/tutorials/erc20-annotated-code",
167-
"/developers/tutorials/erc20-with-safety-rails",
168-
"/developers/tutorials/getting-started-with-ethereum-development-using-alchemy",
169-
"/developers/tutorials/guide-to-smart-contract-security-tools",
170-
"/developers/tutorials/hello-world-smart-contract",
171-
"/developers/tutorials/hello-world-smart-contract-fullstack",
172-
"/developers/tutorials/how-to-implement-an-erc721-market",
173-
"/developers/tutorials/how-to-mint-an-nft",
174-
"/developers/tutorials/how-to-mock-solidity-contracts-for-testing",
175-
"/developers/tutorials/how-to-use-echidna-to-test-smart-contracts",
176-
"/developers/tutorials/how-to-use-manticore-to-find-smart-contract-bugs",
177-
"/developers/tutorials/how-to-use-slither-to-find-smart-contract-bugs",
178-
"/developers/tutorials/how-to-use-tellor-as-your-oracle",
179-
"/developers/tutorials/how-to-view-nft-in-metamask",
180-
"/developers/tutorials/how-to-write-and-deploy-an-nft",
181-
"/developers/tutorials/interact-with-other-contracts-from-solidity",
182-
"/developers/tutorials/ipfs-decentralized-ui",
183-
"/developers/tutorials/kickstart-your-dapp-frontend-development-with-create-eth-app",
184-
"/developers/tutorials/learn-foundational-ethereum-topics-with-sql",
185-
"/developers/tutorials/logging-events-smart-contracts",
186-
"/developers/tutorials/merkle-proofs-for-offline-data-integrity",
187-
"/developers/tutorials/monitoring-geth-with-influxdb-and-grafana",
188-
"/developers/tutorials/nft-minter",
189-
"/developers/tutorials/optimism-std-bridge-annotated-code",
190-
"/developers/tutorials/reverse-engineering-a-contract",
191-
"/developers/tutorials/run-node-raspberry-pi",
192-
"/developers/tutorials/scam-token-tricks",
193-
"/developers/tutorials/secure-development-workflow",
194-
"/developers/tutorials/send-token-ethersjs",
195-
"/developers/tutorials/sending-transactions-using-web3-and-alchemy",
196-
"/developers/tutorials/server-components",
197-
"/developers/tutorials/set-up-web3js-to-use-ethereum-in-javascript",
198-
"/developers/tutorials/short-abi",
199-
"/developers/tutorials/smart-contract-security-guidelines",
200-
"/developers/tutorials/testing-erc-20-tokens-with-waffle",
201-
"/developers/tutorials/the-graph-fixing-web3-data-querying",
202-
"/developers/tutorials/token-integration-checklist",
203-
"/developers/tutorials/transfers-and-approval-of-erc-20-tokens-from-a-solidity-smart-contract",
204-
"/developers/tutorials/understand-the-erc-20-token-smart-contract",
205-
"/developers/tutorials/uniswap-v2-annotated-code",
206-
"/developers/tutorials/using-websockets",
207-
"/developers/tutorials/waffle-dynamic-mocking-and-testing-calls",
208-
"/developers/tutorials/waffle-say-hello-world-with-hardhat-and-ethers",
209-
"/developers/tutorials/waffle-test-simple-smart-contract",
210-
"/developers/tutorials/yellow-paper-evm",
211-
"/developers/tutorials/creating-a-wagmi-ui-for-your-contract",
212-
// Static (68/68) ✅
213-
"/about",
214-
"/bridges",
215-
"/community/code-of-conduct",
216-
"/community/events",
217-
"/community/get-involved",
218-
"/community/grants",
219-
"/community/language-resources",
220-
"/community/online",
221-
"/community/research",
222-
"/community/support",
223-
"/contributing",
224-
"/contributing/adding-desci-projects",
225-
"/contributing/adding-developer-tools",
226-
"/contributing/adding-exchanges",
227-
"/contributing/adding-glossary-terms",
228-
"/contributing/adding-layer-2s",
229-
"/contributing/adding-products",
230-
"/contributing/adding-staking-products",
231-
"/contributing/adding-wallets",
232-
"/contributing/content-resources",
233-
"/contributing/design",
234-
"/contributing/design/adding-design-resources",
235-
"/contributing/design-principles",
236-
"/contributing/quizzes",
237-
"/contributing/style-guide",
238-
"/contributing/style-guide/content-standardization",
239-
"/contributing/translation-program",
240-
"/contributing/translation-program/content-buckets",
241-
"/contributing/translation-program/faq",
242-
"/contributing/translation-program/how-to-translate",
243-
"/contributing/translation-program/mission-and-vision",
244-
"/contributing/translation-program/playbook",
245-
"/contributing/translation-program/resources",
246-
"/contributing/translation-program/translatathon",
247-
"/contributing/translation-program/translatathon/details",
248-
"/contributing/translation-program/translatathon/translatathon-hubs",
249-
"/contributing/translation-program/translatathon/terms-and-conditions",
250-
"/contributing/translation-program/translators-guide",
251-
"/cookie-policy",
252-
"/eips",
253-
"/energy-consumption",
254-
"/enterprise",
255-
"/enterprise/private-ethereum",
256-
"/foundation",
257-
"/glossary",
258-
"/governance",
259-
"/guides",
260-
"/guides/how-to-create-an-ethereum-account",
261-
"/guides/how-to-id-scam-tokens",
262-
"/guides/how-to-revoke-token-access",
263-
"/guides/how-to-swap-tokens",
264-
"/guides/how-to-use-a-bridge",
265-
"/guides/how-to-use-a-wallet",
266-
"/history/",
267-
"/privacy-policy",
268-
"/roadmap/account-abstraction",
269-
"/roadmap/danksharding",
270-
"/roadmap/dencun",
271-
"/roadmap/pectra",
272-
"/roadmap/merge/issuance",
273-
"/roadmap/pbs",
274-
"/roadmap/secret-leader-election",
275-
"/roadmap/single-slot-finality",
276-
"/roadmap/statelessness",
277-
"/roadmap/verkle-trees",
278-
"/security",
279-
"/smart-contracts",
280-
"/staking/dvt",
281-
282-
"/terms-of-use",
283-
"/web3",
284-
"/whitepaper",
285-
"/wrapped-eth",
286-
"/zero-knowledge-proofs",
287-
]
26+
const contentRoot = getContentRoot()
27+
const _dir = join(contentRoot, dir)
28828

28929
// Get an array of all files and directories in the passed directory using `fs.readdirSync`
290-
const fileList = fs.readdirSync(contentDir)
30+
const dirContents = fs.readdirSync(_dir)
29131

29232
// Create the full path of the file/directory by concatenating the passed directory and file/directory name
293-
for (const file of fileList) {
294-
const name = join(contentDir, file)
33+
for (const fileOrDir of dirContents) {
34+
// file = "about", "bridges".... "translations" (<-- skip that one)...
35+
const path = join(_dir, fileOrDir)
29536

29637
// Check if the current file/directory is a directory using fs.statSync
297-
if (fs.statSync(name).isDirectory()) {
38+
if (fs.statSync(path).isDirectory()) {
39+
// Skip nested translations directory
40+
if (fileOrDir === "translations") continue
29841
// If it is a directory, recursively call the `getPostSlugs` function with the
29942
// directory path and the files array
300-
const nestedDir = join(dir, file)
43+
const nestedDir = join(dir, fileOrDir)
30144

30245
getPostSlugs(nestedDir, files)
303-
} else {
304-
const fileExtension = extname(name)
46+
continue
47+
}
30548

306-
if (fileExtension === ".md") {
307-
// If it is a .md file (allowed content page), push the path to the files array
308-
for (const page of temporalAllowedPages) {
309-
const fullPagePath = join(currentDir, page)
49+
// If the current file is not a markdown file, skip it
50+
if (extname(path) !== ".md") continue
31051

311-
if (name.includes(fullPagePath)) {
312-
files.push(
313-
toPosixPath(
314-
fullPagePath.replace(currentDir, "").replace("/index.md", "")
315-
)
316-
)
317-
}
318-
}
319-
}
320-
}
52+
const sanitizedPath = toPosixPath(
53+
path.replace(contentRoot, "").replace("/index.md", "")
54+
)
55+
56+
files.push(sanitizedPath)
32157
}
32258

32359
return files
@@ -334,8 +70,8 @@ export const getContentBySlug = (slug: string) => {
33470
}
33571
}
33672

337-
const currentDir = getCurrentDir()
338-
let fullPath = toPosixPath(join(currentDir, realSlug))
73+
const contentRoot = getContentRoot()
74+
let fullPath = toPosixPath(join(contentRoot, realSlug))
33975
let contentNotTranslated = false
34076

34177
// If content is not translated, use english content fallback
@@ -371,9 +107,9 @@ export const getContent = (dir: string) => {
371107
}
372108

373109
export const getTutorialsData = (locale: string): ITutorial[] => {
374-
const currentDir = getCurrentDir()
110+
const contentRoot = getContentRoot()
375111
const fullPath = join(
376-
currentDir,
112+
contentRoot,
377113
locale !== "en" ? `translations/${locale!}` : "",
378114
"developers/tutorials"
379115
)
@@ -384,7 +120,7 @@ export const getTutorialsData = (locale: string): ITutorial[] => {
384120

385121
tutorialData = languageTutorialFiles.map((dir) => {
386122
const filePath = join(
387-
currentDir,
123+
contentRoot,
388124
locale !== "en" ? `translations/${locale!}` : "",
389125
"developers/tutorials",
390126
dir,

0 commit comments

Comments
 (0)