Skip to content

Commit 7cdbf47

Browse files
authored
Add script to bulk edit samples (#969)
1 parent 9e1d205 commit 7cdbf47

37 files changed

+993
-0
lines changed

scripts/.gitattributes

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
* text=auto
2+
.gitattributes text
3+
*.css text eol=lf
4+
*.html text eol=lf
5+
*.js text eol=lf
6+
*.json text eol=lf
7+
*.xml text eol=lf
8+
*.kql text eol=lf
9+
*.lock text eol=lf
10+
*.md text eol=lf
11+
*.ts text eol=lf
12+
*.tsx text eol=lf
13+
*.txt text eol=lf
14+
*.yaml text eol=lf
15+
*.yml text eol=lf
16+
.npmrc text eol=lf
17+
18+
*.cs text eol=crlf
19+
*.sln text eol=crlf
20+
*.csproj text eol=crlf
21+
22+
23+
*.png binary
24+
*.jpg binary

scripts/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/*

scripts/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Scripts
2+
3+
These scripts used to help maintain this repository.
4+
5+
## Setup
6+
7+
> npm install
8+
9+
## Edit Script
10+
11+
This script is used to bulk edit samples.
12+
13+
To run this script:
14+
15+
> npm run edit
16+
17+
The edit targets all prod samples listed in `playlists-prod` and all default samples.
18+
19+
Under the src folder the transform* files contain the specific JavaScript transforms that will run.
20+
21+
To develop new transforms:
22+
23+
1. Make changes the transform* functions
24+
2. Run the transforms (npm run edit)
25+
3. Check using the git diff to make sure the changes are what you expect
26+
4. If you don't like the changes run the following in the **samples** folder:
27+
> git checkout -- *

scripts/config/prettier.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "all",
3+
"arrowParens": "always",
4+
"endOfLine": "lf",
5+
"proseWrap": "preserve",
6+
"printWidth": 100,
7+
"tabWidth": 4
8+
}

scripts/package-lock.json

Lines changed: 249 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "scripts",
3+
"version": "0.0.0",
4+
"description": "Scripts to transform samples",
5+
"private": true,
6+
"engines": {
7+
"node": ">=18.0",
8+
"npm": ">=10.0"
9+
},
10+
"scripts": {
11+
"edit": "ts-node src/main.ts",
12+
"style": "prettier --config ./config/prettier.json --write \"@(src|test|scripts)/**/*.@(ts|tsx|js|md|html|css|json)\""
13+
},
14+
"author": "wandyezj",
15+
"license": "Unlicense",
16+
"devDependencies": {
17+
"@types/node": "^18.19.80",
18+
"prettier": "^3.5.3",
19+
"ts-node": "^10.9.2",
20+
"typescript": "^5.8.2",
21+
"yaml": "^2.7.0"
22+
}
23+
}

scripts/src/RawPlaylist.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { RawPlaylistItem } from "./RawPlaylistItem";
2+
3+
export type RawPlaylist = RawPlaylistItem[];

scripts/src/RawPlaylistItem.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* YAML
3+
*/
4+
export interface RawPlaylistItem {
5+
name: string;
6+
description: string;
7+
rawUrl: string;
8+
}

scripts/src/RawSample.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* YAML
3+
*/
4+
export interface RawSample {
5+
name: string;
6+
description: string;
7+
script: {
8+
content: string;
9+
language: string;
10+
};
11+
template: {
12+
content: string;
13+
language: string;
14+
};
15+
style: {
16+
content: string;
17+
language: string;
18+
};
19+
libraries: string;
20+
}

scripts/src/SampleTypes.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)