Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Feature/npm release #13

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,36 @@ jobs:

- name: bump package version (pre-release)
if: ${{ 'refs/heads/master' != github.ref }}
# TODO: use different --preid for every ref
run: |
git config --local user.email "[email protected]"
git config --local user.name "BDBuilder builder"
npm version prerelease --preid preview -m "bump package version to %s"

- name: publish
id: publish
- name: publish to GH
id: publish-gh
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ github.token }}
access: public
registry: https://npm.pkg.github.com
tag: latest
tag: latest # TODO: remove this tag for preview releases

- name: push version change
if: steps.publish.outputs.type != 'none'
run: git push

- name: patch package.json
run: |
node -e "
require('fs').writeFileSync('package.json', JSON.stringify(Object.assign(require('./package.json'), {
name: 'bdbuilder'
}), null, 2));"

- name: publish to NPM
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
tag: latest # TODO: remove this tag for preview releases
8 changes: 4 additions & 4 deletions common/apis/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ export type Command = {
__registerId?: string;
};

if (!DiscordCommands.BUILT_IN_SECTIONS.some(e => e.id === "betterdiscord")) {
DiscordCommands.BUILT_IN_SECTIONS.push({
if (!DiscordCommands.BUILT_IN_SECTIONS["betterdiscord"]) {
DiscordCommands.BUILT_IN_SECTIONS["betterdiscord"] = {
icon: "https://github.com/BetterDiscord.png",
id: "betterdiscord",
name: "BetterDiscord",
type: 0
});
};
}

export function registerCommand(caller: string, options: Command) {
Expand Down Expand Up @@ -96,4 +96,4 @@ export function unregisterAllCommands(caller: string) {

const Commands = { registerCommand, unregisterAllCommands };

export default Commands;
export default Commands;
4 changes: 2 additions & 2 deletions common/apis/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const loadedStrings = {};
SettingsStore.addChangeListener(injectStrings);

function injectStrings() {
Object.assign(Strings._proxyContext.messages, loadedStrings[Strings.getLocale()] ?? {});
if (loadedStrings["en-US"]) Object.assign(Strings._proxyContext.defaultMessages, loadedStrings["en-US"]);
Object.assign(Strings._provider._context.messages, loadedStrings[Strings.getLocale()] ?? {});
if (loadedStrings["en-US"]) Object.assign(Strings._provider._context.defaultMessages, loadedStrings["en-US"]);
};

export function addStrings(locale: string, strings: any) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@betterdiscordbuilder/bdbuilder",
"version": "1.2.8",
"version": "1.2.9-preview.4",
"description": "Enhanced plugins transpiler for BetterDiscord. Allows you to build plugin with multiple files at once.",
"main": "./dist/bdbuilder.min.js",
"dependencies": {
Expand Down