Skip to content

Commit

Permalink
use pnpm and upgrade deps (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qusic authored Nov 2, 2023
1 parent d453dfb commit 1169ebd
Show file tree
Hide file tree
Showing 18 changed files with 4,752 additions and 8,709 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package-lock.json
node_modules
addon/gn
build
18 changes: 11 additions & 7 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: latest
check-latest: true
cache: npm
cache: pnpm
- name: Install Python
uses: actions/setup-python@v4
with:
Expand All @@ -39,8 +43,8 @@ jobs:
sudo apt install -y ninja-build
;;
macOS)
brew install llvm@15 ninja
addpath "$(brew --prefix llvm@15)/bin"
brew install llvm ninja
addpath "$(brew --prefix llvm)/bin"
;;
Windows)
choco install ninja
Expand All @@ -66,13 +70,13 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('addon/deps.json') }}
path: addon/gn
- name: Prepare Dependencies
run: npm ci
run: pnpm install --frozen-lockfile
- name: Build Debug
run: npm run debug
run: pnpm debug
- name: Run Test
run: npm test
run: pnpm test
- name: Build Release
run: npm run build
run: pnpm build
- name: Upload Archive
uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Linux' }}
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package-lock.json
pnpm-lock.yaml
node_modules
addon/gn
build
Expand Down
20 changes: 11 additions & 9 deletions addon/addon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ enum class GNSymbolKind {
};

struct GNDocumentSymbol {
const GNSymbolKind kind = GNSymbolKind::Unknown;
const LocationRange range;
const std::string name;
const LocationRange selection_range;
GNSymbolKind kind = GNSymbolKind::Unknown;
LocationRange range;
std::string name;
LocationRange selection_range;
std::list<GNDocumentSymbol> children;
};

Expand Down Expand Up @@ -423,13 +423,15 @@ class GNDocument {
case Token::EQUAL:
case Token::PLUS_EQUALS:
case Token::MINUS_EQUALS:
result.emplace_back(
result.emplace_back() =
GNDocumentSymbol{GNSymbolKind::Variable,
binary_op->GetRange(),
ExpressionToString(binary_op->left()),
binary_op->left()->GetRange(),
{}});
default:;
{}};
break;
default:
break;
}
} else if (const auto* function_call = node->AsFunctionCall()) {
// Call = identifier "(" [ ExprList ] ")" [ Block ] .
Expand All @@ -441,7 +443,7 @@ class GNDocument {
selection_range,
{}};
symbol.children = ConstructDocumentSymbolAST(function_call->block());
result.emplace_back(symbol);
result.emplace_back() = std::move(symbol);
} else if (const auto* condition = node->AsCondition()) {
// Condition = "if" "(" Expr ")" Block
// [ "else" ( Condition | Block ) ] .
Expand All @@ -457,7 +459,7 @@ class GNDocument {
elseNode->GetRange(), ConstructDocumentSymbolAST(elseNode)};
symbol.children.emplace_back(elseSymbol);
}
result.emplace_back(std::move(symbol));
result.emplace_back() = std::move(symbol);
} else if (const auto* block = node->AsBlock()) {
// Block = "{" [ StatementList ] "}" .
for (const auto& statement : block->statements()) {
Expand Down
2 changes: 1 addition & 1 deletion addon/deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "gn",
"repo": "https://gn.googlesource.com/gn",
"commit": "ffeea1b1fd070cb6a8d47154a03f8523486b50a7",
"commit": "e4702d7409069c4f12d45ea7b7f0890717ca3f4b",
"patches": ["gn.patch"]
}
]
6 changes: 3 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {Config} from '@jest/types'
import type {Config} from 'jest'

export default <Config.InitialOptions>{
export default {
roots: ['<rootDir>/src'],
transform: {'\\.tsx?$': 'ts-jest'},
}
} as Config
Loading

0 comments on commit 1169ebd

Please sign in to comment.