Skip to content

Commit 6dddf02

Browse files
committed
Make .js files no-op (do nothing) in @ncharts/types, fix publish script
1 parent e99d412 commit 6dddf02

File tree

7 files changed

+3906
-3857
lines changed

7 files changed

+3906
-3857
lines changed

.github/workflows/Release.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# 🐻‍❄️📦 @ncharts/sdk: SDK bindings and typings for charted-server
2+
# Copyright 2023 Noelware, LLC. <[email protected]>
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
name: Release a new version
23+
on:
24+
release:
25+
types:
26+
- published
27+
jobs:
28+
release:
29+
name: Release a new version
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
35+
- name: Setup Node.js 19
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: 19.x
39+
40+
- name: Setup Yarn and node-modules cache
41+
id: yarn-cache
42+
uses: auguwu/node-pm-action@master
43+
44+
- name: Install dependencies
45+
if: steps.yarn-cache.outputs.cache-hit != 'true' || steps.yarn-cache.outputs.node-modules-cache-hit != 'true'
46+
run: yarn install --immutable
47+
48+
- name: Install tsx
49+
run: npm i -g tsx
50+
51+
- name: Build distribution
52+
run: yarn build
53+
54+
- name: Publish!
55+
run: yarn publish
56+
env:
57+
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
],
1111
"scripts": {
1212
"generate:types": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/generate-types.ts",
13+
"publish": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/publish.ts",
1314
"build": "yarn fmt && yarn lint && rimraf dist && tsx --tsconfig ./scripts/tsconfig.json scripts/build.ts",
1415
"lint": "tsx --tsconfig ./scripts/tsconfig.json scripts/eslint.ts",
1516
"fmt": "prettier --config ./.prettierrc.json --write **/*.{md,ts,js,tsx,mdx,yaml,yml,json}"

packages/sdk/src/errors/HTTPError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { isObject } from '@noelware/utils';
2323
*/
2424
export class HTTPError extends Error {
2525
constructor(public readonly statusCode: number, errors: ApiError<unknown>[] = []) {
26-
super(`Received status code [${statusCode}] with errors:\n${HTTPError._formatErrors(errors)}`);
26+
super(`Received status code [${statusCode}] with errors\n${HTTPError._formatErrors(errors)}`.trim());
2727
}
2828

2929
private static _formatErrors(errors: ApiError<unknown>[]) {
@@ -41,6 +41,6 @@ export class HTTPError extends Error {
4141
}\n`;
4242
}
4343

44-
return buf;
44+
return buf.trim();
4545
}
4646
}

packages/types/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,4 @@
1515
* limitations under the License.
1616
*/
1717

18-
if (require.main === module) {
19-
process.emitWarning('Do not import this module into code', {
20-
code: 'NLW_NOT_IMPORTABLE',
21-
detail: [
22-
'Importing @ncharts/types into your application is *not* recommended',
23-
'Please use `import type {} from "@ncharts/types"` to remove this warning'
24-
].join('\n')
25-
});
26-
}
18+
// no-op

packages/types/index.mjs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,4 @@
1515
* limitations under the License.
1616
*/
1717

18-
process.emitWarning('Do not import this module into code', {
19-
code: 'NLW_NOT_IMPORTABLE',
20-
detail: [
21-
'Importing @ncharts/types into your application is *not* recommended',
22-
'Please use `import type {} from "@ncharts/types"` to remove this warning'
23-
].join('\n')
24-
});
18+
// no-op

0 commit comments

Comments
 (0)