-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from vechainfoundation/minor-clean-up
refactor: using common dependencies so versions are not duplicated
- Loading branch information
Showing
13 changed files
with
294 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/build/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,85 @@ | ||
const path = require("node:path"); | ||
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | ||
const webpack = require("webpack"); | ||
const paths = require("react-scripts/config/paths"); | ||
const { overrideDevServer } = require("customize-cra"); | ||
const path = require('node:path'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const webpack = require('webpack'); | ||
const paths = require('react-scripts/config/paths'); | ||
const { overrideDevServer } = require('customize-cra'); | ||
|
||
paths.appSrc = path.resolve(__dirname, "src"); | ||
paths.appSrc = path.resolve(__dirname, 'src'); | ||
// Tell the app that "src/index.tsx" has moved to "src/popup/index.tsx" | ||
paths.appIndexJs = path.resolve(__dirname, "src/index.tsx"); | ||
paths.appIndexJs = path.resolve(__dirname, 'src/index.tsx'); | ||
|
||
// Adds a manifest file to the build according to the current context, | ||
// and deletes files from the build that are not needed in the current context | ||
const devServerConfig = () => (config) => { | ||
return { | ||
...config, | ||
// webpackDevService doesn't write the files to desk | ||
// so we need to tell it to do so so we can load the | ||
// extension with chrome | ||
hot: true, | ||
liveReload: true, | ||
devMiddleware: { | ||
writeToDisk: true, | ||
}, | ||
}; | ||
return { | ||
...config, | ||
// webpackDevService doesn't write the files to desk | ||
// so we need to tell it to do so so we can load the | ||
// extension with chrome | ||
hot: true, | ||
liveReload: true, | ||
devMiddleware: { | ||
writeToDisk: true, | ||
}, | ||
}; | ||
}; | ||
|
||
module.exports = { | ||
webpack(config) { | ||
// Disable bundle splitting, | ||
// a single bundle file has to loaded as `content_script`. | ||
config.optimization.splitChunks = { | ||
cacheGroups: { | ||
default: false, | ||
}, | ||
}; | ||
webpack(config) { | ||
// Disable bundle splitting, | ||
// a single bundle file has to loaded as `content_script`. | ||
config.optimization.splitChunks = { | ||
cacheGroups: { | ||
default: false, | ||
}, | ||
}; | ||
|
||
// `false`: each entry chunk embeds runtime. | ||
// The extension is built with a single entry including all JS. | ||
// https://symfonycasts.com/screencast/webpack-encore/single-runtime-chunk | ||
config.optimization.runtimeChunk = false; | ||
// `false`: each entry chunk embeds runtime. | ||
// The extension is built with a single entry including all JS. | ||
// https://symfonycasts.com/screencast/webpack-encore/single-runtime-chunk | ||
config.optimization.runtimeChunk = false; | ||
|
||
config.entry = { | ||
// Main Entry | ||
main: "./src/index.tsx", | ||
}; | ||
config.entry = { | ||
// Main Entry | ||
main: './src/index.tsx', | ||
}; | ||
|
||
// Filenames of bundles must not include `[contenthash]`, so that they can be referenced in `extension-manifest.json`. | ||
// The `[name]` is taken from `config.entry` properties, so if we have `main` and `background` as properties, we get 2 output files - main.js and background.js. | ||
config.output.filename = "[name].js"; | ||
// Filenames of bundles must not include `[contenthash]`, so that they can be referenced in `extension-manifest.json`. | ||
// The `[name]` is taken from `config.entry` properties, so if we have `main` and `background` as properties, we get 2 output files - main.js and background.js. | ||
config.output.filename = '[name].js'; | ||
|
||
// `MiniCssExtractPlugin` is used by the default CRA webpack configuration for | ||
// extracting CSS into separate files. The plugin has to be removed because it | ||
// uses `[contenthash]` in filenames of the separate CSS files. | ||
config.plugins = config.plugins | ||
.filter((plugin) => !(plugin instanceof MiniCssExtractPlugin)) | ||
.concat( | ||
// `MiniCssExtractPlugin` is used with its default config instead, | ||
// which doesn't contain `[contenthash]`. | ||
new MiniCssExtractPlugin() | ||
); | ||
// `MiniCssExtractPlugin` is used by the default CRA webpack configuration for | ||
// extracting CSS into separate files. The plugin has to be removed because it | ||
// uses `[contenthash]` in filenames of the separate CSS files. | ||
config.plugins = config.plugins | ||
.filter((plugin) => !(plugin instanceof MiniCssExtractPlugin)) | ||
.concat( | ||
// `MiniCssExtractPlugin` is used with its default config instead, | ||
// which doesn't contain `[contenthash]`. | ||
new MiniCssExtractPlugin(), | ||
); | ||
|
||
const fallback = config.resolve.fallback || {}; | ||
Object.assign(fallback, { | ||
crypto: require.resolve("crypto-browserify"), | ||
stream: require.resolve("stream-browserify"), | ||
assert: require.resolve("assert"), | ||
http: require.resolve("stream-http"), | ||
https: require.resolve("https-browserify"), | ||
os: require.resolve("os-browserify"), | ||
url: require.resolve("url"), | ||
"process/browser": require.resolve("process/browser"), | ||
}); | ||
config.resolve.fallback = fallback; | ||
const fallback = config.resolve.fallback || {}; | ||
Object.assign(fallback, { | ||
crypto: require.resolve('crypto-browserify'), | ||
stream: require.resolve('stream-browserify'), | ||
assert: require.resolve('assert'), | ||
http: require.resolve('stream-http'), | ||
https: require.resolve('https-browserify'), | ||
os: require.resolve('os-browserify'), | ||
url: require.resolve('url'), | ||
'process/browser': require.resolve('process/browser'), | ||
}); | ||
config.resolve.fallback = fallback; | ||
|
||
config.plugins = (config.plugins || []).concat([ | ||
new webpack.ProvidePlugin({ | ||
process: "process/browser", | ||
Buffer: ["buffer", "Buffer"], | ||
}), | ||
]); | ||
config.plugins = (config.plugins || []).concat([ | ||
new webpack.ProvidePlugin({ | ||
process: 'process/browser', | ||
Buffer: ['buffer', 'Buffer'], | ||
}), | ||
]); | ||
|
||
return config; | ||
}, | ||
devServer: overrideDevServer(devServerConfig()), | ||
return config; | ||
}, | ||
devServer: overrideDevServer(devServerConfig()), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = { extends: ["@commitlint/config-conventional"] }; | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
"build:deps": "turbo build --no-daemon --filter='@vechain/*'", | ||
"clean": "npx turbo@latest run clean && rm -rf node_modules .turbo", | ||
"dev": "turbo run dev --no-daemon", | ||
"format": "prettier --write \"**/*.{ts,tsx,md}\"", | ||
"format": "prettier --write \"**/*.{ts,tsx,md,json,js,jsx}\"", | ||
"install:all": "yarn && yarn run build:deps", | ||
"lint": "turbo run lint", | ||
"prepare": "husky install", | ||
|
@@ -40,8 +40,8 @@ | |
"husky": "^8.0.0", | ||
"lint-staged": "^15.0.2", | ||
"prettier": "^2.5.1", | ||
"tsconfig": "*", | ||
"turbo": "latest" | ||
"turbo": "latest", | ||
"typescript": "4.9.5" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"extends": "@vechain/repo-config/src/tsconfig/base.json", | ||
"include": ["."], | ||
"exclude": ["dist", "node_modules"] | ||
"exclude": ["dist", "node_modules"], | ||
"compilerOptions": { | ||
"target": "ES6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"build": { | ||
"outputs": ["build/**", "dist/**"], | ||
"dependsOn": ["^build"] | ||
}, | ||
"test": { | ||
"outputs": ["coverage/**"], | ||
"dependsOn": ["build"] | ||
}, | ||
"lint": {}, | ||
"dev": { | ||
"cache": false, | ||
"persistent": true | ||
}, | ||
"clean": { | ||
"cache": false | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"build": { | ||
"outputs": ["build/**", "dist/**"], | ||
"dependsOn": ["^build"] | ||
}, | ||
"test": { | ||
"outputs": ["coverage/**"], | ||
"dependsOn": ["build"] | ||
}, | ||
"lint": {}, | ||
"dev": { | ||
"cache": false, | ||
"persistent": true | ||
}, | ||
"clean": { | ||
"cache": false | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.