Skip to content

Commit

Permalink
chore: update: node version to 18 and packages
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed Dec 23, 2023
1 parent ffed2c0 commit 053d329
Show file tree
Hide file tree
Showing 11 changed files with 3,114 additions and 4,164 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.20.0
18.19.0
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.19.0
5 changes: 5 additions & 0 deletions app/scripts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ chrome.tabs.query({}, (tabs) => {
return;
}

// Under some circumstances a Tab may not be assigned an ID
if (tab.id === undefined) {
continue;
}

chrome.scripting.executeScript({
target: {
tabId: tab.id,
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/content/editable-sheet-tabs-mover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const WAIT_TABS_RENDER_INTERVAL = 20;
export default class EditableSheetTabsMover implements SheetTabsMover {
alreadyAppliedExtension(): boolean {
const editorContainer = document.getElementById(EDITOR_CONTAINER_ID);
if (!editorContainer) {
return false;
}
return editorContainer.getAttribute(APPLIED_EXTENSION_FLAG_ATTRIBUTE_NAME) === '1';
}

Expand Down
7 changes: 7 additions & 0 deletions app/scripts/content/preview-sheet-tabs-mover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const WAIT_TABS_RENDER_INTERVAL = 20;
export default class PreviewSheetTabsMover implements SheetTabsMover {
alreadyAppliedExtension(): boolean {
const tableBody = document.querySelector(TABLE_BODY_SELECTOR);
if (!tableBody) {
return false;
}
return tableBody.getAttribute(APPLIED_EXTENSION_FLAG_ATTRIBUTE_NAME) === '1';
}

Expand All @@ -20,6 +23,10 @@ export default class PreviewSheetTabsMover implements SheetTabsMover {

moveToTop(): void {
const tableBody = document.querySelector(TABLE_BODY_SELECTOR);
if (!tableBody) {
return;
}

const cellsContainer = tableBody.querySelector(CELLS_CONTAINER_SELECTOR);
const tabsContainer = tableBody.querySelector(TABS_CONTAINER_SELECTOR);

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/content/sheet-tabs-mover-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SheetTabsMover from './sheet-tabs-mover-interface';

export default class SheetTabsMoverFactory {
public create(): SheetTabsMover | null {
let sheetTabsMover: SheetTabsMover = null;
let sheetTabsMover: SheetTabsMover | null = null;
const locationPathPieces = window.location.pathname.split('/');

if (locationPathPieces.includes('edit') || locationPathPieces.includes('create')) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/content/utils/extension-running-checker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function isAlreadyRunningExtension(identifier: string): boolean {
const meta: HTMLMetaElement = document.querySelector(`meta[name="${identifier}"]`);
const meta: HTMLMetaElement | null = document.querySelector(`meta[name="${identifier}"]`);

if (meta) {
return true;
Expand Down
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,37 @@
"url": "https://github.com/yamadashy/google-sheets-tabs-on-top/issues"
},
"dependencies": {
"core-js": "3.6.5"
"core-js": "3.34.0"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.11.5",
"@babel/preset-typescript": "^7.8.3",
"@types/babel__core": "^7.1.10",
"@types/babel__preset-env": "^7.9.1",
"@types/chrome": "^0.0.220",
"@types/core-js": "2.5.4",
"@types/eslint": "^7.2.3",
"@types/eslint-plugin-prettier": "^3.1.0",
"@types/jquery": "^3.5.1",
"@types/prettier": "^2.1.1",
"@types/webpack-bundle-analyzer": "^3.8.0",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"@webextension-toolbox/webextension-toolbox": "^5.2.2",
"babel-loader": "^8.0.6",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.12.0",
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.6",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.6",
"@babel/preset-typescript": "^7.23.3",
"@types/babel__core": "^7.20.5",
"@types/babel__preset-env": "^7.9.6",
"@types/chrome": "^0.0.254",
"@types/core-js": "2.5.8",
"@types/eslint": "^8.56.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint-plugin-prettier": "^3.1.3",
"@types/jquery": "^3.5.29",
"@types/prettier": "^3.0.0",
"@types/webpack-bundle-analyzer": "^4.6.3",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@webextension-toolbox/webextension-toolbox": "^6.2.0",
"babel-loader": "^9.1.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-formatter-friendly": "^7.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"fork-ts-checker-webpack-plugin": "^5.2.0",
"prettier": "^2.1.2",
"typescript": "^4.0.3",
"typesync": "^0.7.0",
"webpack-bundle-analyzer": "^3.9.0"
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.1",
"prettier": "^3.1.1",
"typescript": "^5.3.3",
"typesync": "^0.11.1",
"webpack-bundle-analyzer": "^4.10.1"
},
"babel": {
"presets": [
Expand Down
9 changes: 5 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"module": "esnext",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"lib": [
"dom",
"esnext"
],
"baseUrl": ".",
"allowJs": false,
"noImplicitAny": true,
"removeComments": true,
"sourceMap": true,
"noEmit": true
"skipLibCheck": true,
"sourceMap": true
}
}
44 changes: 8 additions & 36 deletions webextension-toolbox.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,16 @@
const path = require('path');
const GlobEntriesPlugin = require('webpack-watched-glob-entries-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const { DefinePlugin } = require('webpack');

module.exports = {
webpack: (config, { dev, vendor }) => {
const envName = dev ? 'development' : 'production';

// Support TypeScript
config.resolve.extensions.push('.ts');
config.entry = GlobEntriesPlugin.getEntries(
[
path.resolve('app', '*.{js,mjs,jsx,ts}'),
path.resolve('app', '?(scripts)/*.{js,mjs,jsx,ts}')
]
);

// Loader
config.module.rules.push({
test: /\.ts$/,
loader: 'babel-loader',
options: {
cacheDirectory: true
}
});

// Runs typescript type checker on a separate process.
config.plugins.push(new ForkTsCheckerWebpackPlugin({
async: !!dev,
eslint: {
enable: !!dev,
files: '**/*.ts',
options: {
extensions: ['ts'],
cache: true,
}
},
typescript: {
enabled: true,
configFile: path.resolve(__dirname, 'tsconfig.json'),
},
}));
// Definitions
config.plugins.push(new DefinePlugin({
IS_PRODUCTION_BUILD: !dev,
}))

// BundleAnalyzer
config.plugins.push(new BundleAnalyzerPlugin({
Expand All @@ -53,5 +23,7 @@ module.exports = {

return config
},
copyIgnore: [ '**/*.ts' ]
copyIgnore: [
path.resolve('**/*.ts'),
]
};
Loading

0 comments on commit 053d329

Please sign in to comment.