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

Add CodeQL workflow for GitHub code scanning #148

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f36e809
chore(deps): update jest monorepo to v29
renovate[bot] Oct 28, 2022
d3b792c
fix(deps): update dependency @prezly/sdk to v10
renovate[bot] Oct 28, 2022
8249028
Update SDK types
riffbyte Oct 28, 2022
e5a75af
Update SDK types in tests
riffbyte Oct 28, 2022
ed90716
Update previously missed SDK types in mocks
riffbyte Oct 28, 2022
a6f41cc
Convert package to ES Module
riffbyte Oct 28, 2022
fa78146
Merge pull request #133 from prezly/renovate/prezly-sdk-10.x
riffbyte Oct 28, 2022
bb4627b
Update node and npm version in package.json
riffbyte Oct 28, 2022
7f0571c
Allow Next 13 in peerDeps
riffbyte Oct 28, 2022
c9071a9
Merge pull request #134 from prezly/renovate/react-hookz-web-16.x
riffbyte Oct 28, 2022
ab0dda4
Merge pull request #132 from prezly/renovate/major-jest-monorepo
riffbyte Oct 28, 2022
2ae7394
2.0.0-0
riffbyte Oct 28, 2022
c3bc88e
Use Babel for build
riffbyte Oct 28, 2022
71a75cb
2.0.0-1
riffbyte Oct 28, 2022
e6a0d16
Add `exports` property, allow importing localeConfig separately
riffbyte Oct 28, 2022
e83e3fe
Include the dummy locale in the `localeConfig`
riffbyte Oct 28, 2022
2563ee9
Export complete `i18n` config object
riffbyte Oct 28, 2022
d379bf6
2.0.0-2
riffbyte Oct 28, 2022
a55217b
Fix `NewsroomContextProps` type being exported in js
riffbyte Oct 28, 2022
c4749a6
2.0.0-3
riffbyte Oct 28, 2022
124b103
chore(deps): pin dependency @babel/preset-env to 7.19.4
renovate[bot] Oct 28, 2022
1eae05a
chore(deps): update dependency @sentry/nextjs to v7.17.2
renovate[bot] Oct 28, 2022
007240c
chore(deps): update dependency @sentry/nextjs to v7.17.3
renovate[bot] Oct 31, 2022
d89c862
chore(deps): update dependency @types/jest to v29.2.1
renovate[bot] Nov 1, 2022
c7e75ee
chore(deps): update dependency @sentry/nextjs to v7.17.4
renovate[bot] Nov 3, 2022
bdab2b8
chore(deps): update dependency @types/react to v18.0.25
renovate[bot] Nov 4, 2022
36b5856
chore(deps): update dependency @types/jest to v29.2.2
renovate[bot] Nov 4, 2022
783fc59
chore(deps): update dependency @babel/preset-env to v7.20.2
renovate[bot] Nov 4, 2022
0311c5e
chore(deps): update dependency eslint to v8.27.0
renovate[bot] Nov 6, 2022
ea8103c
chore(deps): update dependency jest to v29.3.0
renovate[bot] Nov 7, 2022
309dee7
chore(deps): update dependency @sentry/nextjs to v7.18.0
renovate[bot] Nov 8, 2022
69efc87
chore(deps): update dependency jest to v29.3.1
renovate[bot] Nov 8, 2022
72ded4b
Add CodeQL workflow for GitHub code scanning
lgtm-migrator Nov 10, 2022
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
Prev Previous commit
Next Next commit
Convert package to ES Module
riffbyte committed Oct 28, 2022
commit a6f41cc303aafc89b565b297e41ff4884283b977
File renamed without changes.
2 changes: 2 additions & 0 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
extensionsToTreatAsEsm: ['.ts'],
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true,
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',
useESM: true,
},
},
};
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,12 +2,10 @@
"name": "@prezly/theme-kit-nextjs",
"version": "1.18.2",
"description": "Data layer and utility library for developing Prezly themes with NextJS",
"type": "module",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build",
"src"
],
"files": ["build"],
"engines": {
"node": ">= 14.x",
"npm": ">= 7.x"
@@ -31,7 +29,7 @@
"clean": "rimraf build/ node_modules/",
"build": "tsc --project .",
"watch": "tsc --watch --preserveWatchOutput --project .",
"test": "jest",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"typecheck": "tsc --noEmit --incremental --project .",
"lint": "eslint src",
"lint:fix": "npm run lint -- --fix",
2 changes: 1 addition & 1 deletion src/intl/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './languages';
export * from './locale';
export { default as localeConfig } from './localeConfig';
export { localeConfig } from './localeConfig';
export * from './localeObject';
2 changes: 2 additions & 0 deletions src/intl/locale.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { jest } from '@jest/globals';

import {
DEFAULT_LOCALE,
DUMMY_DEFAULT_LOCALE,
6 changes: 3 additions & 3 deletions src/intl/localeConfig.js → src/intl/localeConfig.ts
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
* Together with permutation performed lower in the code,
* the exported list represents all of the possible locale codes that Next.js theme application might accept.
*/
const supportedLocales = require('./localeList');
import { localeList } from './localeList';

const lowercaseLocales = supportedLocales.map((l) => l.toLowerCase());
const lowercaseLocales = localeList.map((l) => l.toLowerCase());

// Get all permutations for the shorter locale codes supported by Prezly (e.g. short region codes and neutral language codes)
const lowercaseLocalPermutations = Array.from(
@@ -20,4 +20,4 @@ const lowercaseLocalPermutations = Array.from(
]),
).sort();

module.exports = lowercaseLocalPermutations;
export const localeConfig = lowercaseLocalPermutations;
2 changes: 1 addition & 1 deletion src/intl/localeList.js → src/intl/localeList.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This list is pulled from the main Prezly application. The underscores are replaced with dashes.
*/
module.exports = [
export const localeList = [
'af-ZA',
'ar',
'ar-AE',
2 changes: 1 addition & 1 deletion src/intl/localeObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import localeConfig from './localeConfig';
import { localeConfig } from './localeConfig';

/**
* This class is created to simplify working with locales and transforming between different locale code formats.
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"compilerOptions": {
"allowJs": true,
"allowJs": false,
"allowSyntheticDefaultImports": true,
"declaration": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["dom", "es2019"],
"module": "commonjs",
"module": "esnext",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
2 changes: 1 addition & 1 deletion tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules"],
"include": ["./src", "next-env.d.ts", "jest.config.js"]
"include": ["./src", "next-env.d.ts", "jest.config.cjs"]
}