Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use import attributes instead of import assertions #145

Merged
merged 4 commits into from
May 29, 2024
Merged
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
45 changes: 9 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
node: [ 20 ]
node: [ lts/*, current ]

steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
- name: 🔨 Install pnpm
uses: pnpm/action-setup@v3
- name: 🛠️ Prepare pnpm workspace
uses: dyne/pnpm@main
with:
version: 8
- name: ⏬ Install dependencies
run: pnpm recursive install
node-version: ${{ matrix.node }}
- uses: supercharge/[email protected]
with:
redis-version: 6
Expand All @@ -62,20 +58,10 @@ jobs:
needs: build_and_test
if: github.ref == 'refs/heads/main'
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
- name: 🎯 Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v3
name: 🔨 Install pnpm
with:
version: 8
- name: 🛠️ Prepare pnpm workspace
uses: dyne/pnpm@main
- name: 📖 Setup Pages
uses: actions/configure-pages@v4
- name: ⏬ Install dependencies
run: pnpm install
uses: actions/configure-pages@v5
- name: 🏗️ update sentences tabled and build the docs
run: pnpm build && pnpm run docs
- name: ⏫ Upload artifact
Expand All @@ -100,21 +86,8 @@ jobs:
needs: build_and_test
if: github.ref == 'refs/heads/main'
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: 🎯 Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- name: 🔨 Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: ⏬ Install dependencies
run: pnpm i
- name: 🛠️ Prepare pnpm workspace
uses: dyne/pnpm@main
- name: 🏗️ Build all
run: pnpm build
- name: 🌍 Build @slangroom/browser
Expand Down
2 changes: 1 addition & 1 deletion pkg/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/node": "^20.10.4",
"esbuild": "^0.18.20"
"esbuild": "^0.21.4"
},
"scripts": {
"build": "pnpm exec esbuild --bundle src/index.ts --outfile=build/slangroom.js --target=es2016 --external:fs --external:path --external:crypto && cp build/slangroom.js public"
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/src/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// read the version from the package.json
import packageJson from '@slangroom/core/package.json' assert { type: 'json' };
import packageJson from '@slangroom/core/package.json' with { type: 'json' };

/**
* A whitespace-separated string of characters with position information.
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { PluginMap, Token, type PluginMapKey } from '@slangroom/core';
// read the version from the package.json
import packageJson from '@slangroom/core/package.json' assert { type: 'json' };
import packageJson from '@slangroom/core/package.json' with { type: 'json' };

export const errorColor = (s: string): string => '\x1b[31m' + s + '\x1b[0m';
export const suggestedColor = (s: string): string => '\x1b[32m' + s + '\x1b[0m';
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/test/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Plugin, Slangroom } from '@slangroom/core';
import test from 'ava';
// read the version from the package.json
import packageJson from '@slangroom/core/package.json' assert { type: 'json' };
import packageJson from '@slangroom/core/package.json' with { type: 'json' };
// error colors
import { errorColor, suggestedColor, missingColor, extraColor } from '@slangroom/core';

Expand Down
2 changes: 1 addition & 1 deletion pkg/db/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Plugin } from '@slangroom/core';
import { BindOrReplacements, DataTypes, Model, Sequelize } from "sequelize";
// read the version from the package.json
import packageJson from '@slangroom/db/package.json' assert { type: 'json' };
import packageJson from '@slangroom/db/package.json' with { type: 'json' };

class Result extends Model {
public result!: string;
Expand Down Expand Up @@ -55,7 +55,7 @@
const t = await db.transaction();
const [o, m] = await db.query(statement, { transaction: t });
await t.commit();
const output: any = o ? o : m;

Check failure on line 58 in pkg/db/src/plugin.ts

View workflow job for this annotation

GitHub Actions / build_and_test (lts/*)

Unexpected any. Specify a different type

Check failure on line 58 in pkg/db/src/plugin.ts

View workflow job for this annotation

GitHub Actions / build_and_test (current)

Unexpected any. Specify a different type
db.close();
return ctx.pass(output);
} catch (error) {
Expand Down Expand Up @@ -83,7 +83,7 @@
replacements: parameters
});
await t.commit();
const output: any = o ? o : m;

Check failure on line 86 in pkg/db/src/plugin.ts

View workflow job for this annotation

GitHub Actions / build_and_test (lts/*)

Unexpected any. Specify a different type

Check failure on line 86 in pkg/db/src/plugin.ts

View workflow job for this annotation

GitHub Actions / build_and_test (current)

Unexpected any. Specify a different type
db.close();
return ctx.pass(output);
} catch (error) {
Expand Down Expand Up @@ -111,7 +111,7 @@
const parse = (o: string) => safeJSONParse(o, `[DATABASE] Error in JSON format "${o}"`)

try {
var output = {}

Check failure on line 114 in pkg/db/src/plugin.ts

View workflow job for this annotation

GitHub Actions / build_and_test (lts/*)

Unexpected var, use let or const instead

Check failure on line 114 in pkg/db/src/plugin.ts

View workflow job for this annotation

GitHub Actions / build_and_test (current)

Unexpected var, use let or const instead
const db = new Sequelize(database, { logging: false });
Result.init(
{ result: DataTypes.TEXT },
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import { DataTypes, Model, Sequelize } from 'sequelize';
import fs from "fs";
// read the version from the package.json
import packageJson from '@slangroom/db/package.json' assert { type: 'json' };
import packageJson from '@slangroom/db/package.json' with { type: 'json' };

process.env['FILES_DIR'] = "./test";
const dbPath1 = "sqlite://./test/db1.db";
const dbPath2 = "sqlite://./test/db2.db";

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Check failure on line 17 in pkg/db/test/e2e.ts

View workflow job for this annotation

GitHub Actions / build_and_test (lts/*)

Unexpected control character(s) in regular expression: \x1b

Check failure on line 17 in pkg/db/test/e2e.ts

View workflow job for this annotation

GitHub Actions / build_and_test (current)

Unexpected control character(s) in regular expression: \x1b

const complexQuery = `Rule unknown ignore
Scenario 'ecdh': Create the keypair
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/test/raw_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Slangroom } from '@slangroom/core';
import { db } from '@slangroom/db';
import sqlite3 from "sqlite3";
// read the version from the package.json
import packageJson from '@slangroom/db/package.json' assert { type: 'json' };
import packageJson from '@slangroom/db/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/ethereum/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { erc20abi } from '@slangroom/ethereum';
import { Web3 } from 'web3';
import { isAddress } from 'web3-validator';
// read the version from the package.json
import packageJson from '@slangroom/ethereum/package.json' assert { type: 'json' };
import packageJson from '@slangroom/ethereum/package.json' with { type: 'json' };

const p = new Plugin();

Expand Down
2 changes: 1 addition & 1 deletion pkg/fs/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as os from 'node:os';
import axios from 'axios';
import extractZip from 'extract-zip';
// read the version from the package.json
import packageJson from '@slangroom/fs/package.json' assert { type: 'json' };
import packageJson from '@slangroom/fs/package.json' with { type: 'json' };

export class FsError extends Error {
constructor(e: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fs/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import test from 'ava';
import { Slangroom } from '@slangroom/core';
import { fs } from '@slangroom/fs';
// read the version from the package.json
import packageJson from '@slangroom/fs/package.json' assert { type: 'json' };
import packageJson from '@slangroom/fs/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/git/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import http from 'isomorphic-git/http/node/index.js';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
// read the version from the package.json
import packageJson from '@slangroom/git/package.json' assert { type: 'json' };
import packageJson from '@slangroom/git/package.json' with { type: 'json' };

export class GitError extends Error {
constructor(e: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/helpers/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Plugin } from '@slangroom/core';
import _ from 'lodash';
// read the version from the package.json
import packageJson from '@slangroom/helpers/package.json' assert { type: 'json' };
import packageJson from '@slangroom/helpers/package.json' with { type: 'json' };

const p = new Plugin()

Expand Down
2 changes: 1 addition & 1 deletion pkg/helpers/test/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Slangroom } from '@slangroom/core';
import { helpers } from '@slangroom/helpers';
import test from 'ava';
// read the version from the package.json
import packageJson from '@slangroom/helpers/package.json' assert { type: 'json' };
import packageJson from '@slangroom/helpers/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/helpers/test/pick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Slangroom } from '@slangroom/core';
import { helpers } from '@slangroom/helpers';
import test from 'ava';
// read the version from the package.json
import packageJson from '@slangroom/helpers/package.json' assert { type: 'json' };
import packageJson from '@slangroom/helpers/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/http/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { JsonableArray, JsonableObject } from '@slangroom/shared';
import { Plugin, type PluginExecutor } from '@slangroom/core';
import axios, { type AxiosRequestConfig } from 'axios';
// read the version from the package.json
import packageJson from '@slangroom/http/package.json' assert { type: 'json' };
import packageJson from '@slangroom/http/package.json' with { type: 'json' };

export class HttpError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/http/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import nock from 'nock';
import { Slangroom } from '@slangroom/core';
import { http } from '@slangroom/http';
// read the version from the package.json
import packageJson from '@slangroom/http/package.json' assert { type: 'json' };
import packageJson from '@slangroom/http/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/ignored/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { zencodeParse } from '@slangroom/shared';
// read the version from the package.json
import packageJson from '@slangroom/ignored/package.json' assert { type: 'json' };
import packageJson from '@slangroom/ignored/package.json' with { type: 'json' };

/**
* Represent zencode invalid statement error
Expand Down
2 changes: 1 addition & 1 deletion pkg/json-schema/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Plugin } from '@slangroom/core';
import { Ajv, type ValidationError } from 'ajv';
// read the version from the package.json
import packageJson from '@slangroom/json-schema/package.json' assert { type: 'json' };
import packageJson from '@slangroom/json-schema/package.json' with { type: 'json' };

export { ValidationError };

Expand Down
2 changes: 1 addition & 1 deletion pkg/oauth/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AuthenticateHandler, InMemoryCache, AuthorizeHandler } from '@slangroom
import { JsonableObject } from '@slangroom/shared';
import { JWK } from 'jose';
// read the version from the package.json
import packageJson from '@slangroom/oauth/package.json' assert { type: 'json' };
import packageJson from '@slangroom/oauth/package.json' with { type: 'json' };

export class OauthError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/pocketbase/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Plugin } from '@slangroom/core';
import { z } from 'zod';
import { Preferences } from '@capacitor/preferences';
// read the version from the package.json
import packageJson from '@slangroom/pocketbase/package.json' assert { type: 'json' };
import packageJson from '@slangroom/pocketbase/package.json' with { type: 'json' };

export class PocketBaseError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/pocketbase/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import test from 'ava';
import { Slangroom } from '@slangroom/core';
import { JsonableObject } from '@slangroom/shared';
// read the version from the package.json
import packageJson from '@slangroom/pocketbase/package.json' assert { type: 'json' };
import packageJson from '@slangroom/pocketbase/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/qrcode/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Plugin } from '@slangroom/core';
import QrCode from 'qrcode'
// read the version from the package.json
import packageJson from '@slangroom/qrcode/package.json' assert { type: 'json' };
import packageJson from '@slangroom/qrcode/package.json' with { type: 'json' };

export class QrCodeError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/redis/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Plugin, PluginContext } from '@slangroom/core';
import type { JsonableObject } from '@slangroom/shared';
import * as redisClient from "@redis/client";
// read the version from the package.json
import packageJson from '@slangroom/redis/package.json' assert { type: 'json' };
import packageJson from '@slangroom/redis/package.json' with { type: 'json' };

export class RedisError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/shell/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Plugin } from '@slangroom/core';
import { execaCommand } from 'execa';
// read the version from the package.json
import packageJson from '@slangroom/shell/package.json' assert { type: 'json' };
import packageJson from '@slangroom/shell/package.json' with { type: 'json' };

export class ShellError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/shell/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Slangroom } from '@slangroom/core';
import { shell } from '@slangroom/shell';
import { $ } from 'execa';
// read the version from the package.json
import packageJson from '@slangroom/shell/package.json' assert { type: 'json' };
import packageJson from '@slangroom/shell/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
2 changes: 1 addition & 1 deletion pkg/wallet/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
} from '@meeco/sd-jwt-vc';
import type { JsonableArray, JsonableObject } from '@slangroom/shared';
// read the version from the package.json
import packageJson from '@slangroom/wallet/package.json' assert { type: 'json' };
import packageJson from '@slangroom/wallet/package.json' with { type: 'json' };

export class WalletError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/zencode/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Plugin } from '@slangroom/core';
import type { JsonableObject } from '@slangroom/shared';
import { zencodeExec } from '@slangroom/shared';
// read the version from the package.json
import packageJson from '@slangroom/zencode/package.json' assert { type: 'json' };
import packageJson from '@slangroom/zencode/package.json' with { type: 'json' };

export class ZencodeError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/zencode/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Slangroom } from '@slangroom/core';
import { zencode } from '@slangroom/zencode';
import type { JsonableObject } from '@slangroom/shared';
// read the version from the package.json
import packageJson from '@slangroom/zencode/package.json' assert { type: 'json' };
import packageJson from '@slangroom/zencode/package.json' with { type: 'json' };

const stripAnsiCodes = (str: string) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');

Expand Down
Loading
Loading