-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cab7bd
commit 6018aa5
Showing
427 changed files
with
40,747 additions
and
37,134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# .git-blame-ignore-revs | ||
# Switched to a shared DDG ESLint config https://github.com/duckduckgo/content-scope-scripts/pull/1185 | ||
76bab4d80982ddab63265c694ab96c27a0fa5138 | ||
# introduced Prettier https://github.com/duckduckgo/content-scope-scripts/pull/1198 | ||
53818cc0152d4a814d170563145004b65f5d404d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
src/locales/** linguist-generated | ||
src/types/* text eol=lf | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
target-branch: "main" | ||
open-pull-requests-limit: 20 | ||
labels: | ||
- "dependencies" | ||
groups: | ||
eslint: | ||
patterns: | ||
- "eslint*" | ||
- "@typescript-eslint*" | ||
stylelint: | ||
patterns: | ||
- "stylelint*" | ||
typescript: | ||
patterns: | ||
- "typedoc" | ||
- "typescript" | ||
- "@types/*" | ||
- "@typescript-eslint*" | ||
rollup: | ||
patterns: | ||
- "@rollup/*" | ||
- "rollup-*" | ||
- "rollup" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
target-branch: "main" | ||
labels: | ||
- "dependencies" | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
target-branch: 'main' | ||
open-pull-requests-limit: 20 | ||
labels: | ||
- 'dependencies' | ||
groups: | ||
eslint: | ||
patterns: | ||
- 'eslint*' | ||
- '@typescript-eslint*' | ||
stylelint: | ||
patterns: | ||
- 'stylelint*' | ||
typescript: | ||
patterns: | ||
- 'typedoc' | ||
- 'typescript' | ||
- '@types/*' | ||
- '@typescript-eslint*' | ||
rollup: | ||
patterns: | ||
- '@rollup/*' | ||
- 'rollup-*' | ||
- 'rollup' | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' | ||
target-branch: 'main' | ||
labels: | ||
- 'dependencies' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,124 +1,124 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
function readFilesRecursively (directory) { | ||
const filenames = fs.readdirSync(directory) | ||
const files = {} | ||
function readFilesRecursively(directory) { | ||
const filenames = fs.readdirSync(directory); | ||
const files = {}; | ||
|
||
filenames.forEach((filename) => { | ||
const filePath = path.join(directory, filename) | ||
const fileStats = fs.statSync(filePath) | ||
const filePath = path.join(directory, filename); | ||
const fileStats = fs.statSync(filePath); | ||
|
||
if (fileStats.isDirectory()) { | ||
const nestedFiles = readFilesRecursively(filePath) | ||
const nestedFiles = readFilesRecursively(filePath); | ||
for (const [nestedFilePath, nestedFileContent] of Object.entries(nestedFiles)) { | ||
files[path.join(filename, nestedFilePath)] = nestedFileContent | ||
files[path.join(filename, nestedFilePath)] = nestedFileContent; | ||
} | ||
} else { | ||
files[filename] = fs.readFileSync(filePath, 'utf-8') | ||
files[filename] = fs.readFileSync(filePath, 'utf-8'); | ||
} | ||
}) | ||
}); | ||
|
||
return files | ||
return files; | ||
} | ||
|
||
function upperCaseFirstLetter (string) { | ||
return string.charAt(0).toUpperCase() + string.slice(1) | ||
function upperCaseFirstLetter(string) { | ||
return string.charAt(0).toUpperCase() + string.slice(1); | ||
} | ||
|
||
function displayDiffs (dir1Files, dir2Files, isOpen) { | ||
const rollupGrouping = {} | ||
function displayDiffs(dir1Files, dir2Files, isOpen) { | ||
const rollupGrouping = {}; | ||
/** | ||
* Rolls up multiple files with the same diff into a single entry | ||
* @param {string} fileName | ||
* @param {string} string | ||
* @param {string} fileName | ||
* @param {string} string | ||
* @param {string} [summary] | ||
*/ | ||
function add(fileName, string, summary = undefined) { | ||
if (summary === undefined) { | ||
summary = string | ||
summary = string; | ||
} | ||
if (!(summary in rollupGrouping)) { | ||
rollupGrouping[summary] = { files: [] } | ||
rollupGrouping[summary] = { files: [] }; | ||
} | ||
rollupGrouping[summary].files.push(fileName) | ||
rollupGrouping[summary].string = string | ||
rollupGrouping[summary].files.push(fileName); | ||
rollupGrouping[summary].string = string; | ||
} | ||
for (const [filePath, fileContent] of Object.entries(dir1Files)) { | ||
let diffOut = '' | ||
let compareOut | ||
let diffOut = ''; | ||
let compareOut; | ||
if (filePath in dir2Files) { | ||
const fileOut = fileContent | ||
const file2Out = dir2Files[filePath] | ||
delete dir2Files[filePath] | ||
const fileOut = fileContent; | ||
const file2Out = dir2Files[filePath]; | ||
delete dir2Files[filePath]; | ||
if (fileOut === file2Out) { | ||
continue | ||
continue; | ||
} else { | ||
compareOut = filePath.split('/')[0] | ||
diffOut = `File has changed` | ||
compareOut = filePath.split('/')[0]; | ||
diffOut = `File has changed`; | ||
} | ||
} else { | ||
diffOut = '❌ File only exists in old changeset' | ||
compareOut = 'Removed Files' | ||
diffOut = '❌ File only exists in old changeset'; | ||
compareOut = 'Removed Files'; | ||
} | ||
add(filePath, diffOut, compareOut) | ||
add(filePath, diffOut, compareOut); | ||
} | ||
|
||
for (const filePath of Object.keys(dir2Files)) { | ||
add(filePath, '❌ File only exists in new changeset', 'New Files') | ||
add(filePath, '❌ File only exists in new changeset', 'New Files'); | ||
} | ||
const outString = Object.keys(rollupGrouping).map(key => { | ||
const rollup = rollupGrouping[key] | ||
let outString = ` | ||
` | ||
const title = key | ||
if (rollup.files.length) { | ||
for (const file of rollup.files) { | ||
outString += `- ${file}\n` | ||
const outString = Object.keys(rollupGrouping) | ||
.map((key) => { | ||
const rollup = rollupGrouping[key]; | ||
let outString = ` | ||
`; | ||
const title = key; | ||
if (rollup.files.length) { | ||
for (const file of rollup.files) { | ||
outString += `- ${file}\n`; | ||
} | ||
} | ||
} | ||
outString += '\n\n' + rollup.string | ||
return renderDetails(title, outString, isOpen) | ||
}).join('\n') | ||
return outString | ||
outString += '\n\n' + rollup.string; | ||
return renderDetails(title, outString, isOpen); | ||
}) | ||
.join('\n'); | ||
return outString; | ||
} | ||
|
||
function renderDetails (section, text, isOpen) { | ||
function renderDetails(section, text, isOpen) { | ||
if (section === 'dist') { | ||
section = 'apple' | ||
section = 'apple'; | ||
} | ||
const open = section !== 'integration' ? 'open' : '' | ||
const open = section !== 'integration' ? 'open' : ''; | ||
return `<details ${open}> | ||
<summary>${upperCaseFirstLetter(section)}</summary> | ||
${text} | ||
</details>` | ||
</details>`; | ||
} | ||
|
||
if (process.argv.length !== 4) { | ||
console.error('Usage: node diff_directories.js <directory1> <directory2>') | ||
process.exit(1) | ||
console.error('Usage: node diff_directories.js <directory1> <directory2>'); | ||
process.exit(1); | ||
} | ||
|
||
const dir1 = process.argv[2] | ||
const dir2 = process.argv[3] | ||
const dir1 = process.argv[2]; | ||
const dir2 = process.argv[3]; | ||
|
||
const sections = { | ||
} | ||
function sortFiles (dirFiles, dirName) { | ||
const sections = {}; | ||
function sortFiles(dirFiles, dirName) { | ||
for (const [filePath, fileContent] of Object.entries(dirFiles)) { | ||
sections[dirName] = sections[dirName] || {} | ||
sections[dirName][filePath] = fileContent | ||
sections[dirName] = sections[dirName] || {}; | ||
sections[dirName][filePath] = fileContent; | ||
} | ||
} | ||
|
||
const buildDir = '/build' | ||
const sourcesOutput = '/Sources/ContentScopeScripts/' | ||
sortFiles(readFilesRecursively(dir1 + buildDir), 'dir1') | ||
sortFiles(readFilesRecursively(dir2 + buildDir), 'dir2') | ||
sortFiles(readFilesRecursively(dir1 + sourcesOutput), 'dir1') | ||
sortFiles(readFilesRecursively(dir2 + sourcesOutput), 'dir2') | ||
|
||
const buildDir = '/build'; | ||
const sourcesOutput = '/Sources/ContentScopeScripts/'; | ||
sortFiles(readFilesRecursively(dir1 + buildDir), 'dir1'); | ||
sortFiles(readFilesRecursively(dir2 + buildDir), 'dir2'); | ||
sortFiles(readFilesRecursively(dir1 + sourcesOutput), 'dir1'); | ||
sortFiles(readFilesRecursively(dir2 + sourcesOutput), 'dir2'); | ||
|
||
// console.log(Object.keys(files)) | ||
const fileOut = displayDiffs(sections.dir1, sections.dir2, true) | ||
console.log(fileOut) | ||
const fileOut = displayDiffs(sections.dir1, sections.dir2, true); | ||
console.log(fileOut); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
name: 'asana sync' | ||
on: | ||
pull_request_review: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- closed | ||
- reopened | ||
- synchronize | ||
- review_requested | ||
pull_request_review: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- closed | ||
- reopened | ||
- synchronize | ||
- review_requested | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: sammacbeth/action-asana-sync@v6 | ||
with: | ||
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }} | ||
ASANA_WORKSPACE_ID: ${{ secrets.ASANA_WORKSPACE_ID }} | ||
ASANA_PROJECT_ID: '1208598406046969' | ||
USER_MAP: ${{ vars.USER_MAP }} | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: sammacbeth/action-asana-sync@v6 | ||
with: | ||
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }} | ||
ASANA_WORKSPACE_ID: ${{ secrets.ASANA_WORKSPACE_ID }} | ||
ASANA_PROJECT_ID: '1208598406046969' | ||
USER_MAP: ${{ vars.USER_MAP }} |
Oops, something went wrong.