com.soosvet_games.common_tools 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # Required for OIDC
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
- uses: actions/setup-node@v6
|
|
17
|
+
with:
|
|
18
|
+
node-version: '24'
|
|
19
|
+
registry-url: 'https://registry.npmjs.org'
|
|
20
|
+
package-manager-cache: false # never use caching in release builds
|
|
21
|
+
- run: npm install
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm run build --if-present
|
|
24
|
+
- run: npm publish
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
|
|
4
|
+
namespace SoosvetGames.CommonTools
|
|
5
|
+
{
|
|
6
|
+
public class ServiceLocator
|
|
7
|
+
{
|
|
8
|
+
private readonly Dictionary< Type, object > _services = new();
|
|
9
|
+
|
|
10
|
+
public void Clear()
|
|
11
|
+
{
|
|
12
|
+
_services.Clear();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public void Register< T >( T service )
|
|
16
|
+
{
|
|
17
|
+
_services[ typeof(T) ] = service;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public T GetAs< T >()
|
|
21
|
+
{
|
|
22
|
+
return (T)_services[ typeof(T) ];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Add Package
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish-gpr:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
packages: write
|
|
13
|
-
contents: read
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v3
|
|
16
|
-
- uses: actions/setup-node@v3
|
|
17
|
-
with:
|
|
18
|
-
node-version: '16.x'
|
|
19
|
-
- run: npm install
|
|
20
|
-
- run: npm publish
|
|
21
|
-
env:
|
|
22
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|