Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Prettier #1198

Merged
merged 23 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
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
68 changes: 34 additions & 34 deletions .github/dependabot.yml
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'
138 changes: 69 additions & 69 deletions .github/scripts/diff-directories.js
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);
38 changes: 19 additions & 19 deletions .github/workflows/asana.yml
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 }}
Loading
Loading